Ask Your Question

Delay a ROS Topic by a certain amount of time

asked 2020-05-18 09:40:05 -0500

csg gravatar image

Actual problem:

I have a controller node that subscribes to 2 topics and publishes to 1 topic. Although, in simulation everything seems to be working as expected, in actual HW, the performance degrades. I suspect the problem is that one of the two input topics is lagging behind the other one by a significant amount of time.


I want to re-create this behavior in simulation in order to test the robustness of the controller. Therefore, I need to delay one of the topics by a certain amount of time - ideally this should be configurable parameter. I could write a node that has a FIFO memory buffer and adjust the delay-time by monitoring the frequency of the topic. Before I do that, is there a command line tool that I can use?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2021-04-02 05:48:59 -0500

Hi, If your simulation is constantly outputting data, you can reduce the throughput dropping messages using topic_tools drop. It's not a delay though but a change in frequency. Not sure if you could use topic_tools transform to change the timestamp, the message would be passed straight away just with the changed timestamp.

edit flag offensive delete link more

answered 2021-04-01 08:31:17 -0500

mohamed ahmed gravatar image

You can use ros::topic::waitForMessage

edit flag offensive delete link more

answered 2021-03-31 15:34:14 -0500

piupiu_island gravatar image

you can firstly record the bag file, then check the timestamp of each topic. I mean, each msg has it's timepoint, by checking it, you should know whether there is a lag.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2020-05-18 09:40:05 -0500

Seen: 392 times

Last updated: Apr 02