Why is the result of sim. getObject Velocity inaccurate?

Typically: "How do I... ", "How can I... " questions
Post Reply
gkw521
Posts: 5
Joined: 29 Nov 2021, 10:45

Why is the result of sim. getObject Velocity inaccurate?

Post by gkw521 »

Hello,

I use zmqRemoteApi and Python for remote control.

I used sim.setJointTargetVelocity to set the speed of both sides of the car to 0.5, but the linear speed obtained using sim.getObjectVelocity differs significantly from the set speed.

The result obtained is [-0.09996414184570312, 0.0010907649993896484, -1.773238182067871e-05]. The document says to use sim.handleflag_axis, I don't know how to set it, so I directly used the liner, angle=self. sim.getObjectVelocity (self. robot | self. sim.handleflag_axis), and the result remained unchanged.

I want to obtain the linear and angular velocities of the car in a relative coordinate system. What should I do?

thanks a lot

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

Re: Why is the result of sim. getObject Velocity inaccurate?

Post by coppelia »

Hello,

sim.setJointTargetVelocity tells the controller what velocity is desired. There is no guarantee that the velocity will be reached immediately, or will ever be reached: think of a car that wants to accelerate to 100 mph. It will take some time until that speed is reached. Additionally, if the torque the motor is able to provide is not large enough, then that speed will never be reached.

On the other hand sim.getObjectVelocity will return the current, measured velocity.

Cheers

Post Reply