I'm still taking a break, as I said in the November update. I'm focusing only on things that bring me joy, and right now that's getting Hubris moving and figuring out perception and navigation. Apparently my idea of a break still involves robots. Just the bits I feel like doing.
So this month I've shipped camera support and our first vision estimator. Beam Bots can now watch a camera, find ArUco markers in the picture, and draw what it found over live video in the dashboard. The whole path has been exercised with a real USB webcam: capture, detection, browser preview and little outlines around the markers.
That's a first step towards the perception and navigation I want for Hubris. There's plenty left to figure out, but being able to see what the robot sees is a useful start.
Since the November update, we've also gained dashboard
driving controls from Lars Wikman, a refreshed website, joint-state history, and a less
fiddly way to recover after hardware disappears. There are breaking changes in the camera packages and
bb 0.34; the upgrade notes are below.
Cameras, With Supervision
The new bb_camera
package makes a camera an ordinary sensor in the robot's topology. It gets the same
supervision and parameter configuration as other sensors, while the core framework
doesn't need to know anything about video.
There are drivers for
Linux V4L2,
macOS AVFoundation
and Raspberry Pi cameras through rpicam-vid.
They share bb_camera_ffmpeg
for supervised capture. There's also a synthetic camera for trying things without
hardware, which is considerably easier to persuade to sit still for a test.
The important design choice is that the camera hub never publishes frames onto PubSub. It holds the newest frame, and consumers ask for one when they're ready. A slow detector skips pictures instead of collecting an ever-growing mailbox of things the robot saw some time ago. Multiple consumers share the capture, and the drivers hand over raw pixels so each consumer doesn't have to decode the same image. The camera documentation covers both the interface and the reasoning behind it.
bb_camera_webrtc 0.1.1
takes those frames to the browser. The LiveView dashboard now uses WebRTC, encoding
each camera once however many dashboards are watching. Pausing a preview or switching
away releases that viewer's stream. It's a better fit for a mobile connection than
sending a fresh JPEG for every frame.
Livebook got camera discovery and previews too, in
bb_kino 0.5.0.
Declared cameras that aren't running stay visible in the list: an absent camera is
useful information, even if its pictures aren't.
Making a Mark
bb_estimator_aruco 0.1.0
finds ArUco markers — those square black-and-white patterns you can print and stick
to things — using OpenCV through evision. Nest it inside a camera sensor:
sensor :camera, {BB.Camera.V4L, device: "/dev/video0", width: 640, height: 480} do
estimator :markers, {BB.Estimator.ArUco, dictionary: :dict_4x4_50}
end
It publishes each marker's ID and four image corners, stamped with the frame's capture time. There's a Mix task to generate printable markers too. For once, "have you tried putting a sticker on it?" is part of the technical solution.
bb_liveview 0.5.1
draws the results over the preview. This uses a new BB.Camera.Annotation protocol:
an estimator's payload describes its drawing, and the viewer renders it without
knowing which detector produced it. Layers have individual visibility toggles and
expire relative to the original frame's capture time, so an old detection doesn't
hang around pretending to be current.
The framework work underneath this shipped in
bb 0.34.0.
Estimators can now take input through a sensor-specific source, with PubSub remaining
the default. A camera estimator asks for another frame after it finishes the current
one. The same estimator callbacks work; the delivery mechanism understands that
video needs a little more restraint than a temperature reading.
Next I want to look at integrating models like YOLOX for object detection, using more of OpenCV for depth mapping, and adding stereo camera support. Those are the next steps to explore for Hubris: recognising what's in front of it and working out how far away it is. Ideally before introducing itself to the furniture.
Lars Takes the Wheel
Lars Wikman contributed an optional Drive widget and several dashboard fixes from his work driving a robot remotely.
The widget supports hold-to-drive from the keyboard or an on-screen pad, with
application-supplied publish and stop callbacks. It follows the same contract as
bb_tui's drive extension.
His fixes also make parameter inputs refresh when their values change, keep large binary payloads out of the event stream's rendered output, and show the final value of a burst of updates. Dragging a slider should leave the dashboard showing where you stopped, which seems an entirely reasonable ambition for a dashboard.
Thanks, Lars!
A Fresh Coat of Pixels
The website got a refresh this month too. The homepage now walks through how a robot's physical structure becomes its supervision structure, with a topology diagram and an Elixir example to make it concrete. If you've heard me talking about Beam Bots but still weren't sure what you actually write, it should give you a better starting point.
Community robot demos show what that turns into: arms copying each other's movements, balance bots staying upright, and a small robot with rather more personality than strictly necessary. There are clearer routes into the tutorials and package ecosystem, along with improvements to mobile navigation, keyboard access and light and dark themes.
The robots got eyes; the website got a little easier on ours.
Where Were Your Joints On the Night in Question?
bb 0.33.1 added
joint-state history. BB.Robot.State.get_all_configurations_at/2 answers where the
robot's joints were at a past moment, using the timestamps from their state messages.
This matters for cameras mounted on moving robots. By the time a picture gets through capture and decoding, the arm may have moved. Pairing that picture with the arm's current configuration gives you a very confidently wrong answer about where the camera was pointing.
The camera hub now looks up the configuration at capture time. History keeps ten seconds by default, supports interpolation, and can be configured or disabled. If the history can't answer, the hub falls back to the current configuration; it isn't a promise that every frame has a perfect historical pose. The joint-history PR explains the boundaries.
Pulling the Plug, Then Putting It Back
Unplugging a USB CAN adapter on a real robot exposed another awkward recovery path. After the hardware subtree exhausted its restart budget, clearing the fault still left the operator restarting the topology supervisor by hand.
In bb 0.33.2,
BB.Safety.force_disarm/1 also restarts a stopped topology. If that fails, the robot
returns to :error; arming is refused when there is no running topology. Fault logs
now explain more of what went wrong, including component startup failures and disarm
callback timeouts. This remains an explicit operator recovery step.
Camera recovery got attention too. The hub retries failed capture with backoff while subscribers remain. Drivers now stop when their hub dies and wait for the capture process to exit before finishing shutdown, so a replacement doesn't race the old process for a camera it still has open. "Device or resource busy" is a fairly poor substitute for a picture.
Before You Upgrade
If you picked up the first camera releases during November, update the camera stack together. It moved quickly:
- Frames are now raw pixels inside a message.
bb_camera0.3 replacesBB.Camera.Framewith%BB.Message{payload: %BB.Message.Camera.Frame{}}. Capture timestamps live in the envelope, and driver authors construct frames withBB.Message.new/4. JPEG frames stopped being accepted in 0.2; the supplied drivers deliver I420. Their old:qualityand:max_frame_bytesoptions are gone. - Use the matching driver releases:
bb_camera_v4l0.4.0,bb_camera_avf0.3.0 andbb_camera_libcamera0.3.0, alongsidebb_camera0.3.0 andbb_camera_ffmpeg0.3.0. Older drivers' broad dependency requirements can admit the new camera API without implementing it. - LiveView previews use WebRTC.
bb_liveview0.5 removes the MJPEG route and:camera_streamoption. Addbb_camera_webrtcfor previews;:ice_serversis available for deployments that need it. See the migration PR. - Nested estimators restart with their sensor in
bb0.34. This includes existing PubSub estimators, such as an AHRS filter nested inside an IMU sensor. Their state resets when the sensor crashes.BB.Message.Sensor.Imageis also removed; camera frames live inbb_camera. The core PR has the full changes.
The latest core release is
bb 0.34.1, which updates
the usage rules for these features.
If you're putting cameras on your robots, come show us in Discord. We can finally see what all the fuss is about.