Move the Robot

This tutorial aims to take control of a tbot robot. A tbot is a turtlebot2 robot (based on a kobuki platform) equipped with a laser range to navigate in a cluttered environment and a camera to recognize objects.

Connect the tbot:

If it is not yet the case, the machine connecting the robot and its sensors have to be configured accordingly to the IMT MobiSyst tbot

You will have then a ROS-2 WorkSpace including tbot meta-package (pkg-tbot) itself including several ROS packages.

  • Verrify it:

cd ~/mb6_space
ls 
ls pkg-tbot
  • Build the packages:

cd pkg-tbot   # enter le project directory
git pull      # download the last version
cd ..         # return on your ros workspace (mb6_space)
colcon build  # build...

ATTENTION all your command as colcon build need to be executed from you ROS workspace. The root directory of your ROS project (i.e. mb6-space here).

  • Update your shell environment variables:

source bin/run-commands.bash
  • Connect the tbot base, the laser and launch the control nodes (a ros launch file permits to start a collection of nodes with a desired configuration):

ros2 launch tbot_node minimal_launch.yaml

Into another, you can explore the existing node (rqt_graph) or topics (ros2 topic list)

Finally, you can try to take control in a third terminal:

Close everything with ctrl-c.

The teleop publishes a geometry_msgs twist message. It is composed of two vectors $(x, y, z)$, one for linear speed $(m/s)$, and the second for angular speed $(rad/s)$. However a nonholonomic ground robot as the tbot would move only on x and turn only on z. It is not as free as a drone, you can echo the messages into a 4th terminal.

  • Try to control the robot with ros2 topic pub command publishing in the navigation topic (/multi/cmd_nav).

Tbot integrate a subsumption multiplexer. The node listens different topics with different priorities (by default: /multi/cmd_nav and /multi/cmd_telop) and filter the appropriate commands to send to the robot. The topics cmd_nav and cmd_telop stend for autonomous navigation and operator teleoperate. The human operator has a higher priority and make the multiplexer to trash the cmd_nav commands.

Our first node

The goal is to create a process connecting a topic and publishing velocities as a twist message:

  • First we have to create a file for our script.

  • The script depends from several ROS2 ressources.

  • You can try that everything is well imported:

In a shell:

  • Next move consists in making a node and an infinite loop

In tuto_move.py add:

  • You can try that a node is created :

Move Script

We want our node to publish velocities continuously. To do that we have to import the type of message we have to send, to instantiate a publisher, and to publish messages.

You have to add the next pieces of codes at the appropriate location in the tuto_move.py script:

  • To verify that everything is right:

Basicly it echoes 0 speed vectors. To investigate what is a Twist you can ask to ros2 interface or search at the package location (/opt/ros/iron/share) (or search the documentations).

In case of nonhonolome mobile ground robot, the control uses two speed values, one lienar (x) and one angular (z).

SO, for a circling behavior:

At this point, your robot should move... Notice that you can also test your code on turtlesim by changing the name of the velocity topic.

Last updated

Was this helpful?