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

I believe I identified the issue.

First, as gvdhoorn mentioned, the melodic paths are being added by colcon build to the install/setup files. If ROS1 is sourced, then the melodic paths are embedded in the CMAKE_PREFIX_PATH variable. If I unset this variable before cleaning and rebuilding the colcon workspace, only the eloquent path remains in the install/setup files.

Second, sourcing melodic also adds its paths to the PYTHONPATH variable, which produces the AttributeError exception. In my case, this variable is only used by ROS and ROS2, so I can safely unset and reset it by sourcing the eloquent setup scripts. This is also fixed by opening a new terminal.

By resetting these variables, I can keep sourcing ROS1 or ROS2 in .bashrc, commenting the one I don't want to run.