Ive been trying to get my hexapod walking using the phoenix code.
Ive put my measurements and connented// out any thing not needed like the Tars parts and even did the body IK measurements.
Heres my problem. When i turn the bot and the PS2 controller on and press start, it brings the femurs up and i cant lower them. When i try to lower them using the triangle or dpad ot moves the tibias up and down but not the femurs.
If i use the analog sticks on the ps2 controller to try and move the bot forward, it does try to walk and femurs do move up and down but its so high it cant walk.
Please help me. Ive checked the wiring the servos and even the code but its driving me nuts.
@Paul: I'm surprised that you didn't understand what to do.
Duhjoker expects you to do a search for "phoenix code", download the relevant hit, comment out all the sections not needed, like those for "Tars parts" and upload the result on your copy of the robot for testing. Don't forget to do the "body IK measurements" first!
ok ive been working with robotshop on this and they were the ones that told me this would work and what to do. i dont expect anybody to do the work for me i would just like a lil help figuring out the problem.
heres part of my code i was told use. i have to do it in two parts because the forum wont let me print out more than 9000 characters
//====================================================================
//Project Lynxmotion Phoenix
//Description:
// This is the hardware configuration file for the Hex Robot.
//
// This version of the Configuration file is set up to run on the
// Lynxmotion BotboardDuino board, which is similiar to the Arduino Duemilanove
//
// This version of configuration file assumes that the servos will be controlled
// by a Lynxmotion Servo controller SSC-32 and the user is using a Lynxmotion
// PS2 to control the robot.
//
//Date: March 18, 2012
//Programmer: Kurt (aka KurtE)
//
//NEW IN V1.1 (2013-05-17)
// - Support for Arduino Pro Mini on Bot Board (originally for Basic Atom Pro)
//NEW IN V1.0
// - First Release
//
//====================================================================
//==================================================================================================================================
//==================================================================================================================================
//==================================================================================================================================
//[CONDITIONAL COMPILING] - COMMENT IF NOT WANTED
// Define other optional compnents to be included or not...
//comment if terminal monitor is not required
#define OPT_TERMINAL_MONITOR
//uncomment the board you want to use
#define __BOTBOARDUINO__ //botboarduino board
//#define __BOTBOARD_ARDUINOPROMINI__ //arduino pro mini on botboard (originally for BasicAtomPro)
//====================================================================
#ifdef OPT_TERMINAL_MONITOR // turning off terminal monitor will turn these off as well...
#define OPT_SSC_FORWARDER // only useful if terminal monitor is enabled
#define OPT_FIND_SERVO_OFFSETS // Only useful if terminal monitor is enabled
#endif
#define OPT_GPPLAYER
// Which type of control(s) do you want to compile in
#define DBGSerial Serial
#if defined(UBRR1H)
#define SSCSerial Serial1
#else
#endif
#define USEPS2
//==================================================================================================================================
//==================================================================================================================================
//==================================================================================================================================
// CHR-3
//==================================================================================================================================
#define USE_SSC32
//#define cSSC_BINARYMODE 1 // Define if your SSC-32 card supports binary mode.
//[SERIAL CONNECTIONS]
// Warning I will undefine some components as the non-megas don't have enough memory...
//#undef OPT_FIND_SERVO_OFFSETS
#define cSSC_BAUD 38400 //SSC32 BAUD rate
//--------------------------------------------------------------------
//[Botboarduino Pin Numbers]
#ifdef __BOTBOARDUINO__
#define SOUND_PIN 5 // Botboarduino JR pin number
#define PS2_DAT 8
#define PS2_CMD 7
#define PS2_SEL 6 // On the PS2 receiver this pin may be called ATT (attention)
#define PS2_CLK 9
// If we are using a SSC-32 then:
// If were are running on an Arduino Mega we will use one of the hardware serial port, default to Serial1 above.
// If on Non mega, if the IO pins are set to 0, we will overload the hardware Serial port
// Else we will user SoftwareSerial to talk to the SSC-32
#define cSSC_OUT 12 //Output pin for Botboard - Input of SSC32 (Yellow)
#define cSSC_IN 13 //Input pin for Botboard - Output of SSC32 (Blue)
#endif
#ifdef __BOTBOARD_ARDUINOPROMINI__
#define SOUND_PIN 11 // Bot Board JR pin number (with Arduino Pro Mini plugged)
#define PS2_DAT 14
#define PS2_CMD 15
#define PS2_SEL 16
#define PS2_CLK 17
// If we are using a SSC-32 then:
// If were are running on an Arduino Mega we will use one of the hardware serial port, default to Serial1 above.
// If on Non mega, if the IO pins are set to 0, we will overload the hardware Serial port
// Else we will user SoftwareSerial to talk to the SSC-32
#define cSSC_OUT 10 //Output pin for Botboard - Input of SSC32 (Yellow)
#define cSSC_IN 9 //Input pin for Botboard - Output of SSC32 (Blue)
#endif
//====================================================================
//[SSC PIN NUMBERS]
#define cRRCoxaPin 0 //Rear Right leg Hip Horizontal
#define cRRFemurPin 1 //Rear Right leg Hip Vertical
#define cRRTibiaPin 2 //Rear Right leg Knee
//#define cRRTarsPin 3 // Tar
#define cRMCoxaPin 4 //Middle Right leg Hip Horizontal
#define cRMFemurPin 5 //Middle Right leg Hip Vertical
#define cRMTibiaPin 6 //Middle Right leg Knee
//#define cRMTarsPin 7 // Tar
#define cRFCoxaPin 8 //Front Right leg Hip Horizontal
#define cRFFemurPin 9 //Front Right leg Hip Vertical
#define cRFTibiaPin 10 //Front Right leg Knee
//#define cRFTarsPin 11 // Tar
#define cLRCoxaPin 16 //Rear Left leg Hip Horizontal
#define cLRFemurPin 17 //Rear Left leg Hip Vertical
#define cLRTibiaPin 18 //Rear Left leg Knee
//#define cLRTarsPin 19 // Tar
#define cLMCoxaPin 20 //Middle Left leg Hip Horizontal
#define cLMFemurPin 21 //Middle Left leg Hip Vertical
#define cLMTibiaPin 22 //Middle Left leg Knee
//#define cLMTarsPin 23 // Tar
#define cLFCoxaPin 24 //Front Left leg Hip Horizontal
#define cLFFemurPin 25 //Front Left leg Hip Vertical
#define cLFTibiaPin 26 //Front Left leg Knee
//#define cLFTarsPin 27 // Tar
//--------------------------------------------------------------------
//[MIN/MAX ANGLES]
#define cRRCoxaMin1 -650 //Mechanical limits of the Right Rear Leg
#define cRRCoxaMax1 650
#define cRRFemurMin1 -1050
#define cRRFemurMax1 750
#define cRRTibiaMin1 -530
#define cRRTibiaMax1 900
//#define cRRTarsMin1 -1300 //4DOF ONLY - In theory the kinematics can reach about -160 deg
//#define cRRTarsMax1 500 //4DOF ONLY - The kinematics will never exceed 23 deg though..
#define cRMCoxaMin1 -650 //Mechanical limits of the Right Middle Leg
#define cRMCoxaMax1 650
#define cRMFemurMin1 -1050
#define cRMFemurMax1 750
#define cRMTibiaMin1 -530
#define cRMTibiaMax1 900
//#define cRMTarsMin1 -1300 //4DOF ONLY - In theory the kinematics can reach about -160 deg
//#define cRMTarsMax1 500 //4DOF ONLY - The kinematics will never exceed 23 deg though..
#define cRFCoxaMin1 -650 //Mechanical limits of the Right Front Leg
#define cRFCoxaMax1 650
#define cRFFemurMin1 -1050
#define cRFFemurMax1 750
#define cRFTibiaMin1 -530
#define cRFTibiaMax1 900
//#define cRFTarsMin1 -1300 //4DOF ONLY - In theory the kinematics can reach about -160 deg
//#define cRFTarsMax1 500 //4DOF ONLY - The kinematics will never exceed 23 deg though..
#define cLRCoxaMin1 -650 //Mechanical limits of the Left Rear Leg
#define cLRCoxaMax1 650
#define cLRFemurMin1 -1050
#define cLRFemurMax1 750
#define cLRTibiaMin1 -530
#define cLRTibiaMax1 900
//#define cLRTarsMin1 -1300 //4DOF ONLY - In theory the kinematics can reach about -160 deg
//#define cLRTarsMax1 500 //4DOF ONLY - The kinematics will never exceed 23 deg though..
#define cLMCoxaMin1 -650 //Mechanical limits of the Left Middle Leg
#define cLMCoxaMax1 650
#define cLMFemurMin1 -1050
#define cLMFemurMax1 750
#define cLMTibiaMin1 -530
#define cLMTibiaMax1 900
//#define cLMTarsMin1 -1300 //4DOF ONLY - In theory the kinematics can reach about -160 deg
//#define cLMTarsMax1 500 //4DOF ONLY - The kinematics will never exceed 23 deg though..
#define cLFCoxaMin1 -650 //Mechanical limits of the Left Front Leg
#define cLFCoxaMax1 650
#define cLFFemurMin1 -1050
#define cLFFemurMax1 750
#define cLFTibiaMin1 -530
#define cLFTibiaMax1 900
//#define cLFTarsMin1 -1300 //4DOF ONLY - In theory the kinematics can reach about -160 deg
//#define cLFTarsMax1 500 //4DOF ONLY - The kinematics will never exceed 23 deg though..
//--------------------------------------------------------------------
//[LEG DIMENSIONS]
//Universal dimensions for each leg in mm
#define cXXCoxaLength 12 // This is for CH3-R with Type 3 legs
#define cXXFemurLength 32
#define cXXTibiaLength 50
//#define cXXTarsLength 85 // 4DOF only...
#define cRRCoxaLength cXXCoxaLength //Right Rear leg
#define cRRFemurLength cXXFemurLength
#define cRRTibiaLength cXXTibiaLength
//#define cRRTarsLength cXXTarsLength //4DOF ONLY
#define cRMCoxaLength cXXCoxaLength //Right middle leg
#define cRMFemurLength cXXFemurLength
#define cRMTibiaLength cXXTibiaLength
//#define cRMTarsLength cXXTarsLength //4DOF ONLY
#define cRFCoxaLength cXXCoxaLength //Rigth front leg
#define cRFFemurLength cXXFemurLength
#define cRFTibiaLength cXXTibiaLength
//#define cRFTarsLength cXXTarsLength //4DOF ONLY
#define cLRCoxaLength cXXCoxaLength //Left Rear leg
#define cLRFemurLength cXXFemurLength
#define cLRTibiaLength cXXTibiaLength
//#define cLRTarsLength cXXTarsLength //4DOF ONLY
#define cLMCoxaLength cXXCoxaLength //Left middle leg
#define cLMFemurLength cXXFemurLength
#define cLMTibiaLength cXXTibiaLength
//#define cLMTarsLength cXXTarsLength //4DOF ONLY
#define cLFCoxaLength cXXCoxaLength //Left front leg
#define cLFFemurLength cXXFemurLength
#define cLFTibiaLength cXXTibiaLength
//#define cLFTarsLength cXXTarsLength //4DOF ONLY
//--------------------------------------------------------------------
//[BODY DIMENSIONS]
#define cRRCoxaAngle1 -600 //Default Coxa setup angle, decimals = 1
#define cRMCoxaAngle1 0 //Default Coxa setup angle, decimals = 1
#define cRFCoxaAngle1 600 //Default Coxa setup angle, decimals = 1
#define cLRCoxaAngle1 -600 //Default Coxa setup angle, decimals = 1
#define cLMCoxaAngle1 0 //Default Coxa setup angle, decimals = 1
#define cLFCoxaAngle1 600 //Default Coxa setup angle, decimals = 1
#define cRROffsetX -41 //Distance X from center of the body to the Right Rear coxa
#define cRROffsetZ 51 //Distance Z from center of the body to the Right Rear coxa
#define cRMOffsetX -51 //Distance X from center of the body to the Right Middle coxa
#define cRMOffsetZ 0 //Distance Z from center of the body to the Right Middle coxa
#define cRFOffsetX -41 //Distance X from center of the body to the Right Front coxa
#define cRFOffsetZ -51 //Distance Z from center of the body to the Right Front coxa
#define cLROffsetX 41 //Distance X from center of the body to the Left Rear coxa
#define cLROffsetZ 51 //Distance Z from center of the body to the Left Rear coxa
#define cLMOffsetX 51 //Distance X from center of the body to the Left Middle coxa
#define cLMOffsetZ 0 //Distance Z from center of the body to the Left Middle coxa
#define cLFOffsetX 41 //Distance X from center of the body to the Left Front coxa
#define cLFOffsetZ -51 //Distance Z from center of the body to the Left Front coxa
//--------------------------------------------------------------------
//[START POSITIONS FEET]
#define cHexInitXZ 80
#define CHexInitXZCos60 40 // COS(60) = .5
#define CHexInitXZSin60 69 // sin(60) = .866
#define CHexInitY 80 //30
#define cRRInitPosX CHexInitXZCos60 //Start positions of the Right Rear leg
#define cRRInitPosY CHexInitY
#define cRRInitPosZ CHexInitXZSin60
#define cRMInitPosX cHexInitXZ //Start positions of the Right Middle leg
#define cRMInitPosY CHexInitY
#define cRMInitPosZ 0
#define cRFInitPosX CHexInitXZCos60 //Start positions of the Right Front leg
#define cRFInitPosY CHexInitY
#define cRFInitPosZ -CHexInitXZSin60
#define cLRInitPosX CHexInitXZCos60 //Start positions of the Left Rear leg
#define cLRInitPosY CHexInitY
#define cLRInitPosZ CHexInitXZSin60
#define cLMInitPosX cHexInitXZ //Start positions of the Left Middle leg
#define cLMInitPosY CHexInitY
#define cLMInitPosZ 0
#define cLFInitPosX CHexInitXZCos60 //Start positions of the Left Front leg
#define cLFInitPosY CHexInitY
#define cLFInitPosZ -CHexInitXZSin60
//--------------------------------------------------------------------
//[Tars factors used in formula to calc Tarsus angle relative to the ground]
//#define cTarsConst 720 //4DOF ONLY
//#define cTarsMulti 2 //4DOF ONLY
//#define cTarsFactorA 70 //4DOF ONLY
//#define cTarsFactorB 60 //4DOF ONLY
//#define cTarsFactorC 50 //4DOF ONLY
And here is a video showing that the servos are wired right to the boatd using the code and testing using the servo sequencer utility. Didnt have the space to record more than 1 leg but i assure they are correct
If you need anything else let me know and ill get right in it.
Sorry for going OT here but I wanted to let you know why you don't see me around Let's Make Robots anymore.
The new owners made it pretty clear they didn't want me around anymore.
RobotShop has been pretty thorough with whitewashing what happened but you can kind of get an idea of what happened by reading the comments of this Hackaday article.
I know some of the threads where we discussed IK look pretty one sided after they deleted all my posts (which I did not request).
ok since i had to change the Body X,Z measurements and the leg measurements i think i need to change these measurements too but dont know what or how to measure for them............
Those constants look familiar but I'm not sure that they mean.
I recently modified someone's Propeller hexapod code and I got stuck trying to figure out the same sorts of constants.
My guess is it refers to where the feet are position with respect to the body/coxa pivot. IMO, it doesn't make sense to calculate the IK this way. I think one should just identify the angles the legs are positioned in their neutral state and include this angle in the calculations.
Duhjoker:
Robot shop wants me to try the code unmodified but i dont see it working with out the proper leg IK measurements and body offset measurements.
It should work okay. The feet will likely slide a bit as it walks but as long as your bot has roughly the same proportions as the target bot, it should produce reasonably motion.
Ok uploaded the unmodified code to the botbiarduino then removed it from power and procrastinated for an hour before trying it.
So it walks now!!! After all this time it walks!!! It freaking walks!!!
If you cant tell im exstatic!!!! It is a lil buggy though. After hitting the start button after walking to lock the bot up the legs now come all the down forcing the bot body up.
The walking is kinda sloppy too. I really think that the IK needs to be modified for the size of my bot but at least i can walk it which will keep me happy while i figure out how.
Duane, seriously thank you for all the help you given during this time.
Nice work getting your hex running! That's fantastic!
It's also good to see you using trig functions to figure out the constants.
Duhjoker:
Now how should i take care of the initial Y measurement?!
I think the Y constant is how high your bot should be off the ground. I think it's the height of the middle servo's pivot point. I often use the length of the tibia (the last segment) as the height but I think it's common to use a lower value.
You could scale the "CHexInitY" proportional to the difference between the original constants and the your new constants. It looks like your new constants are aCHexInitY little less than half of the original constants. I think a value of 11 or 12 seems like a reasonable guess for "" if you don't want to base it on the length of the tibia.
Thank you that means alot. No problem, as soon as i work the lil issues out ill make a video.
25 as listed above is a lil low. The several different codes ive looked at use several different measurements. Theres in at 90 and another at another height.
My tibs are at 50mm so i could prolly leave that there at 25mm. Ill experiment with some different numbers and see what works best.
You were definitely right, its totally worth all the time and work.
Ok one more question before i start, the InitXZ measurement, do i turn my XAndZ into a tan number or do i use the length between the coxa servo center and the tibia servo center at its 1500 neutral position?
Duhjoker:
Ok one more question before i start, the InitXZ measurement, do i turn my XAndZ into a tan number or do i use the length between the coxa servo center and the tibia servo center at its 1500 neutral position?
I'm not sure what they are using as the leg's origin. The math is easiest if you use the XZ location of the first servo's pivot and the Y location of the second servo's pivot. I'm still not positive what these numbers represent but I'd guess they're the position of the tip of the foot. If the XZ offset is equal to the length of the coxa and femur and the Y offset is the length of the tibia, then all three servos would be in their 1500 positions. It's unlikely they're using these exact offsets so the two outside servos probably have different positions than 1500. You don't need to worry what these positions are since the IK algorithm should take care of this for you.
It sounds like you're close enough to just try a few values to see what works best.