# Arduino Quadruped Robot – Stalker

I am going to build an Arduino Quadruped Robot. As usual, I will share my source code and show as many pictures as possible, to help those of you who are also building Quadruped robots. The way I do things might not be the best ways, and I am sure you can come up with better solutions, please let me know if you do! :-)

This robot is actually the first robot I wanted to build, but I failed miserably. you can check this out and this. After building a working Arduino Hexapod robot, I feel confident that I can pull it off this time! I recycled the parts from the arduino hexapod robot, and build a body with styrene sheets, so there is no new parts. For Inverse Kinematics, Check out my tutorial:

```https://oscarliang.com/inverse-kinematics-and-trigonometry-basics/
```

I made an excel spreadsheet to simulate the movements of a quadruped robot. It shows detailed inverse kinematics calculations, and it might help those who are having problem understanding IK to visualize the complex computations, also it’s a great help to debug your code.

`Download Quadruped Robot Simulation Spreadsheet V1.0`

Update on [31/01/2013]

I call this arduino quadruped robot ‘Stalker’, because of the game unit in Star Craft of the same name. (although they look totally different :p)

## Hardware that I use at the moment:

• Arduino Mega
• 12 Servos
• Wii Nunchuck controller
• a few thick styrene sheets (skeleton)
• 6V Ni-MH 4300mh Battery

## Plan:

1. Build Body and Assemble Robot.
2. Test Wii Nunchuck on it.
3. Write good IK for body rotation, and translation.
4. Get it walking!
5. Write Android App to achieve more complicated task.
6. IR/ Ultra-Sonic Detection and simple AI.

============================================================

## Project Started – Update 31/03/2013

Basically copied most of the codes from my last Hexapod robot. All I did was to remove the variables related to the middle legs, and modifed the preset variable values to work in the Quadruped Robot, and it actually worked! :) But the movements are quite Awkward, a lot of work need to be done about Inverse Kinamatics. Here is how I made the body:

========================================================================

## Quadruped Robot Leg Calibration (Servo Angle Offsets) – Update 03/04/2013

I just didn’t like the body, i thought it was too big! So I spent an evening re-measured, and cut it down from 16cm to 12cm (leg to leg distance).

I have also created a very simple Servo Offset calibration program. As you might know, due to the fact that no servo is perfect, they might tilt to the right a little more than the left, or the other way round. (It could be also caused by the servo brackets) You might want to give it an offset to correct this. It’s very handy when you have a lot of servos like Hexapod/Quadruped Robts have.

[sourcecode language=”cpp”]
// ===========================================================
// blog.OscarLiang.net
// Created on 04/04/2013
//
// ===========================================================
//
// A very simple program to calibrate multiple servo offsets.
// Especially useful if you have a lot of servos, for example
// Hexapod Robots and Quadruped Robots.
//
// ===========================================================
//
// Instructions:
//
// 1. change variable “ServoNum” – number of servos you have.
// 2. change variable “servoPin” – the pins used by your servos.
// 3. upload code to Arduino.
// 4. open serial monitor, use baud rate 9600
// 5. enter + or – in serial monitor to calibrate servo, there
// is a reading printed on the monitor.
// 6. enter n or l to move to next or last servo.
//
// =============================================================

#include

const int ServoNum = 12;

Servo legServo[ServoNum];
int servoPos[ServoNum];
int servoIndex;

int servoPin[ServoNum] = {23, 24, 25,
26, 27, 28,
29, 30, 31,
32, 33, 34};

void setup() {

Serial.begin(9600);
servoIndex = 0;

// ================ Servos ==================
for (int i=0; i<ServoNum; i++){
legServo[i].attach(servoPin[i]);
delay(50);
legServo[i].writeMicroseconds(1500);
servoPos[i] = 1500;
delay(100);
}
delay(500);

Serial.println(“enter + to increment”);
Serial.println(“enter – to decrement”);
Serial.println(“enter n to proceed to next servo”);
Serial.println(“enter l to go back to last servo”);

}

void loop(){

if ( Serial.available()) {

switch(ch){
case ‘+’:
servoPos[servoIndex] += 3;
if(servoPos[servoIndex] >= 2350){
servoIndex = 2350;
Serial.println(“You can’t turn it up anymore (you might damage it!”);
}
else{
legServo[servoIndex].write(servoPos[servoIndex]);
Serial.println(servoPos[servoIndex]);
delay(100);
}
break;

case ‘-‘:
servoPos[servoIndex] -= 3;
if(servoPos[servoIndex] <= 650){
servoIndex = 650;
Serial.println(“You can’t turn it down anymore (you might damage it!”);
}
else{
legServo[servoIndex].write(servoPos[servoIndex]);
Serial.println(servoPos[servoIndex]);
delay(100);
}
break;

case ‘n’:
if(++servoIndex >= 12){
servoIndex = 11;
Serial.println(“we have reached last servo”);
}
else{
Serial.print(“Switched to Pin “);
Serial.println(servoPin[servoIndex]);
}
break;

case ‘l’:
if(–servoIndex < 0){
servoIndex = 0;
Serial.println(“we have reached first servo”);
}
else{
Serial.print(“Switched to Pin “);
Serial.println(servoPin[servoIndex]);
}
break;

default:
Serial.println(“Unknown Command… “);

}
}
}
[/sourcecode]

.

## Creeping Gait – Update 15/04/2013

Some Background Gait Knowledge you might want to know:

`https://oscarliang.com/quadruped-robot-gait-study/`

Tonight I came up with a 20-step Creeping Gait. This gait is how 4 legged animals, for example cats, walk. This is the GaitStep Plan (leg 1 is the top right leg, leg 2 is the bottom right leg… etc…) This follows the idea about creep gait described here:

`https://oscarliang.com/quadruped-robot-gait-study/`

Circled steps are the leg-lifting steps, and the gait cycle starts at step one where leg starts to be lifted. I copied most of the code on how to generate gait sequence from my previous hexapod robot, you can check out the source code. Here is the source code for the gait I have written: Before we start, we call this function to initialize the variables for the Gait:

[sourcecode language=”cpp”]

void GaitSelect (){

//begining of the step cycle for each leg (with reference to the first leg)
GaitLegNr[LR] = 1;
GaitLegNr[LF] = 6;
GaitLegNr[RR] = 11;
GaitLegNr[RF] = 16;

NrLiftedPos = 5; // number of steps that the leg is in the air
TLDivFactor = 15; // number of steps that the leg is on the ground
StepsInGait = 20; // total steps
}
[/sourcecode]

For a complete Gait cycle (e.g. from step 1 to step 20), we will go through loop() function 20 times, each time we call GaitCalculate(), and then increment ‘GaitStep’ variable.

[sourcecode language=”cpp”]
coor GaitCalculate (){
//Calculate Gait positions

for (int LegIndex = 0; LegIndex < 4; LegIndex++){

if (GaitStep == GaitLegNr[LegIndex]) {
GaitPos[LegIndex].Y = -LegLiftHeight/2;
}
else if (GaitStep == GaitLegNr[LegIndex]+1) {
GaitPos[LegIndex].Z = 0;
GaitPos[LegIndex].Y = -LegLiftHeight;
}
else if (GaitStep == GaitLegNr[LegIndex]+2) {
GaitPos[LegIndex].Z = WalkLength/2;
GaitPos[LegIndex].Y = -LegLiftHeight/2;
}
else if (GaitStep == GaitLegNr[LegIndex]+3) {
GaitPos[LegIndex].Y = 0;
}
else{
// move body forward
GaitPos[LegIndex].Z -= WalkLength/TLDivFactor;

}

}

if (++GaitStep > StepsInGait)
GaitStep = 1;

}
[/sourcecode]

This is by no mean the best implementation, but it might give you an idea how to start doing gaits if you still have no clue. I will keep working on Gait, make it more stable, faster, smoother and maybe come up with some more gait style as well, before I publish my full working code.

## Trot Gait – Update 28/04/2013

Right, finally have the time to do some robotics, and this time I made a fist version of Trot Gait for the stalker.

I didn’t look into too much theory stuff to get this gait working, as it pretty straight forward: 2 diagonal legs (1 and 3) lifted and move forward, the other two legs (2 and 4) at the same time move backward, 1 and 3 land. Now 2 and 4 are lifted to move forward while 1 and 3 move backward … And repeat…. Check out my Gait Study post for more detail:

`https://oscarliang.com/quadruped-robot-gait-study/`

## DIY Remote Controller – Update 28/07/2013

I have been working hard on a universal DIY robotic remote controller that uses XBee or Ciesco XRF for wireless communication. I also aim to develop an open source Arduino library that can be easily modified to suit different remote controller configuration. You can find more information on the project post. Hopefully at the end, this remote controller can be used in all sorts of robots and projects that requires manual control.

## Servo Horn orientation

Some one asked me what’s the orientation of the leg servo horns. so here is a very rough drawing.

To raise money for future projects, I am starting a fund raise. To say thank you, anyone who donate more than UK£10, I will send you the source code of this project. Amount does not matter, every little helps. You can donate through paypal via the link on the side bar (right hand side – Donate button). Please drop me a private message as soon as the donation is made and point out which project you are interested in. However I can’t give you any technical support on this project anymore as I am no longer working one it.

(Please don’t expect my source code will work straight after uploading on your robot. It would be best only for your reference. Although it’s possible, but it will take some effort to rewrite the code, therefore I don’t recommend Arduino/programming beginners to get it)

21st March 2023 - 5:45 pm

Hi…Oscar, can i still donate and have the code?

16th October 2022 - 9:40 am

Hi Oscar, Can i still have the code for this project after donating?

12th July 2022 - 7:01 am

hi oscar, i have donated 5 dollars. please send source code

12th July 2022 - 2:06 pm

i sent a few days ago, check your spam maybe?

31st March 2022 - 9:28 am

Hi, I can’t find the donate button.

18th December 2021 - 10:49 am

hi oscar.. i have the same project could i get the source code

14th May 2021 - 11:50 am

Hello Oscar,

I am working on a similar project and i am struggling to get my robot to walk. My Kinematic model is working fine but the stepping sequence is big problem right now.
Is it still possible to get the source code your project? I will donate 15 euros.

14th May 2021 - 1:35 pm

Yes of course :)

16th March 2021 - 11:09 am

Awesome work…..?
Have you calculated Center of Mass and Support Polygon? if yes, then how?
I’m working on a similar project…….

1st February 2021 - 2:52 am

hi oscar, I will donate 10 dollars, will I get the source code?

7th February 2021 - 9:27 pm

Yea it’s still available.

21st December 2020 - 11:17 am

Hi, I’m interested in the spreadsheet but unfortunately the link doesn’t work. What should I do to get it?

21st July 2020 - 8:05 pm

Thank you so much for posting about your project! I have made a donation, it would be greatly appreciated if you could send along the source code and the spreadsheet for the Quadruped.

Thank you so much Oscar!

31st July 2020 - 3:00 pm

Sent :) thanks for the dontation!

10th December 2019 - 6:06 am

Hi Oscar, I will donate 15 U\$D, it is possible to email me your code?

10th December 2019 - 1:39 pm

Yes of course

18th October 2019 - 8:33 am

Hi…is it possible to use this information for code small spotmini or spotmicro quadruped robot…

30th September 2019 - 5:50 pm

Hi Oscar, If I donate, can I have the design chassis and the source code of this quadruped robot. And does the chassis design have all the femur, tibia, coxa? Thanks for replying me.

30th September 2019 - 6:11 pm

No i don’t have the chassis design, only the source code for this robot.

7th September 2019 - 10:35 am

Hi…Oscar, can i still donate and have the code?

10th September 2019 - 6:36 pm

Yes :)

30th May 2019 - 3:00 am

Hi Oscar, I’m very interest in your this quadruped robot, can I still donate and get the source code now?

30th May 2019 - 11:04 am

thanks, got your donation, will send you the code shortly.

27th August 2018 - 12:49 am

Hi, I am interested in your Quaduped robot. Coulyou tell me how to donate for Inverse Kinematic and code. I have Visa.

28th August 2018 - 5:04 pm

Only paypal donation accepted. The link is on the sidebar that says “Paypal Donate”

19th July 2018 - 6:58 pm

26th April 2018 - 7:12 am

Hi Oscar,
I am a student working on my first robot and was wondering if you could send me your spreadsheet? I am having some difficulty coding my gait.
My email is crcali AT gmail.com.

26th April 2018 - 7:25 am

How much do I need to donate, if anything, to receive the code?

26th April 2018 - 7:30 am

Also, if I donate, can I receive all the code mentioned on this blog, including both the spreadsheet and the code for the gaits?
Thanks!

30th April 2018 - 4:29 pm

Yes I will have the code.

24th October 2017 - 11:37 am

11th October 2017 - 1:43 pm

Hi,

I just donated for the source code, do you think you could send me the code? I’m really struggling with smoothing out the movement on my quad, hope your code will point me in the right direction.

Thank you!

Louis

19th October 2017 - 3:13 pm

sent :)
thanks for the donation!

3rd September 2017 - 9:21 am

Very nice project. Do you still have the Quadruped Robot Simulation Spreadsheet? The dropbox link doesn’t work.

17th January 2017 - 9:04 am

Are the codes still available for donation ?
thanks
babby

21st January 2017 - 6:13 pm

Yes Babby.

15th January 2017 - 9:30 am

Hi,
can I also use the code on Arduino one?
Is the code the same one used by Sunfounder Quadruped ?
Thanks
Gabry

25th November 2016 - 1:48 pm

Hi Oscar

I have donated 12 pounds just to be sure it was enough. Would you be able to send me the code for the Quad and Hex?
Great work on the development of these robot!

28th November 2016 - 3:53 pm

thanks Brad, I have sent you the code!

21st October 2016 - 10:49 pm

Oh i got it , I’ve just trying using my phone , but it;s done by my laptop.
I already donate, so could you please send to me the source code of quadruped robot with remote :)

10th November 2016 - 3:56 pm

Hi Oscar, It’s time for me to tackle a quadruped after a couple hexy. Am interested in yr coding n excel spreadsheet.
Just did a contribution. Thks mate.

15th November 2016 - 6:02 pm

thank you :)

21st October 2016 - 9:55 pm

Hi Oscar
How can I donate to get the source code?

4th October 2016 - 8:23 am

Hi Oscar ,
Is donation is still available ?
Becouse I’m very interested in this project and I plan to make it for my B-tech project .

4th October 2016 - 3:03 pm

Hi Hagar
yes the codes are still available for donation.

3rd July 2016 - 5:59 pm

I am trying to build a quad bot and this would help me very much learn what i am missing. However i cannot find a paypal button anywhere. I am so excited about this since i am a disabled US military veteran and Arduino has been my calming, and i have been fully into coding for about a year. This is what i really want to build.

16th May 2016 - 11:08 pm

Hi. Oscar. I am Jack. I just did the donation. Could you send me the source code for both of quadruped one and hexapod? Thanks so much.

16th May 2016 - 6:31 am

Hi. Is the donation still available for the source code? If it is, please let me know as soon as possible. I am learning the programming of four-legged robot. Once you reply me, I will donate immediately. BTW, how can I send you the private messages to tell you which project I am interested in because I think I need both of quadruped robot and hexapod.

16th May 2016 - 4:11 pm

Yes Jack, still available :)
no worries i will send you both source code!

26th December 2015 - 5:35 pm

Hi Oscar!
Great post!
How do you think if i use plastic gear micro servo?
Are they strong enough to lift frame, arduino and small servo driver circuit?
Thanks!

6th January 2016 - 10:33 am

depends on your payload and robot weight… I tried 9g servos but they are just not strong enough…

14th December 2015 - 11:37 pm

Hello as I can the programming of simple Quadruped Robot

thank you!

26th September 2015 - 6:38 pm

Hi Oscar!

Thanks
Kjell B
Norway

14th July 2015 - 8:09 pm

Hello I want a help can I make a basic quadruped with just 12 servos and arduino mega….is servo controller board is necessary?

29th June 2015 - 7:25 pm

it is very useful thnk u oscar… can you send me the source code

18th May 2015 - 3:28 am

Hi oscar, can you send me the flow chart of programming of the robot I want to know the sequence of how the robot operate. I already donated for the contribution . Thx :-)

26th April 2015 - 5:17 am

Hi Oscar
I have a question about your Arduino Mega shield what capacitor u using for the both??
If i didnt put the capacitor is it ok ??

27th April 2015 - 5:32 pm

that’s fine i think, they are there just because I am paranoid :)

24th April 2015 - 8:10 am

Very well written arcticle. Congrats on making such a wonderful blog. I have donated the amount please share the source code. Thank you.

24th April 2015 - 1:59 pm

Code sent! Thanks for the donation :)

24th April 2015 - 4:07 am

Hi Oscar
I m doing the same project as u did
If i donate UK£10 can u send me the full code and also the DIY wireless Remote controller which is link together
and can u list out what electronic component u used in the project THX :)

24th April 2015 - 1:55 pm

Hi Mike, yes once the donation is received you will get the code :)
thanks
Oscar

24th April 2015 - 4:05 pm

Donated

19th March 2015 - 1:15 pm

Hi Oscar,
I was interested in the code for a quadruped.
thank you very much

20th March 2015 - 4:01 pm

yes, it’s still available.

18th December 2014 - 7:46 pm

Beside that, im using digital servo hs-5645 mg, i wonder whats wrong with my servo PWM pin to arduino, it only generate about 1.5 volt instead of 3.3volt.

im using arduino mega 2560 , and i attach my 12 servo’s signal pin to 2 until 13 pwm pin in arduino. is that okay to do that? am i need servo shield?

18th December 2014 - 7:26 pm

Hi, Oscar i just donated today.

Im now in project for quadruped.
can you send your code for the quadruped please? the last one with gait, inverse kinematics, rotation matrix, and coordinate transform. thank you. i want learn from your code.
my email is [email protected], i’ll email to you my donation transaction proof.

5th December 2014 - 12:46 pm

hi oscar, have you recieved my donations? if you do please email me back at [email protected] .i would like the source code for this.

regards,
khair

5th December 2014 - 4:03 pm

Hi Khair, thanks, code has been sent.
thanks
Oscar

5th December 2014 - 5:45 am

Oscar,
Donated today, thank you in advance for the great code examples you are going to send me. I also fly quadcopter and a tricopter. Looking forward to seeing what I can do on the ground with your project as a base. I will try to post some of the results as I get them.

Thanks again.

5th December 2014 - 4:07 pm

thank you very much! Code has been sent earlier today! good luck with the project!

2nd December 2014 - 2:04 am

hi is the \$10 donation for the code available??

2nd December 2014 - 2:42 pm

yes it is.

2nd December 2014 - 2:02 am

hi oscar is the \$10 donation for the code still available? i am doing something similar like you…

2nd December 2014 - 2:42 pm

yes it is.

18th September 2014 - 5:38 am

Hi Oscar,

is the £10 for the code still available? We are planning to build the same robot but IK is just somewhat beyond us. We would like to see how IK and the gait is implemented in your code.

Thanks

18th September 2014 - 9:14 am

yes :)

22nd July 2014 - 9:55 pm

hi,

Thanks

22nd July 2014 - 6:36 pm

Hi,

Im interested on your quadruped code, do you still have it for a donation?

23rd July 2014 - 11:20 pm

yes!

6th July 2014 - 7:34 am

Great job man!! I was looking for a good quaduped frame example to start mine and i have to admit i love this one… so please can i have more details about your frame ?? (dimensions, weight…)
thx!

30th June 2014 - 10:07 pm

Is the Quadruped source code still available for a \$10 donation?

30th June 2014 - 10:32 pm

yes, sorry it’s £10

28th May 2014 - 5:36 pm

Hi Oscar,
How many servos are moving simultaneously in your project?

30th May 2014 - 3:15 pm

12 servos.

21st May 2014 - 12:07 pm

Hi Oscar,
I was interested in the code for a quadruped.
thank you very much

21st May 2014 - 5:41 pm

yes i do.

14th May 2014 - 4:18 am

Hey Oscar,

Nicely done mate! Im working on a similar project for my robotic class this semester. What I am stuck on is keeping the creeper balance when walking. Whenever it walks for more than 4 steps, the body would start to collapse and sink from the middle =(. Any suggestion? And how long was your source code? did you code each individual legs with .attach () and .write () and delays? It will be really cool if I can refer your codes.

Thanks !

12th May 2014 - 12:34 pm

On what basis you are using 6V Ni-MH 4300mh Battery? I mean what are the calculations at the back end. how do we calculate the requirements for our battery?

19th January 2014 - 5:27 am

Outstanding post however , I was wanting to know if you could write a litte more
on this subject? I’d be very thankful if you could elaborate a
little bit more. Cheers!

15th January 2014 - 4:58 pm

Hi Oscar,

Your blog is great! Me and my son are having a blast going through it looking for projects and he got really excited about the robot.

Is there any chance of getting your Quadruped Robot source code mentioned in the top of the page? (gait & IK programming is a little beyond us.. so would be great to see the code)

Going to be exciting to build one with my son using your code!

Thanks!

2nd January 2014 - 4:04 am

I have to say, I see your design almost two days without sleep, I really love it, and I learn to do quadruped robot for my son .but i study to do it just now,i really want to get your help.tks

2nd January 2014 - 9:58 am

Of course, let me know if you have any question and I will try my best :-D

2nd January 2014 - 2:33 pm

thanks Mr. Oscar

Lilian

9th December 2013 - 12:44 pm

Hey oscar,
I have staretd the development of arduino based Quadruped robot for my college project.I initially started with the purchase of hardware like servo brackets,robot leg
and i purchased it at a very cheap cost compared to others.I purchaesd robot parts form
.I also bought the quadruped robot chasis for the same website .Its awesum and my full assembled robot is complete
and it looks perfect.Now i want to start with the programming of the same robot using arduino.I want to know which dimensional measurements of the robot to feed to the IK program
and if u can tell me according to your program which parameters i need to measure as per my chassis.If u show it in pictorial format i will be gratefu to u.

Thanks

9th December 2013 - 12:52 pm

please don’t spam my site! if you continue to spam with URLs, i will block you IP.

10th October 2013 - 12:46 pm

thanks Mr. Oscar,

we are working on quadrupped robot and we are done with the leg IK,i.e.finding Alpha ,beta ,gamma and we dont know how to get the body IK and relate it int full program…ur reply wil be appreciated

regards,
laximikant.

9th October 2013 - 5:25 am

hi Oscar,
can u please tell me the steps to be followed in coding a quadrupped…like wat i understood by reading previous post that we should first callibrate the servos…so wat is the stepwise implementation….

regards
laximikant

10th October 2013 - 11:23 am

1. decide on the frame, and then the servo, control board, battery…
2. assembling (servo + frame + electronics)
3. servo testing, make sure all servos are working as expected, and servo calibration.
4. implement Inverse Kinematics (IK)
5. with IK, you can implement body stretching (pitch, roll, yaw – moving center of body to all directions)
6. you can now try to implement gait

that’s all I have done so far, from here you can use your imagination, and do more advance stuff, like AI, object avoidance etc…

29th August 2013 - 8:21 am

Hi Oscar, Would it perhaps be possible to get an explanation on how your balancing works?
Would it perhaps also be possible for me to send you some emails asking you about how some of your functions work? Just drop me an email if it is.
Thanks a lot

27th August 2013 - 9:38 pm

Hi Oscar,

Here’s hoping you’re keeping well. I’ve spent hours in your hexapod code since my last post on here. Things are coming along nicely. I’m turning my attention to your BodyBalance() function now. I’ve got everything else working ok at this point. I’d really appreciate a little explanation on the BodyBalance function. For example, I don’t see how TotalBal is used to do anything useful in the code. Also, how is that Quad code coming along? Can we expect a release sometime soon?:) I’ve tried making monetary contributions to your cause, but unfortunately I don’t have credit card facilities at this point. Any suggestions in that regard are welcome.

Thank you Oscar, always appreciate your efforts.

Kind Regards,
Martin

19th August 2013 - 6:49 am

Hey, I got a ques plz
1-What is the torque of the servos? I’m using a 10 kg/cm^3 servos , is this torque enough?
2- Are u willing to attach a camera so that u can get a video stream or pictures? If yes, is it possible to use arduino for real time streaming? :/
3- I love ur robot’s legs :D did u make them urself? they are super nice, for me i’m planning to make the whole body on my own any advises? :D

19th August 2013 - 5:30 pm

Hi,
1. Those servos are hitec mg645. it’s about 9 kg/cm^3, but it’s already a over kill for this kind of robot.
2. Arduino can’t be used for video streaming (not even pictures), because it’s not powerful enough. You will need a separate system to handle that type of business, e.g. a smart phone, or raspberry pi.
3. those legs are actually very rubbish! it’s kinematically restrained. I am looking for a better design. You can DIY it, I would suggest 3D printing, it could save you a lot of time. or if you have a laser cutter, you can use some other stronger and cheap materials.

7th August 2013 - 10:24 pm

Hi Oscar, Is there any chance that you could post your source code?
I would like to see how you implemented the gaits.
Have you managed to get the creep gait to be able to not just walk in a straight line yet?

7th August 2013 - 11:19 pm

Yes! I will do that.
perhaps in a couple of weeks because i need to find the time to clean the code and add comments (so i don’t get blamed :( )

I haven’t looked into gait transition yet, but i will post the code before i do that so you don’t have to wait another year haha

5th August 2013 - 8:19 pm

Oscar, you’ve done an incredible job here! I’ve been most grateful for your comprehensive tutorials and other tips. I’m a final-year electronic engineering student and my Quad uses the Arduino Mega and an SSC32 servo controller. I’ve been converting somebody else’s hexapod code for use with a quaduped and the SSC32 but it has been rather problematic. I actually think they have used snippets of your code! Yours is that good:) Your hexapod code is seemingly more suitable for conversion and use in a quad with an SSC32. Are you sharing your quadruped code? I have a vision system which is taking plenty of my time to get working at the moment and would be keen to see how well it would integrate with your quad code. If not, I’ll continue wading through your hexapod code:) Thanks again, and keep up the great work!

Martin

7th August 2013 - 11:25 pm

Hi Martin, thanks for the kind words.
I can share the code with you that’s fine, I know how much it would help with your final year project because I had been there before myself!

i will email you to let you know.

regards
Oscar

12th August 2013 - 8:45 pm

Oscar, thank you kindly for that. I really appreciate it!

2nd September 2013 - 6:31 pm

Hi Oscar,

Kindly let me know when you receive my donation. Here’s hoping you’re well Oscar.

Regards,
Martin

4th September 2013 - 10:01 am

Hi Martin, thank you very much and yes I received your contribution!
I am currently working very hard on my second/third websites and not have much time spent on robots!
but should be back to it soon!

I hope you are doing well too.
Regards
Oscar

31st July 2013 - 12:01 am

Hello, first let me express my admiration for ur project, I really like it and i’m aiming to make a similar one as my graduation project with android app to control it + a camera for face detection,i have some question plz.
did u use a servo controller circuit or u plugged the servos directly to arduino mega? (this confuses me alot as i see other projects using a servo controller circuts that costs a fortune!)
where is the power source that u used? i’m not seeing any battery in the pics :D

31st July 2013 - 8:15 am

Thank you!
I connected everything directly to the Arduino Mega, but you will need external power source for the servos, so no servo controller is required.
Battery is a 6V NiMH Battery, it’s inside the body (under the arduino). You can also use LiPo, it’s lighter but less capacitance and more expensive.

14th July 2013 - 3:28 am

Your robot looks great! I am trying to modify your hexapod code to work with a quadruped as you have done here but I am seeing a difference between the two GaitCalculate functions. In your hexapod code you pass in a coor object called WalkLength and use the x y and z values determined by nunchuck. In your quadruped GaitCalculate you just directly use the walklength variable. Could you explain more how these two variants differ and why? Thanks for the help in advance and for sharing your awesome project!

14th July 2013 - 7:23 am

Thanks Brian!
that’s a good question. I am using WalkLength as a variable (literally just the z direction) because I still don’t know how to turn turn right or left during walking forward with this gait (creep gait), so I have ignore the x input (going right or left). How embarrassing…. ;-p

But for Trot Gait (the last video, or third video), I used the same the same WalkLength variable as the Hexapod (a coordinate).

So yea, WalkLenghth input should awlays be a coordinate… hope that make senses..

17th August 2013 - 1:57 pm

Hey Oscar,

After reading Brian’s comment regarding the variable WalkLength, and your comment about WalkLength always being a coordinate, I have a question.

I get an error “no match for ‘operator/’ ” when I leave WalkLength as a variable as follows:

GaitPos[LegIndex].Z = WalkLength/2;

However, when used as a coordinate:

GaitPos[LegIndex].Z = WalkLength.Z/2

Then I have no problems in terms of compiling. May I do this? I’m not sure what I’m missing since Brian didn’t seem to have a problem using WalkLength as a variable or a coordinate. All I have done is replaced the hexapod “GaitSelect” and “GaitCalculate” with your quadruped versions of those functions. Your assistance is appreciated as usual.

Kind Regards,
Martin

18th August 2013 - 12:14 pm

Hi Martin,

It depends on what variable you use to get the input.

If you declare “WalkLength” as int, you should be using
GaitPos[LegIndex].Z = WalkLength/2;

If you declare it as coor (a data type I define in a separate library file), then you should use this
GaitPos[LegIndex].Z = WalkLength.Z/2;

Yes, from the video I posted, I pretty much copied the code from the hexapod robot, so you are doing the same thing as I have done so far.
But there is something extra we should do with Quadruped robot. Because the COG (center of gravity) has to be inside of the tripod (formed by the 3 landing legs) before the other leg can lift. We need to have a function that makes sure of that, and tells the quadruped robot to shift the body toward that point to maintain balance.

Of course that could be the next step forward if you get the quadruped robot moving walking.

Regards
Oscar

4th July 2013 - 1:42 am

Hey Oscar,

Could you please post your entire source code for both of your gaits? That would be awesome! Thank you!

4th July 2013 - 2:58 am

I should’ve mentioned before. We are trying to make an autonomous quadruped for a senior project. We have been having a lot of issues with our project so far (like getting a properly stable frame, finding the right type of servo controller, etc) We solved these issues but now we are stuck on the gait with only a couple weeks left before our deadline. For now, we would appreciate it if we could get it to walk by typing commanding into the serial command window in the Arduino program. Is there any way that we can:
1) get you source code for the quadruped
2) get some helpful tips for how to use this code without having the nunchuck?
We greatly appreciate your help and how well organized your code is. Thank you

Jodgey

4th July 2013 - 3:11 am

PS… We are using an Arduino Uno

3rd July 2013 - 12:04 am

Could you post the code or the algorithm you use for walking.

or a bit explanation on how you choose angles.

I read your IK post but I don’t quit understand on how to apply them.

Thanks

3rd July 2013 - 9:03 am

i will reply on the other comment you sent me.

6th July 2013 - 3:45 pm

thank you.

28th June 2013 - 7:18 pm

Hey Oscar,