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

Does the order of a launch file node influence the order of execution?

asked 2021-08-21 10:24:24 -0500

Kansai gravatar image

I have a launch file like

<launch>

<arg name="input_folder" default="input" />
<node type= "dosomething.py" name="dosomething" pkg="a_package" output="screen" cwd="node" required="true" />

<arg name="output_folder" />
<node name="rosbag" type="record" pkg="rosbsag"
args="-O $(arg output_folder) /message">
</node>
</launch>

dosomething publishes messages. My problem is that it seems that rosbag record does not record the first published messages

when I launch the file though I can see that rosbag starts after dosomething has started, but I think that still it starts before the first message is published

However it seems it is not recorded. How can I solve this and make sure all published messages are recorded?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-08-21 13:36:57 -0500

gvdhoorn gravatar image

updated 2021-08-21 13:37:20 -0500

Does the order of a launch file node influence the order of execution?

No, it doesn't.

(or at least not significantly)

edit flag offensive delete link more

Comments

The why is it not recording the first message? And how to record it?

Kansai gravatar image Kansai  ( 2021-08-21 19:41:55 -0500 )edit

The why is it not recording the first message?

Likely because setting up subscriptions takes time, and any messages published during connection establishment will not be seen by the new subscriber (ie: rosbag in this case).

There are quite a few Q&As on this topic here on ROS Answers. Use Google and append site:answers.ros.org to your query. Keywords which will likely find those Q&As: first message lost.

gvdhoorn gravatar image gvdhoorn  ( 2021-08-22 01:55:09 -0500 )edit

I stopped using rosbag record and wrote my own script. After some experiments I can see that the order of launch file node do have a significant influence in the result

Kansai gravatar image Kansai  ( 2021-08-22 07:55:25 -0500 )edit

It may be more efficient to use the rosbag API instead of replaying a .bag. That would make things much more predictable.

gvdhoorn gravatar image gvdhoorn  ( 2021-08-22 08:41:47 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2021-08-21 10:24:24 -0500

Seen: 170 times

Last updated: Aug 21 '21