# Leg and Walking Kinematics

This topic is 4108 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi! I'd like to build a simulation of a walking robot. This is my current situation: * A robot with 4 legs (or even more - it shouldn't matter). * The end point of every leg is assumed to be a point (zero area). * There are always 3 legs on the ground. * The ground is flat. Using simple matrix multiplication and translation, I've been able to calculate the position of the leg endpoints. Now, is there any algorithm which enables me to determine... * on which three legs the robot is currently standing, and how he's standing (rotation / translation)? * how the robot moves when the legs move? Tubos

##### Share on other sites
The big question, like with any simulation or modeling relates to the accuracy you're trying to achieve.

If you're looking to have a nice looking simulation the process you'll follow will be slightly different to what you'll want if you're doing the simulation in preparation for the construction of a real robot.

As for a starting point, I think you're going to need to investigate collision detection and response. For collision detection tests on for the end of a leg vs. a plane you can probably get away with a dot product. As for responses, that depends on how you want to transfer linear and rotational forces & velocities back from the collision to the rest of the vehicle.

* The robocup community have a large number of AIBO simulators which might be worth checking out.
* If the accuracy of most of the physics side of things doesn't worry you, or you're in a hurry a rigid body physics engine like ODE might help.

An alternative approach more suitable for animation would be to hand tune one or more gaits (leg movement sequences) for your robot and just replay each when appropriate.

##### Share on other sites
The results of the simulation will be used for a real robot which is already constructed but needs to be programmed. The real robot has 6 legs, but I assume the mathematics are the same, no matter how many legs we have.

Quote:
 If the accuracy of most of the physics side of things doesn't worry you, or you're in a hurry a rigid body physics engine like ODE might help.
I already had a look into ODE, and tried to implement Ageia PhysX, but there were some problems with it. A physics engine is probably not right for this purpose, because I don't need any dynamics (gravity, friction, bounce, forces, whatsoever) - just kinematics.

Determining the position of the robot when all the leg positions are known should be a simple mathematical problem. There probably is some elegant algorithm out there, and that's what I'm searching for.

##### Share on other sites
The thing is you *do* need dynamics. You should represent each segment of your robot as a body in a physics engine like ODE. and represent the joints as hinge joints with a motor attached (do you see how this is very accurate?). Each motor can only apply so much torque to reach a specified angle, very much like the servos you are probably using on your robot.

Then, the physical bodys will collide with a ground object and create movement with the friction between the leg segments and the ground. And if you dont get it right, the simulation will fall over, just like the real thing. You can fake it (like you want to do), but the mathes will be complex to acheive very little. You might as well opt for full simulation and use an existing library.

##### Share on other sites
I see what you mean!
Indeed, that's how I wanted to do it initially, but after reading some posts on the Ageia PhysX board, I dropped the idea.
I'd have to constantly check if the motor has reached the desired angle, and if yes, switch it off. That check would have to happen very often so that the motors don't move too far. That way, it would never be possible to exactly reach a desired angle.
Based on what I know about the real robot, my guess is that I could model the servo motors more accurately if I assumed perfect behaviour. Afterwards, I could try to model the servo's inaccuracies (e.g. they have a maximum velocity without load and a maximum velocity with load).

I'll maybe implement both methods (physics engine vs. perfect kinematic behaviour) and see which one works better.

##### Share on other sites
ODE's (www.ode.org) motor model perfectly emmulates a servo, it has two inputs, a desired angular velocity and a max torque. You set the max torque to that of your servo's specifications and forget it. then you servo controller subtracts the current joint angle from the ideal joint angle and comes up with some joint error, translate this into a velocity, and set this to the second parameter of the motor. This all happens on that servo level, in your robot that happens inside the servo itself, so the connection between the physical simulation motor objects and the controller should be a virtual pwm connection just like on the real robot. So your virtual robot receives pwm inputs from the emulated robot control program, and drives the simulator.

##### Share on other sites
Sounds great, thanks for your help!
I'll have a look into ODE.

1. 1
2. 2
Rutin
21
3. 3
A4L
15
4. 4
5. 5

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633742
• Total Posts
3013630
×