/* Sends commands to the motors based on the current state of the * walking finite state machine */ void sendMotorCommands(void) { float push = CtrlWalk_ankPush; switch (WALK_FSM_MODE_PREV) { case Glide_Out: holdStance_ankOut(); flipUp_ankInn(); hipGlide(); break; case Push_Out: flipDown_ankInn(); pushOff_ankOut(push); hipHold(CtrlWalk_hipHold); break; case Glide_Inn: flipUp_ankOut(); holdStance_ankInn(); hipGlide(); break; case Push_Inn: flipDown_ankOut(); pushOff_ankInn(push); hipHold(CtrlWalk_hipHold); break; case Flight: // In the air, get ready for Glide_Out holdStance_ankOut(); flipUp_ankInn(); disable_hip(); break; } }
/* --9-- The robot holds the outer feet while the inner feet alternate * between flip-up and flip-down to hold. Used to test the basic * wrapper functions on the ankles */ void test_flipUpDownHold_outer(void) { float period = 2.0; float upDownTest; float time = getTime(); upDownTest = SquareWave(time, period, -1.0, 1.0); if (upDownTest > 0.0) { flipUp_ankInn(); } else { flipDown_ankInn(); } disable_hip(); holdStance_ankOut(); }
/* Sends commands to the motors based on the current state of the * walking finite state machine */ void sendMotorCommands(void) { float hipTargetAngle; float push = CtrlWalk_ankPush; switch (WALK_FSM_MODE_PREV) { case Glide_Out: holdStance_ankOut(); flipUp_ankInn(); hipGlide(); break; case Push1_Out: case Push2_Out: flipDown_ankInn(); pushOff_ankOut(push); hipTargetAngle = getTargetHipAngle(STATE_th0, STATE_th1, CtrlWalk_critStepLen); hipHold(hipTargetAngle); break; case Glide_Inn: holdStance_ankInn(); flipUp_ankOut(); hipGlide(); break; case Push1_Inn: case Push2_Inn: flipDown_ankOut(); pushOff_ankInn(push); hipTargetAngle = getTargetHipAngle(STATE_th1, STATE_th0, CtrlWalk_critStepLen); hipHold(hipTargetAngle); break; case Flight: // In the air, get ready for Glide_Out holdStance_ankOut(); flipUp_ankInn(); disable_hip(); break; } }