In the last post I explained how to interface the Robotis Mini robot with python using the pypot library and a Robotis Mini module I created. In this post I will make use of this functionalities to connect the robot to the ROS environment. My goals are:

  1. read motor states and publish them to ROS as JointState messages
  2. get motor commands from ROS (controllers) and send them to the robot
  3. visualize the robot on RViz

Therefore, in this post I will explain how I created a ROS node that will take care of 1) and 2). This node will have to create a RobotisMiniPoppy object (pypot library) and use it to read/write to the robot, and create and use the corresponding publishers/subscribers to ROS.

Then, I created a URDF model of the robot. I found some existing URDF models for the Robotis Mini that I could use to start with and extend. The URDF will use the CAD models provided by Robotis for each robot part.

Finally, I created two launch files:

  • one to connect to the real Robotis Mini robot and visualize it in RViz
  • a second one to visualize in RViz a virtual Robotis Mini. Its joints can be manually set using the joint_state_publisher node GUI.

I created a meta-package robotis_mini_ros that contains two packages: robotis_mini_control (for all the control related stuff for the robot, also for the bridge node to connect to the real robot) and robotis_mini_description (for the URDF and the launch files). It is publicly available in this repository: https://github.com/roberto-martinmartin/robotis_mini/ This github repo also “contains” the pypot module I created for the RobotisMiniPoppy pypot code as a submodule (a submodule in a git repository is like a link to another repository; it allows you to match and pack together versions of both repositories).

RViz visualization of the Robotis Mini Robot

RViz visualization of the Robotis Mini URDF model

To launch RViz and the bridge to the real robot I just execute:

roslaunch robotis_mini_descriptor real_display.launch

To launch RViz and visualize a virtual robot I execute:

roslaunch robotis_mini_descriptor mockup_display.launch

To recap, now it is possible to:

  • connect to the real robot, send commands and query the state of the motors
  • connect the robot to the ROS environment
  • use the robot URDF model that defines the kinematics of the robot in combination with the motor values (joint values) to estimate the pose of each link of the robot
  • visualize the real or a virtual Robotis Mini robot in RViz

So what is next? The goal I am pursuing by connecting the robot to ROS and defining a model of the robot is to be able to simulate the robot in Gazebo (ROS physics simulator) so that I can use this simulator to generate and collect data necessary for any machine learning algorithm. The idea is that if I can simulate the robot in Gazebo, I can easily switch to the real robot whenever I want to test the results of the learning process on the real Robotis Mini, but I can leverage the simulator to generate large amounts of data. In the next post I will then develop the necessary models to simulate the robot in Gazebo.