Here you will find a list of robots that you can use for learning ROS2 or build robotics products on top of them based on ROS2.
By robots running ROS2, I mean robots that publish their control and sensor topics in ROS2 topics. Let’s call this type of robots ROS2 Native.
I’m not including here robots that publish in ROS1 and then, there is a node that subscribes to those ROS1 topics and republishes in ROS2 format. Let’s call this type of robots ROS2 Hybrid.
This was the first commercial robot able to run ROS2 on it. Turtlebot3 was designed to run ROS1 by default, so if you buy it, it will come with ROS1 pre-installed. However, the guys from Robotis quickly prepared a tutorial about how to make your Turtlebot3 run ROS2. The full tutorial is here.
Again, this robot default system is ROS1 but Husarion has released a full tutorial about how to change the default ROS version to ROS2. The full tutorial is here.
Same procedure as the previous 2. Default system is ROS1 but Rover provides a git repo with the code and instructions about how to install the ROS2 drivers for that robot. Check it out here.
This is the first ROS2 native robot I have seen. It is a very simple robot with the main purpose of learn ROS2 while applying it to the real robot. Basically, just a pair of wheels with encoders, more than enough for learning basic ROS2. Check it out here.
The e-puck 2 robot is a very small and cool robot with lots of sensors. The e-puck 2, from conception, it has nothing to do with ROS. However, recently Cyberbotics company created a ROS2 driver for that robot so we can now use this excellent robot with our favorite ROS. Here the drivers with tutorials.
Open Manipulator, by Robotis
This is the only arm robot running ROS2 that I’m aware of. It is produced by the creators of the Turtlebot3 and, again, the robot boots initially with ROS1. However, the Robotis team have created a detailed tutorial about how to set this manipulator work with ROS2. Find the tutorial here.
…and that is all that I’ve found!
Guys, I see a potential business here… just saying…
The reason behind so few ROS2 robots
I think that one of the reasons why there are no more ROS2 robots is because ROS1 ones can make the deal even with ROS2. I mean, you can have a ROS1 robot running all your drivers to the robot hardware in ROS1 format, and thenuse the ROS1_bridge to interface that with ROS2 programs (that is, republishing in ROS2 format).
In case you want to learn how to do the ROS2 republishing of ROS1 topics, take our ROS2 Basics course were we teach how to use the ROS1_bridge to mix ROS1 and ROS2 programs on a single robot, among many other things of ROS2.
If you have a robot that runs on ROS2 and can be bought (not experimental ones), let me know so I can add it to the list.
In this episode of ROS2 Tutorials Series, you will learn how to create a simple ROS2 custom message for Topics.
We are going to use a ROS2 (Dashing) installation for this, but you don’t need to install ROS, as we will use the ROS Development Studio (ROSDS), an online platform that provides access to ROS2 and ROS2 computers and other powerful ROS tools within a browser!
Head to http://rosds.online and create a project with a similar configuration as the one shown below. You can change the details as you like, but please ensure you select “Ubuntu 18.04 + ROS2 Dashing” under “Configuration”.
Once done with that, open your ROSject. This might take a few moments, please be patient.
Step 2: Source the ROS2 workspace
Once the ROSject is open, head to the Tools menu and pick the Shell tool (a terminal) and run the following command to source the workspace:
user:~$ source /opt/ros/dashing/setup.bash
ROS_DISTRO was set to 'melodic' before. Please make sure that the environment does not mix paths from different distributions.
user:~$
If you get that ROS_DISTRO warning, just ignore it.
Step 3: Create a ROS2 C++ package in your ROS2 workspace
We are creating a C++ package (ament_cmake) and adding dependencies rclcpp (ROS C++ client) and std_msgs (in-built standard messages type, on which our new message will be based).
Add the following function to CMakeList.txt.This function tells the ROS system to generate a new message from the specified message definition, using the specified interface.
Whew, a couple of ingredients had to be added there; now it is time to compile the message and taste the “soup”!
Get back to the terminal and run the following commands:
user:~$ cd ~/ros2_ws
user:~/ros2_ws$ colcon build --symlink-install
Starting >>> ros2_msg
Finished <<< ros2_msg [14.1s]
Summary: 1 package finished [14.3s]
user:~/ros2_ws$ source install/setup.bash
ROS_DISTRO was set to 'dashing' before. Please make sure that the environment does not mix paths from different distributions.
ROS_DISTRO was set to 'melodic' before. Please make sure that the environment does not mix paths from different distributions.
user:~/ros2_ws$
Pick another Shell from the Tools menu and check the message being published (PS: you need to source ROS Dashing and the workspace first):
user:~$ source /opt/ros/dashing/setup.bash
ROS_DISTRO was set to 'melodic' before. Please make sure that the environment does not mix paths from different distributions.
user:~$ source ros2_ws/install/setup.bash
ROS_DISTRO was set to 'dashing' before. Please make sure that the environment does not mix paths from different distributions.
ROS_DISTRO was set to 'melodic' before. Please make sure that the environment does not mix paths from different distributions.
user:~$ ros2 topic list
/parameter_events
/rosout
/test_topic
user:~$ ros2 topic echo /test_topic
day: 7
month: October
year: 2019
---
day: 7
month: October
year: 2019
---
day: 7
month: October
year: 2019
---
day: 7
month: October
year: 2019
---
day: 7
month: October
year: 2019
---
day: 7
month: October
year: 2019
---
^Cuser:~$
Did you like this post? Do you have questions about what is explained? Whatever the case, please leave a comment on the comments section below, so we can interact and learn from each other.
If you want to learn about other ROS or ROS2 topics, please let us know in the comments area and we will do a video or post about it 🙂
In this post, you will learn how to communicate between ROS1 & ROS2 with ros1_bridge. You will see how to set up the ros1_bridge package in order to send ROS2 commands to control a TurtleBot2 simulation running in ROS1 Melodic.
Step 1: Grab a copy of the Project (ROSject) on ROSDS
Click here to get your copy of the project used in this post.
Step 2: Launch the TurtleBot2 simulation from the Simulations menu
Now you should see a Simulation window pop up with the TurtleBot2 simulation.
Step 2: Source the workspace for ROS1 Melodic
Pick a Shell (terminal tool) from the Tools menu and run the following command:
In the same Shell used in Step 2, run the following command:
user:~$ source /opt/ros/dashing/local_setup.bash
ROS_DISTRO was set to 'melodic' before. Please make sure that theenvironment does not mix paths from different distributions.
user:~$
Step 3: Ensure ROS_MASTER_URI is pointing in the right direction:
Step 4: Communicate between ROS1 & ROS2 with ros1_bridge: start the ros_bridge
Now, start the ros1_bridge and put this terminal on one side – we’re done with it for now.
user:~$ ros2 run ros1_bridge dynamic_bridge
Created 2 to 1 bridge for service /gazebo/clear_body_wrenches
Created 2 to 1 bridge for service /gazebo/clear_joint_forces
Created 2 to 1 bridge for service /gazebo/delete_light
Created 2 to 1 bridge for service /gazebo/delete_model
Created 2 to 1 bridge for service /gazebo/get_joint_properties
Created 2 to 1 bridge for service /gazebo/get_light_properties
Created 2 to 1 bridge for service /gazebo/get_link_properties
...
Step 5: Control the ROS1 TurtleBot2 Simulation from ROS2
Fire up another Shell from the Tools menu and publish to /cmd_vel.
user:~$ source /opt/ros/dashing/local_setup.bash
ROS_DISTRO was set to 'melodic' before. Please make sure that the environment does not mix paths from different distributions.
user:~$ ros2 topic pub /cmd_vel geometry_msgs/Twist "linear:
x: 0.5
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0"
publisher: beginning loop
publishing #1: geometry_msgs.msg.Twist(linear=geometry_msgs.msg.Vector3(x=0.5, y=0.0, z=0.0), angular=geometry_msgs.msg.Vector3(x=0.0, y=0.0, z=0.0))
In the shell where you’re running the ros1_bridge, you should see messages similar to the following:
created 1to2 bridge for topic '/rosout' with ROS 1 type 'rosgraph_msgs/Log' and ROS 2 type 'rcl_interfaces/msg/Log'
created 2to1 bridge for topic '/cmd_vel' with ROS 2 type 'geometry_msgs/msg/Twist' and ROS 1 type ''
created 2to1 bridge for topic '/rosout' with ROS 2 type 'rcl_interfaces/msg/Log' and ROS 1 type 'rosgraph_msgs/Log'
[INFO] [ros_bridge]: Passing message from ROS 2 geometry_msgs/msg/Twist to ROS 1 geometry_msgs/Twist (showing msg only once per type)
And, of course, you should see that your robot started to move!
And that was it 😉 . We just controlled a simulation started in ROS1 with ROS2, using the ros1_bridge.
Extra: Video
Prefer to watch a video demonstrating the steps above? We have one for you below! PS: the video uses another simulation, a Parrot Drone, but the concepts are the same.
Did you like this post? Do you have questions about what is explained? Whatever the case, please leave a comment on the comments section below, so we can interact and learn from each other.
If you want to learn about other ROS or ROS2 topics, please let us know in the comments area and we will do a video or post about it 🙂
In this post, you will learn how to create a ROS2 launch file.
The problem: we have a ROS2 C++ package but it has no launch file. Yes, we can run the code of this package using ros2 run..., but we also want to be able to run it using ros2 launch...
Let’s get to work right away and solve this problem!
Open the ROSject. This might take a few moments, please be patient.
Once the ROSject opens, fire up a Shell from the Tools menu and run the following commands to recompile the package.
user:~$ source /opt/ros/crystal/setup.bash
ROS_DISTRO was set to 'melodic' before. Please make sure that the environment does not mix paths from different distributions.
user:~$ cd ros2_ws
user:~/ros2_ws$ colcon build --symlink-install
Starting >>> ros2_cpp_pkg
Finished <<< ros2_cpp_pkg [21.9s]
Summary: 1 package finished [22.0s]
user:~/ros2_ws$ source install/setup.bash # source the workspace
ROS_DISTRO was set to 'crystal' before. Please make sure that the environment does not mix paths from different distributions.
ROS_DISTRO was set to 'melodic' before. Please make sure that the environment does not mix paths from different distributions.
user:~/ros2_ws$
Step 3: Create a ROS2 launch file for this package
Create a launch directory within the package and create a launch file within the directory.
On the Shell, run:
user:~/ros2_ws$ cd src/ros2_cpp_pkg/
user:~/ros2_ws/src/ros2_cpp_pkg$ mkdir launch
user:~/ros2_ws/src/ros2_cpp_pkg$ cd launch && touch ros2_cpp_code.launch.py
user:~/ros2_ws/src/ros2_cpp_pkg$
Fire up an IDE from the Tools menu, find the launch file just created and paste the following code into it:
"""Launch the cpp_code executable in this package"""
from launch import LaunchDescription
import launch_ros.actions
def generate_launch_description():
return LaunchDescription([
launch_ros.actions.Node(
# the name of the executable is set in CMakeLists.txt, towards the end of
# the file, in add_executable(...) and the directives following it
package='ros2_cpp_pkg', node_executable='cpp_code', output='screen'),
])
Now, we need to tell ROS to recognize the launch file. Open up CMakeLists.txt in the IDE and add the following lines at the bottom of it.
# install the launch directory
install(DIRECTORY
launch
DESTINATION share/${PROJECT_NAME}/
)
Step 5: Launch the package using the new launch file and be happy!
You’ve been working very hard, time to eat the fruit of your labor!
The format for the command is ros2 launch <package_name> <launch_file_name>.
We are launching the C++ code in src/ros2_cpp_code.cpp, and the output should be something like this:
user:~/ros2_ws$ ros2 launch ros2_cpp_pkg ros2_cpp_code.launch.py
[INFO] [launch]: process[cpp_code-1]: started with pid [13071]
[INFO] [ObiWan]: Help me Obi-Wan Kenobi, you're my only hope
[INFO] [launch]: process[cpp_code-1]: process has finished cleanly
user:~/ros2_ws$
Prefer to watch a video demonstrating the steps above? We have one for you below!
Related Resources
ROS2 Basics
Feedback
Did you like this post? Do you have questions about what is explained? Whatever the case, please leave a comment on the comments section below, so we can interact and learn from each other.
If you want to learn about other ROS topics, please let us know in the comments area and we will do a video/post about it 🙂
In this post, you will learn how to create a simple ROS2 package for Python. You don’t need a ROS2 installation for this as we will use the ROS Development Studio (ROSDS), an online platform that provides access to ROS (1 or 2) computers and other powerful ROS tools within a browser!
PS: If you have ROS2 installed locally on your machine, you can skip Step 1.
Head to http://rosds.online and create a project with a similar configuration as the one shown below. You can change the details as you like, but please ensure you select “Ubuntu 18.04 + ROS2 Crystal” under “Configuration”.
Once done with that, open your ROSject. This might take a few moments, please be patient.
Step 2: Source the ROS2 workspace
Once the ROSject is open, head to the Tools menu and pick the Shell tool (if on your local PC just fire up a terminal) and run the following command to source the workspace:
user:~$ source /opt/ros/crystal/setup.bash
ROS_DISTRO was set to 'melodic' before. Please make sure that the environment does not mix paths from different distributions.
user:~$
If you get that ROS_DISTRO warning, just ignore it.
Step 3: Create a ROS2 Python package in your ROS2 workspace
The syntax for creating a ROS2 Python package is ros2 pkg create <package_name>.
In the same terminal as in Step 2, change to your ROS2 workspace src directory and create a package there:
user:~$ cd ros2_ws/src
user:~/ros2_ws/src$ ros2 pkg create ros2_demo_py
going to create a new package
package name: ros2_demo_py
destination directory: /home/user/ros2_ws/src
package format: 2
version: 0.0.0
description: TODO: Package description
maintainer: ['user <user@todo.todo>']
licenses: ['TODO: License declaration']
build type: ament_cmake
dependencies: []
creating folder ./ros2_demo_py
creating ./ros2_demo_py/package.xml
creating source and include folder
creating folder ./ros2_demo_py/src
creating folder ./ros2_demo_py/include/ros2_demo_py
creating ./ros2_demo_py/CMakeLists.txt
user:~/ros2_ws/src$
Step 4: Delete CMakeLists.txt , create setup.py and setup.cfg and edit package.xml
Unlike ROS1, ROS2 Python packages don’t use CMakeList.txt, but a new setup.py file. Let’s create one here. In the Shell:
Locate package.xml and replace the contents with this snippet:
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="2">
<name>ros2_demo_py</name>
<version>0.7.3</version>
<description>A simple ROS2 Python package</description>
<maintainer email="sloretz@openrobotics.org">Shane Loretz</maintainer>
<license>Apache License 2.0</license>
<exec_depend>rclpy</exec_depend>
<exec_depend>std_msgs</exec_depend>
<!-- These test dependencies are optional
Their purpose is to make sure that the code passes the linters -->
<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>
<test_depend>python3-pytest</test_depend>
<export>
<build_type>ament_python</build_type>
</export>
</package>
We created the __init__.py file so that the ros2_demo_py folder could be recognized as a python module directory.
Locate the demo.py file, open it in the IDE and paste in the following code:
# Copyright 2016 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import rclpy
from rclpy.node import Node
from std_msgs.msg import String
class MinimalPublisher(Node):
def __init__(self):
super().__init__('minimal_publisher')
self.publisher_ = self.create_publisher(String, 'topic')
timer_period = 0.5 # seconds
self.timer = self.create_timer(timer_period, self.timer_callback)
self.i = 0
def timer_callback(self):
msg = String()
msg.data = 'Hello World: %d' % self.i
self.publisher_.publish(msg)
self.get_logger().info('Publishing: "%s"' % msg.data)
self.i += 1
def main(args=None):
rclpy.init(args=args)
minimal_publisher = MinimalPublisher()
rclpy.spin(minimal_publisher)
# Destroy the node explicitly
# (optional - otherwise it will be done automatically
# when the garbage collector destroys the node object)
minimal_publisher.destroy_node()
rclpy.shutdown()
if __name__ == '__main__':
main()
Step 6: Compile the package and source the workspace
We have created all the files needed. Now let’s compile.
Did you like this post? Do you have questions about what is explained? Whatever the case, please leave a comment on the comments section below, so we can interact and learn from each other.
If you want to learn about other ROS topics, please let us know in the comments area and we will do a video or post about it
In this post, you will learn how to create a simple ROS2 package for C++. You don’t need a ROS2 installation for this, as we will use the ROS Development Studio (ROSDS), an online platform that provides access to ROS (1 or 2) computers and other powerful ROS tools within a browser!
PS: If you have ROS2 installed locally on your machine, you can skip Step 1.
Head to http://rosds.online and create a project with a similar configuration as the one shown below. You can change the details as you like, but please ensure you select “Ubuntu 18.04 + ROS2 Crystal” under “Configuration”.
Once done with that, open your ROSject. This might take a few moments, please be patient.
Step 2: Source the ROS2 workspace
Once the ROSject is open, head to the Tools menu and pick the Shell tool (if on your local PC just fire up a terminal) and run the following command to source the workspace:
user:~$ source /opt/ros/crystal/setup.bash
ROS_DISTRO was set to 'melodic' before. Please make sure that the environment does not mix paths from different distributions.
user:~$
If you get that ROS_DISTRO warning, just ignore it.
Step 3: Create a ROS2 package in your ROS2 workspace
The syntax for creating a ROS2 package is ros2 pkg create <package_name> --build-type <build_type> --dependencies <dependencies_separated_by_single_space>.
In the same terminal as in Step 2, change to your ROS2 workspace src directory and create a package there:
Create a file named ros2_cpp_code.cpp inside the new package:
user:~/ros2_ws/src$ cd ros2_cpp_pkg/src
user:~/ros2_ws/src/ros2_cpp_pkg/src$ touch ros2_cpp_code.cpp
user:~/ros2_ws/src/ros2_cpp_pkg/src$
Pick the IDE from the Tools menu, locate the C++ file and paste in the following code:
#include "rclcpp/rclcpp.hpp"
int main(int argc, char *argv[]) {
rclcpp::init(argc, argv);
auto node = rclcpp::Node::make_shared("ObiWan");
RCLCPP_INFO(node->get_logger(),
"Help me Obi-Wan Kenobi, you're my only hope");
rclcpp::shutdown();
return 0;
}
In the IDE, open up the CMakeLists.txt and paste the following line at the bottom of the file. We are doing this to ensure the C++ file will be properly detected and compiled.
Now your package is ready to compile…so compile it and source the workspace!
user:~/ros2_ws/src/ros2_cpp_pkg/src$ cd /home/user/ros2_ws
user:~/ros2_ws$ colcon build --symlink-install
Starting >>> ros2_cpp_pkg
Finished <<< ros2_cpp_pkg [21.9s]
Summary: 1 package finished [22.0s]
user:~/ros2_ws$ source install/setup.bash # source the workspace
ROS_DISTRO was set to 'crystal' before. Please make sure that the environment does not mix paths from different distributions. ROS_DISTRO was set to 'melodic' before. Please make sure that the environment does not mix paths from different distributions.
user:~/ros2_ws$
Great. Now test-run it. You should have the string mentioned in the C++ code printed to the terminal output:
user:~/ros2_ws$ ros2 run ros2_cpp_pkg cpp_code
[INFO] [ObiWan]: Help me Obi-Wan Kenobi, you're my only hope
user:~/ros2_ws$
Done!
Extra 1: ROSject link
Get the ROSject containing all code used in the post in the following link: http://www.rosject.io/l/bce4ffd/!
Extra 2: Video
Prefer to watch a video demonstrating the steps above? We have one for you below!
Did you like this post? Do you have questions about what is explained? Whatever the case, please leave a comment on the comments section below, so we can interact and learn from each other.
If you want to learn about other ROS topics, please let us know in the comments area and we will do a video or post about it 🙂