Posts Tagged ‘FlorianEnner’
[DevoxxBE2025] Robotics and GraalVM Native Libraries
Lecturer
Florian Enner is the co-founder and chief software engineer at HEBI Robotics, a company specializing in modular robotic systems. With a background in electrical and computer engineering from Carnegie Mellon University, Florian has extensive experience in developing software for real-time robotic control and has contributed to various open-source projects in the field. His work focuses on creating flexible, high-performance robotic solutions for industrial and research applications.
Abstract
This article delves into the integration of Java in custom robotics development, emphasizing real-time control systems and the potential of GraalVM native shared libraries to supplant segments of C++ codebases. It identifies key innovations in modular hardware components and software architectures, situated within HEBI Robotics’ approach to building autonomous and inspection-capable robots. Through demonstrations of robotic platforms and code compilations, the narrative highlights methodologies for cross-platform compatibility, performance optimization, and safety features. The discussion evaluates contextual challenges in embedded systems, implications for development efficiency and scalability, and provides insights into transitioning legacy code for enhanced productivity.
Modular Building Blocks for Custom Robotics
HEBI Robotics specializes in creating versatile components that function as high-end building blocks for constructing bespoke robotic systems, akin to advanced modular kits. These include actuators, cameras, mobile bases, and batteries, designed to enable rapid assembly of robots for diverse applications such as industrial inspections or autonomous navigation. The innovation lies in the actuators’ integrated design, combining motors, encoders, and controllers into compact units that can be daisy-chained, simplifying wiring and reducing complexity in multi-joint systems.
Contextually, this addresses the fragmentation in robotics where off-the-shelf solutions often fail to meet specific needs. By providing standardized yet customizable modules, HEBI facilitates experimentation in research and industry, allowing users to focus on higher-level logic rather than hardware intricacies. For instance, actuators support real-time control at 1 kHz, with features like voltage compensation for battery-powered operations and safety timeouts to prevent uncontrolled movements.
Methodologically, the software stack is cross-platform, supporting languages like Java, C++, Python, and MATLAB, ensuring broad accessibility. Demonstrations showcase robots like hexapods or wheeled platforms controlled via Ethernet or WiFi, highlighting the system’s robustness in real-world scenarios. Implications include lowered barriers for R&D teams, enabling faster iterations and safer deployments, particularly for novices or in educational settings.
Java’s Role in Real-Time Robotic Control
Java’s utilization in robotics challenges conventional views of its suitability for time-critical tasks, traditionally dominated by lower-level languages. At HEBI, Java powers control loops on embedded Linux systems, leveraging its rich ecosystem for productivity while achieving deterministic performance. Key to this is managing garbage collection pauses through careful allocation strategies and using scoped values for thread-local data.
The API abstracts hardware complexities, allowing Java clients to issue commands and receive feedback in real time. For example, a simple Java script can orchestrate a robotic arm’s movements:
import com.hebi.robotics.*;
public class ArmControl {
public static void main(String[] args) {
ModuleSet modules = ModuleSet.fromDiscovery("arm");
Group group = modules.createGroup();
Command cmd = Command.create();
cmd.setPosition(new double[]{0.0, Math.PI/2, 0.0}); // Set joint positions
group.sendCommand(cmd);
}
}
This code discovers modules, forms a control group, and issues position commands. Safety integrates via command lifetimes: if no new command arrives within a specified period (e.g., 100 ms), the system shuts down, preventing hazards.
Contextually, this approach contrasts with C++’s dominance in embedded systems, offering Java’s advantages in readability and rapid development. Analysis shows Java matching C++ latencies in control loops, with minor overheads mitigated by optimizations like ahead-of-time compilation. Implications extend to team composition: Java’s familiarity attracts diverse talent, accelerating project timelines while maintaining reliability.
GraalVM Native Compilation for Shared Libraries
GraalVM’s native image compilation transforms Java code into standalone executables or shared libraries, presenting an opportunity to replace performance-critical C++ components. At HEBI, this is explored for creating .so files callable from C++, blending Java’s productivity with native efficiency.
The process involves configuring GraalVM for reflections and resources, then compiling:
native-image --shared -jar mylib.jar -H:Name=mylib
This generates a shared library with JNI exports. A simple example compiles a Java class with methods exposed for C++ invocation:
public class Devoxx {
public static int add(int a, int b) {
return a + b;
}
}
Compiled to libdevoxx.so, it’s callable from C++. Demonstrations show successful executions, with “Hello Devoxx” printed from Java-originated code.
Contextualized within robotics’ need for low-latency libraries, this bridges languages, allowing Java for logic and C++ for interfaces. Performance evaluations indicate near-native speeds, with startup advantages over JVMs. Implications include simplified maintenance: Java’s safety features reduce bugs in controls, while native compilation ensures compatibility with existing C++ ecosystems.
Performance Analysis and Case Studies
Performance benchmarks compare GraalVM libraries to C++ equivalents: in loops, latencies are comparable, with Java’s GC managed for determinism. Case studies include snake-like inspectors navigating pipes, controlled via Java for path planning.
Analysis reveals GraalVM’s potential in embedded scenarios, where quick compilations (under 5 minutes for small libraries) enable rapid iterations. Safety features, like velocity limits, integrate seamlessly.
Implications: hybrid codebases leverage strengths, enhancing scalability for complex robots like balancing platforms with children.
Future Prospects in Robotic Software Stacks
GraalVM promises polyglot libraries, enabling seamless multi-language calls. HEBI envisions full Java controls, reducing C++ reliance for better productivity.
Challenges: ensuring real-time guarantees in compiled code. Future: broader adoptions in frameworks for robotics.
In conclusion, GraalVM empowers Java in robotics, merging efficiency with developer-friendly tools for innovative systems.
Links:
- Lecture video: https://www.youtube.com/watch?v=md2JFgegN7U
- Florian Enner on LinkedIn: https://www.linkedin.com/in/florian-enner-59b81466/
- Florian Enner on GitHub: https://github.com/ennerf
- HEBI Robotics website: https://www.hebirobotics.com/