Programming Ada: Designing A Lock-Free Ring Buffer

Ring buffers are incredibly useful data structures that allow for data to be written and read continuously without having to worry about where the data is being written to or read from. Although they present a continuous (ring) buffer via their API, internally a definitely finite buffer is being maintained. This makes it crucial that at no point in time the reading and writing events can interfere with each other, something which can be guaranteed in a number of ways. Obviously the easiest solution here is to use a mutual exclusion mechanism like a mutex, but this comes with a severe performance penalty.

A lock-free ring buffer (LFRB) accomplishes the same result without something like a mutex (lock), instead using a hardware feature like atomics. In this article we will be looking at how to design an LFRB in Ada, while comparing and contrasting it with the C++-based LFRB that it was ported from. Although similar in some respects, the Ada version involves Ada-specific features such as access types and the rendezvous mechanism with task types (‘threads’).

Continue reading “Programming Ada: Designing A Lock-Free Ring Buffer”

Re-imagining Telepresence With Humanoid Robots And VR Headsets

Don’t let the name of the Open-TeleVision project fool you; it’s a framework for improving telepresence and making robotic teleoperation far more intuitive than it otherwise would be. It accomplishes this in part by taking advantage of the remarkable technology packed into modern VR headsets like the Apple Vision Pro and Meta Quest. There are loads of videos on the project page, many of which demonstrate successful teleoperation across vast distances.

Teleoperation of robotic effectors typically takes some getting used to. The camera views are unusual, the limbs don’t move the same way arms do, and intuitive human things like looking around to get a sense of where everything is don’t translate well.

A stereo camera with gimbal streaming to a VR headset complete with head tracking seems like a very hackable design.

To address this, researches provided a user with a robot-mounted, real-time stereo video stream (through which the user can turn their head and look around normally) as well as mapping arm and hand movements to humanoid robotic counterparts. This provides the feedback to manipulate objects and perform tasks in a much more intuitive way. In short, when our eyes, bodies, and hands look and work more or less the way we expect, it turns out it’s far easier to perform tasks.

The research paper goes into detail about the different systems, but in essence, a stereo depth and RGB camera is perched with a 3D printed gimbal atop a humanoid robot frame like the Unitree H1 equipped with high dexterity hands. A VR headset takes care of displaying a real-time stereoscopic video stream and letting the user look around. Hand tracking for the user is mapped to the dexterous hands and fingers. This lets a person look at, manipulate, and handle things without in-depth training. Perhaps slower and more clumsily than they would like, but in an intuitive way all the same.

Interested in taking a closer look? The GitHub repository has the necessary code, and while most of us will never be mashing ADD TO CART on something like the Unitree H1, the reference design for a stereo camera streaming to a VR headset and mirroring head tracking with a two-motor gimbal looks like the sort of thing that would be useful for a telepresence project or two.

Continue reading “Re-imagining Telepresence With Humanoid Robots And VR Headsets”

Undersea Cable Repair

The bottom of the sea is a mysterious and inaccessible place, and anything unfortunate enough to slip beneath the waves and into the briny depths might as well be on the Moon. But the bottom of the sea really isn’t all that far away. The average depth of the ocean is only about 3,600 meters, and even at its deepest, the bottom is only about 10 kilometers away, a distance almost anyone could walk in a couple of hours.

Of course, the problem is that the walk would be straight down into one of the most inhospitable environments our planet has to offer. Despite its harshness, that environment is home to hundreds of undersea cables, all of which are subject to wear and tear through accidents and natural causes. Fixing broken undersea cables quickly and efficiently is a highly specialized field, one that takes a lot of interesting engineering and some clever hacks to pull off.

Continue reading “Undersea Cable Repair”

Read Utility Meters Via SDR To Fill Out Smart Home Stats

[Jeff Sandberg] has put a fair bit of effort into adding solar and battery storage with associated smarts to his home, but his energy usage statistics were incomplete. His solution was to read data from the utility meter using RTL-SDR to fill in the blanks. The results are good so far, and there’s no reason similar readings for gas and water can’t also be done.

[Jeff] uses the open source home automation software Home Assistant which integrates nicely with his solar and battery backup system, but due to the way his house is wired, it’s only aware of about half of the energy usage in the house. For example, [Jeff]’s heavy appliances get their power directly from the power company and are not part of the solar and battery systems. This means that Home Assistant’s energy statistics are incomplete.

Fortunately, in the USA most smart meters broadcast their data in a manner that an economical software-defined radio like RTL-SDR can access. That provided [Jeff] with the data he needed to get a much more complete picture of his energy usage.

While getting data from utility meters is conceptually straightforward, actually implementing things in a way that integrated with his system took a bit more work. If you’re finding yourself in the same boat, be sure to look at [Jeff]’s documentation to get some ideas.

Junk Bin Build Lets You Test Fuel Injectors On The Cheap

Fiddle around with cars long enough and you’ll realize two things: first, anything beyond the simplest repairs will probably require some kind of specialized tool, and second, those tools can be prohibitively expensive. That doesn’t mean you’re out of luck, though, especially if you’ve got scrap galore and a DIY spirit, as this junk bin fuel injector test stand ably demonstrates.

[Desert Rat Racer]’s test rig is designed to support four injectors at once and to test them under conditions as close as possible to what they’ll experience when installed. To that end, [Rat] mounted a junk intake manifold to a stand made from scrap wood and metal found by the side of the road. A pickle jar serves as a reservoir for the test fluid — he wisely used mineral spirits as a safer substitute for gasoline — and a scrap electric fuel pump pressurizes a junk fuel rail, which distributes fuel to the injectors under test.

For testing, the injectors are wired up to an electric injector tester, which is one of the few off-the-shelf components in the build. The fuel pump and injectors are powered by the 12 volt rail of a scrapped PC power supply. Just being able to watch the spray pattern is often enough to find a faulty injector, but in case a more quantitative test is indicated, each injector is positioned over a cheap glass cylinder to catch the test fluid, and scraps of a tape measure are used to measure the depth of the collected fluid. No fancy — and expensive — graduated cylinders required.

While we truly respect the hackiness of [Desert Rat Racer]’s build, the concept of avoiding buying tactical tools is foreign to us. We understand the logic of not dropping a ton on a single-use tool, but where’s the fancy blow-molded plastic case?

Continue reading “Junk Bin Build Lets You Test Fuel Injectors On The Cheap”

Building The Unreleased Lemmings Arcade Cabinet From 1991

Back in the early 90s the world was almost graced with an arcade version of Lemmings, but after a few board revisions it was abandoned in 1991. Now the folk over at UK-based [RMC – The Cave] on YouTube have managed to not only get their mitts on a nearly finished prototype board, but have also designed and built a period-appropriate cabinet to go with it. This involved looking at a range of arcade cabinets created by Data East and picking a design that would allow both for the two-player mode of the game, and fit the overall style.

The finished Lemmings arcade cabinet. (Credit: RMC – The Cave, YouTube)

Arcade cabinets came in a wide range of cabinet styles and control layouts, largely defined by the game’s requirements, but sometimes with flourishes to distinguish the cabinet from the hundred others in the same arcade.

In this particular case the typical zig-zag (Z-back) style was found to be a good fit as on the Data East Night Slashers 1993-era cabinet, which then mostly left the controls (with two trackballs) and cabinet art to figure out. Fortunately there is plenty of inspiration when it comes to Lemmings art, leading to the finished cabinet with the original mainboard, the JAMMA wiring harness with MultiPi JAMMA controller, a 19″ CRT monitor and other components including the 3D printed controls panel.

With more and more new arcades popping up in the US and elsewhere, perhaps we’ll see these Lemmings arcade cabinets appear there too, especially since the ROMs on the prototype board were dumped for convenient MAME-ing.

Continue reading “Building The Unreleased Lemmings Arcade Cabinet From 1991″

A bright orange sailboat with solar panels on the wing sail and the hull of the craft. A number of protuberances from the wing are visible containing instruments and radio equipment.

Saildrones Searching The Sea For Clues To Hurricane Behavior

Hurricanes can cause widespread destruction, so early forecasting of their strength is important to protect people and their homes. The US National Oceanic and Atmospheric Administration (NOAA) is using saildrones to get better data from inside these monster storms.

Rising ocean temperatures due to climate change are causing hurricanes to intensify more rapidly than in the past, although modeling these changes is still a difficult task. People on shore need to know if they’re in store for a tropical storm or a high strength hurricane to know what precautions to take. Evacuating an area is expensive and disruptive, so it’s understandable that people want to know if it’s necessary.

Starting with five units in 2021, the fleet has gradually increased in size to twelve last summer. These 23ft (7m), 33ft (10m), or 65ft (20m) long vessels are propelled by wing sails and power their radio and telemetry systems with a combination of solar and battery power. No fossil fueled vessel can match the up to 370 days at sea without refueling that these drones can achieve, and the ability to withstand hurricane winds and sea conditions allow scientists an up-close-and-personal look at a hurricane without risking human lives.

We’ve covered how the data gets from a saildrone to shore before, and if you want to know how robots learn to sail, there’s a Supercon talk for that.

Thanks to [CrLz] for the tip!