This system now supports two path sources:
- YAML file (original functionality)
- Built-in switch_back course (new functionality)
ros2 launch limo_controller mpc_single_evaluation.launch.py \
path_type:=yaml \
yaml_path_file:=path.yaml \
experiment_name:=mpc_yaml_test \
duration:=120.0 \
target_speed:=1.1ros2 launch limo_controller mpc_single_evaluation.launch.py \
path_type:=switch_back \
experiment_name:=mpc_switch_back_test \
duration:=120.0 \
target_speed:=0.8ros2 launch limo_controller mpc_single_evaluation.launch.py \
path_type:=yaml \
yaml_path_file:=custom_path.yaml \
experiment_name:=mpc_custom_path_test \
duration:=120.0 \
target_speed:=1.0ros2 launch limo_controller mpc_single_evaluation.launch.py \
path_type:=switch_back \
experiment_name:=mpc_tuned_test \
duration:=120.0 \
target_speed:=1.2 \
position_weight:=15.0 \
yaw_weight:=20.0 \
control_weight:=0.05 \
horizon_length:=15 \
control_dt:=0.08 \
max_steer_deg:=12.0path_type: "yaml" or "switch_back"yaml_path_file: Name of YAML file in the path directory (only used when path_type=yaml)
target_speed: Target speed in m/shorizon_length: MPC prediction horizon lengthcontrol_dt: MPC control time stepposition_weight: Position tracking weight in cost functionyaw_weight: Yaw tracking weight in cost functioncontrol_weight: Control effort weight in cost functionmax_steer_deg: Maximum steering angle in degrees
experiment_name: Name for the experiment (used in output files)duration: Experiment duration in secondssave_directory: Directory to save evaluation results
- Loads waypoints from a YAML file in
limo_controller/path/directory - YAML format:
- x: 0.0
y: 0.0
yaw: 0.0
- x: 5.0
y: 2.0
yaw: 0.5
# ... more waypoints- Uses the built-in
get_switch_back_course()function - Generates a complex path with forward and reverse sections
- Includes sharp turns and direction changes
- Good for testing MPC performance on challenging maneuvers
limo_controller/
├── launch/
│ └── mpc_single_evaluation.launch.py # Modified launch file
├── limo_controller/
│ ├── mpc.py # Modified MPC controller
│ ├── mpc_lib.py # MPC library functions
│ ├── mpc_evaluator.py # Performance evaluator
│ ├── PathPlanning/
│ │ └── CubicSpline/
│ │ └── cubic_spline_planner.py # Spline path generation
│ └── utils/
│ └── angle.py # Angle utilities
└── path/
├── path.yaml # Default path file
└── custom_path.yaml # Custom path files
The evaluator generates:
raw_data_*.json: Raw sensor datametrics_*.json: Processed performance metricssummary_stats_*.csv: Summary statisticscomprehensive_analysis_*.png: Performance plotsevaluation_report_*.md: Detailed analysis report
You can easily switch between path types by changing the path_type parameter:
- For YAML paths:
path_type:=yaml - For switch back course:
path_type:=switch_back
The system will automatically:
- Load the appropriate path
- Generate speed profiles
- Initialize the MPC controller
- Start path tracking
- For YAML paths: Ensure smooth waypoint transitions and appropriate yaw angles
- For switch back course: Use lower target speeds (0.5-1.0 m/s) for better tracking
- Tuning: Increase position_weight and yaw_weight for tighter tracking
- Control smoothness: Increase control_weight to reduce aggressive control actions