Phoenix code problems

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.

Cool thank you. Yep im ready. Waiting on batteries to charge!!!

I see now after looking at config file again. Its the length of the coxa + the femur.

Ok well that didnt work at all. So i switched it back.

It tripods great though i see a weak servo that needs to be replaced. Im trying to switch it to ripple but im doing something wrong.

You know there is a comment on the the inity line that says //30. I wonder if thats means the integer needs to be higher than 30.

Duhjoker:
You know there is a comment on the the inity line that says //30. I wonder if thats means the integer needs to be higher than 30.

You don't think 30 was the a value they had previously tried but commented out? This would be my first guess.

Nice sense of humour arduino!!

Ok i was told by Xan that the conversion factor will be different for my hex's servos than the hitec servos he programmed it for.

Hitec HS645MG

Rotational range = 180*
Pulse cycle = 20ms
Pulse width = 900 - 2100

Towerpro MG90

Rotational range = 180*
Pulse cycle = 20ms
Pulse width = 400 - 2400

He said to change the conversion factor in the servo driver function but i dont know which of the program files to look at.

If you click on the "Reply" button, you get a text editor with several buttons at the top. One of these buttons is "Insert a link". Use this to link to the code you're using. I'll need all the library files being used.

No problem!! Thank you gor taking a look at it for me!!!

I looked and cant find a github page for this but this is the link to the software i am supposed to use.

https://codeload.github.com/Lynxmotion/3DOF-4DOF-Hex/legacy.zip/Botboarduinohttps://codeload.github.com/Lynxmotion/3DOF-4DOF-Hex/legacy.zip/Botboarduino

Does anybody know what this means? I found it under hex_globals.h. Could it need changing too?

#define WTIMERTICSPERMSMUL 64 //BAP28 is 16mhz need a multiplyer and divider to make the conversion with /8192

#define WTIMERTICSPERMSMUL 125

#define USRINT_TIMERAV

Ok so when i put it on a pedestal and activate it, when you try to make it walk front legs come all tje way to their forward position. The middle legs seeem to he fine. But all the femurs bring the tibias down further than ground level.

Any body got any guesses to the post above.

Also do think i need to change the acos and sin constants tables in the phoenix_code file?

Does anybody out there know anything about the min/max mechanical limits numbers on the config_h?

Are the numbers degrees in TAU?

All right i was able to find a thread that asked about the min/max angles. They apparently they do need to be changed. The numbers are angles. 1700 would 170*.

Now how do i make these measurements. For example.

Left middle coxa, do i Measure the two angles where they meet the left front and left rear legs in thier full reverse\forward postion.

Left front leg rearmost position. Middle leg anlge only to where it meets the left front.

ok i found a french post on robotshop talking about the min/max angles/mechaical limits, what im reading is what i said above but checkout this bit of code.......

//[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..

ok the numbers are in degrees from neutral position for example crrcoxamin and crrcoxamax are 650 and -650 so 65* forward and 65*reverse.

now take a look at Crrfemurmin and max. they are set at -105* and +75*. My servos cant move 105* from neutral. and if the bot is moving at full stride you can see how this mess with bots logic and cause it to over compensate.

does sound right?

Ok i got on the sequencer and got my handy servo times table out and started looking at some coxa angles.

With my particular bot i got these angles

Front coxas

+20* and -15* // the positive could be more i guess but im actually trying to go inline on the configuration.

Middle coxas

+15* and -15* // any more angle will run into fronts and rears

Rear coxas

+15* and -20*

Now my question is what limit should i put on the femurs and tibias?

If i change the values above do i also need to change the default coxa range to match my new values?

Can it be set at 0*

Ok i think changing the min/max angles helped it a bit. It now turns around in spot better but the walking is still a bit sloppy though it will move forward.

I think since i reduced the anlges so much that i need to lower the default coxa angles. But how much?

Man this thread is starting to get a lil one sided.

Ok so i think i have found a clue into whats going on. On the PS2 controller, the D-pad up is supposed to raise the bot while D-pad down lowers it. But for some reason its reversed.

I think this explains why my femurs go down further than they are supposed to on a downward leg stroke yet barely lift.

Its working in reverse, instead of lifting leg it pushing it down and bringing it back to level.

Yep thats the problem, the polarity of the fumurs are reversed when walking causing the upstroke to down and vice versa

Problem solved!!!!

It was definitely moving all the joints in reverse. Turns out the polarity of my particular servos was reversed from the servos the code is written for.

All i had to do go into the phoenix_driver.h file and and find the leg update parameters and changed the negative values to positive and the positive negative.

Now it works completely. Walks around fine. I need to tweak the mechanical limits degrees a lil but im completely happy.

I was actually starting to think it would never walk.

Thank you Duane for all your help. You were totally right about the wait and hard work. Though i fidnt write my code your help let me fix the prewritten code to my bot.

Here we go with a wave gait