Learning Robotics with ROS made easy

GoPiGo3 educational robot delivers its first ROS package

The basic setup explained in this article works with the GoPiGo3 Starter Kit, that will include the following hardware as part of the ROS environment:

  • Raspberry Pi 3
  • Servomotors driving the right and left wheels
  • Distance sensor

You need ROS Melodic installed in the Raspberry Pi. Ubuntu Mate is recommended as the Operating System.

Software installation

Clone the source code into your ROS workspace. Replace catkin_ws with the name of your actual workspace:

$ cd ~/catkin_ws/src
$ git clone https://github.com/ros-gopigo3/gopigo3

Include a basic teleoperation package such as teleop_tools for remote controlling the robot with the keyboard or the mouse:

$ git clone https://github.com/ros-teleop/teleop_tools

Then build the workspace:

$ cd ~/catkin_ws
$ catkin_make
$ source ~/catkin_ws/devel/setup.bash

In the following sections we describe every ROS package included in the repository of code.

Robot model

The package gopigo3_description contains the URDF description of GoPiGo3 that you can use to perform simulations of the robot.

The following command allows to view the model of robot with the RViz tool:

$ roslaunch gopigo3_description gopigo3_rviz.launch

You can set the gui parameter to launch a widget that lets you rotate both wheels with the sliders:

$ roslaunch gopigo3_description gopigo3_rviz.launch gui:=True

The figure below shows what the RViz window should look like:

In the left widget there are the two sliders that you can use to rotate the wheels from -180º to 180º (angles are in radians, i.e. -3.14 to 3.14 rad).

Fake robot

The package gopigo3_fake allows to experiment with GoPiGo3 without needing the physical one. Yo can, for example, explore its kinematics as we illustrate below.

First launch the virtual (fake) robot:

$ roslaunch gopigo3_fake gopigo3_fake.launch

To make sure that teleoperation is enabled, check that cmd_vel topic is being published:

$ rostopic list | grep cmd_vel

If there is the output as above, then GoPiGo3 is ready to accept motion commands. You can control it with the keyboard as follows:

$ rosrun key_teleop key_teleop.py /key_vel:=/cmd_vel

Later you will see that this teleoperation works for both the virtual robot in RViz or the physical GoPiGo3. For the last you should have connected a wireless keyboard to the Raspberry Pi.

After some strokes to the arrow keys, the RViz window should show something similar to the following screenshot:

The red arrow represents the set of poses (position + orientation) that the robot has covered. Hence, the trajectory is the line joining all the positions (starting point of every arrow) tangent to every arrow.

NOTE: In a next article we will show you how to use the keyboard of a remote computer to teleoperate the robot. This will allow to introduce the concept of networking in ROS.

Physical robot

The last ROS package included in the repository is gopigo3_bringup. This one allows the user to operate the robot including the distance sensor and the servomotors of the wheels.

To launch ROS for GoPiGo3 simply run the following command:

$ roslaunch gopigo3_bringup starter_kit.launch

This file activates both the servomotors of the wheels and the distance sensor. If you launch rqt_graph from another terminal, you will see the ROS graph composed of two independent parts: the upper one corresponding to the drives, and the bottom part to the distance sensor.

Since the two parts of the graph are disconnected, you can launch any of them individually using their respective files as shown below.

  • Distance sensor

Call the corresponding launch file as follows:

$ roslaunch bringup_car distance_sensor.launch

You can subscribe to the topic that publishes the distance in another terminal:

$ rostopic echo distance_sensor/distance

In any case, you will see the real time distance it is measuring right in the log of the terminal from which you launched ROS.

  • Servomotors of the wheels

Another launch file makes GoPiGo3 ready to accept motion commands through the cmd_vel topic just as we did with the fake robot above:

$ roslaunch bringup_car differential_drives.launch 

Then teleoperate with the keyboard as for the fake robot:

$ rosrun key_teleop key_teleop.py /key_vel:=/cmd_vel

Be aware that for GoPiGo3 to respond to the key strokes you need to keep active the window where the preceding command is running.

In the coming weeks we will provide practical examples to learn ROS with GoPiGo3.

Software Engineer spreading cutting edge technologies. Psychologist applying the current knowledge of the human brain to power intelligent robots & IoT devices

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store