Project Hexapod Part 2: More walking design thinking

Each leg on this robot has 3 motors; a shoulder, an elbow, and an ankle

To make things easier I labelled them up like this:

There are 18 separate motors to control:

BoardServoBoardServo
LeftFrontShoulderPwm18RightFrontShoulderPwm17
LeftFrontElbowPwm110RightFrontElbowPwm15
LeftFrontAnklePwm113RightFrontAnklePwm12
  
LeftMiddleShoulderPwm19RightMiddleShoulder136
LeftMiddleElbowPwm114RightMiddleElbow141
LeftMiddleAnklePwm115RightMiddleAnkle150
  
LeftBackShoulderPwm28RightBackShoulderPwm27
LeftBackElbowPwm29RightBackElbowPwm26
LeftBackAnklePwm210RightBackAnklePwm25

Design Thoughts

First thought was to create a function that controls each limb.  At the least every limb should move in the same way.  However, whilst limbs move together from the gait perspective (Figure 2) I don’t think we can do that from an Arduino perspective.  I don’t think I can create a function that says move limbs L1, R2, L3 at the same time.  I think I’ll need a function that does that.  But then separately what it’s doing is moving “Left Front Shoulder, Right Middle Shoulder, Left       Back Shoulder” together, then “Left Front Elbow, Right Middle Elbow, Left Back Elbow”, etc.  until that function is complete.

I think I’ll have a multidimensional array with degrees in it for each joint.  What I might do though is write a routine which sets each joint to 0.  Then unscrew and reattach the joints so I know where zero is on each motor.  Either way, I probably need a few lists to define:

the start and end position of each joint for a forward motion

the start and end position of each joint for a circular motion

the start and end position of each joint for being sat still.

That currently looks like this:

NameBoardServoservo_minservo_max
LeftFrontShoulderPwm18500500
LeftFrontElbowPwm110  
LeftFrontAnklePwm113  
LeftMiddleShoulderPwm19  
LeftMiddleElbowPwm114  
LeftMiddleAnklePwm115  
LeftBackShoulderPwm28  
LeftBackElbowPwm29  
LeftBackAnklePwm210  
RightFrontShoulderPwm17  
RightFrontElbowPwm15  
RightFrontAnklePwm12  
RightMiddleShoulder136  
RightMiddleElbow141  
RightMiddleAnkle150  
RightBackShoulderPwm27  
RightBackElbowPwm26  
RightBackAnklePwm25  

Maybe a piece of code that takes serial input and resets the device to zero’s.

Control System:

Due to its built in Bluetooth, I’m thinking about having a raspberry pi zero-w connected to an Arduino nano over USB Serial:

https://maker.pro/raspberry-pi/tutorial/how-to-connect-and-interface-raspberry-pi-with-arduino

ser=serial.Serial(“dev/ttyACM0”,9600)

Then I can both ssh into the robot to tell it what to do.  And I can also write a phone app to act like a remote control, connecting over Bluetooth.  The v5 of the robot car did that.