Vrep simulation time to real time

Typically: "How do I... ", "How can I... " questions
Post Reply
jessica
Posts: 10
Joined: 06 Oct 2015, 16:03

Vrep simulation time to real time

Post 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!

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

Re: Vrep simulation time to real time

Post 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

jessica
Posts: 10
Joined: 06 Oct 2015, 16:03

Re: Vrep simulation time to real time

Post 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?

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

Re: Vrep simulation time to real time

Post 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

Post Reply