At xTerra Robotics, we're dedicated to pushing the boundaries of legged mobility, developing solutions for a diverse range of applications. Our recent technical deep dive at ROSCon India 2024, presented by our co-founder Amritanshu Manu, offered a fascinating look into the intricate software architecture that brings our robots to life. This post expands on those insights, detailing the core components, strategic design choices, and advanced algorithms that enable efficient, real-time locomotion on even low-power compute platforms.
The Sense-Plan-Act Loop: The Heart of Legged Robot Intelligence
All robots, including our legged platforms, operate on a fundamental Sense-Plan-Act loop that must run at a fast enough rate to enable dynamic movement. Our robots are equipped with an array of sensors, including a depth camera, IMU (inertial measurement unit), and joint encoders at each of their 12 actuated joints, providing crucial proprioceptive data about the robot's state and its environment.
Core Architectural Components: A Model-Based Approach
Our locomotion software is built upon a model-based architecture, utilizing a detailed understanding of the robot's dynamics and kinematics. This forms the foundation for three interconnected core components:
1. Locomotion Software (The PEC Cycle)
- This is the brain of the robot's movement, operating as a Planner-Estimator-Controller (PEC) cycle.
- The Motion Planner takes user commands (e.g., desired velocity) and calculates the robot's next footstep and joint movements, creating a reference state.
- The Estimator continuously determines the robot's current state (velocity, orientation, limb position) using data from proprioceptive sensors.
- The Controller then computes the precise torques required at each joint to achieve the planned movement.
2. Perception and Navigation Stack
- We leverage NVIDIA's Isaac ROS libraries for Visual SLAM, using depth camera and IMU data to compute odometry and poses.
- The NV Blocks Toolbox generates signed distance fields of the environment and handles static/dynamic scene construction.
- The Nav2 Toolbox processes the reconstructed scene data and computes commanded velocities passed to the Locomotion software.
3. Interfaces for Seamless Operation
- Communication Interface: Supports ROS 1, ROS 2, and DDS for seamless data flow between software blocks and hardware.
- Hardware Interface: Bridges Locomotion software with low-level motor interfaces.
- Simulation Interface: Custom Gazebo plugins simulate base, joint, and contact states, including custom contact models and motor control loops.
Strategic Design Choices & Optimization for Real-Time Performance
The challenge for modern legged robots lies in executing sophisticated locomotion algorithms on power-constrained hardware while maintaining real-time performance. Our architectural decisions are specifically tailored to address this:
1. Synchronous PEC Cycle
We made a pivotal design change to make the PEC cycle synchronous, ensuring planner, estimator, and controller execute sequentially. This improved code modularity and resolved the synchronization issues of the previous asynchronous ROS 1 approach.
2. Hybrid Middleware Approach
- For the core Locomotion software, we use bare DDS instead of ROS 2, providing direct QoS access while avoiding ROS 2 overhead, allowing the PEC cycle to run at 500 Hz on a Raspberry Pi 4B at 65–68% CPU.
- For the Perception and Navigation stack, we fully leverage the ROS 2 ecosystem due to its well-developed tooling.
3. Modular Code and Finite State Machine (FSM)
We implemented an FSM to easily switch between robot behaviors such as moving, standing, sleeping, or performing specific tasks.
Advanced Algorithmic Approaches for Efficient Locomotion
- Model Predictive Control (MPC) Optimization: Reduced-order models, adaptive horizon scaling, and hierarchical decomposition for parallel solving.
- Real-Time Gait Pattern Generation: Hybrid approach combining pre-computed gait libraries, online interpolation, and reactive modifications for obstacle avoidance.
- Whole-Body Impulse Control: Efficient computation of joint torques in high-DOF systems while meeting task objectives.
- Terrain-Aware Footstep Planning: A* search with heuristics, local optimization, and risk assessment for step feasibility.
Leveraging Edge Computing
GPU acceleration for matrix operations, dedicated AI accelerators for learned components, and FPGA implementation for critical control loops.
Memory Optimization
In-place operations, circular buffers, and quantization minimize memory usage, crucial for real-time performance on resource-constrained systems.
Machine Learning Integration for Adaptability
- Lightweight Neural Network Architectures: MobileNet-inspired depthwise separable convolutions for terrain classification, LSTMs for state estimation, and knowledge distillation for deployment.
- Online Learning and Adaptation: Online tuning of control parameters, continuous learning of surface properties, and real-time failure mode detection.
Validated Performance on Resource-Constrained Hardware
Our optimized algorithms have demonstrated significant improvements on various hardware platforms:
- ARM Cortex-A78: 40% reduction in CPU usage compared to baseline implementations.
- NVIDIA Jetson Orin: 60% improvement in real-time factor using GPU acceleration.
- Custom FPGA: Sub-millisecond control loop execution for critical functions.
The Future is Efficient and Open
By carefully crafting our software architecture and optimizing algorithms, we enable sophisticated robotic behaviors on resource-constrained hardware without sacrificing energy efficiency or operational duration. We are considering releasing our software as open source soon, contributing to the broader robotics community.
Our approach ensures that the future of robotics lies not just in more powerful hardware, but in smarter algorithms that extract maximum performance from available computational resources.
