Thankfully, I’m now at the point where I’m fixing actual dynamics problems on the robot. Doubly thankfully I have a robot which is pretty robust and keeps working! That said, it is still, shall we say, “non-ideal”, to be testing code for the first time ever on a real robot.
Back with my HerkuleX based Super Mega MicroBot, I had a working DART based simulation which was decently accurate. However, the actuators for that machine were so limited that it didn’t really make sense to do any work in simulation. The only way to be effective with that machine was to tweak and tweak on the real platform and rely on exactly the right amount of bouncing and wiggling that would get it moving smoothly.
Now that I can accurately control force at 400Hz and beyond, that isn’t a problem anymore, so I’m working to resurrect the bitrotted simulator. In the end though, it turned out to be a complete re-write as basically nothing of the original made sense to use.
Here’s a video of the very first time it moved around in sim (which means there are still many problems left!)
A while ago I derived some closed form solutions for the inverse force dynamics for a 2 dimensional mammal geometry leg. Now that I want to execute more dynamic gaits, I need to be able to control the velocity and force of the 3 dimensional leg in real time. That means I need to be able to go forward and back between the two representations. The first being joint angles, joint velocities, and joint torques — the second being 3D position, velocity, and force.
Rather than derive those myself in 3 dimensions, I decided to save a bit of time now by using the DART kinematics and dynamics routines. I might need to undo this later if it turns out to be too slow at runtime, but if nothing else it can be a good ground truth for anything I do myself. I also took this opportunity to do all calculations in consistent rational coordinate frames, where before I had conventions that while documented, were rather unorthodox.
As it turns out, this demonstrated that my old 3 dimensional force calculation, was as I had expected, slightly incorrect.
The shoulder torque was the most affected, being off by 20% or so.
The source is at:
Next up will be using this to actually control a real leg.
A previous simulator I had built for Super Mega Microbot was based on the “DART” robotics toolkit. It is a C++ library with python bindings that includes kinematics, dynamics, and graphical rendering capabilities under a BSD license. I wanted to use some of its dynamics capabilities for future gait work on the quad A0, and eventually re-incorporate its simulation capabilities, so integrated a subset of it into mjbots/bazel_deps.