Tag Archives: quada0

moteus servo mk2

As described in my roadmap, making a new revision of the moteus servo is up there on my list of things to do.  The initial servos were a work of art, yes, but also pretty fragile, very labor intensive, and still not all that robust.  My goals this time around are:

  • Manufacturability: The servo mk1 took about 2 or 3 man-days of manufacturing time per servo once all the steps were factored in.  I’d like to get that down to an hour or two at most per servo.
  • Robustness: The planet input, outer housing, back housing, and controller cover of the mk1 servo were 3d printed, mostly to save cost and time.  This necessitated adding reinforcing rings on the outer housing, as it is nearly impossible to 3d print something with the required material properties in a single print.  At this point, all of these components should just be made of aluminum like the others.
  • Repairability: Once the mk1 was assembled, there was no way to disassemble it, as installing the stator interfered with the ability to remove the outer housing, and the outer housing in place interfered with the ability to remove the stator.
  • Convenience: The mk1 servo used the r3.1 moteus controller, which had RS485 connectors sticking straight out the back, and bare power wires coming out the back.  That orientation for connecting things was not terribly convenient in the full rotation leg design, and required making extension cables.  The newer moteus controller has the connectors sticking out the bottom, so the servo needs to accommodate that.

CAD explosion

CAD rendering

Changes in moteus servo mk2

The current design for the moteus servo mk2, as the exploded video above shows, has a number of changes.

First, the outer housing has been changed to be purely cylindrical.  This allows it to be machined out of round tube stock, and also assembled and removed in any order.  Thus the front housing now has a slightly larger outer diameter, and has threaded holes around the perimeter and 8 primary mounting holes instead of 6.

The rotor is custom machined, so that the sun gear holder assembly is no longer required.  A not shown in the explosing mini 3d printed adapter will hold the magnet and fit inside the rotor bearing on the back.

The planet input now has a small indexing slot to eventually register a magnet holding assembly that can be used to sense the position of the output stage, and a position sense board is installed in the front housing to sense it.

All of the gears are now custom manufactured (at shop.mjbots.com – Internal Gear, Planet Gear, Sun Gear).  This reduces the cost considerably, improves tolerances, and requires no post-machining.

The back housing has been updated to mount a newer moteus controller, provide heatsinking to it, and also be slightly slimmer due to being manufactured from aluminum.

The overall dimensions are approximately the same as the mk1, with the depth increasing by a few millimeters (largely because of the connectors on the new moteus controller), and the outer diameter decreasing by a few millimeters.  I believe I should be able to get the weight to be about the same as the mk1, around 430-450 grams.

Next steps

First, I’ll make a functional prototype to verify that all the parts fit together and work.  Then I’ll work to get the weight back down to closer to the mk1, after which I’ll start producing enough of these to make more robots.

Successful pronking!

While not perfect, now that I have flux braking in place, I have now succesfully pronked around for a while without faulting!  There are a number of outstanding problems that still need to be addressed:

  • Sometimes the landing phase is erroneously cut short
  • There is occasionally a grinding like noise that sounds like some controller is unstable
  • I think the lateral movement is not working correctly
  • The gait needs to be smarter about moving the legs past the center point when in mid-flight, and changing the gait period to achieve different speeds
  • And probably a bunch of other problems I haven’t even identified yet

That said, it is still fun to watch it romp around!

quad A0 chassis v2 – final assembly

In the last post in this series, I conducted a fit test on the new chassis.  After my ignominious belly-flop, I now had a more urgent need to complete the switch.

A busted robot
An even bigger close-up

The chassis cracked in the corner, completely separating.  Doing anything more with this chassis was likely to result in many more things breaking very quickly.

Build process

So, here are the photos as I put everything together.

Raspberry pi attached
All the wiring extracted
Half the legs off the old chassis
Legs re-attached to new chassis!
Battery stud and wiring re-installed
The power board installed
Bottom plates installed
Upright with untidy wires
All set for testing!

Next up is continuing to try and get pronking working!


Flux braking with the moteus controller

When I was trying my first pronking, I kept having over-voltage issues when the servos were trying to dump power back onto the DC bus, no matter how high I set the voltage limit.  During that test, I was running with a nearly full battery, so my working theory is that the battery protection circuit was disconnecting the battery either because of too high a charging current, or too high a system voltage.  When the battery was disconnected, and the servos were still putting power onto the bus, that resulted in the voltage spiking arbitrarily high, followed by a total loss of power when they all faulted and then nothing was powering the bus at all.

Clearly I needed somewhere to dump the power during those transient events.  One option would be to build a brake chopper, sticking a power resistor somewhere and using that to burn off the extra.  But, why bother with that when I already have 12 big power resistors attached to the robot!  Errr… motors that is.

Anyways, my solution for now is to create a “virtual resistor” in the moteus firmware  i.e. “flux braking” that just dumps current into the D-axis of each motor proportional to the magnitude of the DC bus voltage above some configurable threshold.  That results in each servo working independently to keep the overall system voltage from getting too high in a hopefully stable manner.


I ran the programmable power supply through a voltage sweep while commanding zero velocity on all 12 joints to verify this was working as expected.  It did get pretty audibly noisy at the higher voltages, probably because of some feedback with the voltage sensing so I added a little filtering after which the noise was manageable.

HTML + websocket joystick control

Now that I had a controlled jump with the quad A0, I wanted to chain those jumps together into a pronking gait.  The first part of that was creating a mechanism by which I could actually command varying motion commands.  For the previous full rate experiments, all I had built was a CLI that allowed you to type commands.  That sufficed for initiating a single jump, but not really for moving around in space with a dynamic gait.  Something with a joystick would be necessary.

For Super Mega Microbot, we had a Mech Warfare dedicated client application which, for various reasons is something I want to get away from and its control protocol isn’t even that suited to the things that the quad A0 is capable of anyways.  For the quad A0 I want to eventually have 2 command and control systems: a high bandwidth one that uses wifi, and a low bandwidth robust one that uses a spread spectrum RC style transmitter.  For now, I figured I would start by making a first minimum viable product of the high bandwidth diagnostics tool, since it would be more useful initially.


The intended system roughly looks like this:

quad A0 diagnostics architecture.png

The client in this case is a regular web browser.  It connects to the embedded web server which is running in the robot control process and fetches some static assets, including HTML, CSS, and Javascript.  Then, the diagnostics client is a single page javascript application which makes a separate websocket connection to the embedded web server for real-time control and status data.


Initially, I spent a half day making a standalone proof of concept server and client.  The server was based on boost::beast / boost::asio and the client was vanilla JS using the gamepad API.  All it did was render the state of the joystick into a text string at 10Hz, stick that into an HTML element and send it over the websocket connection.  Anything it received over the websocket connection it stuffed into a different HTML element.  The server just sent an incrementing number over.  Once this was working mostly well enough, I felt confident enough to move on and integrate it into the actual robot control application.

For that, I implemented a more generic “WebServer” class which just serves the static files and accepts websocket connections at configurable endpoints.  Then a separate “WebControl” class uses WebServer to report the quadruped status and send commands.  For now, I just exposed the raw C++ status and command structures over the websocket interface as JSON, so the control class doesn’t have a whole lot of work to do.

On the client side, I spent zero effort on presentation, and just dumped raw JSON into HTML elements for now.  There is minimally enough logic to command the robot through the states that are implemented now based on joystick commands.  The result is just about the ugliest web application you can imagine, but it gives me a place to start from both to make it more functional, look nicer, and more importantly lets me once again use the joystick to command variable gaits.

HTML at its finest


quad A0 chassis v2 – construction

After CADing up the second revision of the chassis, I set to work with the 3d printer and printed up all the pieces.


There were a few minor post-modifications I had to make, which were all much faster than printing the pieces again.  All the holes for M3 bolts were slightly undersized, so I drilled them out.  The battery holder had a channel to let the power wires out, which inexplicably terminated before reaching the edge of the holder.  I also had to install all the heat set inserts.

Mostly assembled
All put together, with a snazzy new sticker

I did attempt something new, which was to post-process the printing by smoothing out a corner by sanding.  An experiment it was.  I spent about 2 hours on it, of which 45 minutes was on the coarsest paper I had, about 80 grit.  I eventually gave up on that coarsest grit and started moving on, so there are still a few blemishes in the final result.

Smoothed out corner

Needless to say, until I get really bored, I probably won’t spend the full day required to do the other 3 corners of the chassis using this method.

There are a few other minor changes I’ll make before installing legs, which will be the next step!

quad A0 chassis v2 – design

As described in my roadmap, the chassis for the quad A0 was on the verge of failing, or causing the shoulder motors themselves to fail, after only a few hours of walking around.  Also, it was nigh impossible to assemble, disassemble, or change anything about it.  Thus, the chassis v2!


More than one piece

The old chassis was a single monolithic print that took about 35 hours of print time.  Because of its monolithic nature, there were lots of interference problems during assembly.  For instance, the shoulder motors could only have 4 of the 6 possible bolts installed, and 2 more of the bolts extended beyond the chassis entirely.  I decided to break it up into multiple pieces, which uses a lot more inserts and bolts, but should allow for a feasible order of assembly and manageable repair.

Now there are separate front and back plates, to which the shoulders can be attached in isolation.  Then the top plate can attach to that, followed by the side plates, the battery holder, and eventually the bottom plates.

Enclosing the electronics

V1 had the primary computer sitting on top of the chassis.  That was a legacy from the first Mech Warfare configuration, where the primary computer sat in the turret.  I’ve decided that for Mech Warfare, I’ll just put a second independent computer in the turret, which frees the robot computer to be placed inside the chassis where it is much less likely to get mangled.


The power distribution board is now mounted to the other side opposite the computer, instead of on the now top-plate.

Power switch and strap

I’ve left room for a recessed top mounted power switch on the top plate.  This should remove the need to unplug and re-plug the battery any time that power needs to be cycled.  That hole is marked in red below.


Also, while I’m at it, I left holes in the top through which a carrying strap can be threaded (marked in blue above).  The old chassis had some M3 inserts that I screwed eye bolts in and then threaded some cord through.  That didn’t work terribly well and was unsightly.


As mentioned in the roadmap, I was going to try and replace the battery with something with a smaller form factor.  I looked through a number of batteries, and got a Milwaukee M18 as the best of the options, but ultimately decided that the Ryobi style was the best compromise for now despite the wasted space.  All the lower profile ones required insertion sliding in from the side, which would have required that the chassis be much longer than it was already.


Thus, I still have the 3D printed Ryobi battery holder, only now it attaches to the top plate with just some bolts instead of a complicated dovetail arrangement I had previously.



Since this is being printed in multiple pieces, I wanted a separate piece to increase the longitudinal stiffness.  That is now just two plates which bolt to the front and back plate, and to the battery holder.


Next steps

Next up is printing and assembling this chassis!

quad A0 – Controlled jump

Now that I have a full rate inverse kinematics and dynamics solution, I can begin to do more interesting things.  A while ago I did the first jump on the quad A0 — in that video I used a limited technique just to verify that the platform was indeed capable of jumping.  The joints were commanded in an open loop fashion, and really only at the transition points of the jump sequence, relying on the control loops in the servo to actually achieve each stage of the jump cycle.  That resulted in the jump only being minimally controlled… tracking errors would result in the robot taking off from a not-level position and the timing was not super reliable to boot.

Now I’ve taken that demonstration to the next level by controlling the full position, velocity, and force profile of each of the 4 legs at 150Hz during the jump maneuver.  In the launch phase, all four legs follow a constant acceleration trajectory while maintaining a level body.  During the flight phase, the force is cut to the legs and the velocity of each leg is monitored.  A few milliseconds after the legs have been detected as moving, the velocity is sampled and a controlled constant acceleration profile is selected which results in zero velocity when the robot reaches its initial takeoff point.  After that, it just moves at a constant velocity back to the starting height.

Next up is chaining these together into a pronking gait.


Full rate inverse dynamics on the quad A0

Last time I updated my inverse kinematics solution to also include dynamics, velocities and forces.  Now I’m in the process of integrating this onto the robot.

The old SMMB / HerkuleX control software commanded the servo positions in an open loop, which did not take into account the actual position of the joints in any way.  What I’ve done now is implemented a control flow where at each cycle the state of all 12 servos is sampled, then the control laws are applied based on that state, then the resulting commands are sent out.

So far, the only control laws I have ported are a simple one which just sends raw commands to each joint, and a somewhat more useful one which commands the end effector of each joint in terms of position, velocity, and force.  Here’s a quick video showing it commanding various constant forces with no position constraints.  The scale isn’t super accurate, nor is the actual force coming out of the device, but I think it should be good enough.