0
$\begingroup$

Rosanswers logo

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

Originally posted by Maytheewat on ROS Answers with karma: 215 on 2013-05-15

Post score: 18

$\endgroup$

3 Answers 3

0
$\begingroup$

Rosanswers logo

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


Originally posted by Stephane.M with karma: 1304 on 2013-05-16

This answer was ACCEPTED on the original site

Post score: 44


Original comments

Comment by max11gen on 2018-11-13:
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?

Comment by gvdhoorn on 2018-11-13:
@max11gen:

re: --clock: #q12577.

re: relative path: #q235337.

Comment by max11gen on 2018-11-13:
@gvdhoorn thanks a lot.

$\endgroup$
0
$\begingroup$

Rosanswers logo

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.


Originally posted by tfoote with karma: 58457 on 2013-05-15

This answer was NOT ACCEPTED on the original site

Post score: 5

$\endgroup$
0
$\begingroup$

Rosanswers logo

For relative path use this just change MY_PACKAGE to your package name. Tested on Noetic:

<launch>
  <arg name="bag_file_name" value="my_bag"/>

  <node pkg="rosbag" type="play" name="rosbag_play" output="screen" args="--clock $(find MY_PACKAGE)/bags/$(arg bag_file_name).bag"/>
</launch>

Originally posted by Combinacijus with karma: 65 on 2021-02-26

This answer was NOT ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.