How to clean up ROS paths
Somehow ROS2 humble and rolling got mixed up in my environment variables, like this:
PATH=/usr/lib/ccache:/home/andy/ws_ros2/install/moveit_core/bin:/opt/ros/humble/bin:/opt/ros/rolling/bin:/home/andy/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
Note that there is both :/opt/ros/humble/bin
and :/opt/ros/rolling/bin
. I think this came from sourcing Rollling, then sourcing Humble.
Is there an easy way to clean this up? What I've been doing so far to unset humble is:
printenv | grep -i humble
... to see a list of environment variables
export MY_ENV_VARIABLE=
.... reset an environment variable with references to humble
removed
But this takes awhile.
Did you build your workspace with both sourced? If so, reset your bashrc to just source /opt/ros/rolling and then do a rebuild of your workspace.
"Did you build your workspace with both sourced?"
I sourced one, built, then sourced the other, opened a new terminal, then tried to build.
"reset your bashrc to just source /opt/ros/rolling and then do a rebuild of your workspace."
Hmm, I'm pretty sure I tried that. Should PATH get reset every time I open a new terminal?
Building leaves residue in the build and install directories, so sourcing them also brings the old /opt/ros stuff with it. Sourcing your humble workspace and then /opt/ros/rolling should result in workspace, humble and rolling on PATH. (at least that's my experience with ROS1)
It does for me. Unless your path stuff comes from somewhere other than bashrc.