## Torque/force control of the Sawyer robot and control of the end-effector with a keyboard

Typically: "How do I... ", "How can I... " questions
kamil
Posts: 5
Joined: 02 May 2019, 21:31

### Torque/force control of the Sawyer robot and control of the end-effector with a keyboard

Dear all,

I am very new to Vrep and I have been using it for less than two weeks. I am working with the sawyer robot and am aiming to achieve the following:

1) implement realistic force torque control of the robot. I have already set all joints to the "torque/force mode", checked "motor enabled" and unchecked "control loop enabled" as the first step. I have also implemented some functions in python that enable me to set the torque/force on each joint by setting a very high target velocity and limiting the maximum torque which can be applied to each joint. My question is: in a real robot I would assume there is gravity compensation from internal frictions and other complicated mechanisms, meaning that when the torque on a joint is 0, then if the joint is moving the angular velocity should begin to decrease and if it was stationary it should remain stationary. However, in the simulator, when I set the torque to 0 the robot begins to accelerate downwards due to gravity and finally collapses on itself. How could I implement gravity compensation such that controlling the robot is more like controlling a real robot?

2) I would like to control the end-effector of the robot via a keyboard. Is this possible to achieve? If yes, how should I go about implementing this?

Thank you for any help!

coppelia
Site Admin
Posts: 8292
Joined: 14 Dec 2012, 00:25

### Re: Torque/force control of the Sawyer robot and control of the end-effector with a keyboard

Hello,

force/torque control is not an easy task. You will have to do the low-level torque modulation in a joint callback function, or in the dynamics callback function. MAybe also have a look here.

To mimic friction in a joint, simply set the target velocity of the joint to zero (but keep the maximum force/torque different from zero).

Cheers

kamil
Posts: 5
Joined: 02 May 2019, 21:31

### Re: Torque/force control of the Sawyer robot and control of the end-effector with a keyboard

Thank you. Could I ask about my second question as well?

coppelia
Site Admin
Posts: 8292
Joined: 14 Dec 2012, 00:25

### Re: Torque/force control of the Sawyer robot and control of the end-effector with a keyboard

Of course. Short and precise questions are always prefered ;)

Cheers

kamil
Posts: 5
Joined: 02 May 2019, 21:31

### Re: Torque/force control of the Sawyer robot and control of the end-effector with a keyboard

My second question was referring to the second question on the initial post "2) I would like to control the end-effector of the robot via a keyboard. Is this possible to achieve? If yes, how should I go about implementing this?" I would also like to ask if the same would be possible with an external controller, such as a PlayStation 3 controller?

fferri
Posts: 688
Joined: 09 Sep 2013, 19:28

### Re: Torque/force control of the Sawyer robot and control of the end-effector with a keyboard

In case your joystick device is supported by SDL2, there is an incomplete low-level interface to the SDL2 library on my GitHub: https://github.com/fferri/v_repExtSDL which has support for joystick devices. Have a look at the test-sdl.ttt scene in the repository and the generated documentation. You may want to extend the implementation of the pollEvent(...) function in plugin.cpp to support more event types, as currently only SDL_JOYAXISMOTION is supported.