How forzaeth/race_stack works
This project is a full-stack autonomous racing system built for scaled race cars, integrating simulation, real‐car hardware, and various state-of-the-art modules. Its purpose is to provide an end-to-end solution for head-to-head autonomous racing; it includes everything from low-level control and state estimation to high-level planning, perception, and system identification, as well as simulation support. The design has deep roots in ROS-based architectures and leverages several well-known open source projects.
Major Components and Layers
• Base System & Stack Master: Representing the main entry point that ties together the various modules for deployment on the car or in simulation.
• Controller and f110_utils: Low-level control, message definitions, and utility libraries for interfacing with the car hardware and simulation. Include the “controller” folder and the “f110_utils” libraries (which include message definitions [e.g., CarState, Waypoints], conversion utilities, and node implementations).
• Perception: Handling sensor processing and object/opponent tracking (e.g., the “perception” directory with its opponent_tracker module).
• Planner: This module covers path planning, trajectory optimization, and graph-based planning. It includes both traditional optimal planning (frenet-planner) and global planners implemented under the “planner” directory.
• State Estimation & State Machine: Running the fuse of sensor data and feedback through modules like “state_estimation” and “state_machine” which govern the overall behavioral logic of the vehicle.
• System Identification: This sub-system, under “system_identification”, is responsible for on-track system identification and performance tuning.
• Simulation and Deployment Infrastructure: Includes docker and container configurations, “docker-compose”, and “devcontainer” scripts, as well as associated launch files for simulation (both hardware and software in a ROS environment).
• Supporting modules: Additional libraries (e.g., cartographer integrations, predictive spliner, mapping, etc.) and configuration files (often YAML/CMakeLists) that bind the components.
Relationships and Data Flow
• Data flow can be segmented by layers. For example, sensor data from the perception system feeds into state estimation; then the state machine uses this processed information to update control commands that pass to the controller.
• The high-level planner (which may operate via the planner and global optimizer nodes) consumes route designs and data from perception to generate trajectories.
• Deployment orchestration is managed by “stack_master”, which composes launch files and configurations for both simulation and hardware.
Architectural Patterns and Design Principles
• Modularity and separation of concerns: Each module (perception, planning, state estimation, control, system identification) is a self-contained ROS node or set of nodes.
• Publisher-subscriber communication: ROS topics and services are used extensively.
• Use of configuration files and launch scripts: Many folders contain launch, configuration (YAML, .cfg), and parameter files that drive the operation.
• Hybrid usage of C++ and Python: Some nodes are implemented in C++ (for performance-critical parts, e.g., in controller and planner implementations) and others in Python (for orchestration, state machine, etc.).
• Containerization for reproducibility: Dockerfiles and devcontainer configurations provide a containerized environment.