How to get trajectory and torques from simulation to control the real robot?

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

How to get trajectory and torques from simulation to control the real robot?

Post by pmietki »

Hi,
I am trying to control a real robot with a controller that uses as an input: positions, velocities, accelerations and torques for a given trajectory.
I would like to get all of these values from simulation.
I can get positions, velocities and accelerations from sim.rmlPos and then during sim.rmlStep move robot in simulation with sim.setJointTargetPosition and then read torques of each joints. In this approach I obtain torques that are a little shifted in time. Is there a way to synchronize it?
I also tried to use sim.rmlMoveToJointPosition, where I can read joints' torques during moving, but I do not know how to get joint positions, velocities and accelerations. Is there a way to obtain them during simulation?
E.g. for velocity I see there is sim.getObjectVelocity method but obtained values are in absolute coordinates. I wonder if there is a simpler way to get the speed.
I have one more question. Torques from simulation are not so adequate to the real ones, i.e. implementing them to robot do not gives proper move. I change frictions and add angular and linear damping, but these damping parameters seems to have no affect if there are fractional values, only change from 0 to 1 change the torques values. Is it right?

So, is there a way to get positions, velocities, accelerations and torques simultaneously from a simulation?

Thanks.

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

Re: How to get trajectory and torques from simulation to control the real robot?

Post by coppelia »

Hello,

you are correct when you use the RML API functions: they will provide you with the position, velocity and acceleration values when executing a trajectory with a specific velocity profile. Now, trying to read the torque at the same time appears to be quite tricky, since this would typically involve a PID controller on the physics engine side to execute the desired positions in each simulation step. the executed movement via that PID controller will have different velocity/acceleration parameters.e.g. while the RML functions appear to execute a smooth movement, the PID controller could be executing several stop/go movements, in a stepped fashion.
Your real robot will itself also have its own controller, with specific input values, e.g. points to travel through, tolerances, etc.

Cheers

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

Re: How to get trajectory and torques from simulation to control the real robot?

Post by pmietki »

OK. Thank you!

Post Reply