High Performance Java, Nashorn, Afterburner or Collaborative Robots With HEBI Robotics
Florian, could you please introduce yourself
I'm a co-founder of HEBI Robotics, a startup that develops modular robotic systems. The company is a spin-off from the Robotics Institute at Carnegie Mellon University. I spend most of my time working on cross-platform tools and libraries that simplify the programming of our robotic modules as they get assembled into various types of robots. Occasionally I also write parts of the firmware for the modules.
A startup aiming for modular robotic systems sounds interesting. What is it exactly?
We want to solve the difficult, expensive, and very time consuming process of building custom robotic systems. To enable this, we are creating smart building blocks that allow users to quickly reconfigure and size robots to suit their particular task or problem. The dream is to create an industrial strength 'Lego' that anyone can put together.
We are focusing on collaborative robots that are similar in scale and performance to humans. The goal is to make lower-cost robots that are able to automate tasks that currently require a more compliant 'human touch'.
What is the business model? Can we buy something already? (x-mas is around the corner)
We sell the modular actuators mentioned above, as well as develop custom solutions for industrial automation. We have experience using our products in academia and for R&D, and we are currently working with alpha partners to get the product ready for the much larger industrial automation market. We already have one type of module that we can sell, originally developed for snake robots at Carnegie Mellon, However, these aren't an ideal form factor and are too high a price point for most tasks. The next generation of modules have been developed with a lot of feedback from our partners, and will fit the needs of industrial automation and research institutions much better. They will be lower cost and should be ready within the next 3 months, so not quite in time for Christmas :-).
Please tell me about your JavaOne talk this year. What is the title?
The title is 'Robotics Programming with Java in MATLAB' and will be on Thursday at 2:30pm. The background story is that many robotics researchers have an electrical or mechanical engineering background, and often don't know any programming language besides MATLAB. This often creates long development cycles in their research. While they are able to quickly prototype math and algorithms in MATLAB, significant time has to be spent on porting their work over C++ to test the behavior of the real robot.
We have spent a lot of time over the past 4-5 years in developing ways to allow real-time control of our robots directly from MATLAB running on the developer's machine. This completely eliminates the porting step and dramatically shortens feedback cycles and overall development time. It also greatly reduces the need to rely on simulation, since it has become very simple to run experiments directly on the real hardware.
We do this by building on MATLAB's Java interface to create a real-time capable Java API that is specifically designed to interact seamlessly with MATLAB. Since there is little public information about designing such APIs, we want to share our experiences with the community. During the talk I'll also be showing some live coding demonstrations on a real robot.
What performance can you achieve using Java?
Java can be extremely fast, and is more than capable of handling the data rates of a sophisticated robot. Using a recent desktop computer running Linux with real-time patch, we can get the 99.999% round trip time of 250-byte UDP packets down to below 1ms under normal load. Only about 20% of that time is spent within the Java library. When replaying large log-files of real data through our system, we are able to handle more than 1.3 million messages per second, which is over a hundred times faster than a typical real-time scenario.
The main issue from a performance perspective is the Java garbage collector. Thus, we designed the system to completely avoid major GCs, and be able to spread out minor GCs so that they occur less than once a day. In practice, the most limiting factor is the underlying operating system scheduler.
What role does Java play in your startup?
Java plays a significant role. While we do also provide APIs for C/C++, we tend to first test new features and prototype architectures in Java because of its ability to support multiple platforms, the mature ecosystem, as well as simplified development through great tooling support. Additionally, all of our monitoring tools are based on JavaFX, and we use Nashorn for some of our code generation.
You are using afterburner.fx. What was your experience so far? How has afterburner helped you to implement the UI?
It is one of my favorite libraries. When I got started, I found that JavaFX has quite a steep learning curve. To me, it wasn't immediately obvious how to combine multiple FXML files with resources and dependency injection. Afterburner.fx has solved these problems, and has given me a set of working conventions that I was able to get started with. It has since become my preferred way to structure JavaFX apps.
I also use it for small side projects. For example, a few months ago I've wanted to learn about charts in JavaFX, and I ended up spending a weekend on creating a simple visualization tool for HdrHistogram logs using Afterburner.fx.
Why do you need to generate code? You mentioned a mixture of Nashorn, Handlebars, Mustache and JavaPoet. What are the pros and cons of this approach?
Each of our robot actuator modules returns data from more than 30 integrated sensors. Since maintaining a large number of almost identical code blocks would be too error prone to do manually, we decided to auto-generate much of the related code.
It's main benefit is that templates are specified by simple plain text files that are easy to setup and understand. However, once generated code becomes more complex, the templates become very difficult to maintain. In those cases, we prefer to use JavaPoet.
Overall, I really enjoy working with generated code. It makes the code base much more maintainable, because it tends to either be fully working, or be so significantly broken that bugs are immediately obvious.
Are there any server components, or is the focus more on frontend?
At the moment we are still focusing on developing the core libraries and monitoring tools. However, a service that exposes useful statistics about all of our robotic modules in a deployed setting is definitely something that is on our radar for the future.
Which IDEs, build tools, utilities, SCMs etc. are you using?
On the Java side we primarily use Maven, IntelliJ, and SVN.
Are you looking to expand your team?
Definitely! We are looking for 1-2 software engineers in the next 6 months. I'm currently the only Java developer on our team and would like to get some help, especially on the JavaFX side.
Can you share any interesting resources (videos would be great) with the readers.
Of course! The HEBI Robotics website is currently a bit sparse with information, but we do have a lot of videos. I'd recommend looking through the YouTube channels of HEBI and the Biorobotics lab at CMU. Some of my personal favorites are:
- A walking hexapod
- An arm feeding lunch
- Inspection of an inactive nuclear power plant
- Demonstrating repeatability
- Sample configurations
- A demo of the MATLAB API
- The same demo code controlling a different actuator
Thank you for the interview!