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

Delay a ROS Topic by a certain amount of time

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

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.

Question:

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
0

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

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
0

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

mohamed ahmed gravatar image

You can use ros::topic::waitForMessage

edit flag offensive delete link more
0

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

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

Question Tools

2 followers

Stats

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

Seen: 1,082 times

Last updated: Apr 02 '21