# 4 legged walking robot, to ride on.

Now before you tear me a new one, I want to disclose, I am reading and still learning arduino. I have visual basic and some C programming experience, but limited. I’m also not pawning off my work of reading and learning myself here, so please don’t throw me under the bus.

What I’m really asking for here is guidance in regards to 1) if this project will work as described, with you all knowing the limits of an arduino uno more than me from real life experience, 2) known pitfalls I could avoid -i.e. “that won’t work because…”, and 3) if you could point me in my reading/studies to a thread or threads that might already address this. (I’m still actively drudging through sections I think might be related, finding some useful things here and there, and going off on a LOT of tangents)

Background: I am learning and reading about H bridges, motor shields, and arduino programming. I am not a student rushing some project, I am simply wanting to get into robotics and teach my 4 and 6 year old sons some of this along the way.

The concept of programming in general is not foreign to me, I am simply still learning arduino and how programming can meet the physical work of mechanized action. Thanks for your help and patience.

The thought with problems: (feasible, or not?)

Walker Theory:

Basic blink style sketch, but you run 2 motors through each pulse instead of LEDs (4 total motors, and yes I understand I’ll likely need to use a motor shield or relay). Have 2 pulses. The shared motors are opposing each other both in front and side position, i.e. front left motor pairs in sequence with rear right motor.

This would produce a “walking” robot if even straight legs were attached.

Great, now what?

Well, now you can add directional guidance. This would mean decreasing the stride (motor running time) on the side to which you want to turn. By extending less on this side, the opposing side will have a longer stride and make more progress/distance, thereby “steering” towards the side with the shorter stride.

The problem is, that you can’t sequence the way mentioned above because both the left and right sides would have shorter strides, cancelling each other out.

So you’d have to have all working independently of eachother, but the aruino can only run one process at a time. So instead of wiring all independently, you just have an interupt to the power source on one side. This would cut power on the side you want to turn towards, allowing only the opposing side movement. This would solve the problem and could be accomplished with your directional controller. When turned towards the right for example, all power to the right motors would cease until the directional controller changed direction (straight, or to the opposing direction).

This may not be the smoothest transition, imagine being mid-stride and you lose power, it may cause the thing to fall towards the side you are turning. So you might be able to accomplish this with a voltage control. Instead of cutting power, you bring it down to a lower voltage. Then there’s an if statement, that if voltage drops from X, then the motor is stopped in the vertical position - straight legged.

I don’t know if this would be possible with a single arduino.

The next issue is variable speed control, not a big deal, you can get a speed knob and tie it in to a variable that represents speed and so adjusts the “blink” delay to a shorter time to speed up the process, or a longer time to decrease the speed… with a loop function that checks the knob setting every so often.

This would give you speed control, with the knob at zero position being “off” or no speed.

As for what I’ve done, besides in my head, I’ve literally just used LEDs as fake motors to see if the speed and parallel action would work, which it has. And yes, this is a modification to the blink sketch.
``` [ code ] /* Parallel Alternating Motors Turns on a motor circuit on for one period of time, then off for the same time period while turning on the alternate motor relay, repeatedly.```

``` */ // Pin 13 has an LED connected on most Arduino boards. // give it a name: int motor1 = 13; int motor2 = 12; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(motor1, OUTPUT); pinMode(motor2, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(motor1, HIGH); digitalWrite(motor2, LOW); // turn the 1st motor on and 2nd motor off(HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(motor1, LOW); digitalWrite(motor2, HIGH); // turn the LED off by making the voltage LOW delay(1000); // wait for a second } ```

```[ code ] ```
Obviously this doesn’t include much and would simply have the thing walking for days. Before I went any further, I wanted input so I could steer myself in the right direction before tackling the syntax of what I’m hoping to accomplish.

The goal for now is to get a small scale model toy version, then once the bugs are worked out to build something with pvc legs and affix a seat and control knobs to it to have the kids play around on after I’ve tested it for safety.

Why? It’d be fun.

Also I've been watching and researching 4 legged robots, I know the military has one it's thinking of using for carrying supplies in rough terrain, and I've seen the bug-style ones as well and have been reading up on them.
I'm hoping for a more rectangular configuration, more like riding a horse, albeit a very bumpy, robotic, headless horse, haha. I'm going for super simple, knowing that things like comfort and efficiency might take some hits. It's not like I have a lot of money around, so it's tinkering.

Please use [ code ] tags next time you post some code.

A walking robot is phenomenally complicated. From reading your ideas I would say that you have only one thousandth of one percent of a rideable robot. That’s not to say that you can’t get there from here but your kids will be grown up by the time you are finished.

For a small tabletop demonstration, look into buying some servos. You could easily get something walking on 4 servos within a week. That will simplify many of your mechanical and electrical issues, giving 4 legs that rotate 90 degrees under control.

There are going to be lots of places where little fingers could get trapped.

If your robot is powerful enough for someone to ride on, then it is powerful enough to cause serious injuries.

I agree with @MorganS - learn by making a small version that is powered by servos.

I think you will quickly find that articulated legs - at least with knees as well as hips - are essential.

You will also have to deal with balance. Somewhere on YouTube there is a video of a military walking "dog" that won't even fall over if you kick it hard. That sort of thing costs \$Ms and thousands of PhD programmer hours.

Right from the very first stages you need to plan your project development so that you will be able to debug it and deal with problems.

...R

JohnLincoln:
There are going to be lots of places where little fingers could get trapped.
If your robot is powerful enough for someone to ride on, then it is powerful enough to cause serious injuries.

My first thought too.

joshuaembry:
but the aruino can only run one process at a time.

While strictly true of any computer with only one processing core you can make it appear to be running multi tasks by correct programming.
See my
http://www.thebox.myzen.co.uk/Tutorial/State_Machine.html
Or Robin2's several things at once

most 4 legged animals articulate in the middle, they do not alter their stride, just the direction of the front legs.,

to bypass the balance problem, look at 6 legs.

You probably need to make a working model first to get a better feel of the issues. Six legs probably would be easier to work with. Below is a ride on spider bot.

Paul__B:
My first thought too.

Fully enclosed solves this. I agree, wouldn't risk my little ones.

"The goal for now is to get a small scale model toy version, then once the bugs are worked out to build something with pvc legs and affix a seat and control knobs to it to have the kids play around on after I've tested it for safety."

First of all, thanks for all of the replies, I know you didn't have to take time to answer and I've read and reread each to ensure I learn from them.

Thanks also for double-checking that I'm not going to put my kids in harms way, I did mention I'd test it for safety here though, but hey, reminders are always welcome when it comes to my little ones.

Thanks for the servo info, I'm trying to make the mini version as much like the one I would hope to build in the larger scale. Also addressed here I did mention I'd make a small scale toy version first, so that's always been the plan. When referencing servos did you mean just to get an idea of how to design the legs before moving on to motors, or do they make reasonably priced giant servos that I should be working towards instead of motors in the long-run? Thanks for any clarification to help save me some time and headache.

In regards to the military one that won't fall over, I understand that's \$\$\$\$\$, I'm not looking for that...if I were I could see how I'd be only a very small fraction of the way there. But...I'm not. I'm literally talking about a level-surface traveling walker, which doesn't seem that difficult to produce. It won't be intuitive, it won't self-correct balance issues, and it will likely be bumpy and nauseating to ride...but the whole point is that it's a starting point.

I'll review how to make the arduiono multi-task, thanks for the post...I'll also use the code tags next time I post some code, thanks, didn't know if they were needed on an html webpage, but now I do and I will add... I'll look into six legs, for stability and as to why they create more stability. I'll also look at knees/hips and bends etc. but I'm thinking stilt-style could still possibly work.

I thank you all for your responses. I'm still looking at simplicity, I think a lot of projects can become huge life-long endeavors and money holes if people make them that way. I also think sometimes simple solutions can bring something functional about. Keep in mind I'm not hoping to duplicate the military bot or anything close to that.

Balance is a key component, after reading your response, I was hoping in regards to balance that if I lowered the center of gravity enough, that the rider's weight could act as a stabilizer. Picture the tops of the legs reaching above the rider, maybe by doubling the leg height and making the pivot mid-leg verses the very end.

Thank you for your ideas, and I'll research based on your guidance. Feel free to provide further info and I'll also review, you took the time to reply, so I'll take the time to learn from you.

I'll also try to have a working toy model up within the next 1-2 weeks and post here if you're interested in guiding me some more.

-Josh

joshuaembry:
Fully enclosed solves this. I agree, wouldn't risk my little ones.

But you know that a 4-legged walker is not stable in steady-state while not moving and keeping one leg up?

As soon as a 4-legged walker pulls up one leg, it is behaving like a 3-legged chair.

A 3-legged chair keeps standing, if the center of gravity is located above the contact area.

So if you think about a 4-legged robot, who pulls up one leg, what is happening?

Let's think about this one, the center of gravity marked '+C'.

``````+---------+
|         |
|  +C     |
|         |
+---------+
``````

In a non perfect world, the center of gravity will not be perfectly fitted, but moved something to the left or right, or top or down.

So if the robot lifts one leg, you get either a triangle of contact area where the center of gravity is within the triangle. In that case, the robot will stay standing.

Or you get a triangle of contact area where the center of gravity is outside the triangle. In that case, the robot starts falling to the side as soon as you lift up the leg.

So with a 4-leg robot, typically the chance is 50% against 50% that you can lift one leg and the robots keeps standing. If you lift the wrong out of the 4 legs, the robot starts falling to the side immediately if you lift up one leg. And sooner or later you have to move each leg while walking.

So walking may become a problem if you are unable to create and solve differential equations of higher degrees in real time to create solutions for a smooth real time balancing with dynamically moving four legs.

Here you can see a 4-legged robot walking:

I think the project needed a lot of engineers for several years to make the robot move such as you can see in the Youtube video.

Balancing a 4-legged robot is much(!) more complicated than balancing a 6-legged robot. A 6-legged walker can always be constructed with his 6 legs and the center of gravity, that up to 3 legs can be lifted up at the same time without falling to the side. But with a 4-legged robot you cannot even select each single leg out of 4 for lifting without falling the robot to the side. So a 4-legged robot always needs dynamic balancing.

jurs:
But you know that a 4-legged walker is not stable in steady-state while not moving and keeping one leg up?

As soon as a 4-legged walker pulls up one leg, it is behaving like a 3-legged chair.

A 3-legged chair keeps standing, if the center of gravity is located above the contact area.

So if you think about a 4-legged robot, who pulls up one leg, what is happening?

Let's think about this one, the center of gravity marked '+C'.

``````+---------+
``````

|         |
|  +C     |
|         |
+---------+

``````

In a non perfect world, the center of gravity will not be perfectly fitted, but moved something to the left or right, or top or down.

So if the robot lifts one leg, you get either a triangle of contact area where the center of gravity is within the triangle. In that case, the robot will stay standing.

Or you get a triangle of contact area where the center of gravity is outside the triangle. In that case, the robot starts falling to the side as soon as you lift up the leg.

So with a 4-leg robot, typically the chance is 50% against 50% that you can lift one leg and the robots keeps standing. If you lift the wrong out of the 4 legs, the robot starts falling to the side immediately if you lift up one leg. And sooner or later you have to move each leg while walking.

So walking may become a problem if you are unable to create and solve differential equations of higher degrees in real time to create solutions for a smooth real time balancing with dynamically moving four legs.

Here you can see a 4-legged robot walking:

I think the project needed a lot of engineers for several years to make the robot move such as you can see in the Youtube video.

Balancing a 4-legged robot is much(!) more complicated than balancing a 6-legged robot. A 6-legged walker can always be constructed with his 6 legs and the center of gravity, that up to 3 legs can be lifted up at the same time without falling to the side. But with a 4-legged robot you cannot even select each single leg out of 4 for lifting without falling the robot to the side. So a 4-legged robot always needs dynamic balancing.
``````

But don't the two oppossing legs moving in sequence solve this? The front left and rear right leg would move in the same direction at the same time, leaving the front right and rear left legs as stabilizers? So two legs always making contact with the primary weight always pulling down and towards the middle?

Thanks for the great explanation, would the above solution solve?

joshuaembry:
But don't the two oppossing legs moving in sequence solve this? The front left and rear right leg would move in the same direction at the same time, leaving the front right and rear left legs as stabilizers? So two legs always making contact with the primary weight always pulling down and towards the middle?

Thanks for the great explanation, would the above solution solve?

try it. make a box with 2 legs on opposite corners and balance it

then see if it is possible to ballane a box on 3 legs

I have seen a wire-frame animation of 2-legged (human) walking and the process clearly involves a forward shift of the centre of gravity followed by movement of the legs to prevent you from falling.

I guess 4-legged walking is a little less complex, but probably not by much. Most animals can lift any two legs off the ground. And 3-legged dogs that have had a leg amputated seem to get by very well.

4-legged animals can eaily walk along the side of a slope - sheep don't really have shorter legs on the left side.

...R

The mathermitation Ian Stewart has done a lot of work on walking, this is one for four legs, he also hase other stuff on more legs if you search.

Will do Dave. A quick model worked if I had wide footings on each leg for both 2 and 3 legs, better at 3. (Paperclips etc. ) My motors should arrive tomorrow, we'll see if it holds up with more weight. Maybe the key here will be wide feet to stabilize, likely related to weight and the series of motion I hope to achieve.

Good points Robin. I think the three legged dog would have more flexible joints to help compensate than I was originally planning on. I'll google and watch some youtube vids of 3 legged dogs and take notes, could be helpful, thanks, wouldn't have thought about reviewing that.

Mike, thanks for the article share, read it twice, seems like my initial sequencing could work based on the reading, but maybe only at a precise speed range. Will look into this when my parts arrive. This is why I wanted to use an arduino, to change patterns on the go. Thanks! It even has leg assignment and timing, great article!

Robin2:
I guess 4-legged walking is a little less complex, but probably not by much. Most animals can lift any two legs off the ground. And 3-legged dogs that have had a leg amputated seem to get by very well.

The point made - and in those videos - is that it is dynamic stability - requiring the ability to quickly move a leg into the correct position to compensate for "falling" and actually (not necessarily immediately) bring the CG within the stance.

Horses can sleep standing up (or something like that - if they can lock their legs). Humans cannot.

Paul__B:
to quickly move a leg into the correct position to compensate for “falling”

And that can’t happen with a fixed length leg because the “falling” will reduce the space in which the leg has to fit.

…R

If you can disperse the centre of gravity over a large area/frame then 2 legs opposite to each other should be able to keep you stable while the other 2 are moving.

But at that point you would need motors strong enough to hold all of that weight without drift. I believe at that point you might as well just use hydraulics . Also the granny next door would be able to lap you.

Don't try to re-invent the wheel. Just use wheels.