a few moments in the clip where it utilized a ripple-like gait in what looked to be a figure-8 pattern
this i true. as you say its only for a few moments and as i have had a chance to play the game iv had a go in one, and you can keep it in the gait state for a while.
i have discussed this all in another thread!
lynxmotion.net/phpbb/viewtopic.php?t=3632
i understand the few types of gaits a quad of this type can have but im not a programmer so iv having problems putting this knowledge into a working code!
this is what i have done to the code so far! i know parts are wrong!
PLEASE SEE THREAD ABOVE BEFORE LOOKING AT CODE.
[code];************************************************
;== Basic Atom with SSC-32 and PS2 DualShock ==
;=================S=T=A=L=K=E=R================
;==============================================**
;=QUADruped program written by [email protected] (jonny poole)=
;**************************************************************************
'==========================================================================
’ Quadruped Overview
'--------------------
’ Right Side
’
’ | |
’ | |
’ F / 1 _/ 2 | B
’ R | | A
’ O | ____ | C
’ N _3/ _4| K
’ T | |
’ | |
’
’ Left Side
'====================================================
’ Walk Forward Diagram
'----------------------
’ |
’ |
’ F \ / | /
’ O _ / | / _
’ R / 1 _/ 2 | | / 1 _/ 2 |
’ <-W | | | | |
’ A | ____ | | | ____ |
’ R _3/ _4| | _3/ _4_|
’ D \ / | /
’ \ / | /
’
'====================================================
’ 3DOF Leg Diagram
'----------------------
’
’ [3] 1= Hip Horizontal
’ // \
’ // \ [1] 2= Hip Vertical
’ // \ //
’ // [2] 3= Knee
’ //
’ //
’
’
'====================================================
clear ;wipes current memory
;--------------------------------------------------------------------
;-------------Constants
;DualShock
DAT con P4
CMD con P5
CLK con P7
SEL con P6
DeadZone con 28
PadMode con $79
;Legs
Legs con 4
;Legs Index= ;-------->Array index 0 - Right Rear leg
; ---->Array index 1 - Left Rear leg
; —>Array index 2 - Front Right leg
; -->Array index 3 - Left Front leg
HipH_AngleDef con 64 ;90° (90/360*256)
HipH_AngleMin con 21 ;30°
HipH_AngleMax con 107 ;150°
HipH_PulseMin con 910
HipH_PulseMax con 2090
HipV_AngleDef con 64 ;90° (90/360*256)
HipV_AngleMin con 25 ;35°
HipV_AngleMax con 103 ;145°
HipV_PulseMin con 960
HipV_PulseMax con 2040
Knee_AngleDef con 64 ;90° (90/360*256)
Knee_AngleMin con 36 ;50°
Knee_AngleMax con 107 ;150°
Knee_PulseMin con 1107
Knee_PulseMax con 2090
;Leg Dimensions
HipV_HipH con 38 ;1.5" = 38mm (1.5 * 25.4)
Femur_Length con 57 ;2.5" = 57mm (2.5 * 25.4)
Tibia_Length con 124 ;4.875" = 124mm (4.875 * 25.4)
LegUpShiftMin con 15
LegUpShiftMax con 35
;ACos
data 64,64,63,63,63,62,62,62,61,61,61,60,60,60,59,59,|
59,59,58,58,58,57,57,57,56,56,56,55,55,55,54,54,|
54,53,53,53,52,52,52,51,51,51,50,50,50,49,49,49,|
48,48,48,47,47,46,46,46,45,45,45,44,44,44,43,43,|
42,42,42,41,41,41,40,40,39,39,39,38,38,37,37,37,|
36,36,35,35,35,34,34,33,33,32,32,31,31,31,30,30,|
29,29,28,28,27,27,26,25,25,24,24,23,23,22,21,21,|
20,19,19,18,17,16,15,15,14,13,11,10,09,07,05,00
; Don’t use ByteTable instead, it takes too much memory
RRHH con “0” ;Rear Right leg : Hip Horizontal : pin 00
RRHH2 con “0”
RRHV con “0” ;Rear Right leg : Hip Vertical : pin 01
RRHV2 con “1”
RRK con “0” ;Rear Right leg : Knee : pin 02
RRK2 con “2”
FRHH Con “0” ;Front Right leg : Hip Horizontal : pin 08
FRHH2 Con “8”
FRHV Con “0” ;Front Right leg : Hip Vertical : pin 09
FRHV2 Con “9”
FRK Con “1” ;Front Right leg : Knee : pin 10
FRK2 Con “0”
RLHH Con “1” ;Rear Left leg : Hip Horizontal : pin 16
RLHH2 Con “6”
RLHV Con “1” ;Rear Left leg : Hip Vertical : pin 17
RLHV2 Con “7”
RLK Con “1” ;Rear Left leg : Knee : pin 18
RLK2 Con “8”
FLHH Con “2” ;Front Left leg : Hip Horizontal : pin 24
FLHH2 Con “4”
FLHV Con “2” ;Front Left leg : Hip Vertical : pin 25
FLHV2 Con “5”
FLK Con “2” ;Front Left leg : Knee : pin 26
FLK2 Con “6”
;--------------------------------------------------------------------
;-------------Variables
Index var Byte
Index2 var Byte
DualShock var Byte(7)
DS2Mode var byte
LastButton var Byte(2)
Steps var Byte
Steps2 var byte
FlipFlap var Bit
FlagOff var Bit
MovesDelai var Byte
HeightAdjust var Bit
Height var Sbyte
XCoord var Sbyte
YCoord var Sbyte
ZCoord var Sbyte
WCoord var Sbyte
Rotate var Sbyte(6)
DCoord var Byte
DAngle var Byte
NbSteps var byte
StepFlag var Byte
TmpXPos var Long
TmpYPos var Long
TmpZPos var Long
TmpDistance var Long
TmpSEW var Word
TmpSEWSEW var Long
TmpCos var Long
TmpAngle var Sbyte
XPos var Sword(6)
YPos var Sword(6)
ZPos var Sword(6)
XPos2 var Sword(6)
YPos2 var Sword(6)
ZPos2 var Sword(6)
Distance var Sword
HipH_Angle var Sword
HipV_Angle var Sword
Knee_Angle var Sword
HipH_Pulse var word(4)
HipV_Pulse var word(4)
Knee_Pulse var word(4)
LegUpShift var byte
;--------------------------------------------------------------------
;***************
;*** Program ***
;***************
;-------------Init
;DualShock
pause 500
clear
high CLK
again
low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$43\8,$0\8,$1\8,$0\8] ;CONFIG_MODE_ENTER
high SEL
pause 1
low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$44\8,$00\8,$01\8,$03\8,$00\8,$00\8,$00\8,$00\8] ;SET_MODE_AND_LOCK
high SEL
pause 1
low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$4D\8,$00\8,$00\8,$01\8,$FF\8,$FF\8,$FF\8,$FF\8] ;VIBRATION_ENABLE
high SEL
pause 1
low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$4F\8,$00\8,$FF\8,$FF\8,$03\8,$00\8,$00\8,$00\8] ;SET_DS2_NATIVE_MODE
high SEL
pause 1
low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$43\8,$00\8,$00\8,$5A\8,$5A\8,$5A\8,$5A\8,$5A\8] ;CONFIG_MODE_EXIT_DS2_NATIVE
high SEL
pause 1
low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$43\8,$00\8,$00\8,$00\8,$00\8,$00\8,$00\8,$00\8] ;CONFIG_MODE_EXIT
high SEL
pause 1
low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8]
shiftin DAT,CLK,FASTLSBPOST,[DS2Mode\8]
high SEL
pause 1
;serout S_OUT,i57600,"PadMode : ", HEX2 DualShock(0), 13]
Sound 9,[100\4435]
if DS2Mode <> PadMode then again
LastButton(0) = 255
LastButton(1) = 255
NbSteps = 4
StepFlag = NbSteps - 1
pause 500
;-------------Init SSC-32 with pulse offsets
serout p15,i38400,"#",RRHH,RRHH2,“po00 #”,RRHV,RRHV2,“po00 #”,RRK,RRK2,“po-90 #”, |
FRHH,FRHH2,“po60 #”,FRHV,FRHV2,“po00 #”,FRK,FRK2,“po90 #”, |;*
RLHH,RLHH2,“po60 #”,RLHV,RLHV2,“po00 #”,RLK,RLK2,“po90 #”, |
FLHH,FLHH2,“po00 #”,FLHV,FLHV2,“po-60 #”,FLK,FLK2,“po-60”,13]
;SSC-32 -> H3 engine
gosub All1500
LegUpShift = (LegUpShiftMin + LegUpShiftMax) / 2
;--------------------------------------------------------------------
;-------------Main loop
main
;DS2
gosub Ps2Query
if (DualShock(2).bit4 = 0) and LastButton(1).bit4 then ;Triangle Button test
FlagOff = FlagOff ^ 1
if FlagOff then
Gosub All1500
Nap 3
serout p15,i38400,"#",RRHH,RRHH2,"P0#",RRHV,RRHV2,"P0#",RRK,RRK2,"P0#", |
FRHH,FRHH2,"P0#",FRHV,FRHV2,"P0#",FRK,FRK2,"P0#", |
RLHH,RLHH2,"P0#",RLHV,RLHV2,"P0#",RLK,RLK2,"P0#", |
FLHH,FLHH2,"P0#",FLHV,FLHV2,"P0#",FLK,FLK2,"P0#",13]
else
gosub All1500
endif
endif
if FlagOff then
pause 165
goto OffEnd
endif
;---------------------------------------------------
if (DualShock(2).bit6 = 0) and LastButton(1).bit6 then ;Cross Button test
endif
XCoord = DualShock(5) - 128
if XCoord > DeadZone then
XCoord = XCoord - DeadZone
elseif XCoord < -DeadZone
XCoord = XCoord + DeadZone
else
XCoord = 0
endif
XCoord = XCoord/5
if (DualShock(1).bit1 = 0) and LastButton(0).bit1 then ;L3 Button test
HeightAdjust = HeightAdjust ^ 1
endif
if HeightAdjust then
YCoord = DualShock(6) - 128
if YCoord > DeadZone then
YCoord = YCoord - DeadZone
elseif YCoord < -DeadZone
YCoord = YCoord + DeadZone
else
YCoord = 0
endif
if Height <> 0 AND YCoord =0 then
MovesDelai = 8
endif
Height = YCoord/5
else
Ycoord = 0
endif
ZCoord = DualShock(3) - 128
if ZCoord > DeadZone then
ZCoord = ZCoord - DeadZone
elseif ZCoord < -DeadZone
ZCoord = ZCoord + DeadZone
else
ZCoord = 0
endif
WCoord = DualShock(4) - 128
if WCoord > DeadZone then
WCoord = WCoord - DeadZone
elseif WCoord < -DeadZone
WCoord = WCoord + DeadZone
else
WCoord = 0
endif
if (DualShock(1).bit5 = 0) and LastButton(0).bit5 then ;Right Button test
NbSteps = (NbSteps + 1) max 5
elseif (DualShock(1).bit7 = 0) and LastButton(0).bit7 ;Left Button test
NbSteps = (NbSteps - 1) min 3
else
goto NoSound
endif
Sound 9,[20\(6-NbSteps) * 300]
MovesDelai = 8
StepFlag = NbSteps - 1
NoSound
if DualShock(1).bit4 = 0 then ;Up Button test
LegUpShift = (LegUpShift + 1) max LegUpShiftMax
elseif DualShock(1).bit6 = 0 ;Down Button test
LegUpShift = (LegUpShift - 1) min LegUpShiftMin
else
goto NoSound1
endif
Sound 9,[20(LegUpShift * 8 + 400)]
MovesDelai = 8
NoSound1
;H3
if XCoord or YCoord or ZCoord or WCoord then
MovesDelai = 8
endif
if MovesDelai then
MovesDelai = MovesDelai - 1
DCoord = SQR(WCoord * WCoord + ZCoord * ZCoord)
if WCoord > 0 then
TmpCos = WCoord * 127 / DCoord
else
TmpCos = -((-WCoord) * 127 / DCoord)
endif
gosub ACos
DAngle = TmpAngle
if ZCoord > 0 then
DAngle = 256 - DAngle
endif
for Index = 0 to Legs - 1
XPos2(Index) = -(DCoord * COS(DAngle + (Index * 43 + 21)) / 300) ; 43 => 60 degrees
ZPos2(Index) = -(DCoord * SIN(DAngle + (Index * 43 + 21)) / 300) ; 43 => 60 degrees
XPos(Index) = XPos(Index) - 102
;THESE PARTS ARE WRONG
next
Steps = Steps + 1
if Steps > NbSteps then
Steps = 1
FlipFlap = FlipFlap ^ 1
endif
;-------------------------------------------------------------
Steps2 = Steps
If FlipFlap then
gosub RR_U
if Steps < NbSteps then
NAP 5
else
Steps2 = 1
gosub RR_D
;-----------------------------------------
If FlipFlap then
gosub RR_D
gosub FL_U
NAP 5
else
Steps2 = 1
gosub FL_D
;-----------------------------------------
If FlipFlap then
gosub FL_D
gosub RL_U
NAP 5
else
Steps2 = 1
gosub RL_D
;-----------------------------------------
If FlipFlap then
gosub RL_D
gosub FR_U
NAP 5
else
Steps2 = 1
gosub FR_D
endif
endif
endif
endif
endif
;------------------------------------------------------------------------------------------------
for Index = 0 to Legs - 1
gosub DistAndBA
gosub SetAngle
HipH_Angle = HipH_Angle + Rotate(Index)
HipH_Pulse(Index) = (HipH_PulseMax - HipH_PulseMin) * (HipH_Angle - HipH_AngleMin) |
/ (HipH_AngleMax - HipH_AngleMin) + HipH_PulseMin
if HipH_Pulse(Index) > HipH_PulseMax then
HipH_Pulse(Index) = HipH_PulseMax
elseif HipH_Pulse(Index) < HipH_PulseMin
HipH_Pulse(Index) = HipH_PulseMin
endif
HipV_Pulse(Index) = (HipV_PulseMax - HipV_PulseMin) * (HipV_Angle - HipV_AngleMin) |
/ (HipV_AngleMax - HipV_AngleMin) + HipV_PulseMin
if HipV_Pulse(Index) > HipV_PulseMax then
HipV_Pulse(Index) = HipV_PulseMax
elseif HipV_Pulse(Index) < HipV_PulseMin
HipV_Pulse(Index) = HipV_PulseMin
endif
Knee_Pulse(Index) = (Knee_PulseMax - Knee_PulseMin) * (Knee_Angle - Knee_AngleMin) |
/ (Knee_AngleMax - Knee_AngleMin) + Knee_PulseMin
if Knee_Pulse(Index) > Knee_PulseMax then
Knee_Pulse(Index) = Knee_PulseMax
elseif Knee_Pulse(Index) < Knee_PulseMin
Knee_Pulse(Index) = Knee_PulseMin
endif
Knee_Pulse(Index) = 3000 - Knee_Pulse(Index)
next
gosub LegUpdatePosition
else
pause 150
endif
OffEnd
LastButton(0) = DualShock(1)
LastButton(1) = DualShock(2)
goto main
;--------------------------------------------------------------------
;-------------Sub Update Position
LegUpdatePosition
serout p15,i38400,"#",RRHH,RRHH2,“P”,DEC HipH_Pulse(0),"#",RRHV,RRHV2,“P”,DEC 3000 - HipV_Pulse(0),"#",RRK,RRK2,“P”,DEC Knee_Pulse(0), |
“#”,FRHH,FRHH2,“P”,DEC HipH_Pulse(2),"#",FRHV,FRHV2,“P”,DEC HipV_Pulse(2),"#",FRK,FRK2,“P”,DEC 3000 - Knee_Pulse(2), |
“#”,RLHH,RLHH2,“P”,DEC HipH_Pulse(1),"#",RLHV,RLHV2,“P”,DEC 3000 - HipV_Pulse(1),"#",RLK,RLK2,“P”,DEC Knee_Pulse(1), |
“#”,FLHH,FLHH2,“P”,DEC 3000 - HipH_Pulse(3),"#",FLHV,FLHV2,“P”,DEC HipV_Pulse(3),"#",FLK,FLK2,“P”,DEC 3000 - Knee_Pulse(3), |
“T170”,13]
return
;-------------Sub H3 Init
H3Init
HeightAdjust = 1
HipH_Angle = HipH_AngleDef
HipV_Angle = HipV_AngleDef
Knee_Angle = Knee_AngleDef
TmpDistance = Femur_Length * SIN(HipV_Angle) - Tibia_Length * COS(Knee_Angle - 64 + HipV_Angle) + HipV_HipH * 127
TmpXpos = TmpDistance * SIN(HipH_Angle) / 127
TmpZPos = TmpDistance * COS(HipH_Angle) / 127
TmpYPos = - (Femur_Length * COS(HipV_Angle) + Tibia_Length * SIN(Knee_Angle - 64 + HipV_Angle))
for Index = 0 to Legs - 1
XPos(Index) = TmpXPos / 127
YPos(Index) = TmpYPos / 127
ZPos(Index) = TmpZPos / 127
Distance(Index) = TmpDistance / 127
next
Gosub InitPos
serout p15,i38400,"#",RRHH,RRHH2,"P1500#",RRHV,RRHV2,"P1500#",RRK,RRK2,"P1500#", |
FRHH,FRHH2,"P1500#",FRHV,FRHV2,"P1500#",FRK,FRK2,"P1500#", |
RLHH,RLHH2,"P1500#",RLHV,RLHV2,"P1500#",RLK,RLK2,"P1500#", |
FLHH,FLHH2,"P1500#",FLHV,FLHV2,"P1500#",FLK,FLK2,"P1500T1152",13]
nap 6
Steps = 1
MovesDelai = 7
return
;-------------Sub InitPos
InitPos
serout p15,i38400,"#",RRHV,RRHV2,“P2100#”,RRK,RRK2,“P1800#”, |
FRHV,FRHV2,“P2100#”,FRK,FRK2,“P1800#”,RLHV,RLHV2,“P900#”,RLK,RLK2,“P1200#”, |
FLHV,FLHV2,“P900#”,FLK,FLK2,“P1200T1152”,13]
nap 5
serout p15,i38400,"#",RRHH,RRHH2,“P1500#”,FRHH,FRHH2,“P1500#”, |
RLHH,RLHH2,“P1500#”,FLHH,FLHH2,“P1500T576”,13]
nap 5
return
;-------------Sub All1500
All1500
HeightAdjust = 1
height = 0
serout p15,i38400,"#",RRHH,RRHH2,“P1500#”,RRHV,RRHV2,“P1500#”,RRK,RRK2,“P1500#”, |
FRHH,FRHH2,“P1500#”,FRHV,FRHV2,“P1500#”,FRK,FRK2,“P1500#”, |
RLHH,RLHH2,“P1500#”,RLHV,RLHV2,“P1500#”,RLK,RLK2,“P1500#”, |
FLHH,FLHH2,“P1500#”,FLHV,FLHV2,“P1500#”,FLK,FLK2,“P1500T576”,13]
nap 5
return
;-------------Sub PS2Query
Ps2Query
low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$42\8]
shiftin DAT,CLK,FASTLSBPOST,[DualShock(0)\8, DualShock(1)\8, DualShock(2)\8, DualShock(3)\8, |
DualShock(4)\8, DualShock(5)\8, DualShock(6)\8]
high SEL
pause 1
return
;-------------Sub Leg SetAngle
SetAngle
TmpXPos = XPos(Index) * 127
if ZPos(Index) > 0 then
TmpZPos = ZPos(Index) * 127
else
TmpZPos = -((-ZPos(Index)) * 127) ; **** due to bug in Basic ****
endif
TmpYPos = (-((-YPos(Index)) * 127)) max 0 ; **** due to bug in Basic ****
TmpDistance = ((Distance - HipV_HipH) * 127) min 0
TmpSEWSEW = ((-TmpYPos) * (-TmpYPos) + TmpDistance * TmpDistance) / 16129 ; **** due to bug in Basic ****
TmpSEW = SQR(TmpSEWSEW)
TmpCos = (Femur_Length * Femur_Length + Tibia_Length * Tibia_Length - TmpSEWSEW)
if TmpCos > 0 then
TmpCos = TmpCos * 127 / (2 * Femur_Length * Tibia_Length)
else
TmpCos = -((-TmpCos) * 127 / (2 * Femur_Length * Tibia_Length)) ; **** due to bug in Basic ****
endif
gosub ACos
If TmpAngle > Knee_AngleMax then
Knee_Angle = Knee_AngleMax
elseif TmpAngle < Knee_AngleMin
Knee_Angle = Knee_AngleMin
else
Knee_Angle = TmpAngle
endif
TmpCos = -TmpYPos / TmpSew
gosub ACos
HipV_Angle = TmpAngle
TmpCos = (Femur_Length * Femur_Length - Tibia_Length * Tibia_Length + TmpSEWSEW)
if TmpCos > 0 then
TmpCos = TmpCos * 127 / (2 * Femur_Length * TmpSEW)
else
TmpCos = -((-TmpCos) * 127 / (2 * Femur_Length * TmpSEW)) ; **** due to bug in Basic ****
endif
gosub ACos
if TmpYpos > 0 then
TmpAngle = TmpAngle - HipV_Angle
else
TmpAngle = TmpAngle + HipV_Angle
endif
If TmpAngle > HipV_AngleMax then
HipV_Angle = HipV_AngleMax
elseif TmpAngle < HipV_AngleMin
HipV_Angle = HipV_AngleMin
else
HipV_Angle = TmpAngle
endif
return
;-------------Sub Distance and HipH_Angle with XZ
DistAndBA
if Zpos(Index) > 0 then
Distance = SQR((XPos(Index) * XPos(Index) + ZPos(Index) * ZPos(Index)) / 4) * 2
else
Distance = SQR((XPos(Index) * XPos(Index) + (-ZPos(Index)) * (-ZPos(Index))) / 4) * 2 ; **** due to bug in Basic ****
endif
if ZPos(Index) > 0 then
TmpCos = ZPos(Index) * 127 / Distance
else
TmpCos = -(-ZPos(Index) * 127 / Distance) ; **** due to bug in Basic ****
endif
Gosub ACos
HipH_Angle = TmpAngle
If HipH_Angle > HipH_AngleMax then
HipH_Angle = HipH_AngleMax
elseif HipH_Angle < HipH_AngleMin
HipH_Angle = HipH_AngleMin
else
return
endif
XPos(Index) = TmpXPos / 127
ZPos(Index) = TmpZPos / 127
return
;-------------Sub Arc Cosinus
ACos
if TmpCos < 0 then
read -TmpCos,TmpAngle
TmpAngle = 128 - TmpAngle
else
read TmpCos,TmpAngle
endif
return
;THESE PARTS ARE WRONG
;Index 0=RearRight
;-------------‘RR’ Up
RR_U
for Index = 0 to legs - 0 step 2
YPos(Index) = -Tibia_Length + LegUpShift + Height
XPos(Index) = XPos(Index) + ((-XPos2(Index) - XPos(Index))/StepFlag)*Steps + HipV_HipH + Femur_Length
ZPos(Index) = ZPos(Index) + ((-ZPos2(Index) - ZPos(Index))/StepFlag)*Steps
Rotate(Index) = Rotate(Index) + ((-XCoord - Rotate(Index))/StepFlag)*Steps
next
return
;-------------‘RR’ Down
RR_D
for Index = 0 to legs - 0 step 2
YPos(Index) = -Tibia_Length + Height
XPos(Index) = XPos(Index) + ((XPos2(Index) - XPos(Index))/NbSteps)*Steps2 + HipV_HipH + Femur_Length
ZPos(Index) = ZPos(Index) + ((ZPos2(Index) - ZPos(Index))/NbSteps)*Steps2
Rotate(Index) = Rotate(Index) + ((XCoord - Rotate(Index))/NbSteps)*Steps2
next
return
'==========================================================================
;Index 1=RearLeft
;-------------‘RL’ Up
RL_U
for Index = 1 to legs - 0 step 2
YPos(Index) = -Tibia_Length + LegUpShift + Height
XPos(Index) = XPos(Index) + ((-XPos2(Index) - XPos(Index))/StepFlag)*Steps + HipV_HipH + Femur_Length
ZPos(Index) = ZPos(Index) + ((-ZPos2(Index) - ZPos(Index))/StepFlag)*Steps
Rotate(Index) = Rotate(Index) + ((-XCoord - Rotate(Index))/StepFlag)*Steps
next
return
;-------------‘RL’ Down
RL_D
for Index = 1 to legs - 0 step 2
YPos(Index) = -Tibia_Length + Height
XPos(Index) = XPos(Index) + ((XPos2(Index) - XPos(Index))/NbSteps)*Steps2 + HipV_HipH + Femur_Length
ZPos(Index) = ZPos(Index) + ((ZPos2(Index) - ZPos(Index))/NbSteps)*Steps2
Rotate(Index) = Rotate(Index) + ((XCoord - Rotate(Index))/NbSteps)*Steps2
next
return
'==========================================================================
;Index 2=FrontRight
;-------------‘FR’ Up
FR_U
for Index = 2 to legs - 0 step 2
YPos(Index) = -Tibia_Length + LegUpShift + Height
XPos(Index) = XPos(Index) + ((-XPos2(Index) - XPos(Index))/StepFlag)*Steps + HipV_HipH + Femur_Length
ZPos(Index) = ZPos(Index) + ((-ZPos2(Index) - ZPos(Index))/StepFlag)*Steps
Rotate(Index) = Rotate(Index) + ((-XCoord - Rotate(Index))/StepFlag)*Steps
next
return
;-------------‘FR’ Down
FR_D
for Index = 2 to legs - 0 step 2
YPos(Index) = -Tibia_Length + Height
XPos(Index) = XPos(Index) + ((XPos2(Index) - XPos(Index))/NbSteps)*Steps2 + HipV_HipH + Femur_Length
ZPos(Index) = ZPos(Index) + ((ZPos2(Index) - ZPos(Index))/NbSteps)*Steps2
Rotate(Index) = Rotate(Index) + ((XCoord - Rotate(Index))/NbSteps)*Steps2
next
return
'==========================================================================
;Index 3=FrontLeft
;-------------‘FL’ Up
FL_U
for Index = 3 to legs - 0 step 2
YPos(Index) = -Tibia_Length + LegUpShift + Height
XPos(Index) = XPos(Index) + ((-XPos2(Index) - XPos(Index))/StepFlag)*Steps + HipV_HipH + Femur_Length
ZPos(Index) = ZPos(Index) + ((-ZPos2(Index) - ZPos(Index))/StepFlag)*Steps
Rotate(Index) = Rotate(Index) + ((-XCoord - Rotate(Index))/StepFlag)*Steps
next
return
;-------------‘FL’ Down
FL_D
for Index = 3 to legs - 0 step 2
YPos(Index) = -Tibia_Length + Height
XPos(Index) = XPos(Index) + ((XPos2(Index) - XPos(Index))/NbSteps)*Steps2 + HipV_HipH + Femur_Length
ZPos(Index) = ZPos(Index) + ((ZPos2(Index) - ZPos(Index))/NbSteps)*Steps2
Rotate(Index) = Rotate(Index) + ((XCoord - Rotate(Index))/NbSteps)*Steps2
next
return
'==========================================================================
;index 0 - Right Rear leg RR
;index 1 - Left Rear leg RL
;index 2 - Front Right leg FR
;index 3 - Front Left leg FL [/code]