Skip to content

Instantly share code, notes, and snippets.

@aarsht7
Last active October 28, 2021 12:59
Show Gist options
  • Save aarsht7/69a200be10ba63c78e3fd74e31e9a289 to your computer and use it in GitHub Desktop.
Save aarsht7/69a200be10ba63c78e3fd74e31e9a289 to your computer and use it in GitHub Desktop.
ros and ros2 workspace management tool (Linux)

ros-ros2-ws-management

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. Visit here for code.

Features

  • 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.

How to use it

  • You can simply replace your ~/.bashrc with the new one provided here and make the change to your source path for ros in line 62&63.

60-63

  • In case if you do not want to replace it, copy from line 59 to 175 and follow the instruction from line 176.

Demo

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.!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment