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

Play .bag file from .launch error

asked 2019-08-22 05:51:42 -0500

Horst gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-08-22 06:26:35 -0500

gvdhoorn gravatar image

updated 2019-08-22 06:27:24 -0500

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.

edit flag offensive delete link more


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..?

Horst gravatar image Horst  ( 2019-08-22 07:03:56 -0500 )edit


would probably work, notice the / at the beginning.

Reamees gravatar image Reamees  ( 2019-08-22 07:44:35 -0500 )edit

Question Tools

1 follower


Asked: 2019-08-22 05:51:42 -0500

Seen: 1,884 times

Last updated: Aug 22 '19