Robotics StackExchange | Archived questions

How to make sure that two nodes (rosbag/record) start at the exact same time?

I have a setup consisting of two computers as described in my previous question. I want to synchronously record rosbags on those computers. Therefore I am using a launch file, that looks like this:

<launch>
    <machine name="comp2" address="10.0.0.1" user="user" env-loader="/home/user/catkin_ws/devel/remote_env_load.bash" default="false" />
    <node pkg="rosbag" type="record" name="record_kinect" machine="comp2" respawn="false" output="screen" args="--duration=5 -O /home/user/test.bag /topic3 /topic4" />
    <node pkg="rosbag" type="record" name="record_atis" respawn="false" output="screen" args="--duration=5 -O /home/user/test.bag /topic1 /topic2" />
</launch>

Later on I'm planning to use the python script that is referenced here to merge those two rosbags. However, it would be a great advantage and simplify my work, if there was a way to make sure, that rosbag starts recording at the exact same time on both machines. Is there a way, to tell a node in a launchfile to wait for another node or something like that?

Asked by max11gen on 2020-02-24 06:27:08 UTC

Comments

Could you perhaps better explain why you want to start things "at the exact same time"? How does that make merging easier?

Asked by gvdhoorn on 2020-02-24 11:14:50 UTC

Answers

i don't know how to achieve it.but it sounds like a workflow problem,and use ros service to connect may did help. to make sure exact at the same time it seems difficult,because it is hard to correct clocktime,focus on key datas and solve it by some way such as the token algorithm

Asked by 流水疾翔 on 2020-02-24 08:41:43 UTC

Comments