ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
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.
2 | No.2 Revision |
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.