Ask Your Question
0

Play .bag file from .launch error

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

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:

<launch>

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

</launch>

Schreibtisch = Desktop..

What is the Problem?

Thanks in advance

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

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

gvdhoorn gravatar image

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

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

Comments

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 imageHorst ( 2019-08-22 07:03:56 -0600 )edit
1

"/home/bryan/Schreibtisch/ros_workspace/kitti_2011_09_26_drive_0002_synced.bag"

would probably work, notice the / at the beginning.

Reamees gravatar imageReamees ( 2019-08-22 07:44:35 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 54 times

Last updated: Aug 22