Author Topic: Meowth Abandoned  (Read 1218 times)


  • Member
  • ****
  • B
  • Posts: 20
Meowth Abandoned
« on: April 10, 2019, 06:35:48 AM »
As we are supposed to learn from our mistakes I have written up one of my failures.

The project was to build a bot, as cat like as possible, to sit and wave a paw, stand up and walk around.

Meowth LP.jpg
*Meowth LP.jpg (83.9 kB . 796x442 - viewed 156 times)

The activity started more than three years ago with an attempt to copy Boston Dynamics’ quadruped - Spot.  Believing the quoted torque values was the first mistake as the 55g servos could barely lift their own weight. The leg modules were later re-used for HybridTrotter and Scooter Boy where they provided the drive but the weight was carried on wheels.

Using a Picaxe micro, Hybrid Trotter was posted on their forum and the video shows a disinterested Meowth idly watching. A spirited American Ragdoll, he didn't live to see his namesake in action.

Much of my learning progress is posted in the Tutorial section. Firstly improving on the MG 995/996R servo performance and squeezing it into the legs. The fixing lugs were cut off and the electronics replaced by an Arduino Nano plus drive circuitry allowing all the motors to run directly from a 3S Li-Po supply.

Distributing the processing between a master and four slaves using an I2C bus required fast routines and short data packets. All processes had to be sync’d to a 15mS cycle time for the sixteen PIDs. Once again the MPU-6050 showed a disregard for protocol and had to be driven separately.

Three modes allowed for setpoint angles to be sent for direct action, or indirectly reached after delta time cycles. Inverse Kinematic values were converted into setpoint angles by sending x,y & w coords of the toes.

Sitting postures were held in lookup tables in the master and sent for indirect action. This proved harder than expected because of balance issues. Try standing up from a chair without moving your weight forward first.

Later development became too complicated and a PLX-DAQ mimic display was a great help.

It sometimes can happen that all four legs step correctly but, not wishing to scratch the table, the clip shows only two legs in action. This is stalking mode for a cat - a creep forward with only one leg lifted at a time.


This is always the main challenge when working with limited motor torque, thicker than real life limbs and limited sensors. Working with 2mm 4-ply is not the only reason the result can appear ‘wooden’.

Once you start using IK values and forget about individual angles, other techniques become simpler. If the bot were to step down onto a hump or into a depression, the riding height at hip or shoulder would need to change for the rest of the gait cycle. Just add a few milimeters to IKy to lower it, or subtract a bit to raise it.

On a flat table surely that won’t be necessary? Consider the leg construction: four motors are joined in line so that the bot is narrow at the hips. Like elephants hanging onto the output shaft of the one in front. Output shafts with end play and gearbox slop. Calculating trig functions to a fraction of a degree and millimetre is fine in theory but in practice the IK coords will end up somewhere near a centimeter circle on a good day.

So balance can’t be predicted because the feet will land in different positions each cycle. The MPU will report Pitch and Roll but the bot has four legs. You might spot in the video the bot straightening up just before lifting a leg. But the MPU cannot indicate where the centre of mass is before it moves. If we’re lucky the error might be recoverable by changing leg lengths on the fly. Or the bot might have been level on three legs and suddenly the most important one is too short and the bot must fall.

So the next creation must have a load cell for each leg to determine CoM before committing to stepping. Moving the balance point still requires flexibilty, mostly to move to the side. The design (which makes for a narrow body that can sit) has the lateral motors set a 40 degrees to the horizontal. Very tricky 3D IK and producing a non-linear roll/rotation. In practice the square foot profile provides more lateral stability than an active motor.

The MPU can derive a ‘falling vector’, different for each leg, that is sensitive enough to trigger an emergency foot down process. Here the motors can step wide quickly and stop a crash. A couple of retries are permitted where the leg straightens and lifts to the last postion before continuing. Each time the bot is tilted further over  to help. Again this is only guesswork without load cells.

Software is now working like a cars suspension to allow IKy coords to drift, within limits, from the theoretical. Placing a foot down is problematical anyway. Too heavily and the shock can tip the bot and upset the next cycle, too softly and the weight distribution may be wrong. Experimenting with a simple microswitch foot sensor did not obviously help. The slave loses a cycle to get the info to the master leaving little time to act. The next creation will need a shock absorbing toe and well designed sensor directly connected to the master.

Tilt Plane

We can derive from Pitch and Roll the amount by which each leg needs to change. This can be referenced to the next leg to lift. These corrections can be applied immediately as a feedback signal but the result is too lively. With four legs grounded the bot bucks and rears much like an animal but will eventually overshoot and topple. With the support body being nearly four times longer than the width, Pitch is dominant.

However, if a snapshot of Pitch and Roll is applied slowly, then the bot will settle into a level pose. Pitch is -1 degree and Roll is +1 degree in the graph referenced to HL.

*Tilt.jpg (3.37 kB . 295x223 - viewed 153 times)

  Poff = 220 * sin(degpos[1]/57.296);
  Roff = 60 * sin(degpos[0]/57.296);

  //snapshot tilt plane values to make level 
  FLbal = -Poff;
  HRbal = Roff + 2;           //then add extra tilt
  FRbal = -Poff + Roff + 2; 
  HLbal = HLbase;     
  balTest ();                 //keep bases within limits


Another issue causing intermittent toppling was my use of the classic PID code to control the motors.

We deal with static friction, or stiction, when driving a vehicle from rest. An extra touch on the gas pedal will ensure a smooth start and once rolling it will need less to run onwards. When controlling a wheeled bot we know that there will be a minimum voltage below which the motor will not turn.

Surely this must also affect a servo motor system. Tim Wescott in his blog puts the tricky maths around the problem. Since Tim has offered consultancy on this for 20 years it is unlikely there will be an easy answer.

Brett Beauregard wrote the library PID code and explains it well. However, it does assume a linear system - and a brushed electric motor with high ratio gearbox can be spectacularly non-linear.

MG996 with PID and PWM control can fail to move sometimes, like a joint with arthritis. Similarly Iterm makes no difference to performance.

I spent forever coding a State Machine form of PID controller. It failed the KISS test but clearly showed the problem. This bot still uses the classic PD code but the output is monitored and ‘kicked’ when it fails to move for a few cycles despite an error signal. Even stiction has a breaking point! The problem comes if it is pulsed too strongly as it has to be brought back under control by the next reversal. Iterm is now more a ‘nudge’ to move closer to the setpoint.


It is very hard to pull the plug on a long running project. So much time and effort invested, hopefully not all wasted. The next project is still to be decided but load cells must certainly be investigated.


  • Member
  • *
  • Posts: 44
    • Anim4bot
Re: Meowth Abandoned
« Reply #1 on: April 11, 2019, 11:08:00 AM »
Very good summary of your work and what you have been through... This reminded me as well some issue I have/had with Animabot.
I'm sure you learned a lot with this project and you will continue to do so.

But I'm sure this robot is not finished, in few weeks/months you will start designing a new one ! Look at me, the last 3 versions of Animabot were supposed to be the last :D

Keep up the good work !
« Last Edit: April 14, 2019, 03:06:05 AM by Nemesis »


* Search

* Recent Topics

Just wanted to say Hi. by ErwinCanto
[Today at 10:11:28 PM]

"1984 Nixie Time" by viswesh
[Today at 01:48:07 AM]

SDR (Software Defined Radio) by Gareth
[August 14, 2019, 01:12:21 PM]

It may be dangerous to work in the virtual realm by fritsl
[August 09, 2019, 09:52:05 AM]

PLX-DAQ by AmandaG
[August 06, 2019, 01:58:42 PM]

DIY Yellow Servo by AmandaG
[August 06, 2019, 01:08:09 PM]

Comp? :o by Impala
[August 02, 2019, 07:32:20 PM]

Website to do list by Killer Angel
[August 02, 2019, 05:38:30 AM]

I Like the new front page! by James
[July 31, 2019, 12:29:53 AM]

Pictures on the front page! by tinhead
[July 30, 2019, 05:17:20 AM]

4x5 Macro Keypad by James
[July 28, 2019, 08:30:41 PM]

My name is Frits and I am Making a Game called TIXITAXI by Killer Angel
[July 08, 2019, 04:01:58 AM]

Coding a Nano i2c Slave by AmandaG
[June 11, 2019, 02:48:03 PM]

repetierHost 2.1.6 not working? by MEgg
[June 09, 2019, 03:11:34 PM]

Servo Calibrator by Bajdi
[May 24, 2019, 04:01:10 AM]

* Recent Posts

Just wanted to say Hi. by ErwinCanto
[Today at 10:11:28 PM]

Re: "1984 Nixie Time" by viswesh
[Today at 01:48:07 AM]

Re: "1984 Nixie Time" by James
[August 16, 2019, 06:37:11 AM]

"1984 Nixie Time" by Gareth
[August 15, 2019, 06:16:37 AM]

Re: SDR (Software Defined Radio) by Gareth
[August 14, 2019, 01:12:21 PM]

Re: SDR (Software Defined Radio) by fritsl
[August 09, 2019, 09:54:11 AM]

It may be dangerous to work in the virtual realm by fritsl
[August 09, 2019, 09:52:05 AM]

Re: PLX-DAQ by AmandaG
[August 06, 2019, 01:58:42 PM]

Re: DIY Yellow Servo by AmandaG
[August 06, 2019, 01:08:09 PM]

SDR (Software Defined Radio) by Gareth
[August 06, 2019, 11:12:09 AM]

Comp? :o by Impala
[August 02, 2019, 07:32:20 PM]

Re: Website to do list by Killer Angel
[August 02, 2019, 05:38:30 AM]

Re: Website to do list by James
[August 01, 2019, 05:57:22 AM]

Re: Website to do list by Killer Angel
[August 01, 2019, 02:23:00 AM]

Website to do list by James
[July 31, 2019, 07:34:53 PM]