Two Otus trackers with there ID’s highlighted are simulated on Gazebo as shown on the right. Gazebo is an open-source robot simulator that can be integrated with the ROS infrastructure to provide powerful interfaces to simulate a robot in a realistic environment.

High-Level Architecture (ROS/Gazebo)

On the right you can see the high-level architecture used in this tutorial. The nodes are:

rcbenchmark_client_udp = “Client Node”

rcbenchmark_pose_parser = “Pose Parser Node”

gazebo

The Gazebo node is not launch internally trough the source code, it is launched via the launch file. The/gazebo/set_model_stateis called inside the Client Node. Once the call has been made, the model is updated (/gazebo/model_states) in the Gazebo world.

All messages used in this tutorial can be found in: … > rcbenchmark_ros_pkg > rcbenchmark> msg

Note: In this tutorial, we are referencing the rcbenchmark project written in C++found in the rcbenchmark_ros_pkg workspace (see right).

RCbenchmark Client Helper Code

The purpose of the RCbenchmark client helper code is to group together various functions that are needed in the ROS project. The code contains the:

Implementation of transport layer for UDP communication

Verification of machine endianness

Conversion of UDP byte package from server to rcbenchmark_msg

Parsing of rcbenchmark_msg to rcbenchmark_pose

Printing rcbenchmark_msg

Printing rcbenchmark_pose

The header file (.h) of the rcbenchmark client helper code can be found in:

Client Node (ROS)

The logic of the client node is shown on the right. The role of the client node is to construct the rcbenchmark_msg based on the UDP packages acquired from the RCbenchmark Tracking Lab 2017 server. The constructed message is published on the /rcbenchmark topic. Also, we are using the gazebo_msgs/SetModelState Service to set the controllers state in the Gazebo simulator by publishing its gazebo_msgs/ModelState.

Pose Parser Node (ROS)

The logic of the pose parser node is shown on the right. The role of the pose parser node is to parse the rcbenchmark_msg and obtain the rcbenchmark_pose. The newly created message does not contain the linear and angular velocities and accelerations.

Note: there is no need for the pose parser node in this tutorial as the controllers simulation on Gazebo is solely based on the rcbenchmark node, but we added it for your convenience.

RCbenchmark Launch (ROS)

As shown on the right, we are launching 3 nodes at once. The client node and pose parser node are highlighted in yellow and green respectively. The piece of code highlighted in orange is necessary to create the Gazebo node and launch the empty world. The piece of code highlighted in blue is used to load the description of the robot into the Parameter Server. Nodes use this server to store and retrieve parameters at runtime. In our case, we are loading the description of the Otus tracker found in:

… > rcbenchmark_ros_pkg > urdf> tracker.urdf

The Otus tracer is represented using the Unified Robot Description Format (URDF). The two block codes highlighted in pink spawn the Otus trackers to the Gazebo world. It is important to note that thenode namehas to be unique and the model which is the ID of the Otus tracker in our case has to match.

The command to execute the rcbenchmark.launch via the shell is shown on the bottom right.

The launch files can be found at:

… > rcbenchmark_ros_pkg > rcbenchmark> launch

Note: there is no need to run roscore as the .launch file automatically runs it.

Note: when adding/modifying the model (controller ID) argument in the launch file, it is important to add/modify the source code of the client node as well.