Sparky is a ROS 2 simulation workspace for basic autonomous vehicle planning, control, and vehicle-state feedback.
The current workspace implements a minimum viable closed loop:
path_plannerpublishes a configurablenav_msgs/Pathfrom waypoint input parameterscontrollertracks that path from/odomusing a Pure Pursuit-style controllervehicle_simsimulates a kinematic bicycle model and publishes odometry plus TFvehicle_descriptionprovides the URDF asset for visualizationmetrics_loggersubscribes to planner and controller telemetry and writes CSV summaries
Full environment setup is in SETUP.md.
Build the workspace:
colcon build
source install/setup.bashRun the current nodes in three separate terminals:
ros2 run path_planner path_planner_node
ros2 run controller controller_node
ros2 run vehicle_sim vehicle_sim_nodeIn another terminal, use the YAML planner route file to start the path_planner node:
ros2 run path_planner path_planner_node --ros-args \
--params-file $(ros2 pkg prefix path_planner)/share/path_planner/config/default_route.yamlYou can also run your own x, y waypoint pairs. For example:
ros2 run path_planner path_planner_node --ros-args \
-p waypoints:="[0.0, 0.0, 3.0, 0.0, 3.0, 1.5, 0.0, 1.5, 0.0, 0.0]"Start the RViz visualization (with RViz configuration file):
rviz2 -d $(ros2 pkg prefix path_planner)/share/path_planner/rviz/sparky.rvizOr start RViz and the robot state publisher separately:
rviz2
ros2 run robot_state_publisher robot_state_publisher \
--ros-args \
-p robot_description:="$(cat $(ros2 pkg prefix vehicle_description)/share/vehicle_description/urdf/vehicle.urdf)"Launch the stack with the default route file:
ros2 launch path_planner sparky.launch.pyOptional: Launch the stack without the metrics logger
ros2 launch path_planner sparky.launch.py enable_metrics:=falseOptional: Swap routes by pointing launch to your own YAML file. First, stop the terminal running ''ros2 launch path_planner sparky.launch.py''. Then run the following:
ros2 launch path_planner sparky.launch.py \
route_config:=/absolute/path/to/your_route.yamlOptional: Change the metrics logger settings
ros2 launch path_planner sparky.launch.py \
metrics_log_dir:=/absolute/path/to/metrics \
metrics_summary_period_s:=5.0Current packages in src/:
path_planner: publishes/pathfrom configurable waypoint inputcontroller: subscribes to/pathand/odom, publishes/cmd_drivevehicle_sim: subscribes to/cmd_drive, publishes/odom, broadcasts TFvehicle_description: installs the vehicle URDF assetmetrics_logger: subscribes to/metrics/controllerand/metrics/planner, writes CSV logs
Runtime flow:
flowchart LR
A[path_planner_node] -->|/path| B[controller_node]
B -->|/cmd_drive| C[vehicle_sim_node]
C -->|/odom| B
A -->|/metrics/planner| E[metrics_logger_node]
B -->|/metrics/controller| E
C -->|TF: map -> odom -> base_link| D[Visualization]
- Implemented: configurable path publication, path tracking, kinematic simulation, odometry, TF, manual RViz visualization, a checked-in RViz config, and CSV-backed controller/planner metrics logging
- Missing: trajectory smoothing, velocity profiling, and packaged metrics plotting
The launch path starts a metrics logger by default.
- Controller metrics topic:
/metrics/controller - Planner metrics topic:
/metrics/planner - Default CSV output directory:
metrics_logs/ - Default summary log period:
2.0seconds
The metrics logger writes:
metrics_logs/controller_metrics.csvmetrics_logs/planner_metrics.csv
The controller metrics CSV currently includes cross-track error, heading error, steering command, steering oscillation, commanded speed, curvature, control latency, lookahead distance, target point, and path size. The planner metrics CSV includes frame id, waypoint count, publish interval, and loop rate.
- SETUP.md: environment and dependency setup
- docs/architecture.md: package responsibilities and interfaces
- docs/requirements.md: current and target requirements
- docs/implementation_status.md: implementation gaps and risks
- Add trajectory smoothing and velocity profiling
- Add plotting or packaged analysis outputs for tracking metrics
- Extend route ingestion beyond parameter files and keep historical notes aligned with the current runtime
My other open source work: www.github.com/janeliu-slac