Skip to content

Commit

Permalink
Adjust leg compensation
Browse files Browse the repository at this point in the history
  • Loading branch information
danic85 committed May 28, 2023
1 parent f10c3bc commit ebbef47
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arduino_sketch/arduino_sketch.ino
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ void animateRandomly()
servoManager.moveServos(PosLookRandom);
// If head looks down, move legs up, and vice versa
float headTiltOffset = ServoEasing::ServoEasingNextPositionArray[7] - 90;
// Scale headTiltOffset value between 0 and 180 to scale of LEG_IK_MIN and LEG_IK_MAX
float legHeight = map(headTiltOffset, -90, 90, LEG_IK_MIN, LEG_IK_MAX);
// Attempt to compensate movement of head by adjusting leg height
// Scale headTiltOffset value between 0 and 180 (inverted) to scale of LEG_IK_MIN and LEG_IK_MAX
float legHeight = map(headTiltOffset, 180, 0, LEG_IK_MIN, LEG_IK_MAX);
// Move legs to that height
servoManager.moveLegs(legHeight, 0);
#ifdef DEBUG
Expand Down

0 comments on commit ebbef47

Please sign in to comment.