Rosanswers logo

Hey guys,

when i try to play a bag-file from a .launch file i get the follwing error:

started core service [/rosout]
process[player-2]: started with pid [3743]
[ INFO] [1566472363.629640670]: Opening ~/Schreibtisch/ros_workspace/kitti_2011_09_26_drive_0002_synced.bag
[FATAL] [1566472363.649632374]: Error opening file: ~/Schreibtisch/ros_workspace/kitti_2011_09_26_drive_0002_synced.bag
[player-2] process has died [pid 3743, exit code 1, cmd /opt/ros/melodic/lib/rosbag/play ~/Schreibtisch/ros_workspace/kitti_2011_09_26_drive_0002_synced.bag __name:=player __log:=/home/bryan/.ros/log/c2eb5e16-c4cd-11e9-ac1b-632677946da6/player-2.log].
log file: /home/bryan/.ros/log/c2eb5e16-c4cd-11e9-ac1b-632677946da6/player-2*.log
[ERROR] [1566477676.826236486]: poll failed with error Interrupted system call

my launch file looks quite simple:


  <!-- Start Bag File -->
  <node pkg="rosbag" type="play" name="player" output="screen" args="~/Schreibtisch/ros_workspace/kitti_2011_09_26_drive_0002_synced.bag"/>


Schreibtisch = Desktop..

What is the Problem?

Thanks in advance

Originally posted by Horst on ROS Answers with karma: 38 on 2019-08-22

Post score: 1


1 Answer 1


Rosanswers logo

What is the Problem?


<node pkg="rosbag" type="play" name="player" output="screen" args="~/Schreibtisch/ros_workspace/kitti_2011_09_26_drive_0002_synced.bag"/>

The problem is that ~ is something that is evaluated (ie: replaced) by your shell, not by roslaunch.

And roslaunch starts rosbag directly, without asking bash (most likely your shell) to first resolve the path. So rosbag is literally passed ~/Schreibtisch/ros_workspace/.., which it cannot open as it is not a valid path.

You cannot use ~ in a path in a .launch file.

You must either use an absolute path, or a relative path that is relative to a ROS package or relative to some environment variable. For the latter, you could perhaps use $HOME, in combination with the $(env ..) substitution arg (documentation).

On Melodic you could also perhaps use $(dirname), which will return the absolute path to the directory the .launch file itself is stored in.

Note that the use of relative paths can lead to some unexpected behaviour if you're not careful. See #q235337 for some related Q&As.

Originally posted by gvdhoorn with karma: 86574 on 2019-08-22

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by Horst on 2019-08-22:
thanks it worked with $(dirname), but why "home/bryan/Schreibtisch/ros_workspace/kitti_2011_09_26_drive_0002_synced.bag" won't work? I think that is a absolute path..?

Comment by Reamees on 2019-08-22:

would probably work, notice the / at the beginning.


Your Answer

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