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

Revision history [back]

click to hide/show revision 1
initial version

answered 2016-06-06 11:51:39 -0500

joq gravatar image

I agree with @gvdhoorn about avoiding relative path names. The trick is to use rospkg to construct a path relative to your package directory, something like this (untested):

import os, rospkg
rp = rospkg.RosPack()
script_path = os.path.join(rp.get_path("your_package"), "src", "script_name")