motor torque control - request of confirmation/clarification

Typically: "How do I... ", "How can I... " questions
Post Reply
Posts: 1
Joined: 13 Oct 2018, 04:40

motor torque control - request of confirmation/clarification

Post by asaccon » 25 Oct 2018, 08:36

I would like to get a confirmation to understand how to control a revolute joint in torque mode from an external application.

By reading various posts about this topic in this forum and reading also the documentation posted in ... controller ,

I concluded that I have to

- Set the joint in force/torque mode
- Check that the joint is dynamically enabled
- Enable the joint motor
- Disable the control loop
- run V-REP in synchronous mode
- Set the simulation loop to the same rate as the physics engine rate
(i.e., set the simulation time step equal to the dynamics time step)
- Modulate the torque by using sim.setJointForce in combination with sim.setJointTargetVelocity
(for C/C++ remote API, simxSetJointForce and simxSetJointTargetVelocity)

It appears that SetJointForce is used to set the magnitude (=absolute value) of the torque, while
setJointTargetVelocity is used to specify both the direction of the torque as well as the maximum revolute speed of the joint. If no saturation of the joint velocity is desired, then V-REP team’s suggestion is to set setJointTargetVelocity to a very high value (in modulus).

In the following, a concrete example, that I would like to have a confirmation of:
Suppose I have a very simple 1DOF revolute system whose dynamics reads

I ddot angle(t) = T(t)

where I is the rotational inertia (kg m^2), ddot angle the angular acceleration (rad/s^2), and T(t) (Nm) is the time-varying torque I want to apply.

Then, according to what I summarized above, what I should do in V-REP at each time instance t is to (conceptual pseudo-code, not proper C/C++ code)

sim.setJointTargetVelocity = MAXVEL * sign(T(t))
sim.setJointForce = abs(T(t)))

with MAXVEL a very large value (because I do not want to have any velocity saturation).

Therefore, to control a joint in torque mode, I need to make the two API calls above at each time instance and it is suggested to keep MAXVEL constant. I should do this for every joint I want to control in torque, and then I should trigger the next simulation step (with C/C++ remote API, calling simxSynchronousTrigger).

Would you please confirm my interpretation? Thank you.

Site Admin
Posts: 6800
Joined: 14 Dec 2012, 00:25

Re: motor torque control - request of confirmation/clarification

Post by coppelia » 05 Nov 2018, 08:34


sorry for the delay. You description appears to be correct for what you want to achieve. Best is normally to test things locally (i.e. without an external application), not make sure that things work like that, before adding the cmmunication with an external application on top of it.


Post Reply