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

How to add a new directory to ROS_PACKAGE_PATH?

asked 2015-07-27 06:50:16 -0600

Asaad Irfan gravatar image

updated 2015-07-27 06:51:57 -0600

I'm working on ROS hydro ,Ubuntu 12.04.

I've created a new directory and i'm unable to add it to ROS_PACKAGE_PATH. Here's what i'm writing to do this:

export ROS_PACKAGE_PATH= /home/user/<name_of-directory_i_want_to_add>:/opt/ros/hydro/share:/opt/ros/hydro/stacks:$ROS_PACKAGE_PATH

(All in one line)

where /opt/ros/hydro/share:/opt/ros/hydro/stacks is what i get when i type: echo $ROS_PACKAGE_PATH

How do i add my directory to the ROS_PACKAGE_PATH?

edit retag flag offensive close merge delete


Did you append this command to your ~/.bashrc file? That's one way to make sure that you actually set it every time you open up another terminal.

yigit gravatar image yigit  ( 2015-07-27 07:45:44 -0600 )edit

Each time I get to the "Building Your Package" I have a sum total of 2 terminals I've used: 1) Roscore 2) Everything else in lessons up to and including 1.2 Building Your Package

Two terminals

*PS I'm using ROS Kinetic NOT Hydro * I don't know how "Hydro" got into my original query

ju78iklo9 gravatar image ju78iklo9  ( 2017-12-03 18:11:10 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2015-07-27 07:55:12 -0600

Airuno2L gravatar image

updated 2015-07-27 07:57:26 -0600

Two things: If /opt/ros/hydro/share:/opt/ros/hydro/stacks is already in ROS_PACKAGE_PATH, you don't need to put it in your export line. This command overwrites the variable, and by putting :$ROS_PACKAGE_PATH at the end of your path, you're say add everything that is already in the variable.

Second, I don't know if it matters, but I would try exactly what you have but without the space between the equals sign and the beginning of your path, like this: export ROS_PACKAGE_PATH=/home/user/<name_of-directory_i_want_to_add>:/opt/ros/hydro/share:/opt/ros/hydro/stacks:$ROS_PACKAGE_PATH

Edit: Also, like the comment the other fella made, if you're just typing this into the command prompt, this is only going to be effective for your current terminal. By adding it to your bashrc file, it will take effect on any new terminals in the future.

edit flag offensive delete link more

answered 2015-07-27 08:10:01 -0600

Asaad Irfan gravatar image

Thanks for the answer. I Just solved the problem by adding the directory that i wanted to add in ROS_PACKAGE_PATH, inside another workspace. This workspace was previously added to ROS_PACKAGE_PATH. (The workspace was created using the tutorial at & this tutorial shows how to add wkspaces to ROS_PACKAGE_PATH). This solved the problem.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-07-27 06:50:16 -0600

Seen: 10,765 times

Last updated: Jul 27 '15