(inverse)-kinematics

My brain’s getting itself in gear to make my Hexy do some awesome things, but I don’t have any experience programming robots. I’m hoping that my Engineering Mechanics/ Dynamics lectures should suffice to walk me through the kinematic side of things (determining where limbs/feet will be for a given set of control inputs), but I’m going into totally new ground with inverse-kinematics (determining the control inputs necessary for a given position of limb/foot).

Two branches here then:
Kinematics
[ul]
[]What are the centres of rotation for the “hips” of a Hexy (ideally from an obvious point on the body) in Cartesian co-ordinates (in mm if possible)?[/]
[]How long are each of the sections of the legs (from centre of rotation to centre of rotation)?[/]
[]What have I forgotten to ask regarding making a kinematic model of a Hexy?[/]
[/ul]
Inverse-Kinematics
[ul]
[]What are good online resources for learning about inverse-kinematics?[/]
[]Does anyone have any clever ideas for algorithms to determine an exact solution to the problem, given the non-trivial nature of this beastie?[/]
[]What have I forgotten to ask regarding making an inverse-kinematic model of a Hexy?[/]
[/ul]

I was going to take a relatively simple approach by using this simple example for the ankle and knee http://www.openprocessing.org/sketch/553. This will place the foot in a plane of x & z dimensions (or y & z depending on how you view the hexapod I guess). Then all you have to do is calculate the angle for the hip (using atan) to place in the y (or x) dimension.

If you play with the simple model from the URL above you get a sense of how the restricted movement of the servos (say ± 80degrees) will limit the points that the foot can reach. i.e. in the plane defined by x & z you will loose a lot of freedom to hit points in the upper right and lower left quadrants. However I think I only care about the lower left quadrant for placing a foot accurately.

This I believe will be a good enough approach to get hexy moving about using inverse kinematics…

Like the original post requested it would be good to get accurate dimensions for the legs and centers of rotations.
Could someone at arcbotics deliver these?

As for dimensions, I believe the STL files are available on Github. With Meshlab you can make fairly accurate measurements
of the dimensions you want. I’ve used calipers on my hexy and matched up well with the STL files (to within ~0.2 mm, if that’s good enough for what you need). If all else fails, it looks like Github (github.com/ArcBotics/Hexy) also has CAD files,
although they may not be compatible with your specific CAD software. A CAD package should be able to pull any dimension you want from the files.

I’ve made my first steps along the road to getting some Inverse-Kinematics going for Hexy (credit for the closed-form solution goes to one of my work colleagues with a giant space brain). I’ve written a post here. Not yet implemented this in a Hexy controller, but it looks like we’re snowed in this weekend, so I’ve got time to fiddle :slight_smile:

The approach I’ve been mulling around is to port the Phoenix Hexapod code over to either Servotor or a standalone library in either C, Objective-C (for iOS) or JavaScript (which I would use with Node and/or Phonegap)…

Phoenix already has all the complex maths figure out and seems to allow you to define parameters such as leg position, segment lengths and so-forth…

Might be worth exploring.

This is my first walker, does anyone put swiches on the bottom of the feet? It seems like that would be a handy way to smooth the gait and would make a nice don’t walk off the ledge safety amongst other things…

I am working on pressure sensors on the feet to be able to walk anywhere.
For this im still waiting for the 2nd batch of my metal gear servos and im allready working on the arduino code for it to walk around using the ping sensor.

Ok, so after finishing my hexy and playing with him yesterday, today I sat down to do some kinematics.

I measured the pieces in the shape files and came up with the following measurements.

There’s a tool for Windows called RoboAnalyzer that I used to play around with the values.

The Denavit-Hartenberg parameters for the arm are as follows:

And the details for the inverse kinematics screen are:

I’ve implemented the IK solution (in a Python PoMoCo move) for the lower two leg joints and taken some measurements here. Problem seems to be with non-linear servo positioning, perhaps this could be calibrated out?

Given this success I’m pretty confident that you can get a closed form solution for positioning the whole leg, given that the hip joint is orthogonal to the other two servos. My interest here is a learning perspective, so I’m keen to get to these answers from first principles. How’s anyone else doing implementing some IK control?

I rather pleased to say that I have finished my (initial) IK code project. I’ll write it up shortly and post the maths and code for people to get their teeth into. What this enables is placement of the feet into any position as defined in a hexy-body centric co-ordinate system. I’ve added some code to allow Hexy to move his body in the x, y and z directions about a fixed set of feet positions on the ground. I haven’t gotten around to including any body rotation yet, but this is just some 3D co-ordinate transforms.

All of these functions are currently in a Moves file, rather than having the functions built into the robot.py hexapod class. A project for another day I feel.

As promised methodology, maths and Python code available here.

Apologies for the delay! Enjoy all.

We will thx, cant wait to see your hexy write stuff with its pen :slight_smile:

Well, it’s taken until the night before I go to the Big Bang Fair, but I’ve push my code commit to GitHub, which should be available for everyone to play with. The new PoMoCo_demo.py has a minimal interface and (most of) the buttons use the IK code to move Hexy about.

I’ll get some media sorted and write this up into a blog post, with pictures and videos. But in the mean time, please grab and have a play. If you follow my post about getting Hexy to hold a pen, you too can have a cute little Hexapod that can write you lovely messages :smiley:

The only thing i want to ask you rob is how do you calibrate your servos on the new demo, do i do it in the old pomoco interface and save the config?

Absolutely. Given that the code uses all the same back-end as the “regular” PoMoCo, the same calibration is used in both. In fact, if you’ve taken this source and made a new folder, you can just copy your config file from the “regular” PoMoCo folder to this one and it should work just fine.

Interesting note, tried running Hexy from an AC power supply today at the Big Bang Fair and the movements seemed much “jumpier” than with NiMH batteries. Haven’t had time to have a think about why this is yet.

Whas it 6v, i got the same thing, movments where really fast.

I bought this AC supply: 5V @ 5A.

My evaluation of the writing code has been done with a set of 4 NiMH batteries. Will post some videos this week some time.

Blog post written up. Evidence that Hexy can write*

*he can’t write well, but he’s still young!

Hi all,

I just finished full 6-DoF inverse kinematics calculation of Hexy and implemented it in a new controller. Check my YouTube videos.

6-DoF body movement with standstill legs:
http://youtu.be/9-ewi55IAok

Walking Hexy with variable direction and movement speed:
http://youtu.be/HY9GTwi_fS4

Slow-motion walk:
http://youtu.be/aAss6WfLKzs

Enjoy!

Um… holy shit. That’s awesome! I wish I had more time to do this stuff instead of just making and shipping the things!

Do you have your code online? I see you’re using a 9V battery, so I presume this was done over bluetooth and thus you were doing python code?