Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: planning control evaluator #2

Merged
merged 34 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6f279eb
feat: planning control node
hayato-m126 Jul 16, 2024
6fd279f
feat: update evaluation logic
hayato-m126 Jul 16, 2024
3656ce6
feat: update evaluation logic
hayato-m126 Jul 17, 2024
ba71358
fix: cast string
hayato-m126 Jul 17, 2024
872c70b
fix: field
hayato-m126 Jul 17, 2024
14ea7ab
feat: add unit test
hayato-m126 Jul 17, 2024
d20482c
chore: add temporary logic
hayato-m126 Jul 18, 2024
df97d79
fix: lane condition
hayato-m126 Jul 18, 2024
f65d46c
fix: lane s condition
hayato-m126 Jul 18, 2024
3cda13f
chore: allow empty KinematicCondition
hayato-m126 Jul 18, 2024
8de32ca
chore: add output decision
hayato-m126 Jul 18, 2024
1d3aa67
chore: update sample
hayato-m126 Jul 18, 2024
686177b
chore: pre-commit
hayato-m126 Jul 18, 2024
fa543a8
feat: add remap /localization/acceleration
hayato-m126 Jul 19, 2024
233ac3b
docs: update
hayato-m126 Jul 19, 2024
281e0e9
docs: update can msg
hayato-m126 Jul 19, 2024
d608bd1
feat: support LaunchPerception and LaunchPlanning
hayato-m126 Jul 19, 2024
509c715
feat: remap topic in bag
hayato-m126 Jul 19, 2024
6b78be4
fix: pre-commit
hayato-m126 Jul 19, 2024
ec98b03
chore: update status length check
hayato-m126 Jul 22, 2024
f068318
fix: remap
hayato-m126 Jul 22, 2024
b0909a0
docs: update document
hayato-m126 Jul 22, 2024
2c46423
docs: update sample
hayato-m126 Jul 22, 2024
618f972
Merge branch 'main' into feat/planning-control-evaluator
hayato-m126 Jul 22, 2024
89ef9df
feat: update unit test
hayato-m126 Jul 22, 2024
2ffc651
fix: local variable lane_info_tuple referenced before assignment
hayato-m126 Jul 22, 2024
2870b9a
Merge branch 'main' into feat/planning-control-evaluator
hayato-m126 Jul 23, 2024
f2ff41c
Merge branch 'develop' into feat/planning-control-evaluator
hayato-m126 Jul 23, 2024
f9f1318
Merge remote-tracking branch 'origin/develop' into feat/planning-cont…
hayato-m126 Jul 24, 2024
4b07ff1
feat: update scenario format and enable/disable component
hayato-m126 Jul 24, 2024
b017c63
Merge branch 'develop' into feat/planning-control-evaluator
hayato-m126 Jul 30, 2024
38b8345
Merge branch 'develop' into feat/planning-control-evaluator
hayato-m126 Jul 31, 2024
f87670d
feat: update topic name
hayato-m126 Jul 31, 2024
16e32ae
fix: pre-commit
hayato-m126 Aug 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions docs/use_case/planning_control.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Evaluate Planning Control

Evaluate whether Planning / Control metrics are output at specified times and conditions

## Evaluation Method

Launching the file executes the following steps:

1. Execute launch of evaluation node (`planning_control_evaluator_node`), `logging_simulator.launch` file and `ros2 bag play` command
2. Autoware receives sensor data output from input rosbag and the perception module performs recognition.
3. Using the results of perception, Autoware output Metrics to `/planning/planning_evaluator/metrics` for planning and `/control/control_evaluator/metrics` for control.
4. The evaluation node subscribes to the topic and evaluates data. The result is dumped into a file.
5. When the playback of the rosbag is finished, Autoware's launch is automatically terminated, and the evaluation is completed.

## Evaluation Result

It is evaluated when status[0].name of the topic matches the module name specified in the scenario and status[0].value[0].key is a decision.
If a lane condition is described in the scenario, it is evaluated when the lane condition is also satisfied.
If the conditions for evaluation are not met, no log is output.

### Normal

Normal if status[0].values[0].value matches the decision in the scenario.
If kinematic_condition is specified, additionally, kinematic_state must meet the condition.

### Error

When the normal condition is not met

## Topic name and data type used by evaluation node

Subscribed topics:

| Topic name | Data type |
| ------------------------------------ | ------------------------------------- |
| /control/control_evaluator/metrics | diagnostic_msgs::msg::DiagnosticArray |
| /planning/planning_evaluator/metrics | diagnostic_msgs::msg::DiagnosticArray |

Published topics:

| Topic name | Data type |
| ---------- | --------- |
| N/A | N/A |

## Arguments passed to logging_simulator.launch

- localization: false

To use /sensing/lidar/concatenated/pointcloud in the bag, add sensing:=false to the launch argument.
If you want to use perception and planning from the bag as well, add “perception:=false planning:=false” to the “launch” argument.

```shell
ros2 launch log_evaluator log_evaluator.launch.py scenario_path:=${planning_control_scenario_path} sensing:=false perception:=false planning:=false
```

## About simulation

State the information required to run the simulation.

### Topic to be included in the input rosbag

| Topic name | Data type |
| -------------------------------------- | -------------------------------------------- |
| /pacmod/from_can_bus | can_msgs/msg/Frame |
| /localization/kinematic_state | nav_msgs/msg/Odometry |
| /localization/acceleration | geometry_msgs/msg/AccelWithCovarianceStamped |
| /sensing/lidar/concatenated/pointcloud | sensor_msgs/msg/PointCloud2 |
| /tf | tf2_msgs/msg/TFMessage |
| /planning/mission_planning/route | autoware_planning_msgs/msg/LaneletRoute |

The vehicle topics can be included instead of CAN.

| Topic name | Data type |
| -------------------------------------- | --------------------------------------------------- |
| /localization/kinematic_state | nav_msgs/msg/Odometry |
| /localization/acceleration | geometry_msgs/msg/AccelWithCovarianceStamped |
| /sensing/lidar/concatenated/pointcloud | sensor_msgs/msg/PointCloud2 |
| /tf | tf2_msgs/msg/TFMessage |
| /planning/mission_planning/route | autoware_planning_msgs/msg/LaneletRoute |
| /vehicle/status/control_mode | autoware_auto_vehicle_msgs/msg/ControlModeReport |
| /vehicle/status/gear_status | autoware_auto_vehicle_msgs/msg/GearReport |
| /vehicle/status/steering_status | autoware_auto_vehicle_msgs/SteeringReport |
| /vehicle/status/turn_indicators_status | autoware_auto_vehicle_msgs/msg/TurnIndicatorsReport |
| /vehicle/status/velocity_status | autoware_auto_vehicle_msgs/msg/VelocityReport |

### Topics that must not be included in the input rosbag

| Topic name | Data type |
| ---------- | ----------------------- |
| -------- | ----------------------- |
| /clock | rosgraph_msgs/msg/Clock |

The clock is output by the --clock option of ros2 bag play, so if it is recorded in the bag itself, it is output twice, so it is not included in the bag.

## About Evaluation

State the information necessary for the evaluation.

### Scenario Format

See [sample](https://github.com/tier4/driving_log_replayer/blob/main/sample/planning_control/scenario.ja.yaml).

### Evaluation Result Format

See [sample](https://github.com/tier4/driving_log_replayer/blob/main/sample/planning_control/result.json).

The result format is shown below.
**NOTE: common part of the result file format, which has already been explained, is omitted.**

Success is determined when all evaluation conditions set in planning and control are met.

```json
{
"Frame": {
"[Planning|Control]_CONDITION_INDEX": {
"Result": { "Total": "Success or Fail", "Frame": "Success or Fail" },
"Info": {
"TotalPassed": "Total number of topics that passed the evaluation criteria",
"Decision": "Decision of the acquired TOPIC",
"LaneInfo": "[lane_id, s, t]",
"KinematicState": "[vel, acc, jerk]"
}
}
}
}
```
125 changes: 125 additions & 0 deletions docs/use_case/planning_control.ja.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Planning Controlの評価

Planning / ControlのMetricsが指定の条件で出力されているか評価する

## 評価方法

launch を立ち上げると以下のことが実行され、評価される。

1. launch で評価ノード(`planning_control_evaluator_node`)と `logging_simulator.launch``ros2 bag play`コマンドを立ち上げる
2. bag から出力されたセンサーデータを autoware が受け取って、perception モジュールが認識を行う
3. perceptionの結果を使って、planningは `/planning/planning_evaluator/metrics` に controlは `/control/control_evaluator/metrics`にMetricsを出力する
4. 評価ノードが topic を subscribe して、各基準を満たしているかを判定して結果をファイルに記録する
5. bag の再生が終了すると自動で launch が終了して評価が終了する

## 評価結果

topicのstatus[0].nameがシナリオで指定したモジュール名と一致し、且つ、status[0].value[0].keyがdecisionの場合に評価される。
また、シナリオでレーン条件を記述した場合は、レーン条件も満たした場合に評価される。
評価の条件を満たさない場合は、ログも出力されない。

### 正常

status[0].values[0].valueがシナリオのdecisionと一致した場合に正常となる。
kinematic_conditionを指定した場合は追加で、kinematic_stateが条件を満たしている必要がある。

### 異常

正常の条件を満たさないとき

## 評価ノードが使用する Topic 名とデータ型

Subscribed topics:

| Topic name | Data type |
| ------------------------------------ | ------------------------------------- |
| /control/control_evaluator/metrics | diagnostic_msgs::msg::DiagnosticArray |
| /planning/planning_evaluator/metrics | diagnostic_msgs::msg::DiagnosticArray |

Published topics:

| Topic name | Data type |
| ---------- | --------- |
| N/A | N/A |

## logging_simulator.launch に渡す引数

- localization: false

bagの中に入っている、/sensing/lidar/concatenated/pointcloudを利用する場合は、launchの引数にsensing:=falseを追加する
perception、planningも同様にbagから出力する場合は、launchの引数にperception:=false planning:=falseを追加する

```shell
ros2 launch log_evaluator log_evaluator.launch.py scenario_path:=${planning_control_scenario_path} sensing:=false perception:=false planning:=false
```

## simulation

シミュレーション実行に必要な情報を述べる。

### 入力 rosbag に含まれるべき topic

| topic 名 | データ型 |
| -------------------------------------- | -------------------------------------------- |
| /pacmod/from_can_bus | can_msgs/msg/Frame |
| /localization/kinematic_state | nav_msgs/msg/Odometry |
| /localization/acceleration | geometry_msgs/msg/AccelWithCovarianceStamped |
| /sensing/lidar/concatenated/pointcloud | sensor_msgs/msg/PointCloud2 |
| /tf | tf2_msgs/msg/TFMessage |
| /planning/mission_planning/route | autoware_planning_msgs/msg/LaneletRoute |

CAN の代わりに vehicle の topic を含めても良い。

| topic 名 | データ型 |
| -------------------------------------- | --------------------------------------------------- |
| /localization/kinematic_state | nav_msgs/msg/Odometry |
| /localization/acceleration | geometry_msgs/msg/AccelWithCovarianceStamped |
| /sensing/lidar/concatenated/pointcloud | sensor_msgs/msg/PointCloud2 |
| /tf | tf2_msgs/msg/TFMessage |
| /planning/mission_planning/route | autoware_planning_msgs/msg/LaneletRoute |
| /vehicle/status/control_mode | autoware_auto_vehicle_msgs/msg/ControlModeReport |
| /vehicle/status/gear_status | autoware_auto_vehicle_msgs/msg/GearReport |
| /vehicle/status/steering_status | autoware_auto_vehicle_msgs/SteeringReport |
| /vehicle/status/turn_indicators_status | autoware_auto_vehicle_msgs/msg/TurnIndicatorsReport |
| /vehicle/status/velocity_status | autoware_auto_vehicle_msgs/msg/VelocityReport |

### 入力 rosbag に含まれてはいけない topic

| topic 名 | データ型 |
| -------- | ----------------------- |
| /clock | rosgraph_msgs/msg/Clock |

clock は、ros2 bag play の--clock オプションによって出力しているので、bag 自体に記録されていると 2 重に出力されてしまうので bag には含めない

## evaluation

評価に必要な情報を述べる。

### シナリオフォーマット

[サンプル](https://github.com/tier4/driving_log_replayer/blob/main/sample/planning_control/scenario.ja.yaml)参照

### 評価結果フォーマット

[サンプル](https://github.com/tier4/driving_log_replayer/blob/main/sample/planning_control/result.json)参照

以下に、それぞれの評価の例を記述する。
**注:結果ファイルフォーマットで解説済みの共通部分については省略する。**

planning と controlで設定した全ての評価条件で成功している場合に成功と判定される。

```json
{
"Frame": {
"[Planning|Control]_CONDITION_INDEX": {
"Result": { "Total": "Success or Fail", "Frame": "Success or Fail" },
"Info": {
"TotalPassed": "評価条件をパスしたtopicの総数",
"Decision": "取得したtopicのdecision",
"LaneInfo": "[lane_id, s, t]",
"KinematicState": "[vel, acc, jerk]"
}
}
}
}
```
1 change: 1 addition & 0 deletions log_evaluator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ install(PROGRAMS
scripts/eagleye_evaluator_node.py
scripts/ar_tag_based_localizer_evaluator_node.py
scripts/annotationless_perception_evaluator_node.py
scripts/planning_control_evaluator_node.py
DESTINATION lib/${PROJECT_NAME}
)

Expand Down
15 changes: 15 additions & 0 deletions log_evaluator/config/planning_control/qos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/tf_static:
reliability: reliable
history: keep_last
depth: 1
durability: transient_local
/planning/mission_planning/route:
reliability: reliable
history: keep_last
depth: 1
durability: transient_local
/perception/obstacle_segmentation/pointcloud:
depth: 10
durability: volatile
history: keep_last
reliability: best_effort
13 changes: 13 additions & 0 deletions log_evaluator/launch/log_evaluator.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,19 @@ def launch_bag_player(
remap_list.append(
"/localization/kinematic_state:=/unused/localization/kinematic_state",
)
remap_list.append(
"/localization/acceleration:=/unused/localization/acceleration",
)
if conf.get("perception", "true") == "true":
# remap perception msgs in bag
remap_list.append(
"/perception/obstacle_segmentation/pointcloud:=/unused/perception/obstacle_segmentation/pointcloud",
)
remap_list.append(
"/perception/object_recognition/objects:=/unused/perception/object_recognition/objects",
)
if conf.get("planning", "true") == "true":
pass
if len(remap_list) != 1:
play_cmd.extend(remap_list)
bag_player = ExecuteProcess(cmd=play_cmd, output="screen")
Expand Down
19 changes: 19 additions & 0 deletions log_evaluator/log_evaluator/launch_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,19 @@

PERFORMANCE_DIAG_NODE_PARAMS = {}

PLANNING_CONTROL_RECORD_TOPIC = """^/tf$\
|^/control/control_evaluator/metrics$\
|^/planning/planning_evaluator/metrics$\
"""

PLANNING_CONTROL_AUTOWARE_DISABLE = {
"localization": "false",
}

PLANNING_CONTROL_AUTOWARE_ARGS = {}

PLANNING_CONTROL_NODE_PARAMS = {}

TRAFFIC_LIGHT_RECORD_TOPIC = """^/tf$\
|^/sensing/camera/camera[67]/image_raw/compressed$\
|^/perception/.*/traffic_signals$\
Expand Down Expand Up @@ -263,6 +276,12 @@
"autoware": PERFORMANCE_DIAG_AUTOWARE_ARGS,
"node": PERFORMANCE_DIAG_NODE_PARAMS,
},
"planning_control": {
"record": PLANNING_CONTROL_RECORD_TOPIC,
"disable": PLANNING_CONTROL_AUTOWARE_DISABLE,
"autoware": PLANNING_CONTROL_AUTOWARE_ARGS,
"node": PLANNING_CONTROL_NODE_PARAMS,
},
"traffic_light": {
"record": TRAFFIC_LIGHT_RECORD_TOPIC,
"disable": TRAFFIC_LIGHT_AUTOWARE_DISABLE,
Expand Down
Loading
Loading