Hello all,
Announcing ZigROS, a zig build of the ROS project. ROS for those that don’t know is short for Robot Operating System, and is one of the largest open source robotics projects out there. It provides a set of core libraries to abstract various elements of robotics to streamline development. Its core libraries are written in a mix of c and c++.
Getting a build of this working with zig was more work than the typical C or C++ build as ROS isn’t a single library, but rather a series of packages that build off of each other, and relies heavily on templating and code generation in python. A base zigros build before any user facing code produces around 55 libraries.
If you’re not interested in ROS, there may still be some interesting nuggets in here. One of the more interesting pieces is I was able to get a version of Andrew’s cpython build to work as a run step dependency, allowing for inline python execution in the zig build system, with caching that works for input and output files as well.
Since this project is building many small libraries, I also opted for an unusual package structure with build files for relevant c or c++ projects as subdirectories, and provide a wrapper for ease of linking in downstream projects. I’m looking for feedback on this approach.
To see this in action, check out this example repo that builds a few simple ros nodes https://github.com/zig-robotics/rclcpp_example
(ziggit won’t let me post more than two real links).
For more background check out the readme and docs folder.
I’m hoping to introduce a ROS client library for zig as well in the near future. I have a proof of concept working, but haven’t circled back to it in a while as I was putting this project together.
If there’s any other folks in the zig community involved or interested in ROS or robotics please reach out. I think zig is the perfect language for robotics and I’d like to showcase that through examples and development of new ideas. This is the first of many robotics related projects I hope to showcase.
Thanks!