Modified bashrc file to make your life easy with running ROS and ROS2 in parallel on same machine that allow you to jump between both with just one command.
-
If you open the terminal into pre-built ros workspace, it will automatically recognize the ros version and source the require setup.bash file.
-
If you want to re-source the workspace, use commands from workspace folder.
$ sb1
(for ros1 workspace)$ sb2
(for ros2 workspace)
-
If you want to initialize ros and source only setup.bash file from ros installation space you can use
$ ros1ws
(to only source the setup.bash from main ros1 path)$ ros1ws <path-to-ws>
(to source the ros1 workspace and move to the workspace)$ ros2ws
(to only source the setup.bash from main ros2 path)$ ros2ws <path-to-ws>
(to source the ros2 workspace and move to the workspace)
-
$ exit_ros
To exit any of the ros workspace and remove all the ros related variable from current bash prompt. You can jump to other version of ros from the same terminal flawlessly.
- [Recommended] You can copy the
.bash_aliases
to your $HOME folder as~/.bash_alias
and make the change to your source path for ros in line 62&63.
- In case if you do not want to add new file you can edit your
./~bashrc
. For that copy from line 59 to 175 and follow the instruction from line 176.
Demo shows how to use updated bashrc file to make your workflow better
demo.mp4
If you like it, a star to the repo would be a great to keep me motivated. Thanks.!