ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

simulating a delay over certain topics with a multi pc ros network

asked 2021-09-14 03:37:42 -0600

lieftinkrj gravatar image

Hello All,

For teleoperating purposes, I want to add a time delay to certain ros topics, to simulate distances between operator and robot. At the moment I am doing this using the message filters, the time sequencer to be exact, but this does more than desired.

So I know the tc command in linux to simulate delay on your network interface, by using for example the following line:

sh tc qdisc add dev eth0 root netem delay 97ms

My systems consists of some nodes running on 1 pc and some nodes running on the other pc. The nodes locally do not need to have their topics delayed. Only the topics send between the pc's have to be delayed.

I am not the greatest in networking(so could be making some mistakes in my reasoning here), so here I go

Now I know that when locally running your ros network everything goes over local host, meaning that you could delay every topic by using the tc command over your local host. But what happends when you have a multi pc network? Do the local nodes its topics go over your local host and the ones between the pc's via your other network interface, or does everything switch to that network interface when using a multi pc network?

So if locally everything goes over local host and the topics via the pc's go via another host, I could easily just use the tc command over that network interface, right?

I hope this is clear.

edit retag flag offensive close merge delete


Hey there, I am basically looking at the same setup where I want to delay messages sent over 2 machines which are synchronized using chrony. Roscore is running on the publishing machine 1 and I calculate the delay in the subscribing node on the other machine 2. The message is sent every 100 ms and I am using netimpair on machine 1 to delay outgoing packets. I am observing the following:

  • With any delay <100 ms, everything is working as expected, the calculated delay equals the input of netimpair.
  • For any delay above 100 ms, it seems like multiple messages are received at the same time and the calculated delay starts rolling up periodically, e.g. for 110 ms it increases by 10 ms until 200 ms and starts again from 110 ms.
  • For a higher delay like 1000 ms, 9 msgs are received almost simultaneously, while a the tenth ...
phikre gravatar image phikre  ( 2023-04-04 04:48:44 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-09-14 06:39:59 -0600

osilva gravatar image

updated 2021-09-14 06:43:38 -0600

Hi @lieftinkrj, your question is very interesting. When I read the, in the last section talks about timing issues. So one thing to consider is that not all your machines might have the same response time and a central delay might make it worse. On the other hand, you are right to assume all communication is bi-directional.

It looks with chrony you may be able to achieve what you are looking for:

edit flag offensive delete link more


Thanks for your answer! I do want to make it worse actually, I am trying to simulate time delays in such systems and check the stability. However I do not see how synchronizing(or applying an offset to the clock) will add a physical delay in the system. However, chrony could be used to test it myself(synchronizing clocks and checking the time stamps of different topics), but hoped that someone knew it.

lieftinkrj gravatar image lieftinkrj  ( 2021-09-14 08:43:07 -0600 )edit

Perhaps you may be able to run with and without offset at different nodes.

osilva gravatar image osilva  ( 2021-09-14 09:40:01 -0600 )edit

Question Tools



Asked: 2021-09-14 03:37:42 -0600

Seen: 154 times

Last updated: Sep 14 '21