Xan's Phoenix Code

Xan, I updated your project page with the new code. Send an email if you need any changes made!

lynxmotion.com/images/html/proj102.htm

Beth, Thanks for updating the project page. 8)

Good work Xan,

How much more cpu time is available now that you went to the lookup tables?

ā€“Aaron

canā€™t wait to start playing around with this.

Howdy,

Iā€™m not sure how you take this 2.0 code and incorporate the RC section into it? copy paste?
Iā€™m probably missing something though.

Thanks for the help in advance.

ā€“Aaron

Hi Aaron,

Xan can answer this one better than I can. But he has different source files for different input devices. I am not sure if you are asking how to build the appropriate version 2.0 phoenix code or once you have a project how do you switch input devicesā€¦

First if this is the first time, with using the projects. After you downloaded the zip file that contained all of the files for the project, what you do is to open the project file: Something like: phoenix_v20.prj. This will show up in the workspace, which you can expand to show all of the files in the project. Double click on one will open up that source file. Now when you click on Build or Program, the compiler will basically read all of the files in the project list in the order they are shown and compile it all at once. I hope that makes sense.

If on the other hand you are asking how to convert from one input type build to another. Example you have both the PS2 file and the RC version in the same directory and you are currently building for the PS2. What you can do is go to the project menu and choose the add file to project menu item. You then select the RC file and add it at the end of the project file list. You then go into the workspace part of the screen which shows the project. Make sure the project is fully shown (click on +). Now select the PS2 file in this and then go back up to the project menu and say remove this fileā€¦ Then build the project.

Sorry if this is not very clear
Kurt

I think you should replace it with the ps2 file. You might need to change a setting for this in the config file.

Thanks Kurt,

Iā€™ll have to take a closer look at it then I remember reading about how you could include code from another .bas file into another project. I assumed it was a ā€¦ well something similar to in c ā€¦ which i know 0% about.
I see he took advantage of your assembly code! I am every eager to try this I have studied the other code that zenta sent me for RC that I was tweaking with for the past couple months and got to a point a couple months ago where i could make a change and it would still operate afterwords, this is a whole new ballgame.

I remember someone making a comment about the 1.0 code being very very close to the atomā€™s max cpu usageā€¦ then adding the Pulsinā€™s really caused gait lag not as smooth as ps2 input.

Looks like thatā€™s completely taken care of now!.. cant wait to try it all.

also good work again Xanā€¦ should be fun.

Hi Xan,

Iā€™m currently apply your math changes from V1.3 to V2.0 to my C-port from your code. First Iā€™ve to say: Greate work again and big thanks for releasing the Code.

Iā€™m wondering why youā€™re recalculate GaitInMotion in Gait() and not in GaitSeq() (line 726 of phoenix_v20.bas).
If I understand your code right, there is no change from leg to leg.
And why you donā€™t use GaitInMotion when you set SSCTime (line 427 of phoenix_v20.bas)?

Best regards
Daniel

Hi Aaron,

Kurt covered your question pretty well. The only thing I would like to add is that you have to make sure that the 3 files are placed in the correct order. The compiler builds the project files from top to bottom. The correct file order can be found in the Ć¢ā‚¬ĖœPhoenix_V20.basā€™ file.

There is no need for changing files besides the control file if you want to need to change the input. Thatā€™s the reason why those functions are in separate files now. If you are working with another hex, load a different cfg file. If you want another controller or AI, change the control file. Sounds cool doesnā€™t it 8)

Hi Daniel,

Can you provide me with a copy once youā€™re done? I would love to see the differences. :slight_smile:

Good tracing! I implemented the indexed version right before release, I probably overlooked this. The GaitInMotion calculation can also be done before the loop in the GaitSeq function or even in the main loop. This would prevent it from calculating the same thing 6 times. Good find.

I recall looking at this. There where some changes made to get the SSC in sync with the BAP while walking and turning off. This probably changed during the modifications on this part. Anyway, I donā€™t see why you canā€™t use the GaitInMotion value. Let me know how it worked out.

Itā€™s good to have an extra eye looking over the code from time to time. Your suggestions are more then welcome. Again, great found!

Iā€™ve made some changes in 2.0 already to get the body rotation with a precision of 0.1 degree. This was needed for the balance mode in the TA part which Iā€™m working on. Maybe I put those changes together with the ones you pointed at in a minor update release.

Thanks,

Xan

Sure, I will post a link. Still have to do the SingleLegMode and maybe the GP-Player.
The code can run at every Linux PC with a joystick and a serial port. I run it at a RoBoard.

Does it affect the binary size or the speed if you work in Main and in ServoDriver only with one loop for Leg?
Just work with a var for the sign.

[code];--------------------------------------------------------------------
;[SERVO DRIVER] Updates the positions of the servos

ServoDriver:
sign=-1

for LegIndex = 0 to 5
IF (LegIndex = 3) THEN
sign = 1
ENDIF
serout cSSC_OUT, cSSC_BAUD, ā€œ#ā€,dec cCoxaPin(LegIndex) ,ā€œPā€,dec (sign*CoxaAngle1(LegIndex) +900)1000/1059+650]
serout cSSC_OUT, cSSC_BAUD, ā€œ#ā€,dec cFemurPin(LegIndex),ā€œPā€,dec (sign
FemurAngle1(LegIndex)+900)1000/1059+650]
serout cSSC_OUT, cSSC_BAUD, ā€œ#ā€,dec cTibiaPin(LegIndex),ā€œPā€,dec (sign
TibiaAngle1(LegIndex)+900)*1000/1059+650]
next

;Send
serout cSSC_OUT, cSSC_BAUD, ā€œTā€,dec SSCTime,13]

PrevSSCTime = SSCTime
return
[/code]

Hi Xan,

Could you please post the ā€œbitcodeā€ table for the ps2 remotes?
I have an extra ā€œhomeā€ button that i want to use. I donā€™t know if that code is on there but it would be handy to have anyway for programming unused buttons.

Thanks in advance!

Hi Mano,

There have been many posts on the PS2 and there are lots of good sources on the net for learning about the packet information.

The one I use the most is: curiousinventor.com/guides/ps2#mappings

I think I have it opening up to the button configuration. Note the byte numbers are off as we donā€™t process the PS2 packets in the standard way. But bytes 1,2 in the packet will correspond to 4,5 in the documentā€¦

Kurt

are you using a ssc to drive the servos or do you use the onboard pwm outputs? I would like to try the rb as well some day. So much plansā€¦

Iā€™m not really sure what your asking Hereā€¦

Xan

At the moment Iā€™m using a ssc in fact that currently donā€™t have the time to program the group move function for the rb.

Thatā€™s just what I wanted to know.

Here is the Code Iā€™m currently work on:
Download

LOL

Looking good! Thanks for sharing! Keep us posted with further improvements :slight_smile:

Xan

He Xan,

is it correct that the single leg mpde doesnā€™t keep the leg in the new position when going to the next leg?
Can this be changed?

Hi Mano,

Yes, the function is made that it can only control a single leg at the time. The leg will return to the ground if you switch to another leg. This is done to ensure stability.

It isnā€™t a simple value that can be changed to enable this function. But with some programming it sure can be done. Having the abillity to control more legs is doable. The hard part will be to make it stable with the different leg combinations. Iā€™m not planning on implementing this. But feel free to give it a try. :slight_smile:

Xan

Ok thank you. I will look into it when the time is thereā€¦

One more question though:

with the new 2.0 code i have a problem. When i start my hexapod and it stands in the normal position, it stands skew. so that would be the Z axis (when looking from the front the right side is lower then the left side. I remember that i had this problem before, with the 1.3 code. But it suddenly went away and i never had the problem again. Do you or anyone else know how to solve this?

Does this happen directly after the bot is started or when you switch to body rotation?

Iā€™m asking this because body rotation on X, Y, Z and body position on X, Z are initialized to 0 on startup. They only change if, the program is in body rotation mode, or balance mode is on. If the program is in body rotation mode the body angle is directly feeded by the position of the stick. It can be possible that the PS2 remote gives a small error which causes the body to rotate by default. Iā€™ve seen this happen with some remotes. Sometimes the bot started to walk by itself. thatā€™s why there is a deadzone programmed for the walking part.

The balance mode only changes the angle of the body when a leg is lift from the ground. I donā€™t think this is the problem youā€™re describing.

Xan

It is from the start. So not with or after bodyrotation.
Itā€™s like on side is not calibrated right, except it is.