Control robot with torque

Typically: "How do I... ", "How can I... " questions
Post Reply
pmietki
Posts: 6
Joined: 10 Sep 2020, 07:28

Control robot with torque

Post by pmietki »

Hi,
I'm trying to control robot with torque. Using sim.addForceAndTorque method robot is not behave correctly. If I try to assign torque as a vector <0,2,0> why my measured torque values are higher than i set and robot oscillating ?
Please check scene (link under to download) i tried to control left_joint_joint_2 by acting on dummy link - left_dummy_2. Maybe my joint or link configuration are wrong? Should i use another method to apply torque to joint? I also checked demo "motorControllerExamples.ttt" from your scenes but that torque controller is based on setting velocity.

https://drive.google.com/file/d/1C2kgZn ... sp=sharing

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

Re: Control robot with torque

Post by coppelia »

Hello,

if you want to apply a specific force/torque to a joint, then enable the motor and make sure that the control loop is disabled. Then specify a very high target velocity (which will never be reached), and regulate the force/torque with sim.setJointMaxForce.

Cheers

pmietki
Posts: 6
Joined: 10 Sep 2020, 07:28

Re: Control robot with torque

Post by pmietki »

Thank you for reply. If I use this method joint start oscillating, how to reduce this ?

Cheers

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

Re: Control robot with torque

Post by coppelia »

It depends on what physics engine you use. You can sometimes add some friction in the joint's engine properties. Another way would be to add some linear/angular damping for the attached shapes, in the material properties.

Cheers

pmietki
Posts: 6
Joined: 10 Sep 2020, 07:28

Re: Control robot with torque

Post by pmietki »

Hi,

I have tried your suggestions and it was helpful. Im struggling with friction problem right now. I have increased linear/angular damping to max values but it is not enough. how can i increase friction between two links in this simulation : https://drive.google.com/file/d/1zGoRX7 ... sp=sharing

In this simulation left_joint_4 is to flexible while i try to move other joint, how can i solve this issue?


Cheers

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

Re: Control robot with torque

Post by coppelia »

You have several problems in your script.
First, your script runs threaded. With threaded scripts, you are in charge of making sure it is synchronized with simulation steps (if required, which is the case in your situation). So instead of:

Code: Select all

    while true do
        ... control all 6 joints
    end
do instead:

Code: Select all

    sim.setThreadAutomaticSwitch(false)
    while true do
        ... control all 6 joints
        sim.switchThread()
    end
But the above could easily be done in a non-threaded script:

Code: Select all

function sysCall_init()
end

function sysCall_actuation()
    ... control all 6 joints
end
Additionally, you are sending some dynamic control signals to your joints in each simulation step. The dynamic part of the simulation however executes 20 times (in your case). By default there are 10 dynamic simulation steps (a 5ms) for one simulation step (a 50ms). So it would be better to use joint callback functions, or the dynamics callback function, e.g.:

Code: Select all

function sysCall_init()
end

function sysCall_dynCallback()
    ... control all 6 joints
end
Cheers

Post Reply