Adds the balance loop, its states and its commands
Adds BB.NSK.Balance.Controller and everything it needs: the :balancing
and :fallen states, the stand and fall commands it drives them with, a
replacement arm that lands in the state the robot's attitude calls for,
and the :balance, :yaw and :drive parameter groups.
After this the robot stands up. Hold it upright and still, arm it, and let go:
MyBot.Robot.arm()The gains are measured, not guessed
Every default here came off the robot rather than out of a textbook, and the reasoning is in the parameter docs. The two worth knowing before touching anything: the proportional and derivative gains live as a ratio rather than independently, and the catch angle is deliberately tight — at five degrees the robot took over while still moving in the operator's hand and spent its whole life answering that transient.
They are parameters rather than constants because nearly all of them were
found on the floor, and a firmware build per guess is not a tuning session.
With bb_parameter_store_cubdb installed, what you find survives a reboot.
Requires an IMU
The loop closes around the lean the IMU reports, so this wants
mix bb_nsk.add_imu to have run. It warns rather than proceeding otherwise,
because a balance loop with nothing to balance against is a robot that
silently never stands up.
Example
mix bb_nsk.add_balance
Options
--robot- The robot module (defaults to{AppPrefix}.Robot).