Phoenix Hexapod Code Autonomous

Hello,

I want to make my Hexapod follow a red ball autonomously (i.e no Remote input). So the idea is that I would press a button on the PS2 controller to activate the “ball follower mode” and it would start to follow a red ball if it was in front of it. So far I have the camera code working, which sends the position of the ball to the robot and compares it to the center of the screen to tell it to turn or not.

Where i’m lost
I would like to use the code from the phoenix library, which already deals with the inverse kinematics and servo sequences, but I’m confused by the source code. Where in the phoenix code does the robot determine which mode it is in and what walking gait to use? How would I go about adding a new movement gait so the robot follows the red ball? I know there is in-line code documentation, but I’m kinda lost in the entire process that goes on in the code.

Thanks for the help!

Hi,

First off, the idea you describe sounds great! :slight_smile:

That being said, it is also a non-trivial change to the code. If you wish to integrate your changes fully into the Phoenix code base, then there is no easy way out :: you’ll need to learn how the system works deeply to make the proper changes.

Another option to this is to simply have a secondary microcontroller read the output from your camera system and instead send command-like control signals to the BotBoarduino (or other Arduino-compatible board) running the Phoenix code. Alternatively, this can also be done from the Phoenix code too by modifying the input controller to use the signals from the camera system.

Code could be change on one of the buttons to toggle a “follow mode” as you mentioned.

You can find the controller code here. You could simply add new code that also handles other inputs (non-PS2 inputs) too.

Please note that the Phoenix code already takes a lot of space (FLASH), so if you do run out of space for a regular Arduino-compatible microcontroller board (such as the BotBoarduino, Arduino Uno, etc.), you can always move on to an Arduino Mega 2560, which has plenty of FLASH for expanding the code to include new, advanced features such as the one you describe.

Good luck with the project and please post more about your progress! We are certain the RobotShop community would be interested in any development. You can also post on our project-oriented website, Let’s Make Robots.

Sincerely,

Thanks for the advice.

I guess i’ll just have to do it the hard way then. I’m not as worried about the PS2 controller as working with the servo sequences. I think I’m just going to feed the robot commands the same way the controller does instead of coming up with a new protocol to control everything using the camera feedback.

That is the wise choice if you want to get a prototype working quickly ASAP.