Communication Delay ROS V-REP

Typically: "How do I... ", "How can I... " questions
Post Reply
FieteBotschen

Communication Delay ROS V-REP

Post by FieteBotschen »

Hi all,

I recently did some tests measuring the latency between ROS and V-REP.

Basically I was sending out from a ROS node PoseStamped data using the the x - coordinate as ID, catching it from V-REP and sending it back to the ROS node taking timestamps each time I send and receive.

I got constantly results between 6 and 20 milliseconds delay and was wondering whether there are any possibilities to get constantly below 1 millisecond?

Best, Fiete

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

Re: Communication Delay ROS V-REP

Post by coppelia »

Hello Fiete,

It is important to understand that V-REP will not produce more data than the speed of the simulation loop.
If the simulation loop takes 5ms, then publishers will only update data every 5 ms. It wouldn't make sense to update the same data more than that anyway, since it would stay same.
Subscribers too, will apply received data only at each new simulation pass.
When you make a service call, then you will have:

1. delay from the network
2. delay from the ROS framework (i.e. thread switches, etc.)
3. delay from the V-REP main simulation loop

You can influence point 3. by making a simulation pass run faster (i.e. by reducing the time step, which will effectively call the physics engine less often in a time step (by default it is 10x)). You can also skip rendering frames, or simply turn rendering off during simulation. This will also increase the responsiveness.

Cheers

FieteBotschen

Re: Communication Delay ROS V-REP

Post by FieteBotschen »

Hey,

thanks for the quick reply! In order to that I would like to ask the whole community whether someone has an idea how to use V-REP only as an "testing environment". With that I mean that all the calculation is done outside of V-REP (meaning in ROS), then only force and torque data is being send to V-REP and force and torque data plus an image is send back to ROS to do further computations.

I would like to test my quadrotor control software with V-REP, but this only works, at least to my knowledge, with data transmission below 1 ms.

Any advice or opinion is highly appreciated!

Best, Fiete

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

Re: Communication Delay ROS V-REP

Post by coppelia »

If you turn display off, and have a very light simulation content, then you can have less than 1ms for a simulation pass.

But I still don't understand what kind of task V-REP will have in there. Could you explain a bit further?

Cheers

FieteBotschen

Re: Communication Delay ROS V-REP

Post by FieteBotschen »

Sure. My real quadrotor calculates internally at a frequency of 500 Hz. The reason is that if you want to stabilize it you have to apply certain forces / torques to every engine and listening at the same time to the engine to stop the increasing of the force / torque at the right moment. If you would do this at 6 - 10 ms, the quadrotor would start to oscillate and would lose control.

Plus, I would like to use in the future a haptic device running at 1kHz controlling the robot. This would require a real time simulation at that rate in any case.

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

Re: Communication Delay ROS V-REP

Post by coppelia »

Hello again,

The best thing that you could do it to artificially limit the frequency of your control algorithm on the controller side when testing the virtual quadrotor. And have also the quadrotor send synchronization signals to V-REP, so that you can run the simulation step-by-step. It will of course not be a real-time simulation.

for what you want to do, namely:

1. have the real quadrotor sent force signals to V-REP
2. have V-REP run the physics engine and update the virtual quadrotor position
3. have V-REP generate a vision sensor image
4. have V-REP send that image back to the real quadrotor

It is physically impossible to do it under 1ms (only openGl will take longer to generate an image).

So on your controller side:

- When controlling the real robot, your control loop runs at X ms
- When controlling the virtual robot, your control loop runs at Y ms (but thinks it runs at X ms)

Chosing Y = 100*X will give you enough time for all the simulation and communication.

Cheers

Cheers

Post Reply