Xan's Phoenix Code

Warning: (LINE 570) : [Token 3.141592] : Converting FLOAT to INTEGER

Error: (LINE 570) : [TOKEN )] : Unexpected token after LET command

iv played about with this section but errors all over. :cry:

You want to rotate the body in the direction of travel? And it uses a servo? I guess Iā€™m not following that.

Can you do ā€œcastsā€ in BASIC to allow the assignments like you can in C?

Alan KM6VV

no. i can see were the confusion lyes.

the code i am trying to write is as follows:

using the phoenix code i wish to impliment a ā€œcameraā€ panning servo to the top of the body. and a want the servo to turn to face the direction of travel.

xan mentioned ā€œbodyā€ as i wish to add a secondy ses structure on to of this servo.
and not a camera etc.

OK, thatā€™s a little easier to understand. A panning servo that tracks the trajectory of the 'bot shouldnā€™t be hard to realize in code.

Iā€™ve just installed a tilt/pan camera mount on a 'bot Iā€™m preparing for field use. It wonā€™t be tracking, however.

Alan KM6VV

initially waht i am after is a panning code that turns the servo in the direction of travel.

here is previous code that worked for me on Atom28 (not pro)

[code]'Turning in circle to track movement
If headPin >= (0.8 * headPin_MAX) Then

        TravelRotationY = TravelLength / 2 ;Right
    ElseIf headPinY <= (0.8 * headPin_MIN) Then
        
        TravelRotationY = -TravelRotationY / 2 ;Left
    Else
        TravelRotationY = 0 ;Center
    End If[/code]

or

[code]
;Head
Head_PulseMin con 600 ;(panning servo) <180ƃā€šĆ‚Ā°>
Head_PulseMax con 2400
;The panning servo will point in the direction of the robots heading

Head_Pulse var word

; 180ƃā€šĆ‚Ā° Head Code
	Head_Pulse =  (((Head_PulseMax - Head_PulseMin) * ((DAngle + 64 ) & $7F) |
		/ 127 + Head_PulseMin) max Head_PulseMax) min Head_PulseMin[/code]

looking to get this to work in pro!

Hi,

thank you for the explanation. much easier to understand.

i did try adding the extra ā€œ(ā€ but i didnt work before.

i found out why it didnt work and i must take the blame.

i had forgotten to take out a previous line of code from and old test, so it conflicted with the current one.

thanks for helping out and pointing me in the right direction. :wink:

hi Xan.

just been thinking.
in your code you have commented out sections of the code:

[code]inā€¦[MAIN]
;GOSUB ReadButtons ;I/O used by the PS2 remote
;GOSUB WriteLeds ;I/O used by the PS2 remote

inā€¦[PS2Input]
ELSE ;Walk
'BodyPosX = 0
'BodyPosZ = 0

'BodyRotX = 0
'BodyRotY = 0
'BodyRotZ = 0

inā€¦[BalCalcOneLeg]
'serout S_OUT, i9600, ā€œBalOneLeg PosX=ā€, sdec PosX," PosZ=", sdec PosZ," TotalXTransZ=", sdec TotalTransZ, 13] [/code]

these parts have been commented out, but why? old reminders or just mess?

obviously it makes no difference to the ā€œgreatā€ performance of the code, but i was just wondering?

what would happen if these section were opened up into the code? (uncommented)

Hi innerbreed,

I think itā€™s a bit of bothā€¦

in....[MAIN] ;GOSUB ReadButtons ;I/O used by the PS2 remote ;GOSUB WriteLeds ;I/O used by the PS2 remote
I used my code with all kinds of remotes. Sometimes it can come in handy to test some small functions without the need of a controller. The PS2 can only be connected the same pins as the buttons/leds on the BB2 so canā€™t use them both at the same time. I rewired them to other pins some time ago but those pins are used by the FSRā€™s at the moment.

Conclustion: It can be removed but it can also be used for some testing. Same thing for the subs.

[code]inā€¦[PS2Input]
ELSE ;Walk
'BodyPosX = 0
'BodyPosZ = 0

'BodyRotX = 0
'BodyRotY = 0
'BodyRotZ = 0[/code]
At first I thought it would be handy if the body returns to the ā€œhomeā€ position while walking. This offcourse is optimal for the gait. But itā€™s also funny to see it walk with a rotated or translated body. Now itā€™s up to the one whoā€™s holding the controller. Making a easy to understand user interface is always though. (Not only talking about controllers but also about pcā€™s, GUIā€™s) So sometimes I let friends control my bots to see if the controls are logic for them or only for me :wink:

Conclusion: I think most users can handle the ā€œcomplexā€ controls so there is no need for locking back to the home position before walking.

in....[BalCalcOneLeg] 'serout S_OUT, i9600, "BalOneLeg PosX=", sdec PosX," PosZ=", sdec PosZ," TotalXTransZ=", sdec TotalTransZ, 13]
Old debug stuffā€¦

Conclusion: Remove!

I think this should clarify it :wink:

Happy to hear youā€™re really digging in to this!

Xan

i thought this might be the case. nice idea too. i may use the ā€œIdeaā€ if/when i change to RC control.

Yeah this was the case in ABB hexapod code. i remember the proā€™s and conā€™s of this. this might work better for me, on my quad project, as it would keep the COG in check! :wink:

Removed!

thanks again for the details on this. a real help. :wink:

i would really like to start programming my own codes from scratch and i have found that you have structured it reall well and i understanding and find your way around it 'is fairly easy.

if iv not said itā€¦ ā€œgreat workā€. :wink:

I totally agree. the COG is much more important for a quad.

Thanks for the comments :slight_smile:

Xan

With the COG being much more important on a quad, what about adding a head, and maybe a tail to allow the COG to be shifted, like the animals do?

Alan KM6VV

Xans code will counteract this. :wink:
plus there is a ā€œheadā€!
just so we dont hijack this thread, further information on the quad can be found here:
lynxmotion.net/phpbb/viewtop ā€¦ &start=180

balance calculations?

Maybe I missed something. Whatā€™s afoot? (pun intended).

I read over the IK for the body, is this it?

I canā€™t keep up. Job gets in the way!

Alan KM6VV

LOL.

the ik yes. still under development. :exclamation:

if you dont mind me askingā€¦ what do you do?

hi xan,

been looking over the code again and i have also found a few more varibles that seem to have no function:

In.. [Body Inverse Kinematics] DistCenterBodyFeet var float ;Total distance between the center of the body and the feet AngleCenterBodyFeetX var float ;Angle between the center of the body and the feet

In.. [Gait] TravelMulti var sbyte ;Multiplier for the length of the step

i have followed up the rest of the code and i cannot find anything that they relate too.
:question:

Just some more left over codeā€¦

You can drop them without a problem. Iā€™ll do the same over here :wink:

Iā€™m using Visual Studio 2008 at work for developing software. Itā€™s got some nice features like intellisence and on the fly pre-compiling. It puts a green or red line under errors or variables that are not used. Looks like Iā€™m a bit spoilt :wink:

Thanks for the feedback!

Xan

ok great.

this is a great feature. iv always wanted something tking like that for the atom IDE.

great well i look forward to seeing some of your work on this.

YEP,

I had suggested that to AcidTech a while ago when I was still in the process of learning the basic code, I admit its a very cool feature to have, and speeds up the learning process.

ā€“Aaron

i have followed the instructions for SSC regesters, and before i connected the botboard i restarted the SSC to see if the legs would ā€œSnap into positionā€ they did. :slight_smile:

i connected the botboard and uploaded the code. When i push (start) to initiate the robot, the legs snap into initial position, but from there nothing else. im lead to believe, from here 'the robot should stand up. it doesnt!?
:confused: