Torque Control

Typically: "How do I... ", "How can I... " questions
Post Reply
Essa6
Posts: 8
Joined: 24 Jun 2020, 15:33

Torque Control

Post by Essa6 »

Hello,
I want to apply torques to joints of the UR5 robot to follow a desired path, I checked "motor enabled" and unchecked "Position control enabled". and I Set a very high target velocity.
I did this for the joint number 1 of the robot but the robot rotates very fast then stop on the ground. I want to know where my mistake was? and what should i do?
thank you for helping

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

Re: Torque Control

Post by coppelia »

Hello,

have a look at the demo scene scenes/motorControllerExamples.ttt (only available from CoppeliaSim V4.1.0): it illustrates the various control modes available.
If you want to control a joint in force/torque mode, and have the joint follow a specific trajectory, then you should put your control code inside of a joint callback function. Such a joint callback function is also illustrated in the example scene mentioned above. Why such a joint callback function is needed is because with a regular script call, you would act on the joint force/torque once each simulation step. But by default, the physics engine will perform 10 sub-step in the same time. So the joint callback function is called 10 times per simulation step. Of course, you also have the possibility to adjust the simulation step size (e.g. from 50ms to 5ms) in order to have the physics engine perform one calculation step within a simulation step.

Cheers

Essa6
Posts: 8
Joined: 24 Jun 2020, 15:33

Re: Torque Control

Post by Essa6 »

Hi,
Thank you for replying, I made Computed torque controller code in python, and the joint callback function is written in Lua?
Is there another way that i can transfer the values of torque that i calculated in python to vrep?

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

Re: Torque Control

Post by coppelia »

you can also do this directly from Python. In CoppeliaSim V4.1.0 or above, have a look at the demo scene scenes/pControllerViaRemoteApi.ttt

The important points are:
  • CoppeliaSim needs to run in synchronous mode
  • The simulation time step has to be the same as the dynamics time step (in this scene 5ms), if dynamics is involved, otherwise you will miss control loops
That simulation needs to be started and run from the corresponding Python script that you can find in:
  • programming/b0remoteApiBindings/python/pController.py
  • programming/remoteApiBindings/python/python/pController.py
Cheers

Post Reply