What we are going to learn
- How to only source one ROS distro at a time
- How to create new ROS2 workspaces
List of resources used in this post
- The Construct: https://app.theconstructsim.com/
- ROS Development Studio (ROSDS) —▸ http://rosds.online
- Robot Ignite Academy –▸ https://www.robotigniteacademy.com
- ROS2 Tutorials –▸
- This video answers the following question asked on ROS Answers: https://answers.ros.org/question/389464/why-does-ros2-installsetupbash-source-ros1-and-ros2/
Creating a rosject
In order to learn how to create conditional publishers, let’s start by creating a publisher and a subscriber in Python. We are going to use The Construct (https://www.theconstruct.ai/) for this tutorial, but if you have ROS2 installed on your own computer, you should be able to do ~everything on your own computer, except this creating a rosject part.
Let’s start by opening The Construct (https://www.theconstruct.ai/) and logging in. You can easily create a free account if you still don’t have one.
Once inside, let’s create My Rosjects and then, Create a new rosject:
For the rosject, let’s select ROS2 Foxy for the ROS Distro, let’s name the rosject as ROS Q&A 224. You can leave the rosject public.
If you mouse over the recently created rosject, you should see a Run button. Just click that button to launch the rosject.
Checking enviroment configuration
Open a webshell and go to the installation folder of ROS, like shown below:
You can see there are installed two ROS distros, ROS 1 Noetic and ROS 2 Foxy
That means both systems are installed, like the user shown his workspace. Now, open the code editor and check the workspaces:
There are two main workspaces, catkin_ws (for ROS noetic) and ros2_ws (for ROS 2 foxy)
Configuring an environment with both setups
The quickest way to have a ROS environment with both ROS and ROS2 is by creating a new workspace. In the webshell, execute the following:
Open in the IDE the file ~/new_ros2_ws/install/setup.bash. This is a fresh new ROS2 workspace, it does not have ROS noetic attached to it. It is shown in the image below, no ROS commands (e.g: roscore) are available:
You can have as many ROS 2 workspaces as you want and the fresh new workspace built does not have the setup to attache ROS 1 to it, unless you configure to do so.
Youtube video
So this is the post for today. Remember that we have the live version of this post on YouTube. If you liked the content, please consider subscribing to our youtube channel. We are publishing new content ~every day.
Keep pushing your ROS Learning.
0 Comments