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

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 :

ROS_ROOT=/opt/ros/kinetic/share/ros
ROS_PACKAGE_PATH=/home/batman/rosbuild-packages:/home/batman/catkin_ws/install/share:/opt/ros/kinetic/share
ROS_MASTER_URI=http://192.168.88.10:11311
ROS_VERSION=2
ROSCONSOLE_FORMAT=${message}
ROS_HOSTNAME=192.168.88.223
ROSLISP_PACKAGE_DIRECTORIES=
ROS_DISTRO=ardent
ROS_IP=192.168.88.223
ROS_ETC_DIR=/opt/ros/kinetic/etc/ros

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
3

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

Comments

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

Question Tools

2 followers

Stats

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

Seen: 3,174 times

Last updated: Oct 08 '18