So the question is: is the torque large enough to be able to quickly change direction? Or does you link have a large mass/inertia?

You can read the effort in a prismatic/revolute joint with simGetJointForce. Try to continuously print the effort in that joint (e.g. inside of a non-threaded child script) and see if you can notice something.

Also, since you are closing the loop from the Matlab side, do you run V-REP in synchronous mode? (i.e. where Matlab will trigger each simulation step individually)

Cheers

## Torque control

### Re: Torque control

Thanks for reply. I read the joint forces with simGetJointForce in both vrep and matlab and they are same. Matlab runs in synchronous mode. I got the joint input and position plots, as I can see the link can not move in reverse direction as long as the total torques(kgm^2/s) are equal in negative and positive directions. I expect that when desired and actual positions are equal, applied torque is zero and it should slow down drastically.

### Re: Torque control

Would it be possible to post a simplified, self-contained scene that illustrates the problem?

Also, if you try to do everything from within V-REP, do you experience similar problems?

Cheers

Also, if you try to do everything from within V-REP, do you experience similar problems?

Cheers

### Re: Torque control

Sorry for bumping this topic but... Sometimes I get private messages based on my answers in this topic. Since I have a hard time finding my login credentials every time I thought I'd post this here :).

To get torque control working (from Matlab in my case), I sent torques via the API and unpacked them in a child script to directly apply to the joint. Also, I enabled velocity control for damping. Also note that I synchronized between Matlab and vrep. In this way, I got stable torque control working in an example where I was compensating for gravity. For details, see my answers on page 2. But more importantly: the working files and models are on Github in the examples of some project I was working on back then.

See: https://github.com/evlasblom/rigid-body ... s-exporter

In Examples/SimpleArm, there are the following Matlab files and corresponding vrep files:

- Example_SimpleArm_VREP.m and SimpleArm_Matlab.ttt

- Example_LessSimpleArm_VREP.m and LessSimpleArm_Matlab.ttt

For gravity compensation of a 2-dof and 3-dof arm respectively.

I hope this helps.

Erik.

To get torque control working (from Matlab in my case), I sent torques via the API and unpacked them in a child script to directly apply to the joint. Also, I enabled velocity control for damping. Also note that I synchronized between Matlab and vrep. In this way, I got stable torque control working in an example where I was compensating for gravity. For details, see my answers on page 2. But more importantly: the working files and models are on Github in the examples of some project I was working on back then.

See: https://github.com/evlasblom/rigid-body ... s-exporter

In Examples/SimpleArm, there are the following Matlab files and corresponding vrep files:

- Example_SimpleArm_VREP.m and SimpleArm_Matlab.ttt

- Example_LessSimpleArm_VREP.m and LessSimpleArm_Matlab.ttt

For gravity compensation of a 2-dof and 3-dof arm respectively.

I hope this helps.

Erik.