Hi,
Iāve done some more work on the Phoenix code based on Kurtās hacked XBee/binary SSC version of Xanās V20 code. I decided to post the code in Kurts DIY Remote Control XBee controller for Robotics thread.
Iāve tried to summarize what changes that have been done by Kurt and me:
;NEW IN V2.1k
; - Added XBee control and fast serial mode (Kurt)
; - Added binary mode for SSC32 (Kurt)
; - Inverted X direction in single leg mode (KĆ„re)
; - Modified sync part between BAP ans SSC while walking (KĆ„re)
; - Removed different gait types (KĆ„re)
; - Added constant (later variable?) for BalanceDiv Factor, other values then 6 can be used.
; - Moved GaitInMotion calc to the GaitSeq sub
You can read all about Kurtās XBee and binary SSC control work in his thread
There was a minor fault in the single leg control when controlling the left side legs. So Iāve just inverted the X-direction. A little snip from the SingelLegControl sub:
ELSEIF (NOT SLHold)
LegPosY(SelectedLeg) = cInitPosY(SelectedLeg)+SLLegY
IF (SelectedLeg>=3 AND SelectedLeg<=5) THEN ;Invert X direction for the left legs
LegPosX(SelectedLeg) = cInitPosX(SelectedLeg)-SLLegX
ELSE
LegPosX(SelectedLeg) = cInitPosX(SelectedLeg)+SLLegX
ENDIF
LegPosZ(SelectedLeg) = cInitPosZ(SelectedLeg)+SLLegZ
ENDIF
I recently posted info about the sync part in this thread. Since the newest code are so fast I seriously didnāt see the point in having so many different type of gait. The gaits using the HalfLiftHeigth = 1 does the best performance, IMHO. I modified the wave gait to a 24 step gait. These are the gait Iāve choosed to use:
[code]GaitSelect
;Gait selector
;Removed some gait types, gaits using HalfLiftHeigth = 1 gives the best result
IF (GaitType = 0) THEN ;Ripple Gait 12 steps
GaitLegNr(cLR) = 1
GaitLegNr(cRF) = 3
GaitLegNr(cLM) = 5
GaitLegNr(cRR) = 7
GaitLegNr(cLF) = 9
GaitLegNr(cRM) = 11
NrLiftedPos = 3
HalfLiftHeigth = 1
TLDivFactor = 8
StepsInGait = 12
NomGaitSpeed = 70
ENDIF
IF (GaitType = 1) THEN ;Tripod 8 steps
GaitLegNr(cLR) = 5
GaitLegNr(cRF) = 1
GaitLegNr(cLM) = 1
GaitLegNr(cRR) = 1
GaitLegNr(cLF) = 5
GaitLegNr(cRM) = 5
NrLiftedPos = 3
HalfLiftHeigth = 1
TLDivFactor = 4
StepsInGait = 8
NomGaitSpeed = 70
ENDIF
IF (GaitType = 2) THEN ;Wave 24 steps
GaitLegNr(cLR) = 1
GaitLegNr(cRF) = 21
GaitLegNr(cLM) = 5
GaitLegNr(cRR) = 13
GaitLegNr(cLF) = 9
GaitLegNr(cRM) = 17
NrLiftedPos = 3
HalfLiftHeigth = 1
TLDivFactor = 20
StepsInGait = 24
NomGaitSpeed = 70
ENDIF
return[/code]
Currently Iāve also been experimenting with different values for the BalanceDivFactor:
BalanceDivFactor con 5 ;Other values than 6 can be used, testing...CAUTION!! At your own risk ;)
[code];--------------------------------------------------------------------
;[BalanceBody]
BalanceBody:
TotalTransZ = TotalTransZ/BalanceDivFactor
TotalTransX = TotalTransX/BalanceDivFactor
TotalTransY = TotalTransY/BalanceDivFactor
if TotalYbal1 > 0 then 'Rotate balance circle by +/- 180 deg
TotalYbal1 = TotalYbal1 - 1800
else
TotalYbal1 = TotalYbal1 + 1800
endif
if TotalZbal1 < -1800 then 'Compensate for extreme balance positions that causes owerflow
TotalZbal1 = TotalZbal1 + 3600
endif
if TotalXbal1 < -1800 then 'Compensate for extreme balance positions that causes owerflow
TotalXbal1 = TotalXbal1 + 3600
endif
;Balance rotation
TotalYBal1 = -TotalYbal1/BalanceDivFactor
TotalXBal1 = -TotalXbal1/BalanceDivFactor
TotalZBal1 = TotalZbal1/BalanceDivFactor
return[/code]
It is possible to use other values than 6 (which make the correct mathematical balance). Using a lower value like 3 the balance mode gets much more visible and āaliveā but can also give some unpredicted result under extreme poses (especial under single leg control). Iāll probably try this out some more later. I just wanted to mention it if someone was wonderingā¦
I canāt remember who mentioned this first, but I moved the GaitInMotion calc from the Gait to the GaitSeq sub.
Ok thats it for now.
All credits to Xan for his great work on the V20 code! (Its always fun to play with your code )