Trajectory Ranker#
Purpose/Role#
This package provides a C++ library that scores candidate trajectories and selects the best one. Ranking combines three independently configurable terms:
- Safety — penalty from the validator risk level (
RiskLevel) - Source — penalty from the trajectory generator (diffusion vs backup planners)
- Quality — optional metric-plugin evaluation (comfort / progress / consistency)
The library can be embedded into a calling ros node (such as autoware_trajectory_selector) via TrajectoryRankerWrapper.
Architecture#
| Component | Role |
|---|---|
TrajectoryRankerWrapper |
Owns parameters, metric Evaluator, and TrajectoryRanker; entry point used by the selector |
TrajectoryRanker |
Applies safety / source / quality penalties and computes the final scalar score |
Evaluator |
Loads and runs quality metric plugins (only when evaluation.enable is true) |
Algorithm Overview#
For each call to TrajectoryRanker::process():
- Safety evaluation (
safety.enable): map each trajectory'sRiskLevelto a penalty viasafety.levels/safety.penalty. - Source evaluation (
source.enable): map each trajectory'sTrajectorySourceto a penalty viasource.levels/source.penalty. - Quality evaluation (
evaluation.enable, default off): resample each trajectory relative to ego odometry, run the configured metric plugins, and setquality_penalty = 1 - quality_score. Skipped if route handler or odometry is unavailable. - Score aggregation:
[
\mathrm{score} = 1 - \frac{
s{\mathrm{safety}}\,p}
- s{\mathrm{source}}\,p}
- s{\mathrm{eval}}\,p} }{ s{\mathrm{safety}} + s} + s*{\mathrm{eval}} } ] where \(s*\_\) are the configured scales and \(p\_\_\) are the per-trajectory penalties (zero when that term is disabled).
- Best selection: the trajectory with the highest score is retained as
best_trajectory_infoand used to update trajectory history / previous points for subsequent quality metrics.
Trajectory sources#
TrajectorySource |
Typical generator name prefix | Default source level string |
|---|---|---|
DIFFUSION_PLANNER |
DiffusionPlanner_ |
diffusion_planner |
BACKUP_PLANNER_GO |
MinimumRuleBasedPlanner_Go |
backup_planner_go |
BACKUP_PLANNER_STOP |
MinimumRuleBasedPlanner_Stop |
backup_planner_stop |
Source mapping from generator names is performed in the calling node (e.g trajectory_selector_node) before calling the ranker.
Default penalties (from config/trajectory_ranker.param.yaml)#
| Term | Levels / order | Penalties | Scale | Enabled by default |
|---|---|---|---|---|
| Safety | safe, low_caution, high_caution, danger, fatal |
0.0, 0.1, 0.4, 1.0, 1.0 |
20.0 |
yes |
| Source | diffusion_planner, backup_planner_go, backup_planner_stop |
0.0, 0.45, 0.5 |
5.0 |
yes |
| Quality | metric plugins under evaluation.plugin_names |
derived from metric score | 1.0 |
no |
Quality Metrics#
Used only when evaluation.enable is true. Plugins are loaded by Evaluator from evaluation.plugin_names.
| Metric | Type | Description | Class name |
|---|---|---|---|
| TravelDistance | Maximization | Progress along the trajectory | autoware::trajectory_ranker::metrics::TravelDistance |
| LateralAcceleration | Deviation | Lateral acceleration comfort | autoware::trajectory_ranker::metrics::LateralAcceleration |
| LongitudinalJerk | Deviation | Longitudinal jerk smoothness | autoware::trajectory_ranker::metrics::LongitudinalJerk |
| LateralDeviation | Deviation | Deviation from preferred lane centerline | autoware::trajectory_ranker::metrics::LateralDeviation |
| SteeringConsistency | Deviation | Consistency vs previous steering command | autoware::trajectory_ranker::metrics::SteeringConsistency |
| TrajectoryConsistency | Deviation | Consistency vs recent best trajectories | autoware::trajectory_ranker::metrics::TrajectoryConsistency |
- Maximization: higher raw values are better
- Deviation: lower raw values are better
When quality evaluation is enabled, trajectories are resampled to evaluation.sampling_number points at evaluation.sampling_resolution seconds relative to the current ego pose.
Interface#
This package is primarily a C++ library consumed by trajectory_selector_node. The selector owns the ROS I/O and passes:
RankerInputTrajectories— each entry has aCandidateTrajectory, validatorrisk_level, andTrajectorySourceRankerContext— odometry, route handler, and generator info (needed for quality metrics and output generator metadata)
Selector-side topics#
| Direction | Topic name | Message Type | Description |
|---|---|---|---|
| Publisher | ~/output/scored_trajectories |
autoware_internal_planning_msgs/msg/ScoredCandidateTrajectories |
Scored candidates from the integrated ranker |
Parameters#
| Name | Type | Description | Default | Range |
|---|---|---|---|---|
| safety. |
boolean | Enable safety evaluation | true | N/A |
| safety. |
array | List of safety levels | ["safe", "low_ |
N/A |
| safety. |
array | List of safety penalties | [0.0, 0.1, 0.4, 1.0, 1.0] | N/A |
| safety. |
float | Safety scale | 20.0 | N/A |
| source. |
boolean | Enable source evaluation | true | N/A |
| source. |
array | List of source levels | ["diffusion_ |
N/A |
| source. |
array | List of source penalties | [0.0, 0.45, 0.5] | N/A |
| source. |
float | Source scale | 5.0 | N/A |
| evaluation. |
boolean | Enable evaluation by metrics | false | N/A |
| evaluation. |
array | List of evaluation plugin names | ["autoware::trajectory_ |
N/A |
| evaluation. |
float | Evaluation scale | 1.0 | N/A |
| evaluation. |
integer | Sampling number | 16 | N/A |
| evaluation. |
float | Sampling resolution | 0.5 | N/A |
| evaluation. |
integer | Trajectory history size | 10 | ≥1 ≤100 |
| evaluation. |
boolean | Enable lateral acceleration | true | N/A |
| evaluation. |
float | Lateral acceleration weight | 0.1 | N/A |
| evaluation. |
float | Lateral acceleration maximum | 5.0 | N/A |
| evaluation. |
array | Temporal decay weights applied per resampled trajectory point | [1.0, 0.8, 0.64, 0.51, 0.41, 0.33, 0.26, 0.21, 0.17, 0.13, 0.1, 0.08, 0.067, 0.053, 0.043, 0.034] | N/A |
| evaluation. |
boolean | Enable longitudinal jerk | true | N/A |
| evaluation. |
float | Longitudinal jerk weight | 0.1 | N/A |
| evaluation. |
float | Longitudinal jerk maximum | 10.0 | N/A |
| evaluation. |
array | Temporal decay weights applied per resampled trajectory point | [1.0, 0.8, 0.64, 0.51, 0.41, 0.33, 0.26, 0.21, 0.17, 0.13, 0.1, 0.08, 0.067, 0.053, 0.043, 0.034] | N/A |
| evaluation. |
boolean | Enable travel distance | true | N/A |
| evaluation. |
float | Travel distance weight | 0.3 | N/A |
| evaluation. |
float | Travel distance maximum | 500.0 | N/A |
| evaluation. |
array | Temporal decay weights applied per resampled trajectory point | [1.0, 0.8, 0.64, 0.51, 0.41, 0.33, 0.26, 0.21, 0.17, 0.13, 0.1, 0.08, 0.067, 0.053, 0.043, 0.034] | N/A |
| evaluation. |
boolean | Enable lateral deviation | true | N/A |
| evaluation. |
float | Lateral deviation weight | 0.3 | N/A |
| evaluation. |
float | Lateral deviation maximum | 10.0 | N/A |
| evaluation. |
array | Temporal decay weights applied per resampled trajectory point | [1.0, 0.8, 0.64, 0.51, 0.41, 0.33, 0.26, 0.21, 0.17, 0.13, 0.1, 0.08, 0.067, 0.053, 0.043, 0.034] | N/A |
| evaluation. |
boolean | Enable steering consistency | true | N/A |
| evaluation. |
float | Steering consistency weight | 0.3 | N/A |
| evaluation. |
float | Steering consistency maximum | 0.1 | N/A |
| evaluation. |
array | Temporal decay weights applied per resampled trajectory point | [1.0, 0.8, 0.64, 0.51, 0.41, 0.33, 0.26, 0.21, 0.17, 0.13, 0.1, 0.08, 0.067, 0.053, 0.043, 0.034] | N/A |
| evaluation. |
boolean | Enable trajectory consistency | true | N/A |
| evaluation. |
float | Trajectory consistency weight | 0.2 | N/A |
| evaluation. |
float | Trajectory consistency time horizon | 2.0 | N/A |
| evaluation. |
float | Trajectory consistency maximum | 1.0 | N/A |
| evaluation. |
array | Temporal decay weights applied per resampled trajectory point | [1.0, 0.8, 0.64, 0.51, 0.41, 0.33, 0.26, 0.21, 0.17, 0.13, 0.1, 0.08, 0.067, 0.053, 0.043, 0.034] | N/A |