Results tagged “legs”

Where are we?

Once the servo controller code was feature complete I switched to looking at the hardware side of things and thinking about the next stage, the servo sequencing.

From a hardware point of view I had several things to work on. Firstly I needed to get the servo controller and I/O multiplexor chips off of a breadboard and onto something a little more permanent. Since I still find building things with perfboard a little hard I decided to build the controller itself on one board and build separate daughter boards for the I/O multiplexing. This should mean that I can replace the parts separately as long as the connections required remain the same. I decided that each I/O daughter board could contain 2 CD74HCT238E's with some header pins for each of the 16 output channels, 3 pins for the address selection lines and 2 more for the signal lines. I deliberately left off the power and ground pins for the servos as these really didn't work well on the perfboard. The power and ground pins are connected in one direction and the IC to servo control connections are in another direction; without some fairly hairy board trace cutting and cross soldering doing both on a single perfboard would have been impossible. My solution was to build yet another separate board from a different style of perfboard for the servo power and ground connections; this was just two long strips of headers connected as two buses.  The servo connectors themselves are then used to physically hold the two boards together. This has another advantage for me in that it will allow me to reuse the I/O board with a more complex power and ground supply board if I decide to investigate the servo torque feedback idea some more (this may require monitoring each of the servo power lines and so would require a different style of power supply board).

Here are some pictures of the resulting boards.
IOBoard.png
IOAndPower.pngIOBoardUnderside.png
I now need to build another I/O board and I'll have 32 PWM channels for my servos. 

The servo controller itself ended up being on a board which could probably be used for all manner of ATMega projects. The board contains header pins for the I/O lines that I need, a reset button, a socketed crystal, power buses and an ISP programming header. About the only thing that's been specially done for the servo controller application is the fact that the I/O multiplexor address lines have 4 banks of headers broken out so that I can connect multiple I/O boards to the servo board easily. The board is pretty much complete and works well; I'm especially pleased with the ISP header as it was quite tricky to fit onto the board due to the connections required. All that's currently missing are the caps on the clock lines, but the board works pretty well without them and they're currently on order and there's space on the board for them. Note that a slight physical design error meant that the single power and ground pins that I had intended to use were in the way of the ISP plug. I cut those off and replaces them with the longer header strips which work better as they give me somewhere else to get a power or ground connection from...
ServoControllerBoard.png
Once all of this was done I tested things and then swapped out my Max232 board for the Sparkfun regulated XBee breakout board and connected the XBee in place of the hard wired RS232 connection. This worked well and left me with a set of boards that only required a power line to tether them; the battery system is on my list of things to work out. Unfortunately I managed to brick one of my XBee's. I'm still not quite sure what happened but I think it could have been either a spike on the 5v power line or a 5v splash onto the XBee TX line. The Sparkfun board regulates the 5v supply to the 3.3v required by the XBee and uses a diode to drop some voltage on the RX line so that the 5v TTL logic line from the ATMega is dropped to be within the tolerances of the 3.3v logic required by the XBee but it leaves the TX line unprotected (the 3.3v logic levels of the XBee are enough to register as valid levels for the 5v side of the circuit but if 5v were applied to it then it would cause problems...). Ideally I'd like to put together a more robustly protected circuit with level shifting on both RX and TX lines but right now I don't quite know how to do that (even the AdaFruit XBee board only level shifts the input lines and leaves the output lines vulnerable). I expect I'll use the Sparkfun level converter board when I get a replacement XBee.

With my electronics off of my breadboard I began working on the servo sequencer. This will deal with moving the servos in sequence to create various walking gaits. Once I'd played with a simple sequencer I decided that I needed to solve the 'hip joint' problem once and for all and then build more legs; after all,sequencing a single leg isn't that much fun.

The prototype leg that I built way back at the start of this project has always been weak as far as the hip joint is concerned. The need to connect two servos at right angles using only a piece of plastic window board creates many problems. My experiments with using metal brackets made from Mecanno failed as the pieces I had were insufficient to hold the servos correctly. Unfortunately I don't currently have access to the custom machining facilities that this guy has access to, so custom aluminium parts are out of the question. In the end I spent a lot of time with a craft knife and pieces of window board and eventually came up with a design that seems to work; at the very least it's stronger and more reliable than the original leg. The design is based on the custom aluminium pieces from the A-Pod hexapod. I expect it will still change somewhat but it's enough for me to move forward...
Legv3.0.png
I now have 6 Hitec HS-645MG servos on order along with a couple more XBee radios and a few more bits and pieces. The plan is to build two legs with the new servos and get the sequencer working. Once I get to this point I should be able to purchase more servos, carve more legs and move to a full six legs. Perhaps this hexapod project will actually have a hexapod before we reach our one year anniversary in April.

Prototype fabrication

As I mentioned back in April after I'd put together my first prototype leg, "the prototype leg has some fairly major failings from a mechanical point of view". Ideally the real legs will be designed and cut from sheet material, either plastic or metal. Getting to that point is going to take some time though and right now I haven't been able to locate a UK based laser cutting service at an affordable price. Anyway, before I get to the point where I can start fabricating the real legs I thought it would be useful to get myself some materials to enable me to prototype the robot's chassis and legs. The Meccano Special Edition Mechanical Workshop set seems to have enough parts for me to get started on bolting together some brackets for the servos and, hopefully moving the mechanical side of things along a little. We'll see. Perhaps I'll just sit around making the models instead :)

Once more with feeling

Having decided that the graduated servo positioning method was the way to go to allow for leg sensors to work correctly I started thinking about leg sensors.

Here's a new lower leg with three switches, one on the foot, one to the inside of the leg and one to the outside of the leg.  ProtoLegv02-1.png
ProtoLegv02-2.png
Ideally the front and back switches would be extended with thin metal bars running the length of the leg and fixed just above the ankle. There should also be two more switches to spot obstructions to the left and right. This would give feedback on the full range of motion of the lower leg.

For now, three switches are enough. The foot switch can detect if we're touching the ground and the other two can be used to ensure that we cater for multiple switches per leg (I can see we'll need to multiplex these into whatever chip we have dealing with the sensors or we'll need  30 inputs just for a set of 5 switch legs).

The next thing to do is to move the 'fine control of movement' code out of the Windows Leg Controller app and into the Arduino. The Windows app will then send the required end servo positions to the Arduino which will deal with breaking this down into a sequence of moves and send those to the servo controller whilst monitoring the switches. If a switch triggers then we can stop straight away. If we get to the end and the foot switch hasn't triggered then we know that the leg isn't grounded...

Meanwhile the Leg Controller can be adjusted to deal with the inverse kinematics issues so that we can initially feed into the GUI to move the foot to X,Y,Z and have it calculate the appropriate servo angles required. 

More thoughts on the proto leg

I adjusted my quick and dirty servo controller program to calculate the number of moves required for the servo that needed to move furthest and then spread the movement of the other servos across the same number of moves. So, given that the servo controller works in terms on a position from 0 - 254 where 0 is full left and 254 is full right and we have three servos that make up the leg I look at the differences between where the three servos are now and where they will be at the end of the move and then build a sequence of moves to get from here to there.

For example, if we're currently at 10, 20, 30 and we need to move to 30, 30, 30 then the second servo would move once for every two moves of the first servo and the third servo wouldn't move at all. The sequence being (10, 20, 30), (11, 20, 30), (12, 21, 30), etc. rather than simply (10, 20, 30), (30, 30, 30)... This works well and makes the movement much smoother. 

Of course, once I had that working I realised that things MUST work that way to allow for sensors on the legs to have any affect at all. If we just said move to 30,30,30 and the leg hit an obstruction halfway through the movement then even if we had a sensor that triggered when we hit the obstruction we wouldn't be able to do much about it as we a) wouldn't know where the servos were at the point at which we touched the obstruction and b) couldn't stop the servos in time to avoid potentially damaging them. With the smoothed sequence of moves we would, hopefully, get feedback in time to stop the servos and move them back a couple of steps in the sequence to hopefully take the pressure off. We'd also know where we were and so could plan accordingly from this point on.

Unfortunately firing lots of servo commands into the servo Pololu controller caused me some problems. The controller would randomly misread the commands and/or crash. Disconnecting the power supply from the motors fixed the problem so I guess the rapid commands to the motors was causing noise on the power supply (which is currently shared between the electronics and the motors) which was causing something to malfunction. Looks like the servos will need their own power supply sooner than I was expecting... 

Thoughts on the proto leg

The prototype leg has some fairly major failings from a mechanical point of view. The only part that may eventually find its way into a weight bearing leg is the lower leg where the cut out around the knee servo provides ample support for the servo itself and also a suitable mounting point for the servo. The hip servos need much more support before they could be used to form a weight bearing leg either in the form of metal brackets or more complexly cut board. I expect that, at some point, I'll need to fabricate some metal brackets that have a bearing on the back, opposite the servo horn so that the servo's shaft doesn't need to take the weight of the leg and/or body. Ideally the skeleton of the leg should be self supporting with the servos needed only to move and hold positions.

Lynxmotion produces a 'servo erector set' (details here) which are brackets for standard sized servos that allow you to put together limbs and other contraptions with relative ease. I can see that the main issue with wanting to build my hexapod from scratch is initially not going to be working out how to design the various pieces that I need but actually fabricating them. There's a nice set of custom machined aluminium brackets on show here. I wonder how hard it is to get that kind of thing made for you in the UK...  

Anyway, I'm a fair way off from needing such things. The next thing on my list of things to do is to build the custom servo controller electronics and firmware. What became immediately apparent from using my quick and dirty servo controller program is that the sequences of servo moves that need to be made to move a limb from one position to another need to be blended so that all of the servos that are taking part can be moved at their own speed. My controller can easily send the three servos a set of position changing commands to move the foot from point A in space to point B in space but the end position, whilst important, isn't all that there is to it. If each of the servos has to move a different distance and you just tell them all where you'd like them to end up then they'll all complete their movement at different times. This works, but is rather, well, robotic to watch. I immediately decided that the controller should allow me to input the 'key frames' on a movement sequence and then be able to work out the intermediate points to move the servos along the way. Rather than using a single command to move each server from A to B I need a sequence of timed commands that move from A to B via a1, a2, etc. where the sequence for servo 2 takes into consideration the number of 'time slots' that it will take servo 1 and servo 3 to compete their moves. Taking this one step further and scaling to multiple legs the blending could be continued between legs to convert a synchronised, robotic, tripod gait into a much more natural 'ripple'. If the servo controller were to be doing this blending in real time then it could add an element of randomness into it which would probably result in an even more realistic movement (or something horrible). Interestingly this seems to be similar to the approach taken by the guys at Lynxmotion with their SEQ-01 servo sequencer product; so at least I seem to be thinking along the right lines.

Then there's the whole question of where to move the foot to and how knowing that position in 3d space we can calculate the required positions of each of the servos that make up the leg. That's where inverse kinematics comes in; see here for the details and the maths.

Prototype leg v0.1

I spent a little time at the weekend putting together my three servos into a prototype leg. The idea is that this very quick and very dirty little experiment should give me some more avenues to explore; and something to show people.

I had originally planned to build the leg out of wood, perhaps thin plywood, but I didn't have any laying around so instead I used some plastic window board which is relatively light and strong. This was easy to machine (cut with either a hacksaw or a hobby knife) and easy to drill with a drill bit in a hand driver. The results are indeed just as quick and dirty as I was expecting. 

ProtoLegv01.png
As you can see I cut a slot in the lower leg to mount the knee servo, I also shaped the lower leg so that the foot was small. The knee servo's "horn" is then screwed on to the thigh (which I didn't bother to shape at all) and once that's done the servo horn and thigh can be connected to the knee servo. The other end of the thigh has another servo horn fitted, this time on the other side (this is less than ideal from a mechanical point of view but allows for more mistakes whilst controlling the servos as the lower leg can't impact on the hip servo). The top of the thigh is then attached to one of the hip servos. The two servos that form the hip are currently screwed on to a small piece of plastic board, it's not very clever but it just about holds the two motors in the right place (with the addition of an elastic band or two) to allow for the correct three degrees of movement that I wanted. The two hip servos are set at right angles to each other to give rotation in two planes. The result isn't especially sturdy and probably couldn't take a great deal of weight but is enough for now. It is, after all, just a quick and dirty prototype...

After connecting the servos to the servo controller I threw together a matching quick and dirty C++ application to allow me to send servo control messages to the controller. This allows me to experiment with the movement available by setting each of the servos to particular positions. The controller also allows me to record a series of positions and then replay them to the controller. This results in very simple movement as can be seen from the video below...

1