PS2 Code Inverse Kinematics Part

Hi again

I’m am trying to make sense of the IK part of the PS2 generated code for the hexapod. Right now I am having problems figuring out the significance of the MoveDelay variable and its connecton to the Steps and NbSteps variables. I tried shortening down the code to just look at the parts with those variables, but is still can’t quite figure it out. Hope someone can help me shed some light on this :slight_smile:

[code] if Steering or (Height <> LastHeight) or YSpeed or XSpeed or LockLegs then
MovesDelay = 8
endif

if MovesDelay > 0 then

	...........................

	Steps = Steps + 1
	if Steps > NbSteps then
		Steps = 1
		FlipFlap = FlipFlap ^ 1
		NbSteps = GaitSpeed
	endif


	if LockLegs then

	.....................................

		GaitSpeedTmp = StepFlag + 2
	else
		StepFlag = NbSteps - Steps + 1
	endif


	Freeze = Steps < (NbSteps - GaitKind)
	
	.....................................


else
	pause 144
	if MovesDelay < -28 then
		MovesDelay = (NbSteps - GaitKind) - Steps + 1
	EndIf	
endif

MovesDelay = MovesDelay - 1[/code]

Btw, I know I have been posting many questions here lately, but its not easy understanding everything without asking. You guys have been great :smiley:

Anyone that has any insight here?

MovesDelay basically controls the time delay needed to match the move of the servos. Otherwise, you’d be overrunning the last commands sent to the servos (they wouldn’t have reached their new positions).

Does that help?

Alan KM6VV