Page 1 of 1

Vrep simulation time to real time

Posted: 05 Jul 2016, 16:25
by jessica
Hi,
I have a simulation built up in vrep and it has a floor of 15mx15m.
And I have a model of Pioneer_3dx which uses differential drive.
I published velocities for it left and right motor as 1 and let ros sleep for 1s, hoping that the pioneer will move forward by 1. But it is not, and the avergae distance that it travelled in between this 1s using the velocity is around 0.28.

Here's the code (I'm using torch-ros so the ros code is in lua):

mot_velL_msg.data = 1
mot_velR_msg.data = 1
setMotVelL_pub:publish(mot_velL_msg)
setMotVelR_pub:publish(mot_velR_msg)
ros.Time.sleepUntil(ros.Time.now() + 1)

So I suppose the time in vrep has a different scale from the ros time, or the distance has a different scale? If so can someone help me with it as how to map this scale, as I need a relatively precision on this control?
Thanks in advance!

Re: Vrep simulation time to real time

Posted: 06 Jul 2016, 16:20
by coppelia
Hello,

make sure that on the V-REP side you have clicked the real-time mode toolbar button. If not, then your simulation will try to run as fast as possible. This could be faster or slower than real-time, depending on the complexity of the simulation.

Cheers

Re: Vrep simulation time to real time

Posted: 07 Jul 2016, 16:33
by jessica
Ah, then does it mean that if I don't toggle the real-time mode, the simulation time that's actually passed will vary a lot for each of the ros.Time.sleep(1) command?

Re: Vrep simulation time to real time

Posted: 07 Jul 2016, 16:42
by coppelia
Yes, if the real-time mode is not enabled, then the V-REP simulation time will not move at the same rate as the time on your watch.

Cheers