Programming Marty The Centaur

Posted   —   № 11

So you just assembled your centaur and you’re ready to get it walk around! We have made a Python function to get you started. You can find the code and an example on this repo.

How it works

Marty The Centaur is essentially two separate Martys attached together. This means that commands have to be sent to the two boards at the same time. Multiple motors on the same board need to be activated at the same instance to ensure that the Centaur moves smoothly.

Movement Sequence

Coming up with the movement sequence has proven to be quite tricky. I had to watch a couple of videos, like this one, before I got the hang of it. At the end I have decided on a sequence that involves 7 different steps and then it repeats. It is, however, quite fun to experiment with your own movement sequences. You can try alternating the legs that move or even twisting the legs while it moves to make it move like a lizard!

Key Frames

Commands are sent to the motors in a format known as key frame, which is basically a snapshot of desired servo positions. This includes the motor IDs to move, their desired positions and the desired duration of the motion(s). MartyPy API includes a function called keyframe that enables you to easily create these key frames.

Sending Commands to Marty

Key frames are sent to Marty using a function called ros_processed_command. This function processes the data provided by keyframe and puts it in ROS Serial format which can be interpreted by Marty.

What To Do Now?

Test out the example code on the repo and feel free to try out your own movement sequences! The main part you want to change are the keyframes and the step duration i.e. temp_sequence and step_duration. temp_sequence utilises the previously metnioned keyframe function so you need to provide it with the number of movements you want to have in every sequence, the duration of the sequence (this is step_duration in the example code), the motor IDs and their desired positions.