Xan's Phoenix Code

Innerbreed,

I’m not sure if this helps you or not, but you don’t really need the initialize legs at all 1500 at start, you can de click this, or when you turn your robot on it will be tall then 2 seconds later it will fall to the ground.

You really don’t need that option, although It’s good to check to see if all your legs are aligned properly.

–Aaron

hope this helps slightly :slight_smile:

Hi Innerbreed,

I’m a bit confused with you’re story. Are you talking about the SSC registers for the initial pulse offset or for the initial pulse length?

The only thing you need to do is set the registers for the pulse offsets and make sure the option is enabled in the enable register (R0). Don’t forget to check bit 15 which enables all functions. (The table in manual talks about bit 12 but it should be 15.) Don’t use the SSC initial pulse lengths.

After hitting the start button the legs should snap in to the init position. Check the vid at 0.03
Phoenix getting up is just me hitting the triangle button :wink:
It’s also possible to use the d-pad up/down buttons to adjust the body-ground clearance.

Let me know if it helped.

Xan

all makes sence now. thanks again.

i feel more questions will follow… i will try and make them less stupid. :wink:

Hi Innerbreed,

I made a quick test-setup started debugging this Saturday. I had the servo following the direction when my girlfriend pulled me away from my PC. :wink: I think I can get the servo to move on rotation as well tomorrow. Then you’ll have a ready to rock sub.

Stay tuned :wink:

Xan

this is great. thanks. im guessing it only needs tweeking a little. the main part is there.

again thanks. cannot credit you anymore for your help. :wink:

It’s mostly about placing the brackets in the right place :wink:

as im not a programmer at heart (having only really modified codes) i have noticed the importance of these breakets. what do they reall do/mean?
and what changes when adding another? ))

The brackets are simply used to define the order of operations. In this case it’s not only for adding and multiplying but also for converting to floats and backwards.

I also had to made some small changes to the calculation to get the servo in the middle position (0 deg). But as I said, this was just a simple scratch. I didn’t even tried to compile it. :wink:

Xan

Hi Innerbreed,

Here is the code to make the body servo move in the walking direction. You will see that the middle position is a bit bumpy. This is caused by a error in the FACOS function. The error is somewhere in the compiler and is out of my hands. Jim and Nathan are both aware of this error. I’m using cos tables in V2.0 so it doesn’t have the same problems which makes the whole setup much more stable. I’ll hope to release it soon. There still are some balance problems to solve. Anyway, here is the code:

[code]BodyDirection:

;Return to the middle position
BodyAngle=0

;IF ((ABS(TravelLengthX)>TravelDeadZone | ABS(TravelLengthZ)>TravelDeadZone) & TravelLengthZ<TravelDeadZone) | ABS(TravelRotationY*10)>TravelDeadZone THEN
IF ABS(TravelLengthX)>TravelDeadZone | ABS(TravelLengthZ)>TravelDeadZone THEN

;Calculate walking direction X and Z 
TravelLengthXZ = SQR((TravelLengthX * TravelLengthX) + TravelLengthZ * TravelLengthZ)
BodyAngle = TOINT(FACOS(TOFLOAT(TravelLengthZ) / TOFLOAT(TravelLengthXZ)) * 180.0 / 3.141592)-180

;Add sign depending on the direction of X 
BodyAngle = BodyAngle * (TravelLengthX/ABS(TravelLengthX)) 

ENDIF

;Calculate body angle depending on rotation
IF ABS(TravelRotationY2)>TravelDeadZone & ABS(TravelRotationY3) > ABS(BodyAngle) THEN
BodyAngle = -TravelRotationY3 ; Rotation max = 166 to get max range of 90 deg.
ENDIF

RETURN[/code]
I only included the bodydirection sub. I guess you’ll figure the rest out :wink:

Enjoy!

Xan

Worked like a charm. :wink:
yeah mid pos is a bit twitchy but only by about -/+ 5º off =0

look forward to seeing V2.0.

thanks for the support Jeroen. :wink:

Glad it works :wink:

hi oh Yes

I’m excited about the new version

look forward to seeing V2.0.

i hope i understand this code, too :smiley:

We’re on it! :blush:

Sorry 'bout that! It’s fixed now.

Hey xan,

were you still thinking about doing the byte lookup table for the sin/cos/tan functions in the original phoenix code?

–Aaron

Thanks for solving!

Not only thinking, v2.0 is already working with byte tables. :wink:
There still is some little work to do in the balance system before release.

Xan

SWEETSASSYMOLASSY!

I hope it will be pretty painless trying to implement this in the code Zenta modified for RC control, doing the 7 Pulsin’s really causes the phoenix to become pre occupied with reading those channels and you can see the gait lagging.

It’s too bad the atom pro isn’t 2x as fast… cause you can always fix slow code with throwing in a faster cpu “cough Microsoft cough”

cool cool, looking forward to taking a look at that code.

–Aaron

is there a small command that i can use to get the servos to pulse at “1500”
in your code, as you code relys on angles not pulse’s.

i wish to use a dualshock to pull up sub.
would the sub be:

ALL1500 for Index = 0 to 31 serout SSC_OUTPUT,SSC_BAUD,"#",DEC Index,"P1500#"] next serout SSC_OUTPUT,SSC_BAUD,"T200",13] return

please note i have changed SSC_OUTPUT & SSC_BAUD intentionally.

Yeah that looks right, give it a try,

That part of the code looked familiar to the “FREESERVOS” subroutine

–Aaron