How sair-lab/mat works
Purpose and execution model
This is a ROS Noetic/catkin workspace for autonomous off-road navigation in BeamNG.tech. It couples simulation sensing and vehicle actuation with terrain/traversability processing, CUDA MPPI local planning, and PID path following. The integrated entry point is example/nav_start.sh, configured by example/config/simulation.config and example/config/navigation_sim.config; module-specific ROS launch files permit partial deployments.
Workspace and interface contracts
The workspace is organized into BeamNG integration, navigation, and shared ROS interfaces under src/CMakeLists.txt. src/beamng/beamng_msgs defines the system boundary contracts: vehicle/sensor state and control messages plus scenario, vehicle, navigation, and simulation services. Key contracts include src/beamng/beamng_msgs/msg/VehicleControl.msg, src/beamng/beamng_msgs/msg/StateSensor.msg, and src/beamng/beamng_msgs/srv/NavigateToPosition.srv.
BeamNG simulation bridge
beamng_control is the runtime bridge to the external BeamNG.tech simulator. It loads scenario, vehicle, and sensor definitions; manages simulator services; converts simulator data into ROS publications; and receives ROS control/state requests. Its core orchestration is src/beamng/beamng_control/scripts/beamng_control/bridge.py, launched through src/beamng/beamng_control/launch/simulation.launch, with BeamNG-facing scenario/sensor configuration in src/beamng/beamng_control/config/scenarios/atv_nav.json and src/beamng/beamng_control/config/sensors.json.
Vehicle command paths
Autonomous control terminates at the simulation bridge through shared vehicle-control interfaces. The PID follower converts a planned local path into steering and throttle/brake commands in src/navigation/pid_controller/src/pathFollower.cpp, launched by src/navigation/pid_controller/launch/pid_controller.launch. Alternative/manual command sources are supported by the BeamNG agent (src/beamng/beamng_agent/scripts/control.py) and keyboard teleoperation (src/beamng/beamng_teleop_keyboard/launch/teleop.launch), so command arbitration/topic ownership must be managed at launch level.
Perception and motion-aware terrain representation
Terrain mapping consumes simulator lidar-derived data to construct local point-cloud and traversability outputs. The principal node is src/navigation/terrain_mapping/src/terrainAnalysisExt_for_data.cpp, with recording-oriented launch orchestration in src/navigation/terrain_mapping/launch/data_record.launch. The learned/derived traversability stage is separated into src/navigation/traverse_map/scripts/traversability_node.py; its model artifacts live under src/navigation/traverse_map/model. This is the key perception-to-planning boundary: geometry and vehicle-motion-aware terrain cost become planner inputs.
Goal production and local planning
Goals enter either interactively through RViz or from a mission waypoint publisher. src/navigation/global_waypoint/src/global_waypoint.cpp reads/publishes waypoint goals, using src/navigation/global_waypoint/waypoints/wp_atv.json, while src/navigation/rviz/goalpoint_rviz_plugin/src/goalpoint_tool.cpp provides an interactive goal mechanism. The CUDA MPPI planner consumes goal and terrain/traversability context and produces optimized local paths in src/navigation/local_planner_mppi/src/mppi_planner_node.cu; it depends on the vendored src/navigation/local_planner_mppi/submodules/MPPI-Generic runtime/library and is launched via src/navigation/local_planner_mppi/launch/local_planner_mppi.launch.
End-to-end control flow and operator surface
The primary flow is: BeamNG scenario/sensors → ROS sensor/state messages → terrain mapping → traversability map → MPPI trajectory optimization, guided by RViz or waypoint goals → PID controls → BeamNG bridge → vehicle dynamics. RViz is an operator-facing boundary for visualization, goal selection, prompts, and teleoperation, implemented through plugins such as src/navigation/rviz/prompt_manager_panel/src/prompt_panel.cpp and src/navigation/rviz/teleop_rviz_plugin/src/teleop_panel.cpp. Material runtime dependencies are ROS Noetic, catkin/CMake, CUDA for MPPI, BeamNG.tech networking configured by host/port, and the MPPI-Generic submodule.
Main entry points: bridge.py BeamNG control bridge · mppi_planner_node.cu CUDA MPPI planner · goalpoint_tool.cpp RViz operator plugins · beamng_msgs BeamNG ROS contracts
Components 19
ROS Interfaces
Shared messages and services define simulator and navigation contracts.
- BeamNG ROS contracts · Vehicle, sensor, scenario, and navigation interfaces.
src/beamng/beamng_msgs - VehicleControl
src/beamng/beamng_msgs/msg/VehicleControl.msg - StateSensor
src/beamng/beamng_msgs/msg/StateSensor.msg - NavigateToPosition
src/beamng/beamng_msgs/srv/NavigateToPosition.srv
BeamNG Integration
External simulator bridge and alternate control sources.
- BeamNG.tech · Vehicle dynamics and simulator-side sensors.
- BeamNG control bridge · Loads scenarios and sensors, translates simulator data, and applies controls.
src/beamng/beamng_control/scripts/beamng_control/bridge.py - Simulation launch
src/beamng/beamng_control/launch/simulation.launch - Scenario & sensor definitions
src/beamng/beamng_control/config/scenarios/atv_nav.json - BeamNG agent control
src/beamng/beamng_agent/scripts/control.py
Navigation Pipeline
Terrain processing, goal generation, planning, and path following.
- Terrain mapping · Builds local geometry from lidar-derived sensor data.
src/navigation/terrain_mapping/src/terrainAnalysisExt_for_data.cpp - Traversability map · Converts terrain and motion context into planner costs.
src/navigation/traverse_map/scripts/traversability_node.py - Mission waypoints
src/navigation/global_waypoint/src/global_waypoint.cpp - CUDA MPPI planner · Optimizes local paths using goals and traversability.
src/navigation/local_planner_mppi/src/mppi_planner_node.cu - MPPI-Generic
src/navigation/local_planner_mppi/submodules/MPPI-Generic - PID path follower · Converts planned local paths into steering and throttle/brake commands.
src/navigation/pid_controller/src/pathFollower.cpp
Operator Surface
Interactive visualization, goals, prompts, and teleoperation.
- RViz operator plugins · Visualization, interactive goals, prompts, and teleoperation.
src/navigation/rviz/goalpoint_rviz_plugin/src/goalpoint_tool.cpp - Keyboard teleop
src/beamng/beamng_teleop_keyboard/launch/teleop.launch
Other components
- Catkin workspace
src/CMakeLists.txt - Navigation startup · Starts the configured end-to-end simulation navigation stack.
example/nav_start.sh
Connections 21
- Catkin workspace → BeamNG ROS contracts: builds
- Navigation startup → Simulation launch: starts
- Simulation launch → BeamNG control bridge: launches
- Scenario & sensor definitions → BeamNG control bridge: loads
- BeamNG control bridge → BeamNG.tech: network API
- BeamNG control bridge → StateSensor: publishes
- BeamNG ROS contracts → BeamNG control bridge: uses
- StateSensor → Terrain mapping: lidar and vehicle state
- Terrain mapping → Traversability map: local terrain geometry
- Traversability map → CUDA MPPI planner: terrain costs
- Mission waypoints → CUDA MPPI planner: mission goals
- RViz operator plugins → CUDA MPPI planner: interactive goals
- NavigateToPosition → CUDA MPPI planner: goal contract
- MPPI-Generic → CUDA MPPI planner: optimization runtime
- CUDA MPPI planner → PID path follower: local path
- PID path follower → VehicleControl: publishes
- VehicleControl → BeamNG control bridge: actuation command
- BeamNG agent control → BeamNG control bridge: alternative commands · Requires launch-level command arbitration.
- Keyboard teleop → BeamNG control bridge: alternative commands · Requires launch-level command arbitration.
- RViz operator plugins → BeamNG control bridge: teleoperation commands · Requires launch-level command arbitration.
- BeamNG control bridge → BeamNG.tech: vehicle actuation