Xan's Phoenix Code

Playing a bit more with a few of these controllers, I think they are just sloppy. That is I move it and release it and it does not come back to the same area. Some other ones I have seen (a madcatz) for example was way off. I am still playing with the init code to see if I can understand more of what some of the messages that a PS2 controller sends to the controllers. Maybe there is a way to have it set its own zero point…

Kurt

About the AH3-R, I think I need to replace the Servo battery as it is old and doesn’t seem to hold a charge long anymore.

Also ZoomKat reminded me of something. I changed out the short ‘C’ tibia brackets for the long ‘C’ brackets. I think I have now overpowered the HS-475HBs. I’ll order a set of 645MG after the new year.

I can verify those findings. Some controllers return 128 reliably, and some do not. Surprisingly the original Sony brand ones are the worst offenders. I know the Lynxmotion ones return 128 pretty reliably. I’ve bought many madcatz ones ofer the years. Some were bad but most worked well.

That make perfect sense. It was an older Sony wired PS2 controller I was testing things with.

That replacement wireless PS2 is showing up today!

Thanks Jim!

Hello,

I wanted to ask how far times with the terrain adaption?
are you doing with the sensors on the feet?
so it only stands if he has ground contact?
or how did you get it to be?

greez t4ndu

Great timing t4ndu,

I just (about 2 min ago) placed a new topic about terrain adaption. :slight_smile:
I’ll start with just a sensor at the tip of the legs and i’ll might add a acceleration sensor later on…

feel free to participate.

Xan

cool!

which acelerator? 2 axis or 3?

do you use the same sensor like i?

extra foot sensor for the phoenix?

ill come to the new topic :slight_smile:

I’ve got this 2 axis acelerator. I don’t see the need for a 3 axis one.

But as I said: it’s for future plans. I first want 2.0 (fixed point) released and the terrain adaption to work.

Oh, so much plans, so less time…

Xan

Isn’s that the way it always is. I hate it when life gets in the way of things you want to do, like work!

Hi

The Phoenix’s Coxa Angles are established at 60 deg in Xan’s code v1.3. I tried modifying them in the code for 30 deg instead of 60 deg: (the values have been calculated by Zenta’s PEP - abs values only were pasted in this modified code as follows):

'Feet Positions
RFPosX = 91     ;Start positions of the Right Front leg
RFPosY = 25
RFPosZ = -53

instead of 53 and -91 like before, etc …
and

;[BODY DIMENSIONS]
CoxaAngle con 30   ;Default Coxa setup angle

instead of 60 like before
-> The legs moved at an unexpected position: near 0 deg and the RR at 30 deg.

CoxaAngle con 60 ;back at 60 like before - Default Coxa setup angle
-> It seems working so.

How will be the right way for init. coxa angles modification (0 to 90 deg)?

Hi McSpider,

At what offset angle did you calibrate the rear and front coxa?

Hi Zenta

Oops, I didn’t carried out a new calibration yet before these trials :blush:
The front and rear coxas are still offseted at 60 deg… Thanks. I’ll try to perform a new calibration with the right angle values.

By the way, in Xan’s code v1.1 the start positions of the front and rear legs are established so: X=80 and Z =-75
-> it gives an angle of 20 deg for coxas
-> the Default Coxa setup (BODY DIMENSIONS) angle is 60 deg

What’s the influence of the Default Coxa setup parameter?

Thanks

I’ve seen some of the Xan code running the Phoenix and it is amazingly lifelike.

I currently have a: CHR-3/3DOF-C legs (3L/3R)/Atom28/Bot Board II/SSC32/PS-2/with upgraded servos.

Is there a port of the more lifelike code onto this configuration?

I’ve been reading through this thread (19 pages) and just need a good spot to jump-in on.

Longer-term, here’s my game plan:

  1. I’d like to configure the existing hexapod to use the more graceful Phoenix-like code

  2. Then I’d like to reconfigure the hexapod to take serial commands instead of PS2 control.

  3. Then add the ultrasound technology (complete with rotation) so he can see obstacles in all directions.

  4. Finally, I’d like to strap-on a single-board Linux computer that can process the ultrasound data, add some personality to the robot and send serial commands to the Bot Board II which will control its movement.

Does anyone helping me get pointed in the right direction?

Hi bcdebusk,

The Phoenix code is pretty universal. It can be used for almost all 3DOF hexapods. It’s just a matter of configuration :wink:

I have no idea where you at. So I suppose you’ve already build it. Did you calibrate it already? This is very important to get it walk smooth. If you’ve got those sets done you can start with the code.

  1. Check the electrical connections. You can change them in the code or in your hardware

[code] ;[SERIAL CONNECTIONS]
SSC_LM_SETUP con 1 ;Changes the SSC pins corresponding to the setup
;1 = Setup with connector to the front
;0 = Setup with connector to the back

SSC_OUT con P11 ;Output pin for (SSC32 RX) on BotBoard (Yellow)
SSC_IN con P10 ;Input pin for (SSC32 TX) on BotBoard (Blue)
SSC_BAUTE con i38400 ;SSC32 Baute rate
;--------------------------------------------------------------------
;[PS2 Controller]
PS2DAT con P12 ;PS2 Controller DAT (Brown)
PS2CMD con P13 ;PS2 controller CMD (Orange)
PS2SEL con P14 ;PS2 Controller SEL (Blue)
PS2CLK con P15 ;PS2 Controller CLK (White)
PadMode con $79
;--------------------------------------------------------------------
;[PIN NUMBERS]
#IF SSC_LM_SETUP ;Connector to the front
RRCoxaPin con P0 ;Rear Right leg Hip Horizontal
RRFemurPin con P1 ;Rear Right leg Hip Vertical
RRTibiaPin con P2 ;Rear Right leg Knee

RMCoxaPin con P4 ;Middle Right leg Hip Horizontal
RMFemurPin con P5 ;Middle Right leg Hip Vertical
RMTibiaPin con P6 ;Middle Right leg Knee

RFCoxaPin con P8 ;Front Right leg Hip Horizontal
RFFemurPin con P9 ;Front Right leg Hip Vertical
RFTibiaPin con P10 ;Front Right leg Knee

LRCoxaPin con P16 ;Rear Left leg Hip Horizontal
LRFemurPin con P17 ;Rear Left leg Hip Vertical
LRTibiaPin con P18 ;Rear Left leg Knee

LMCoxaPin con P20 ;Middle Left leg Hip Horizontal
LMFemurPin con P21 ;Middle Left leg Hip Vertical
LMTibiaPin con P22 ;Middle Left leg Knee

LFCoxaPin con P24 ;Front Left leg Hip Horizontal
LFFemurPin con P25 ;Front Left leg Hip Vertical
LFTibiaPin con P26 ;Front Left leg Knee

#ELSE ;Connector to the back
RFCoxaPin con P2 ;Front Right leg Hip Horizontal
RFFemurPin con P1 ;Front Right leg Hip Vertical
RFTibiaPin con P0 ;Front Right leg Knee

RMCoxaPin con P6 ;Middle Right leg Hip Horizontal
RMFemurPin con P5 ;Middle Right leg Hip Vertical
RMTibiaPin con P4 ;Middle Right leg Knee

RRCoxaPin con P10 ;Rear Right leg Hip Horizontal
RRFemurPin con P9 ;Rear Right leg Hip Vertical
RRTibiaPin con P8 ;Rear Right leg Knee

LFCoxaPin con P18 ;Front Left leg Hip Horizontal
LFFemurPin con P17 ;Front Left leg Hip Vertical
LFTibiaPin con P16 ;Front Left leg Knee

LMCoxaPin con P22 ;Middle Left leg Hip Horizontal
LMFemurPin con P21 ;Middle Left leg Hip Vertical
LMTibiaPin con P20 ;Middle Left leg Knee

LRCoxaPin con P26 ;Rear Left leg Hip Horizontal
LRFemurPin con P25 ;Rear Left leg Hip Vertical
LRTibiaPin con P24 ;Rear Left leg Knee
#ENDIF[/code]

  1. You need to determan what the mechanical limits for the servos are. These values are in deg. You can leave this part for a later stadium but you have to be extra careful.

[code] ;[MIN/MAX ANGLES]
RRCoxa_MIN con -26 ;Mechanical limits of the Right Rear Leg
RRCoxa_MAX con 74
RRFemur_MIN con -101
RRFemur_MAX con 95
RRTibia_MIN con -106
RRTibia_MAX con 77

RMCoxa_MIN con -53 ;Mechanical limits of the Right Middle Leg
RMCoxa_MAX con 53
RMFemur_MIN con -101
RMFemur_MAX con 95
RMTibia_MIN con -106
RMTibia_MAX con 77

RFCoxa_MIN con -58 ;Mechanical limits of the Right Front Leg
RFCoxa_MAX con 74
RFFemur_MIN con -101
RFFemur_MAX con 95
RFTibia_MIN con -106
RFTibia_MAX con 77

LRCoxa_MIN con -74 ;Mechanical limits of the Left Rear Leg
LRCoxa_MAX con 26
LRFemur_MIN con -95
LRFemur_MAX con 101
LRTibia_MIN con -77
LRTibia_MAX con 106

LMCoxa_MIN con -53 ;Mechanical limits of the Left Middle Leg
LMCoxa_MAX con 53
LMFemur_MIN con -95
LMFemur_MAX con 101
LMTibia_MIN con -77
LMTibia_MAX con 106

LFCoxa_MIN con -74 ;Mechanical limits of the Left Front Leg
LFCoxa_MAX con 58
LFFemur_MIN con -95
LFFemur_MAX con 101
LFTibia_MIN con -77
LFTibia_MAX con 106[/code]

  1. Setup the lengths of your hardware. Leg length, body length and coxa positions. The coxa positions are referred to the middle position of the body. That’s why some are negative.

[code] ;[BODY DIMENSIONS]
CoxaLength con 29 ;Length of the Coxa [mm]
FemurLength con 76 ;Length of the Femur [mm]
TibiaLength con 106 ;Lenght of the Tibia [mm]

CoxaAngle con 60 ;Default Coxa setup angle

RFOffsetX con -43 ;Distance X from center of the body to the Right Front coxa
RFOffsetZ con -82 ;Distance Z from center of the body to the Right Front coxa
RMOffsetX con -63 ;Distance X from center of the body to the Right Middle coxa
RMOffsetZ con 0 ;Distance Z from center of the body to the Right Middle coxa
RROffsetX con -43 ;Distance X from center of the body to the Right Rear coxa
RROffsetZ con 82 ;Distance Z from center of the body to the Right Rear coxa

LFOffsetX con 43 ;Distance X from center of the body to the Left Front coxa
LFOffsetZ con -82 ;Distance Z from center of the body to the Left Front coxa
LMOffsetX con 63 ;Distance X from center of the body to the Left Middle coxa
LMOffsetZ con 0 ;Distance Z from center of the body to the Left Middle coxa
LROffsetX con 43 ;Distance X from center of the body to the Left Rear coxa
LROffsetZ con 82 ;Distance Z from center of the body to the Left Rear coxa[/code]

I could be that you need to change some variables from byte to word since the CHR-3 is larger then the phoenix. Kurt mentioned this and I’ve changed it in my own code but it’s not in 1.3. I’ll find out what variables you need to change and post it here for yah.

Let me know if there are any more questions.

Good luck,

Xan

Xan:

Thanks much!

I spoke to Jim today and ordered a Basic Atom Pro 28. He mentioned that the Basic Atom 28 may be a little too underpowered for your Phoenix code.

Here’s where I am:

  1. I have a walking CH3-R that used the default Bot Board II / Basic Atom 28 / SSC-32 configuration (assembled per directions on this site).

  2. It’s calibrated and currently configured to use a PS-2 controller. He works great.

  3. I see how you guys convert from PS-2 input to Serial input in the main loop of the Atom program. I’m guessing your Phoenix code has a similar way to change over.

  4. I’ve ordered a Basic Atom Pro 28 today and it should be here by the end of the week.

  5. I also ordered a PING ultrasconic sensor and two brackets/servos to let him see (but that’s for later).

Here’s what I’d like to do:

  1. Swap-out my Basic Atom 28 board for the Pro. I’ll keep the Bot Board II in place using the previous configuration.

  2. When I program the Pro, put your Phoenix code on him configured for serial input.

I’ve got a decent single-board Linux computer coming. I’d like to integrate the PING with the BB2 for servo control and wire the input directly to the Linux board. The goal is to add the intelligence to the Linux box and use the Atom Pro 28 for movement and control of the ultrasconic sensor.

So in a long-winded way, I guess I’m just asking for the Phoenix code for the Basic Atom Pro 28 ready to run the default BB II / SSC-32 configuration (found on this website).

Hi Xan,

I am reintegrating my DIY remote code into my Rover and looking over the phoenix code, I think my interrrupt timer code is not right…
That is the function:

BEGINASMSUB HANDLE_TIMERW push.w r1 ; save away register we will use bclr #7,@TSRW:8 ; clear the overflow bit in the Timer status word mov.w @LTIMERWOVERFLOWCNT+1:16,r1 ; We will increment the word that is the highword for a clock timer inc.w #1,r1 mov.w r1, @LTIMERWOVERFLOWCNT+1:16 pop.w r1 ; restore our registers rte ; and return
In this I think the L…CNT+1, should be a +2 as the TCNT is a 16 bit value that we add on to get the current time, which would be 2 bytes in length…

I have not fully verified this yet in my rover code, but you might want to try it out. Sorry about that :blush:

Kurt

Hi bcdebusk,

I totally agree on that! Good thing you got yourself a pro.

Don’t see any problem on that. I’ve started out using a BlueSmirft to connect to the PC and have the PC (Wii remote) control the phoenix. Note: The calculations where always in the BAP and I only used my PC as portal for the Wii remote.

The phoenix code got a separate function that handles the input from the ps2 remote. You can replace that one for a Serial port version.

Sounds as a good idea! I never did a thing with AI so I’ve got no idea how many processor power it needs but you could also try to add another BB2 with BAP to do the AI. This keeps it stand alone. Just a thought :wink:

Hi Kurt,

Np about the timer. Are you planning to verify the timer with your logic analyzer?

Thanks for letting me know, I’ll just wait for you to test it on your rover before I start hacking your timer part :stuck_out_tongue:

Xan

On my rover I will probably get rid of the +1 and simply keep a 32 bit overflow count. to get the current 32 bit timer I would simply do something like:

GetCurrentTime:
  Do
    lCurrentTime.highword = lTimerWoverflowCnt.lowword
    lCurrentTime.lowword =TCNT         ; calculate the timer 
  While ( lCurrentTime.highword <> lTimerWOverflowcnt.lowword)
return lCurrentTIme

I have not compiled this as I simply updated here. Also may convet to assembly as I will need the same for my timer based function Mpulsin which I will use to read all 7 input form diy and hopefully still work while processing interrupts from encoders.

May be awhile before I can test as my RSI or CTD in my hands is acting up…

Kurt

I’ve visited your project page (the blackwidow one) and I see code for the Phoenix Code for the Basic Atom Pro 28 with PS/2 control. Has anyone ported the Phoenix code for the Basic Atom Pro 28 for the CHR-3 round body?

I’d like to snag that code as a starting point.

All you need to do is change the leg and body dims and it will work. We will be creating a tutorial for making Xan’s code work with several different hexpod designs. It’s coming soon.