PDA

View Full Version : [Project] Twitch - My 3 Servo Hexapod



Gertlex
08-17-2012, 10:33 PM
I've been working on a new bot for the past couple of months. I finally conquered a software bug last night, and with no anticipated barriers to completion in the way now... I present this new bot, which I dub 'Twitch'! Before I blab on, here is the current level of progress:
4120

My inspiration is the TicTac6 robot by Amino-San (http://www.robots-dreams.com/2012/01/robot-competition-spawns-unique-new-designs-video.html). It uses 3 servos, moves quickly, and was an instant must-build when I saw the video back in January.

What I'm using:
-3 AX-12A servos
-2 Pololu Wixel MCUs with built-in wireless capabilities
-TriState Buffer board with a Sparkfun Level Converter to interface/power the Wixel and servos
-1050 mAh 3-S LiPo battery
-3-S LiPo battery monitor
-3D printed parts, bioloid brackets, 3/16" Delrin plate, .03" Polycarbonate sheet, etc.
-Arbotix Commander (modified to interface with a Wixel; documenting thread... (http://forums.trossenrobotics.com/showthread.php?5558-Pololu-s-Wixel-Arbotix-Commander-V2))

This is a prototype. I have no idea if the AX-12A is going to be strong enough, and I will likely end up building an MX-28T version of Twitch eventually. It will be interesting to see how much payload capacity it has. Were it to qualify for Mech Warfare (which it shouldn't), it'd probably need at least MX-64's to handle all of the guns/camera/scoring stuff.

So that initial picture... shows the three servos and the 4-bar linkage, actuated in the middle of one of the links that makes this configuration work. I still need to (finalize the) design and print the brackets (one of them is done and visible above) that will mount the "feet," as well as actually design the feet. My plan is to get software going, create a stand so the bot is off the ground, attach flimsy cardboard feet cutouts, and then figure out an optimal design from there. Test feet might be done from Delrin initially, and then get some polycarbonate (1/4" thick?) waterjetted/laser cut.

In addition to the inherent neatness of a capable 3 servo walker, I grant myself awesome points for the custom electronics setup. The Wixel is a cheap TI chip-based board (~45 MHz) with built in wireless communication (not compatible with xBees/zigbee/bluetooth/wifi). The Wixel plus interface board is nice and small. I've not seen a smaller setup that does both wireless and (hardware-based) Dynamixel communication... though I suspect Upgrayd has something like this in the pipeline.

The Wixel uses the SDCC toolchain for software. I modified Upgrayd's AVR Dynamixel libraries (with a bit of code from WebbotLib thrown in) in order to interface the Wixel with AX-12s. Took me a while to get it right (http://forum.pololu.com/viewtopic.php?f=30&t=5724). Work in progress code is on Github (https://github.com/erelson/wixel-sdk/tree/master/apps/wireless_serial_twitch).

With just three servos, I reckon the battery should be good for at least half an hour.

Other pictures: (click to embiggen)
411841194121

jwatte
08-18-2012, 01:29 PM
Isn't this an "unopod" rather than a "hexapod" then? It looks fun!

Gertlex
08-18-2012, 09:46 PM
What's an unopod? There nothing 'uno' about it :P Multiple of various things ;). That said, no idea what to refer to this kind of walker as.

Cire wanted to see the CAD for some reason. If nothing else, the perfect contrast of CAD will clue people into what the picture above is showing.
4122

jwatte
08-19-2012, 11:40 AM
"hexapod" means "six legged." Your things has... zero? one? two? "legs," so calling it a "hexapod" might be inaccurate. Although, from looking at the previous video there's six points of contact with the ground.
But you're right, it's hard to know what to call it. It looks cool, though!
Do you have a video of it walking/crawling/locomoting?

Gertlex
08-19-2012, 11:57 AM
I'm still working on code, and have yet to make the feet (in case you wondered). Currently learning a bit more about C to get around memory limitations (I guess) on the Wixel. Others have called it a hexapod, so I went with that. :) (There are other 3 servo hexapods using a different locomotion approach, too)

Gertlex
08-25-2012, 12:03 AM
Finally got within my memory limitations by not including the USB functionality. Only downside there is that the Wixel won't go into bootload mode with such a program. Easy to remedy, though; I added a button to the electronics that puts the Wixel in bootloader mode when pressed. I've now got a random gait that moves the servos. Now I just need to design and make the actual walking/turning gaits. For now I'll just do forward/backward/turn in place.

I 3D printed a housing for power switch + T connector that bolts onto an AX-12's case. The 0.03" polycarbonate battery holder in turn is attached to this housing. The inside is about 50% filled with epoxy.
4129
41304131

Gertlex
08-26-2012, 04:30 PM
This weekend's progress has been three-fold!

I made a stand for Twitch. A CD spindle is now reinforced by a 3D printed plug on the underside, has an adapter for Twitch at the top, and has corkboard epoxied to the bottom for weight/friction/strength.

41334135

I prototyped the crazy curvy legs with cardboard. Rather than try to do the feet in CAD, and make sure I have all the clearances right, I opted to use cardboard to prototype the legs. The cardboard is good to use while I develop the walking gaits... If I mess up, nothing important will break. I'll then use the cardboard as a guide in making actual parts in CAD, and get them cut by a waterjet... The first pic below is a good reminder of the clearances needed that necessitate the crazy leg shapes. I haven't done the straight feet on ends of the bot yet, but Twitch can stand on these cardboard legs...

(Click to embiggen)
41344136
4137

And software. I've now successfully ported Webbotlib's GaitRunner library to the Wixel, and can now use Gait Designer (http://webbot.org.uk/iPoint/44.page) to make poses/gaits. I figured out the rough sequences for the gaits on paper, and have successfully made an initial walking gait... Video!


http://www.youtube.com/watch?v=JZLdhr-IB9c

Suicidal.Banana
09-05-2012, 06:51 AM
Lookin good, i like how the legs 'cross', looks intriguing

Gertlex
09-09-2012, 11:07 PM
Twitch is functionally complete!

Video from last night:
https://www.youtube.com/watch?v=ka1bHdljBA0

https://www.youtube.com/watch?v=ka1bHdljBA0

The video features single-speed testing, basically. Works great on both carpet and linoleum. I experimented a short while ago with faster speed, and walking forward results in curved paths. This is easy to adjust; just need to make the gait slightly non-symmetric.

And details...

I finally got the code fully debugged yesterday morning. It was mostly an issue of getting all of the transitions between gaits - walking/turning/not moving - to be handled properly. A few bugs were simply forgetting to set a variable when changing gait. And debugging was done using a single LED (the center AX-12's LED, no less...). That was slow and tedious. But victory.

Once I had the code debugged, I started cutting out the legs from 3/32" black delrin. That took a few hours, but the result was perfect. I never used CAD for the legs' design. I ended up tracing the cardboard legs on graph paper, and then scanning the traces in. Imported the scans into Inkscape and make smooth vector curves, made sure I had the right size, and then printed out the templates. When I get later versions done, I'll just import the vectors into Solidworks.
4145

The end legs were stenciled on cardboard to size, traced with a knife on the plastic and cut. I then dremeled the sides of the top end down and tapered (hard to see...) these until they fit snugly in between 3D printed parts (this was not planned, but worked great!).
4146

The ridiculous legs mounted:
41474151

Literally just as I was finishing cleaning up after making the legs, the mail lady arrived with a package containing brass rods and shaft collars with which I replaced the loose bolts I was using. Prices on ebay were way better than McMaster-Carr...
4148

The final Wixel-board. I added another button for resetting, which allows me to keep the USB plugged in when testing. The other button gets me into bootloader mode... since I had to not include the USB libraries in my code due to memory limitations (I'm using 96% of whatever the equivalent of RAM is for MCU's; I've got plenty of space for more gaits, though...)
4149

I was originally going to use this rubber band to hold the battery in place, but that's proved unnecessary. Instead it works as a great way to pick Twitch up.
4150

Finally, a size comparison; I've got a definite incentive to make the feet hinged so that Twitch folds up to be more portable:
4152

kamondelious
09-09-2012, 11:15 PM
Awesome project and fantastic work!

:D

jwatte
09-10-2012, 12:34 AM
Yeah, mad props!

Suicidal.Banana
09-10-2012, 04:53 AM
Indeed, very cool! great to see it in action! :veryhappy:

Th232
09-10-2012, 07:30 PM
Looks great! If you've tried it yet, how does it go as the terrain gets rougher?

Gertlex
09-10-2012, 08:31 PM
Thanks for the compliments guys!

I've been experimenting with faster speeds, and correcting the gait for straightness. Alas, I need different gaits for different speeds, it seems... which is tedious to set up and manage. Increasing the stiffness of the curved legs might help with walking straight, as well. The low straight legs don't flex nearly as much.

At some point I'm now thinking of implementing continuous kinematics (for lack of better term) and using both joysticks simultaneously to control how much each side servo is rotating. This would allow for me to do curved walking, and correction of direction on the fly. That said, not sure I'll be driven to do kinematics in the near future :) (First I want to figure out better how WebbotLib's gait playing engine works; It's poorly documented and pretty much a black box in my code at the moment)

As for walking outdoors, I've not tried that yet. Will be interesting to see how that goes...

jwatte
09-10-2012, 10:45 PM
First: Is that really Delrin? It looks so shiny, like acrylic!

Second: Could you use one high and one low leg per side? It might balance better. Or not :-)

Gertlex
09-10-2012, 11:27 PM
All plastic looks shiny when it's flat and smooth :). Two ways I know it's delrin: I selected Delrin on McMaster, and it rarely melts when dremeling (much easier to work with!).

I'll have to try the leg swap. Thanks.

jwatte
09-11-2012, 11:59 AM
All plastic looks shiny when it's flat and smooth

I guess getting my materials on Amazon or as scrap from TAP Plastics has the draw-back that I never get it that smooth ;-)

Xevel
09-12-2012, 03:13 AM
Very cool beast! Congrats :)

Gertlex
09-12-2012, 09:15 AM
Thanks Xevel! Your USB2AX was a great help early on with debugging of getting the Wixel to talk to the Dynamixels :)

Gertlex
09-16-2012, 12:08 AM
I tried the leg swap as jwatte suggested. I think it helps? After tweaking gaits more, there are still asymmetries in the gait profiles, though. Weight's not perfectly centered, of course (should be damn close), which might be a culprit.

On topic of weight, Twitch weighs 625g, including battery. Now you know... ;)

Back on the topic of gaits... I figured I'd document the gait 'profiles' that I use. These are screencaps of Webbotlib's Gait Designer. Looking at these confirms that there's probably a bug in my code. Forwards/backwards are mirror images of each other, but I had problems reversing a single gait, last weekend (especially odd since reversing the turn gait(s) works fine). At the same time, I actually find I need different tweaks for forwards/backwards, so I might as well keep the separate gaits until such time as I do the kinematics control...
4153
Edit: Center/Right/Left refer to servos, if you hadn't guessed...

Gertlex
09-16-2012, 01:55 PM
Took Twitch outside for a bit today. Robots and sunshine!...

Walking in grass was pretty unsuccessful. The grass was rather dead, and somewhat tangled. If there's a twig in Twitch's way, that's insurmountable, as the twig is probably well anchored in grass tangles. Played a bit with walking on concrete (like a boss), and walking half on concrete, half on grass...

Still, should be doable. Slow walking speeds were more successful. Having the legs raise up higher would help too, for sure; currently the battery gets in the way. Additionally, I could see wedges on the feet beeing useful for pushing obstacles to the side/under, or for pushing the legs over obstacles.

A giant MX-28 version would be a solution, too :)

Xevel
10-06-2012, 09:39 PM
Hey Gertlex,

I was looking at your latest screenshots from the visualisation of the gait in PyDyPackets, and it seems to get along nicely :)

I noticed in the latest one (http://forums.trossenrobotics.com/gallery/showimage.php?i=4970&c=3) that you get discontinuities when you move the joysticks. How about adding a filter between the raw koystick input and the gait generation to smooth them out?

In my strange robots (like this one (http://www.youtube.com/watch?v=i2eifk2nh1o)) I usually add a filter that limits the first and second derivative of the input to ensure that I never ask for faster movements than the system can make. This helps a lot when you want to have repeatable movements, with no slipping.

Here is an example of an Arduino lib (http://trac.assembla.com/XD_DSbot/browser/tags/2010/Arduino/libs/Filters) I made for that: the "symetricQuadRamp" object takes as input the raw value and outputs a smoothed out version.

Gertlex
10-07-2012, 01:25 AM
Hi Xevel,

My laziness got the better of me... I ought to post updates about what you noticed ;)

Thanks for the example of the filtering approach! At present, the discontinuities are due to my using a scale factor after the servo positions have been determined from a gait... Which probably doesn't matter. The example code you linked seems simple enough, though I didn't follow fully the logic behind it (e.g. where the equations come from... use more comments ;) ). Since my Wixel is running at 97% full memory, I might have to do a cruder filtering approach. (e.g. store previous scaling, and don't change the scaling by more than e.g. 10% per step)

That all said, curved walking works! I'll hopefully shoot some new vid with better lighting in the near future, and write a real update then. Which reminds me... *checks camera* sonovacrap. My camera's video was set to QVGA @ 15FPS... I knew the last vid seemed particularly bad. Switched that to VGA @ 30FPS...

Xevel
10-07-2012, 01:01 PM
Thanks for the example of the filtering approach! At present, the discontinuities are due to my using a scale factor after the servo positions have been determined from a gait... Which probably doesn't matter. The example code you linked seems simple enough, though I didn't follow fully the logic behind it (e.g. where the equations come from... use more comments ;) ).

The logic might, indeed, not be apparent from the equations. The most cryptic ones are solutions to a quadratic equation (http://en.wikipedia.org/wiki/Quadratic_equation#Quadratic_formula). That's what you need to solve to effectively predict when you need to start slowing down to be able to reach the target point while respecting the acceleration limit.
That's one way of doing it, there are others, but they can easily result in overflows when performing the computation with the teeny tiny number types that exists on AVR... (32bit int and simple precision float).


Since my Wixel is running at 97% full memory, I might have to do a cruder filtering approach. (e.g. store previous scaling, and don't change the scaling by more than e.g. 10% per step)

That's, in effect, first derivative limitation. You get that in my implementation when the acceleration limit is not set (var_2nd_order = 0).



That all said, curved walking works! I'll hopefully shoot some new vid with better lighting in the near future, and write a real update then. Which reminds me... *checks camera* sonovacrap. My camera's video was set to QVGA @ 15FPS... I knew the last vid seemed particularly bad. Switched that to VGA @ 30FPS...

Looking forward to see this!

Gertlex
10-14-2012, 09:22 PM
So since the last update, I have:

Implemented variable speed (needs tuning/testing)
Curved walking (uses both joysticks simultaneously)
Wrote PyDyPackets (https://github.com/erelson/PyDyPackets) to debug and plot the commands being sent to servos
Switch to use sync-write (send one large packet to all servos) rather than sending individual packets for each servo.
More pics and video

Implementing sync-write costs a bit more memory, since I need to queue up bytes for all three servos. But it's definitely faster.

http://www.youtube.com/watch?v=Nm5BVLWxALs

http://www.youtube.com/watch?v=Nm5BVLWxALs

4222
42204221

jwatte
10-14-2012, 11:25 PM
As my son said: "Good-looking robot!"

Suicidal.Banana
10-16-2012, 03:51 AM
I agree! also nice job on the updated gates.

jwatte
10-16-2012, 01:55 PM
I agree! also nice job on the updated gates.

Isn't it "gaits" for walking?
"gates" are what I use to keep the whippersnappers off my lawn ;-)

gdubb2
10-16-2012, 02:16 PM
Naw.. BB guns are for whippersnappers, gates are for the missionarys, and gaits are for walking. (oh yeah.. 22's for cats)

:)

jwatte
10-18-2012, 09:49 PM
I've been thinking -- could this mechanism be turned into a biped? Center of mass needs to be within the area of the "foot" that hits the ground, but that's easily arranged with a big enough foot. Add some cut-outs to allow the thing to criss-cross the feet and you can always keep COG within the footprint.


4223


Comments?

Gertlex
10-18-2012, 10:03 PM
There are definitely bipeds that use this approach for the feet design. Even one-servo bots... but they only walk forward backwards ;)

I actually built one of these out of one of the cheaper Mindstorms kits. This is the design I followed...: http://www.miguelagullo.net/technicpuppy/biddk/bdabout.html

To more directly answer your question, I don't see why it wouldn't work :) Depending on how you do the feet, you might get less range of motion (especially in turning and curved walking).

You should make one and try to get it walking on snow :D

In fact, I reckon I shall try to do that with Twitch this winter... add some foot pads, and wait for some deep-ish but crunchy on top snow.

Gertlex
12-05-2012, 12:05 PM
Testing last weekend clocked Twitch covering 15 feet in 25 seconds, so about 180 mm/s, or 0.6 ft/s. There are still problems with walking straight, which I've not tackled, but I can compensate for this with the aforementioned curved walking implementation. Also turning is fast... a full 360 in 3 s.

I'm working on the MW version of Twitch... that'll get its own thread.

rebel
01-09-2013, 01:38 PM
I do not believe I never saw this guy before, on here. Very good work. Now I want one lol :P

Suicidal.Banana
01-11-2013, 06:04 AM
Congrats on becoming third in contest #9!

rpowers550
03-29-2013, 04:57 PM
Did you use one of the wixels to control the other wixel that was hooked up to the servos? Or did you control the robot using a laptop or smartphone?

Gertlex
03-29-2013, 07:42 PM
I used another Wixel to send bytes to the wixel on Twitch. This other Wixel was attached to my Arbotix Commander. Details here: http://forums.trossenrobotics.com/showthread.php?5558-Pololu-s-Wixel-Arbotix-Commander-V2

siempre.aprendiendo
03-31-2013, 02:51 AM
It's... it's amazing, wonderful!

Gertlex
07-15-2015, 10:04 PM
A few weekends ago, I felt like doing some math and figuring out the formula(s) describing the ideal servo positions for Twitch (and Twitch-likes). In this case, ideal refers to having Twitch move forward at a constant rate.

A diagram of sorts, sorta describing the problem (obviously these are notes for myself):
6091

So the answer turns out to be that the angle of the two feet servos is described by the inverse sine function (asin). The derivation of this is at the end of this post. In practice, the for range of motion that I use for the two foot servos on Twitch/TwitchMX -- about ±40 degrees (±0.7 radians) from center -- the asin function is fairly linear. This is shown below; annotated plot from Wolfram|Alpha.
6092

And Twitch's feet already sweep their range of angles in a linear manner as shown previously with my gait screenshots (http://forums.trossenrobotics.com/showthread.php?5637-Twitch-My-3-Servo-Hexapod&p=53086#post53086). So my initial "this looks about right" approach to the gait turned out to be a good approximation of the ideal.

In doing this work, I figured I might eventually end up with more efficient walking. Given my result above, I don't think improvements would be significant, so I'm unlikely to pursue this further. Still, yay math!

6090

kamondelious
07-16-2015, 12:09 AM
Awesome! Well done Sir.

jwatte
07-16-2015, 01:17 PM
Math is cool!