Reputation: 9912
If I have installed ROS in my linux machine, can I install ROS2 and use both without problems?
I have already installed ROS and I am using it to learn the concept but the system in which I have to work in the end is in ROS2.
Upvotes: 3
Views: 6148
Reputation: 473
Based on Shrijit Singh comment, you need to create in your home directory the file .bash_aliases and then write:
alias source-ros='source /opt/ros/noetic/setup.bash'
alias source-ros2='source /opt/ros/foxy/setup.bash'
Then you just need to type in your terminal either source-ros or source-ros2 You do not need to add something in .bashrc as .bash_alias is automatically loaded from there.
Upvotes: 2
Reputation: 21
Yes, you can use ROS1 with ROS2 (and if you want you can use different distributions together from the same ROS version), the only requirement is to source the correct setup.bash file:
source /opt/ros/[distribution]/setup.bash
If you want to use ROS1 and ROS2 in the same application, checkout the ROS2 package called ROS1_bridge which allows you to connect ROS1 topics to ROS2 topics (or vica versa).
Upvotes: 2
Reputation: 376
Yes, both ROS1 and ROS2 can co-exist.
Source the appropriate setup.bash
to depending on which version of ROS you want to use.
For ROS1: source /opt/ros/melodic/setup.bash
For ROS2: source /opt/ros/dashing/setup.bash
Upvotes: 4