In this post I will report on my steps to connect the Robotis Mini to my PC. I will use the PC to 1) read motor state, and 2) send motor commands.
In previous posts I reported on the physical connection between the PC and the motors through the USB2AX. Now we need to develop a program that sends and receives information to/from the motors through this USB2AX. There are several libraries implementing the dynamixel protocol to read/write to motors. However, I found pypot, a python library developed by the Inria Flowers Robotics Group in France, which directly takes care not only of the low level communication to the motors, but also provides very useful “higher level” interfaces to define robots from groups of motors. And all of it in python, so it is easy to use, to test (using for example a ipython console) and to program with.
First, I was playing around and getting familiar with the library and its possibilities. Then, I created a python module that defines the motor structure of the Robotis Mini and makes it available to the pypot library as a new robot creature. This module can be found here: https://github.com/roberto-martinmartin/robotis_mini_poppy/ . The module is very simple and has two main goals:
- define the RobotisMiniPoppy class deriving from AbstractPoppyCreature class, which makes it to inherit all the basic functionalities of the base class to read, write and control motors
- provide a json file with the configuration of the robot (motors, their IDs and configuration)
Because when I connect the USB2AX to my PC it always gets the /dev/ttyACM0 port, I hardcoded it in the json file. However, it could be that in another computer the assigned port is different.
After I installed this module, I could use pypot with my Robotis Mini robot! I was playing around with the pypot + my RobotisMiniPoppy class in ipython. I was able to:
- read and wrote motor values
- activate, deactivate and change the color of the LEDs of the motors
- record a robot trajectory executed kinestetic teaching (manually moving the robot motors) and replay it afterwards
My next step will be to add another level of abstraction and ROSify the robot. I will use pypot to create a bridge between ROS and the Robotis Mini robot. This will allow me to use ROS packages to control, visualize, record trajectories in rosbags, …
Leave a Reply
You must be logged in to post a comment.