Tag Archives: moteus

Making things walk – and failing

Now that I could stand up and sit down, I needed to be able to walk reliably for the length of a match.  This wasn’t going to be easy because the direct drive motors were always a bit marginal in their power output to support the full robot, so I had my work cut out for me.

The short story is, I tried many things, spent about a day examining high speed video of walking, and made some improvements:

  • Inverse Kinematics: I discovered that my inverse kinematics were broken when the coaxial lower leg had a non-unity belt drive ratio, which I switched to partway through my mammal leg experiments.
  • Less bounce: I updated the leg to stay in the world frame until it was fully lifted and to enter the world frame before lowering.  This would ensure it had zero lateral velocity relative to the ground when starting and stopping the swing phase.
  • More less bounce: I added a separate slew time for the lowering part of the phase, this allowed it to lower more slowly for a more gentle landing.
  • Event more less bounce: I used the moteus servo’s advanced features to lower the P controller term while the leg was lowering, so that it would hit more softly.

Despite all these improvements, the walking was still barely functional.  Also, the robot was just too tippy.  The servos didn’t have enough control authority for the mass of the machine, and it was likely going to tip over if another mech did so much as graze it.  Also servos that were hot for long periods of time kept having their encoder calibration drift.  This seemed to occur in a positive feedback cycle… if a motor was a little bit out of calibration, it might be a bit saggy, and thus would need more torque, which would make it hotter, which would make it more out of calibration.

Here’s a quick slow motion video of about the best walking gait I had achieved:

At this point, I was certainly somewhat dispirited.  It was pretty clear that this machine could not reliably walk around the arena for the length of a match.  But, there was still some time left and I figured I would not give up just quite yet.

In the spirit of failing upward, I decided to try and make a sprint towards a fully gearbox driven machine.  Granted, I didn’t really have enough time to pull this off.  The first 4 gearboxes I built each required about a day of 3d printing time and took me about 1.5 days of machining and assembly.  When I made this call, there were about 8 days before my plane flight to Maker Faire.  I would need to make at least 8 more gearboxes, as well as entirely new legs and shoulders, along with spares and then make it all work in an incredibly short period of time.

To be continued…

 

Standing up and sitting down

Before SMMB could function in the Mech Warfare event it needed to be able to start and stop unattended.  That meant standing up and sitting down on its own.  Being that hack that this was, I went for a two pronged approach.

The direct direct servos I have for the upper and lower legs are somewhat underpowered for this size of robot.  Especially so when the machine is fully squatting down.  Also, the servos aren’t really encapsulated at all, and there are plenty of leg configurations that can self-intersect resulting in robot harm.

To avoid all of that, I 1) installed a second pair of permanently affixed “resting legs”, that mean the robot never has to squat down all the way.  These are just some PVC pipe with squash balls glued on to the bottom.  I printed bottom plates for the chassis with small cutouts to hold the top of the PVC pipe.

dsc_2362

Next, I added a short startup and shutdown sequence.  The startup sequence first moves the motors from wherever they happen to be to some fixed distance above their intended idle position, purely on a servo-by-servo basis.  I don’t yet have position feedback making it into the C++ application, but the servos themselves can interpolate form their current position, so this was a fair way to get the whole thing into a known state.  The only trick was that I had to linearly ramp up the power applied to the lower leg so that it didn’t get stuck dragging along the ground.  A future solution that used position feedback, and thus IK, wouldn’t have that problem.  The next part of the startup sequence just smoothly lowers the legs until the full robot weight is resting on them.  At this point, the robot is freestanding.

The shutdown sequence only does half of the inverse.  It smoothly raises the legs until there is no weight on the robot, then cuts power.

Once I get a robot made fully with gearbox servos instead of direct drives, and positioning sensing working at full rate back into C++, I should be able to undo some of these hacks and get it starting from arbitrary configurations without the help of the resting feet.  However, this is good enough for now.

 

pre-charge circuit

Next up in Super Mega Microbot 2’s existence is being able to run untethered.  Before that can happen, I need to be able to plug in a battery, and hopefully not have everything explode.  As seen with the IMU junction board, even minor inductive links can result in chips getting toasted.  I had thought that just adding sufficient capacitance to each of the point-of-load converters would resolve the issue, but in fact that almost made it worse.

Thus, I built a simple pre-charge board that I could put in line with the main power.  It has two big FETs, one power resistor, an ATTiny44, and the random regulators and glue necessary to make it work.  The microcontroller has one job.  On power on, it waits a bit, energizes the “pre-charge” FET which has the power resistor in line.  Then, a short while later, it energizes the main FET through which all power will flow.

dsc_2319
The pre-charge board as back from MacroFab
dsc_2320
Wired up for testing

I did some minimal qualification testing first with a single motor which went fine.  Then I tested it against the whole quadruped, where I scoped the output ground line.  Here, you can see that the output ground line initially rises linearly with the ramp up rate of the lab supply I was using to test.  Then, about 80ms later after the ATTiny has powered on, it energizes the pre-charge FET and the output ground asymptotically approaches the resistance of the power resistor.  Then again, at 100ms after that, the main FET is engaged and the output ground voltage drops all the way to 0 (or close enough modulo the FET on-resistance).

precharge_whole_robot_startup

After that, all that was left was to try it with a real battery:

 

Spoiler alert: It didn’t smoke.

 

rpi3 interface board

Now that I have a chassis that can walk a little bit, I need to get the onboard computer working.  To do that, I needed to update the raspberry pi 3 daughterboard I built for the previous turret for the new bus voltage and communication format.

The rpi3’s UART is incapable of controlling the direction line on the RS485 transceiver, so I added a small STM32 micro in line to control the transmit / receive direction.  It adds a little bit of latency, but testing the firmware I was able to get it down to only a byte’s worth or so.

Here’s a quick render:

rpi3_hat_r2

And a shot of the actual board:

dsc_1703

Unfortunately, I managed to omit a necessary pullup on the enable line of the primary buck converter.  To get things moving along, I blue-wired it under the microscope:

dsc_1710dsc_1707

And here’s a shot of it installed on the rpi3 b+:

dsc_1716

Sources:

First walking with gearbox chassis

Short recap: After building the quadruped with near-direct drive motors, I discovered that the lateral servos had insufficient position control authority to keep the robot standing up.  Thus I embarked on a now month long quest to design and build an integrated planetary gearbox.  At this point, I have enough gearboxes built for all the lateral servos, so it should be able to walk, right?

And tada!  It can!  Well, at least a little bit.  I’ve only spent a short while with the gearbox based chassis, and have a lot of work left to do.  However, here’s a quick video showing it walking around, slipping on a ruler, and almost falling over a few times.

 

Wiring up the gearbox chassis

Now that I had a set of 4 at least minimally working lateral servos, I needed to wire up the chassis so that everything had power and data.  Here are some pictures of that process:

dsc_2285
Two legs installed
dsc_2287
Four legs installed
dsc_2290
Joint cable routing
dsc_2292
Times four
dsc_2293
Suspended from the test fixture
dsc_2296
Four sets of busbars, the junction board, and a shore power battery simulator

Next up is making it do something!

Lateral servo gearbox build(s)

After completing one gearbox, I needed to build at least 4 more of them to replace the lateral servos on Super Mega Microbot (2).  So, I got to work.  First, I disassembled 5 more BE8108 motors.

dsc_2140

Then, I drilled out the rotors, this time using the mill at AA.

dsc_2145

Next I removed the stators from their backing.  This was painful enough last time, that I tried a new technique using the mill to do most of the work.  Unfortunately, one of the stators was critically damaged during my initial experimentation.  So, now down to 4 survivors.

4 good stators, one casualty, and their detritus
4 good stators, one casualty, and some detritus

I went and printed 5 copies of all the printed parts:

dsc_2146

And turned down some more internal gears:

dsc_2147

Then, I started assembling!

All the parts laid out
All the parts laid out for one servo
dsc_2173
Inserts in back plate
dsc_2174
Output bearing and internal gear installed
dsc_2177
Outer housing fastened
dsc_2182
Output shaft bearing installed in planet output
dsc_2185
Planet output in front housing
dsc_2189
Sun gear in holder, mounted on rotor
dsc_2191
Planets assembled with spacer and bearing
dsc_2193
Input bearing pressed into planet input
dsc_2197
Planets and shafts in planet output
dsc_2204
Planet input and stator installed
dsc_2206
Rotor installed
dsc_2209
Back housing test fit
Repeated 3 more times!
Repeat until I have 4!

 

Rebuild of gearbox assembly

After finally getting the darned thing apart, and printing a new outer housing, I went about re-assembling the whole mechanism.  This time, I tried to take care to make the future disassembly less painful.

To start with, I filed down the problematic outer bearing interfaces of the sun gear holder so that the bearings were a slip fit over them.  These two interfaces don’t need to be particularly snug, so that was easy enough, if monotonous, to accomplish.  I also machined out a some pockets around the magnet hole, to make it possible to just hot-glue the position magnet in place and more easily extract it.

Next, I re-installed the sun gear holder back in the rotor.

After that, I pressed the input bearing into the new planet input:

Input bearing in planet input

Then I went about installing the shaft output bearing into the planet output, the planet output into the output bearing, the planet shafts into the planet output, the planet bushings into the planets, and the planet bearings into the bushings.

Planet output and planet gears partially assembled

Those got dropped onto the shafts, and the planet input was stuck into place.

Planet input partially assembled

After that, the screws were installed in the planet input, and the stator was fit onto the front housing, using a shrink fit again:

dsc_2077

At this point, I aligned the rotor and pressed it and the primary shaft into place.

Rotor installed

Now I used my paper strip alignment technique to get the rotor properly (or at least functionally) spaced from the stator.

Aligning the rotor

At this point, the rotor still didn’t spin freely.  Because of all the rework I’ve done, and my sloppiness in executing it, bits of the exploded bearings and other detritus had lodged themselves against the rotor and stator.  The problematic pieces were small, sub 5 thousandths, but still plenty enough to cause the rotor to hang when spinning.  These I carefully extracted under a microscope with a pair of tweezers.

Extracting !@# from the rotor

At this point, I had a gearbox that spun freely and seemed mostly correct!

Rotor removal, and complete disassembly

So, last time I had a functioning gear-train, I just needed to disassemble everything in order to replace the outer housing.  As I was putting things together, I realized that several custom fixtures would likely be needed in order to disassemble various parts cleanly.  Here, I made a giant 3D printed cylinder that the front housing and planet output would bolt to, and then the central shaft could be pressed out.

Rotor removal fixture
Rotor removal fixture

I somewhat skimped on the printing… even at 25% infill it took something like 14 hours, however the shaft should be relatively easy to extract since it is only held via a mild press fit with the output shaft bearing.  Or at least, it would have been had my mild press fit not ended up being tighter than desired, and had retaining compound not seeped over there.

My first attempt at removal just resulted in my carefully constructed fixture delaminating and the entire planet output and output bearing pushing into the assembly.  The shaft didn’t budge at all on the shaft output bearing.  Then, rather than wait for an even longer print, I installed all the washers on each of the bolts to better distribute the load across the fixture.  At that point, removal was accomplished…. kinda.  The fixture didn’t fail this time, but the planet input in the gearbox shredded.  Fortunately, that was enough to remove the rotor.  I could just print a new planet input, and toss the shaft which now appeared very well welded to its bearing.

Output shaft and bearing
Output shaft and bearing… note the green retaining compound everywhere

 

Rest of the disassembly

At this point, the rotor was removed from the stator, but there was still a fractional planet input attached to it, with the planet input bearing very securely fastened to the sun gear holder, and the rotor bearing, even more securely fastened to the sun gear holder.

First, I shredded the planet input with a pair of pliers.

dsc_2066
Planet input, er… disassembled

Then, I was able to get the input bearing off by cooling down the sun gear holder with the compressed air again.

However, the rotor bearing was too well pressed on to achieve that.  So I ground it off with a cutoff wheel, after trying a few other things first.  At this point, I was finally able to remove the sun gear holder from the rotor, and call my disassembly, as it were, complete!

Rotor bearing removed
Rotor bearing removed

Rotor and stator alignment

Last time I covered getting to the point of having the rotor installed into the gearbox.  Here we’ll look at making it actually work in that configuration.

When I first got the rotor in place, it was clearly not centered properly.  Although much closer than in the plastic gearbox, it did interfere with the stator during a portion of a revolution.  The first obvious problem was that the primary shaft wasn’t making it all the way through the front shaft bearing.  That should have been an easy fix, but for two different very annoying reasons.

Reason 1

When I made the sun gear holder, one of the tweaks I made during my 3d printed iterations was to leave a hole where you could press on the primary shaft.  That was intended to be used to install it all the way into the output bearing.  Unfortunately, that hole is behind the position sensing magnet.  The one that I superglued in place last time overly eagerly.

That magnet has a recess in the sun gear holder which nearly exactly encloses it, with maybe only a few thousandths around it in all directions.  There was no way to grip the magnet at all.  I tried soaking the junction in acetone for some time, I tried using the heat gun, and in the process ruined the 3d printed outer housing, but none of those loosened it up enough to allow another magnet to retrieve it.

Eventually I pressed on the primary shaft from the front of the motor, and used that to pop out the position sensing magnet.

Reason 2

Now that I had the magnet off, I could press the shaft back into place.  Or at least I should have been able to.  I made it into the output bearing, but then the pressing became inordinately difficult.  I think even more so than in any of my test fits.  This may have had two causes… one is that I was using a dowel for the main shaft which is slightly oversized, and second the retaining compound had seeped around into the interior of the bearing, and fractionally cured.  Those combined made it both really hard to push the shaft in, and as I later discovered, impossible to press out.

Aligning the rotor and stator

At this point, I had the rotor installed seemingly properly, and it still was interfering with the stator.  After much experimentation, including partially exploding the rotor bearing on the sun gear holder, I arrived at a technique that allowed me to align them properly and simultaneously discovered that my intended mechanism for registering the rotor to the sun gear holder was, at the least, sub-optimal.

The sun gear holder has 4 M3 flat head bolts which fasten it to the rotor.  I had oversized those holes to 3.1mm, and put tapered countersinks on each.  I had planned on the countersinks forcing the rotor to be centered.  However, it didn’t look like that was working as I had expected.  Each time I would loosen up the bolts and re-tighten them, the rotor would interfere with the stator in a different way.  Eventually, I was able to center them by sliding slips of paper all around the stator between it and the rotor, then tightening the bolts down.

Rotor paper alignment
Rotor paper alignment

Then I spent a few hours, painstakingly under the microscope, picking out grains of steel that had managed to find their way to the rotor, most likely from when I partially exploded the rotor bearing.

Success?

At this point, the rotor did seem to be aligned properly to the stator, everything moved freely, and the gearbox worked as expected.  I just need to disassemble everything in order to install a new outer housing to replace the one I destroyed while attempting to remove the position sensing magnet.  That is its own story, for next time.