PDA

View Full Version : KURT< HELP!!!!!!!!! Phantom X Phoenix code to run on my hexapod.



gregorio_626
01-23-2016, 12:45 AM
I am looking for someone(preferably KurtE) who can adjust the phantom x hexapod with commander code, to work on my hexapod. I think that this will be crucial to me being able to better understand hexapods and legged locomotion.

[email protected]
earl-tech.com

Zenta
01-24-2016, 03:24 AM
I think even Kurt or others need more info. What have you done so far? What is the problem?

KurtEck
01-24-2016, 08:53 AM
As Kåre mentioned,

In order for anyone to help you, they need additional information. Like what issues are you having?

Things like, do you you have a PhantomX hexapod? If so which version. If it is not a PhantomX, what is it? what type of servos?, What servo controller, what is your main processor? Do you have a Commander?

Also additional things like, what type of computer (windows, mac, linux), what OS are you running on it? If your main processor is an Arduino type, including Arbotix-m, what version of the Arduino IDE are you using?

Phoenix Software? Which github project(s) are you using? Are you having problems with getting it to compile? Or download? Servos not working?

Learning hexapod and legged locomotion. I still like referring people back to some of the much earlier stuff.

Example Zenta above was the one who made the original Phoenix hexapod, which then Jim Frye (original owner of Lynxmotion) made into a kit. Kåre, had a nice project write up on Lynxmotion (http://www.lynxmotion.com/images/html/proj098.htm)about the Phoenix, which included an excel document that showed how some leg motions worked.

Likewise, there was another Lynxmotion forum member Xan who wrote the original Phoenix software (in Basic for the BasicMicro Pros). This software was later extended and improved by several of us and then I later ported this code to Arduino and likewise Linux. Again up on Lynxmotion, Xan has a project write up (http://www.lynxmotion.com/images/html/proj102.htm), about his hexapod and code which includes some information about how the walking gaits worked.

And if you want more complete information on Kinematics and the like, there are books and probably web sites. Not sure what people recommend these days, but a few years ago, people highly recommend the book by Reza Jaza (http://www.amazon.com/Theory-Applied-Robotics-Kinematics-Dynamics/dp/1441917497/ref=sr_1_3?s=books&ie=UTF8&qid=1453647383&sr=1-3&keywords=kinematics)r

tician
01-25-2016, 01:50 AM
Highly recommend using scholar.google to search for various permutations of 'genetic algorithm', 'locomotion', 'hexapod', 'gaits', etc. There have been many attempts to identify optimal gaits for different robotic designs using stochastic searches like GA and PSO (particle swarm optimization), and at least one research group has even created a system that will permit a robot to find an effective replacement gait after it has received unknown damage to one or more of its legs.

gregorio_626
01-25-2016, 08:24 AM
First off, I am currently using the Phantom X body plates that Trossen sells.
Everything else is customized. The femur motors are offset with the wheel below the middle of the coxa motor. Not sure how I would account for that. Also, I am currently using the Arbotix-M, but I will be switching to a custom circuit board soon. But let's consider the Arbotix-m to be the board being used for this question.

I work with windows 10 right now, but the intel edison will be put on the final hexapod. I am using Arduino 1.0.6 because the new one isn't compatible with the Arbotix-m, I think.

I am also running the AX-18A motors. My leg dimensions are c=35 mm, f = 130, t = 248.248. Those are all in mm. I tried running the phantom x 2 commander code, but the Coxas went out of range, so I'm printing the new parts right now, that snapped.

KurtEck
01-25-2016, 01:36 PM
Hi again,

Not sure what help you are wanting? What is not working? Without pictures or like again hard to give specifics...

With your measurements, for femur, tibia... Did you update the sizes in the hex_cfg.h file? Are they straight pieces or do they have built in curves/angles? If there is some built in angles/curves there is some built-in support in the software to offset the angles, which is used with PhantomX (cFemurHornOffset1, cTibiaHornOffset1)

Do you have different builds for your left legs versus your right legs? If so/not you may have to update some of the inversion code as the values to some servos will have to move in opposite direction...

Wheels: Sorry you are on your own here. I have seen a few people do something like that but have no idea of they made their code available or not. I remember seeing at least one of them up on Lynxmotion forums (now part of Robotshop). Not sure if there were any up here or not.

Arbotix-m versus custom board? versus Edison... No idea what your custom board is.

Back to Arbotix-m, windows 10 and Arduino. - Note, I do not do anything with Arduino 1.0.6 anymore... I no longer have it installed on any machines. As for Arbotix-m, I made my own versions of the stuff to first run on 1.5.x and now 1.6.x installs of Arduino. I believe as of a few months ago, that Trossen was going to pick up my updated stuff as an option... You can pick my version up on github:
https://github.com/KurtE/arbotix/tree/arduino-1-6

Custom Board: ?

Edison: I have Phoenix code for it in a few different github projects. My Raspberry Pi (https://github.com/KurtE/Raspberry_Pi)project, which I have several different versions up there where I have experimented on several different Linux platforms, as well as a set of Eclipse projects (https://github.com/KurtE/Edison_Eclipse) specific to Edison, where I was using an Edison with Arduino breakout, plus an ILI9341 tft display... Have not touched it in probably a year as current versions of Edison Linux releases completely broke SPI (which was only barely limping along earlier) and my Edison Arduino board blue smoked...

Again with any Linux boards, you will need something to handle the AX servos. Easiest with something like USB2AX or USB2Dynamixel as you simply plug them in and their is code very similar to Arbotix library code (in my case I have ported these). Likewise for Arbotix-Pro as again their are simple libraries setup for this. Alternatively you could setup custom firmware on your Arbotix-m that talks to the Edison. You have lots of options on what runs on both processors. There have been a few threads talking about this.

Good Luck

gregorio_626
01-26-2016, 12:17 PM
6407
Here is the leg design. I went with a straight tobia for now. Notice how the center of the wheel on the femur motor is lower than the center of the wheel on the coxa motor. Not sure how I would incorporate this.
6408
The body is currently just the Phantom X plates that you can buy, as a spare part from trossen:
http://www.trossenrobotics.com/store/p/7038-Hexapod-Top-Bottom-Replacements.aspx (http://www.trossenrobotics.com/store/p/7038-Hexapod-Top-Bottom-Replacements.aspx)
The legs are the same on the left and right. No wheels are used(thankfully)

I currently was hoping to get it running on the Arbotix-M, without the Edison, or any custom boards.

So is your code:
https://github.com/KurtE/arbotix/tree/arduino-1-6

able to be run on the Arbotix-M, so that I can use the newer Arduino IDE version, thus eliminating the need for the 1.0.6? Or did I interpret what you said, incorrectly?

So overall, lets just assume that the only programmable board on the hexapod is the Arbotix-m, the commander v2, and 2 xbees. What would I need to change in order to get it running with the commander? Would anyone be willing to do this for me? I would provide any dimensions needed.

Another question I had, what file(s) in the Phantom_Phoenix_master, would I need to modify? The mk2? the phantom x? phoenix? hex cfg? As specific as you can be, would be greatly appreciated.


-Gregory Roberts
Founder of EARL Technologies
earl-tech.com

gregorio_626
01-26-2016, 12:36 PM
...I meant the Arduino_Phoenix_parts_master. Should I be using that one? Or should I use the Phantom_Phoenix-master?

KurtEck
01-26-2016, 05:51 PM
Simple stuff first:

Either github project should work, I try to keep them somewhat in sync, although I have not updated the in parts project with the latest stuff. I mainly used the Arduino Phoenix Parts project when I was doing stuff for several different robots that used different types of servos and different Input devices... However during the last few years, I have not done much (read that anything), with my Lynxmotion Robots which used RC servos controlled by an SSC-32 servo controller, so I have found it easier to work with the Phantom_Phoenix project, as it is more self contained so I can edit most all of the files directly in the Arduino IDE... So I would suggest use the Phantom_Phoenix project.

Arbotix Libraries: Yes if you install my version from the 1.6 branch on github, you should be able to build using Arduino 1.6.7. That is what I do.

Arbotix Commander (XBees): The Phantom_Phoenix project is setup to use the commander. The two XBees need to be paired to each other. I am pretty sure there is instructions for how to do this up with PhantomX tutorial. If you purchased the commander from Trossen, it comes with an Arduino board (last time I looked it was an Atmega 328 board from Seeedstudio). It probably came preprogrammed with their commander code. I typically run my own version in the commander, which you can get from my github project: https://github.com/KurtE/CommanderEx
The main difference is I use more of the logical ranges for the joysticks than they did...

Note: I believe that my Phantom_Phoenix and CommanderEx code actually has code in it that if you feed it two virgin XBees, it will detect that it is configured for 9600 baud and it will update them to the appropriate settings. I have not tried this in awhile...

Wheels: earlier I read this to imply that you had actual wheels connected to the bottom of your legs that allowed you to either walk or drive... (There have been a few that have done this). It is good to see, that what you meant was the servo horns... The location of these horns lower, may impact some settings like initial position, but should not be much of an issue.

Hopefully you should be able to make most (hopefully all) of your changes by changing stuff in the Hex_Cfg.h file.

However, while I try to be as helpful as I can, it may take you awhile to experiment to update all of the settings for your robot. I can try to give hints, but sometimes you need the actual hardware to make it work....

Some of the things to verify/update in the hex config file: Note I might show some line numbers below, from my current one, but could be slightly different)
===========================================
Servo ID's (129-154) ( - Currently the file is setup with the servos set to the ID's as shown in the Trossen assembly guide. Note: In some of my projects (example linux) I have renumbered the ID#1 to be ID 19, such that we can detect if one or more servos was renumbered back to default. I then have code at startup tries to talk to each of the servos. If it can not talk to one specific servo, but can talk to servo 1, it assumes that servo that was missing reset and the code changes #1 to that servo number...

Min/Max Angles(157-203): these are the approximate minimum and maximum angles each of the servos can move. Assuming coxa 0 point is straight out from robot, Femur 0 is with femur horizontal to ground, and Tibia 0 is with tibia a 90 degree angle from femur (i.e perpendicular to ground). Measurements are in 10ths of degree, so 750 is 75 degrees.

Leg Dimensions (213-245)
Coxa's - horizontal distance between center of coxa servo horn and femur servo horn in mm. Which in your case looks pretty small
Femur - Measure straight line between center of femur servo horn and tibia servo (disregard curve)
Tibia - center of tibia horn to tip.

Body Dimensions (250 - 280) - probably OK since using Trossen body.

Now some harder parts that take experimenting.
Start Positions feet (281-320) - First part is trying to figure out the distance the feet are from the coxa servo horn in mm, with the body more or less at the ground. With this you can figure out the X and Z values for each of the legs, where for example the middle legs all of the distance is in the X direction. Where as the Front and rear legs are at something like 60 degrees, so you use the sine and cosine of the angle to calculate the X and Z for each of the legs.

The CHexInitY value is something I always needs to play with. It is the Y distance from the coxa servo to the ground... Again I often need to muck with this with different setups.

Now with some robots (possibly yours), the ideal position of the legs may depend on how high up the body is. I allow you change the height using the commander. For example when the body gets up higher you may wish for the legs to be closer in to the body.

That is what the

#define CNT_HEX_INITS 2
#define MAX_BODY_Y 150
#ifdef DEFINE_HEX_GLOBALS
const byte g_abHexIntXZ[] PROGMEM = {cHexInitXZ, 144};
const byte g_abHexMaxBodyY[] PROGMEM = { 20, MAX_BODY_Y};
Settings are for. You can define how many y positions you wish to adjust for. The above is setup that if the Y body position is below 20, you should use the 150 distance and if above that use 144...
---------------
Servo Offsets (37-38) - If your leg pieces are not straight, example your Femur, this is the angle adjustment you need such that when the code sets the servo to logically 0 (in femur case horizontal), how many 10ths of a degrees do we need to add or subtract make it horizontal.

Servo Inversion (39-45) plus defaults in Phoenix_Code.h - Hard to explain, but the main code assumes that moving each of the servos in a logical direction will do the same for all of the legs. For example moving a coxa in a positive direction will move it forward (may be back, I forget ;) ) But with our hexapods, if for example you move all of the coxa servos clockwise, the legs on one side would go forward and on the other side backward. To get around this, there is a table in _Phoenix_Code.h that says for some servos, when you logically going to go clockwise these should go counter clockwise. Such that in the coxa case maybe all legs go forward....

Also with most of our robots, we build our left legs and right legs differently. Example if you look PhantomX, you will see that if you are looking from the front, all of the servos have their horns toward the front and connector toward the back. This again influences direction you need the servo to turn to go the desired direction. Again it may take a few attempts to get this correct.

There may be more, but hopefully this can get you started.