Rust

Rust for Robots Pt II: The Rise of an Ecosystem

September 24, 2024
Table of Contents

We’re not going to pretend you haven’t seen this one. We all know the benefits of Rust for Robotics at this point:

  • Unparalleled memory safety
  • Parallel and async frameworks allow for efficient concurrency
  • Run object-oriented or functional (probably both!)
  • Drastic simplification of package management through Cargo
  • A wonderful and supportive community

There’s only one reason it’s still worth talking about, and why we’re talking about it today: its continuous evolution. The robotics stack in robotics has changed dramatically in the last 5 years, and will change even further in the next 5. Today, we’re taking a look back in hopes that we can predict the future. We’ll also talk about some new and exciting approaches that others are taking to further the mission of robotics in Rust.

## Tangram Vision: Always Rust-First

Tangram Vision is part of the vanguard of Rust for Robotics. We were writing articles like this 3 years ago, trying to catch the attention of customers (look, no segfaults!) and developers (please help us!). Many of our business decisions were informed by the capabilities of the language at the time: 

  • There was no way to distribute our software without distributing all of our source code. We settled on Docker as a medium to get around this.
  • There was no visualization package that wasn’t in beta or heavy development, so our first visualizer was a javascript application.
  • There were no sensor packages that even supported Rust, so we had to adopt and write our own.
  • Because there wasn’t any complex mathematics API available, most of our optimization framework (Tangram’s bread and butter) is hand-rolled even to this day.

…and on and on. 

As a company, Tangram Vision never faltered at the choice of Rust. Instead, we changed our technical approach to accommodate the language. And we have no regrets about that decision. We knew, even without all of these resources, our technical velocity was still far faster than what it would have been in any other language. It was only a matter of time before the rest of the world caught up.

## The World Catches Up (Fast)

Catch up they did. We now have a robust ecosystem for the table stakes in Robotics:

  • Linear Algebra libraries like nalgebra and faer
  • Mcap, a versatile logging format for robotics data
  • Rerun, a powerful visualization tool written in Rust with python bindings
  • Evcxr, both a REPL and a Jupyter kernel for Rust
  • Kdtree, a K-dimensional tree in Rust for fast geospatial indexing
  • Numerical Optimization libraries like Argmin and OpEn
  • k, A kinematics library
  • Unit of measurement (uom), which allows you to leverage the Rust type system to keep track of the unit of a variable

...and many more! Check out https://robotics.rs for a curated list.

We’ll be the first to say it: Rust is not an “easy” language. Getting the most out of it requires understanding its complexities and nuances thoroughly. Someone highly technical will bask in the flexibility it brings, but someone product-focused will find it irritating. The current ecosystem caters to the former; we need to evolve to include the latter to make Rust for robotics truly mainstream. 

Rerun makes good assets, what can I say.

## Advancing the Abstraction

This is where companies like Copper Robotics come in. As it says in the project’s README, “Copper is to robots what a game engine is to games”. Copper Robotics, and projects like it, recognize that Rust needs to move beyond the deep-tech developer and towards organizations who want to deploy, not just tinker. This approach is one that’s been somewhat missing in the Rust for robotics space, and it’s the reason I’m so excited for this project.

We’ve been fighting with the problem of robotics abstraction for a long time. There are so many ways to represent data, to represent change in that data, and even individual frameworks come with their own company-by-company customizations. What would it take to abstract the comms, the drivers, the homework away from sensor use? Copper Robotics takes a bold, Rust-first approach to this problem that we just love.

But what about ROS, you may ask? As a proud card-carrying member of the Open Source Robotics Alliance, Tangram Vision also actively supports the efforts that ROS is making in their own journey towards Rust. We have the responsibility as a company to adopt all efforts and approaches in our perception platform. This also means that we have the pleasure of helping any motivated robotics company reach more organizations with better software. When it comes to robotics, a rising tide lifts all boats.

## Here’s To Robotics

So yes, Rust is perfect for robotics, but that’s not the exciting part. The excitement lies in the next step, in projects like Copper Robotics that are working to make the language accessible to all. We’re happy to support these efforts as they start their robotics evolution… and hopefully spur your own.

Share On: