Xan's Phoenix Code

great thanks, i thouht it could be changed in servodriver. same as some of the old coding, using servo-update. just changing “+ / -“.

i know what you mean about wanting things as close to the output as possible, just what i was looking for.

thanks.

any news as to when the tutorial will be available
i just want to find out if i can make xans code work with a ssc32, atom pro,
in a micromagic msr-h01 chasis before i order all the parts i need to build
one
thanks

I can’t think of any reasons why it wouldn’t work.

Badger, Yeah it will work, you have to modify some values of the code which is pretty easy, i could help you with that.

Just assemble the kit and put the wires in the same positions plugged into the SSC32.

Note any change in orientation of the servo if there is any.

You have to change lengths of all the 3 joints and possibly change the max and min if they collide… I’m not sure how similar the dimensions of the legs are in comparison to the phoenix kit…

Why not just buy the phoenix kit? The build quality is good! I found that there was a modification or 2 necessary to do for my setup and the larger battery pack I had put in.

–Aaron

Hi,

Just another conformation. There will no problem running the code on another hexapod. It’s setup so it would be easy to change the mechanical dimensions and get it to work.

You will need to change some constants for the dimensions for the legs and body.

Just post you’re questions when you’re ready.

Xan

thanks guys will give you a shout when i have all the parts delivered and put together
just one question when setting up leg size where are the measurements taken from
,the servo center to tip of foot and servo center to servo center
ect,ect , iam a little confused about that bit ?
thanks
chris green

You’ve got it totally right though :wink:

hi please excuse this stupid question i am new to all this
i read through the code for the body setup
my question is for the z measurement is that taken from a center point
between the middle legs to eg, fr coxa at an angle, or is it the distance from the center point to the center point between the front legs ?
thanks

Z is measured from the front(-) to the rear(+). X if from right(-) to left(+).
The absolute zero position for both X and Z is in the centre of the body. That’s why the middle legs got a Z offset from 0.

The length is measured between the center of the body to the center of the coxa.

Hope this helps!

Xan

this may also answer a few questions:

Foot positions:

Are last and the most difficult numbers to deal with. Essentialy, these foot position are the starting point in space (X,Y,Z) for each of the robots feet. As before, when looking at your robot from above with the robot’s head facing you…the Z-axis is front to back and the x-axis is side to side. The robot’s right front leg is (-,-) on the axis and it’s rear left leg is (+,+). Additionally, the Y-axis is the verticle axis down toward the ground is + and up toward the sky is -. Determining the innitial foot positions is not an easy task but basically they should be the point in space where your robot is curled up in “sleeping positionâ€

Is there some reason the Z axis is front to back? I see this in the code generated by PowerPod as well. I’m accustomed (CNC, elsewhere) to seeing Z as the VERTICAL axis.

Alan KM6VV

You are not alone :smiley:
Apparently, the global axis has been define in such manner.
Z = x (front(+)-back(-))
Y = z (top(+)-down(-))
X = y (right(+)-left(-))

I believe there aren’t any special reason, except that this is also an alternative global axis definition is some other application. I still prefer the Z=vertical axis though.

I’m still using this coordinate set in my C code adaptation of the PowerPod code. the bot’s walking, but I do intend to get my coordinates straightened out.

Do you know where/what that application is? I’m curious.

Did I hear a tutorial for the IK was being prepared? I’d certainly be interested in that. Any news?

Alan KM6VV

Few engineering software. One of my friend has encounter it before, can’t recall which software though.

I remember there was a thread discussion on IK guideline, not sure if it is still active or not :unamused: Now that you mention, perhaps we can check later.

You can get the fundamental from most advance dynamic/robotic books, the IK is usually the first few chapter. Wikipedia has a simpler version if I remember correctly.

If you follow the book, the process to derive the IK equation is extremely long. Advance robotic approach use those lengthy equation because it provide them a better ground to study velocity, dynamic, inertia, stiffness, error etc.

But for our application, we just use simple trigonometry function, since we only need the position. Xan code is an example of that.

It really doesn’t matter, as long as one knows about it.

I’ve studied the Powerpod generated code. I learned enough about the process to add the IK to my own “mini RTOS” robot control program written in C. But I think we need more then that if we move past 3DOF legs (and arms!). I think matrix calcs could be used to advantage. I picked up a mechanical engineering book on robotics. I’m going to need to add a little more math…

The trig works. Add a little cosine law, and the 'bot moves! I just discovered Xan’s code, I’ll have to give it a study.

EDIT:
I just found this paper, really complete on bio-inspired locomotion (GAITS!)

ece.ut.ac.ir/Classpages/S87/ECE642/lectures/04-bioinspired-locomotion.pdf

Alan KM6VV

Thanks for the tip of this very good wide covering document. I see they do copied alot from the famous “Oricom” document :wink: . Very good illustrations of different robots too, ex. snake robots.

Hi,

And if you go to the top of the URL, you’ll find that this one was just one of about eight papers.

ece.ut.ac.ir/Classpages/S87/ECE642/

I checked again last night, and Oricom is back on line! Great Gait info. I’ve been re-reading the Quad section.

www14.addr.com/~oricom/projects/legs.htm

Alan KM6VV

hi xan. i remember talking to you about getting a servo to point in the direction of the Jstick to work with your code.
i cannot remember what the outcome was but…

had a problem compiling the code i wrote for the upper body rotation:
The errors highlighted this section…

BodyPin=  (((BodyPin_Max - BodyPin_Min) * ((TravelLengthZ + 64 ) & $7F) |
		/ 127 + BodyPin_Max) min BodyPin_Min) max BodyPin_Max

i had also added the following. Missing something?

BodyPin        con P19  ;Body rotation

BodyPin_Min con 600	;correct?	
BodyPin_Max con 2400           ;correct?

BodyPin_Pulse var word

and of course the servodriver.

  ;Body Rotate 
  serout SSC_OUTPUT,SSC_BAUD,"#",dec BodyPin,"P",dec TOINT(TOFLOAT(BodyAngle +90)/0.10588238)+650] 

thanks again.

Hi Innerbreed,

Yeah, I remember something to :wink:

If I’m correct you wanted the body to rotate in the direction you’re walking right?

You need to calculate the walking direction between forward/backward(Z) and left/right(X). I used ARCCOS to calculate the angle since this will be easier to use with fixed point later on. :wink:

I also added the rotation so the body servo will rotate to the correct direction while turning. Like he’s looking over his shoulder :wink:

The function is written in word so you need to check/debug it. I may not even compile without a error.

Here is the complete list of what you need to add:

@ [PIN NUMBERS] BodyPin con P19 ;Body rotation

@ [MIN/MAX ANGLES] Body_MIN con -90 Body_MAX con 90I prefer to think in angles…
0 is the middle position

@ [ANGLES] BodyAngle var sword

@ [MAIN] … GOSUB BodyDirection … GOSUB CheckAngles … Place before the CheckAngles function
New Function:[code]
BodyDirection:
IF (ABS(TravelLengthX)>TravelDeadZone | ABS(TravelLengthZ)>TravelDeadZone | ABS(TravelRotationY*2)>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)

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

;Calculate body angle depending on rotation
BodyAngle = BodyAngle + TravelRotationY*10/14 ; Rotation max = 127*1.4 to get max range of 90 deg.

ELSE ;Return to the middle position
BodyAngle = 0
ENDIF
RETURN[/code]

@ [CHECK ANGLES] BodyAngle = (BodyAngle min Body_MIN) max Body_MAX

[code]@ [SERVO DRIVER]
…
Serout SSC_OUT, SSC_BAUTE,“#â€

this is great. i wasnt far off, i think.

at this point i have only compiled it. not ran it yet.
you had missed out:

TravelLengthXZ 	var sword

thanks again xan.