Ask Your Question
13

How to play rosbag using launch file ?

asked 2013-05-15 06:12:58 -0600

Maytheewat gravatar image

updated 2013-05-15 06:14:30 -0600

I'm trying to play a bagfile using following launch file.

<launch>
  <node pkg="rosbag" type="play" name="rosbag" args="8tags.bag"/>
</launch>

However, it gave me an error like this when I launch it.

[FATAL] [1368634083.754058723]: Error opening file: 8tags.bag
[rosbag-1] process has died [pid 14246, exit code 1, cmd /opt/ros/groovy/lib/rosbag/play $8tags.bag __name:=rosbag __log:=/home/mayara/.ros/log/7e11c8fc-bd77-11e2-ae06-ac72890c90a9/rosbag-1.log].
log file: /home/mayara/.ros/log/7e11c8fc-bd77-11e2-ae06-ac72890c90a9/rosbag-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done
edit retag flag offensive close merge delete

2 Answers

Sort by ┬╗ oldest newest most voted
30

answered 2013-05-16 01:36:36 -0600

You have to explicitly give the path to the file, for example :

<node pkg="rosbag" type="play" name="player" output="screen" args="--clock /home/me/ros_files/my_file.bag"/>

You can also use arguments, if you have multiple files to include

<arg name="path" default="/home/me/ros_files/" />
<arg name="file_1" default="my_file_1" />
<arg name="file_2" default="my_file_2" />
<node pkg="rosbag" type="play" name="player" output="screen" args="--clock $(arg path)$(arg file_1).bag $(arg path)$(arg file_2).bag"/>

I hope it helped you. Go to this page to have more info on options you can use.

Have a good day,

Bests regards,

St├ęphane

edit flag offensive delete link more

Comments

What does the --clock option do and if you want to specify a relative path, will it be relative to the package directory, or the launchfile directory?

max11gen gravatar imagemax11gen ( 2018-11-13 03:11:51 -0600 )edit
1

@max11gen:

re: --clock: #q12577.

re: relative path: #q235337.

gvdhoorn gravatar imagegvdhoorn ( 2018-11-13 03:36:39 -0600 )edit

@gvdhoorn thanks a lot.

max11gen gravatar imagemax11gen ( 2018-11-13 03:46:23 -0600 )edit
4

answered 2013-05-15 08:09:57 -0600

tfoote gravatar image

You should look in the referenced log file. But in general processes launched with roslaunch have a working directory in $ROS_HOME (default ~/.ros) you need to make sure to pass a full path to the bag file for it to be able to find the bag file.

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

2 followers

Stats

Asked: 2013-05-15 06:12:58 -0600

Seen: 21,204 times

Last updated: May 16 '13