Ask Your Question

ROS2 environment variables

asked 2018-05-11 03:53:26 -0500

aarushg gravatar image

Hi, I was building ROS2 from source and I already had kinetic installed on my system. After following all the instructions here, I tried to see my environment variables to check if everything was fine(as I did with each distro of ROS1) but I got this output :


Here I can see the ROS_VERSION as 2 and the distro variable as ardent but the ROS_PACKAGE_PATH and ROS_ROOT is still set according to kinetic. Do I need to change that, if yes how?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-05-11 09:49:51 -0500

Dirk Thomas gravatar image

updated 2018-10-08 12:43:29 -0500

First of all you should not source both setup files if you don't have to (e.g. for building something like the ros1_bridge). Commonly you should only source one of the two. Otherwise you will likely run into problems where some packages (e.g. std_msgs) exist in both ROS versions.

Regarding the questions about ROS_PACKAGE_PATH and ROS_ROOT (and several others like ROS_MASTER_URI, ROS_HOSTNAME, ROS_IP): ROS 2 doesn't use either of these variables.

edit flag offensive delete link more


Thanks! But since I was using kinetic since a long time, it was already sourced, so is there a way to unsource it(reset every variable) before sourcing ros2 or the only way is to unset/remove the unrequired variables of ros1 individually?

aarushg gravatar image aarushg  ( 2018-05-11 11:35:51 -0500 )edit

Rather than trying to unset variables / modify the ones which have been changed by the setup script you might want to open a fresh shell (assuming that you don't source the setup file in your bashrc). If you do I would recommend to define an alias instead and explicitly call the alias to source ROS.

Dirk Thomas gravatar image Dirk Thomas  ( 2018-05-11 11:55:13 -0500 )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



Asked: 2018-05-11 03:53:26 -0500

Seen: 1,816 times

Last updated: Oct 08 '18