Quantcast
Channel: 100% Solutions: robotics
Viewing all articles
Browse latest Browse all 3882

How to Program a Quadruped Robot with Arduino

$
0
0

Legged robots are the great! They can handle tough terrain much better than their wheeled counterparts and move in more varied and animalistic ways. However this makes legged robots more complicated, which makes them less accessible to many makers. That’s why I designed a robot to make legged robotics easier — it’s on Kickstarter now, go check it out! Let’s get to it; In this skill builder I’m going to be showing you a method to get a four legged robot (also known as a quadruped) walking. I’ll take you through a key walk style (called gaits) and show you how to program it on an Arduino. You’ll find quadrupeds abundant in nature, because having four legs allows for passive stability, which means it’s able to stay standing without actively adjusting position, whilst still being less complex than six legs. The same is true of robots: a four legged robot will be cheaper and simpler than a robot with more legs, and yet can still achieve stability. A chair is passively stable, because it doesn’t need any control or adjustment to stay upright. A standing human is actively stable because your body requires constant position control to stay standing. When a quadruped is standing on four legs it is passively stable. When walking, it has options. It can maintain passive stability while walking by keeping three legs on the ground, and reaching out with the third. Or it can give up passive stability and use active stability to move faster (albeit less smoothly). These two types of walking gaits are called the Creep and the Trot. I’m going to show you how the Creep gait works. The creep gait is the easiest walking gait to use. You keep three feet on the ground, and keep your center of mass inside the triangle formed by those three feet. If the CoG goes outside this triangle for too long, it will fall over. Simple enough. The question is, how can you maintain this stability while walking. The pattern below will save you hours of trial and error (trust me, I know), it is a simple type of passively stable creep gait: Ok let’s break that down. This is the starting position, with two legs extended out on one side, and the other two legs pulled inwards. The top-right leg lifts up and reaches out, far ahead of the robot. All the legs shift backwards, moving the body forwards. The back-left leg lifts and steps forward alongside the body. This position is the mirror image of the starting position. The top-left leg lifts and reaches out, far ahead of the robot. Again, all the legs shift backwards, moving the body forwards. The back-right leg lifts and steps back into the body, bringing us back to the starting position. Notice that at all times, the triangle formed by all three legs on the ground contains the center of gravity (CoG) of the robot. This is the essence of the creep gait. When we look at this pattern, we can see it’s essentially two sets of mirrored movements. Step, step and shift, followed by another step, step and shift on the other side.. Here’s what that looks like on the EngiMake QuadBot. The gait is fairly simple — but how do we actually turn that into code? Well, the first thing to do is decide the specific x,y positions of the legs at each position. Here we have the quadruped frame. Each leg has its own x and y axis. We can now give the foot of each leg a position, in millimeters, relative to that axis. For example the top-left leg has the position (-50,50) (x,y). Now we can apply these positions to each stage of the creep gait. However bear in mind that the specific positions you want will depend on the length of your robot’s leg. For any arbitrary quadruped you’ll need to do some measuring to find the right numbers. Here is an example of the positions used on the QuadBot. Between each step, we only need to deal with the change in position denoted by the pink arrows on the sequence above. So how does this translate to code? Let’s take a look at the Arduino code to implement it: Surprisingly simple perhaps? Let’s break it down… And there we have it. With this approach you will be able to get your robot walking in no time. Most quadruped robots use servo motors to move, and if yours is one of them, you’ll need to master Inverse Kinematics first, which will let you translate servo motor angles into the positions described here. You can get access to the EngiMake QuadBot on Kickstarter to learn all about that!

Viewing all articles
Browse latest Browse all 3882

Trending Articles