Week Fifteen: Ticks and Talks
Servo drivers get a 100Hz ETS-backed control loop and I give a talk at Code Camp Wellington.
A fortnight of shipping things that tick and saying things out loud.
Code Camp Wellington
I spoke at Code Camp Wellington on Saturday, presenting my take on Zach Daniel's Building on Bedrock: Elixir's Fundamental Design Advantage talk (with his blessing), with a brief aside about Beam Bots. If you're in the Wellington area and missed it — sorry, you'll have to wait for next time.
Servo Drivers: The Rework Lands
The servo driver rework I've been banging on about is done. Both bb_servo_feetech v0.2.2 and bb_servo_robotis v0.2.2 have shipped with the new architecture:
- ETS-backed state — actuators write
goal_positionandgoal_speeddirectly to a shared ETS table instead of casting to the controller GenServer. Any process can read full servo state (position, temperature, voltage, current, hardware error) without going through a bottleneck. - Fixed-rate control loop — the controller runs a single 100Hz loop (configurable via
loop_interval_ms) that batches pending commands intosync_writeoperations and reads positions viafast_sync_read. No more separate poll timers. - Safer arming — enabling torque now reads present positions first and writes them as
goal_position, preventing the "stale goal jump" where a servo lurches to wherever it was last told to go three power cycles ago.
Both drivers are hardware-tested. The Feetech version batches all position writes via sync_write_raw. The Robotis version uses individual write_raw calls per servo because the upstream robotis library doesn't expose sync_write_raw — a minor inefficiency for now, but functionally identical.
Breaking changes (both drivers):
poll_interval_msis replaced byloop_interval_ms(default 10ms instead of 50ms)register_servonow returns{:ok, ets_table_ref}instead of:okhandle_casthandlers forwrite/write_raw/sync_writeare removed
If you're using either driver, you'll need to update your configuration. The new defaults are sensible for most use cases.
Dependency Gardening
The usual Dependabot round. Across the ecosystem:
| Package | From | To | Notes |
|---|---|---|---|
| igniter | 0.7.2 | 0.7.6 | Better task compilation errors, Mix.shell().cmd/1 fix |
| ex_cldr_numbers | 2.38.0 | 2.38.1 | Elixir 1.20 type warning fixes |
| ex_cldr_units | 2.27.1 | 2.27.2 | Elixir 1.20 type warning fixes |
| phoenix_live_view | 1.1.26 | 1.1.27 | Chrome bug fix, Elixir 1.20 compat |
| floki | 0.38.0 | 0.38.1 | Performance improvements |
| credo | 1.7.16 | 1.7.17 | New CondInsteadOfIfElse check |
| git_ops | 2.9.0 | 2.9.2 | Fix: abort release when tag not fetched |
What's Next
With the servo driver rework shipped, the next step is a PR against pkinney/robotis to add sync_write_raw support. Powell Kinney has been an early booster of Beam Bots, so we expect a smooth path to getting batched Robotis writes on par with Feetech.