## Joints Torque Control

Requests or suggestions for new features
dds
Posts: 76
Joined: 20 Mar 2014, 14:35

### Joints Torque Control

Hi. The torque control of joints does not behave in a realistic way, I made several experiments with manipulators and mobile robots and have come to that conclusion. It would be nice to include a physic motor with realistic behave of joints. The natural behave is to apply force (or voltage) to a mass (or motor) and produce an acceleration. In its present form, the mechanism by which the physical engine reaches the desired speed is unknown, likewise, it is unknown how the physical engine makes to maintain this speed, nor can be ensured that the mechanism used is realistic, since the engine is designed to control speed and not the torque.

coppelia
Posts: 7936
Joined: 14 Dec 2012, 00:25

### Re: Joints Torque Control

Hello,

the way a physics engine handles a motor is always similar: a force/torque T is applied, which will accelerate the linked bodies until a max. velocity V is reached.

A real motor will not behave like that: depending on the type of motor, the force/torque will change according to the velocity or other values. You can also do this in V-REP:

Use a joint control callback script. It will be called for each dynamic simulation pass (by default 10 times for a simulation step). As input you can use the joint position/velocity/effort/etc. As output you can provide a force/torque T and a max. velocity V. This means you can dynamically change the properties of your joint/motor according to some parameters/values. Best would be to have a table that describes the force/torque vs velocity (or other parameters) and use it to regulate your motor, so it behaves as the real counterpart.

Cheers

rlchiapp
Posts: 1
Joined: 14 Jul 2016, 11:48

### Re: Joints Torque Control

I disagree with that !
As output you can provide a force/torque T and a max. velocity V.
Looking here http://www.coppeliarobotics.com/helpFil ... cripts.htm
The last two lines of the code:

Code: Select all

-- forceOrTorqueToApply: the maximum force/torque that the joint will be able to exert
-- velocityToApply: the velocity to apply to the joint.
I agree with dds, there is a problem in the way we command the motor. I'm sure the physic engine take in account the maximum torque for realism, but it is not possible for the user to control directly the torque. That's a big problem for a control loop.

I think it might be important to allow the user to control the motor by torque, an update in the next vrep release would be great :)

coppelia
Posts: 7936
Joined: 14 Dec 2012, 00:25

### Re: Joints Torque Control

The comment in the joint callback script is now exactly accurate, it should say: "max. velocity allowed" instead of "the velocity to apply to the joint", I agree.

Here you can see the related code in the various physics engines:

Code: Select all

// Bullet:
hinge->enableAngularMotor(motorOnOff,targetVelocity,maxMotorImpulse);

// ODE:
dJointSetHingeParam(_odeConstraint,dParamFMax,torqueToApply);
dJointSetHingeParam(_odeConstraint,dParamVel,velocityToApply);

// Newton:
jointClass->m_data.SetMotor(onOff,speed,maxForce);

// Vortex is similar
When a joint is controlled in position, the joint force is constant, but the max. velocity is modulated.
When a joint is in spring/damper mode, the joint force is modulated, but the max. velocity is constant.

Cheers