Skip to content

Commit 9dfca09

Browse files
docs(planning_test_utils): update purpose of the package and add lanelet map images (#7077)
* docs(planning_test_utils): Add explanation Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * remove autoware prefix from autoware planning test manager Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * fix document Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * remove implemented test part Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> --------- Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp>
1 parent 4a9bb74 commit 9dfca09

File tree

6 files changed

+527
-73
lines changed

6 files changed

+527
-73
lines changed

planning/.pages

+1
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,6 @@ nav:
8080
- 'About Planning Debug Tools': https://github.com/autowarefoundation/autoware_tools/tree/main/planning/planning_debug_tools
8181
- 'Stop Reason Visualizer': https://github.com/autowarefoundation/autoware_tools/blob/main/planning/planning_debug_tools/doc-stop-reason-visualizer.md
8282
- 'Planning Test Utils': planning/planning_test_utils
83+
- 'Planning Test Manager': planning/autoware_planning_test_manager
8384
- 'Planning Topic Converter': planning/planning_topic_converter
8485
- 'Planning Validator': planning/planning_validator

planning/autoware_planning_test_manager/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Planning Interface Test Manager
1+
# Autoware Planning Test Manager
22

33
## Background
44

+20-72
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,40 @@
1-
# Autoware Planning Test Manager
1+
# Test Utils
22

33
## Background
44

5-
In each node of the planning module, when exceptional input, such as unusual routes or significantly deviated ego-position, is given, the node may not be prepared for such input and could crash. As a result, debugging node crashes can be time-consuming. For example, if an empty trajectory is given as input and it was not anticipated during implementation, the node might crash due to the unaddressed exceptional input when changes are merged, during scenario testing or while the system is running on an actual vehicle.
5+
Several Autoware's components and modules have already adopted unit testing, so a common library to ease the process of writing unit tests is necessary.
66

77
## Purpose
88

9-
The purpose is to provide a utility for implementing tests to ensure that node operates correctly when receiving exceptional input. By utilizing this utility and implementing tests for exceptional input, the purpose is to reduce bugs that are only discovered when actually running the system, by requiring measures for exceptional input before merging PRs.
9+
The objective of the `test_utils` is to develop a unit testing library for the Autoware components. This library will include
1010

11-
## Features
11+
- commonly used functions
12+
- input/mock data parser
13+
- maps for testing
14+
- common routes and mock data for testing.
1215

13-
### Confirmation of normal operation
16+
## Available Maps
1417

15-
For the test target node, confirm that the node operates correctly and publishes the required messages for subsequent nodes. To do this, test_node publish the necessary messages and confirm that the node's output is being published.
18+
The following maps are available [here](https://github.com/autowarefoundation/autoware.universe/tree/main/planning/planning_test_utils/test_map)
1619

17-
### Robustness confirmation for special inputs
20+
### Common
1821

19-
After confirming normal operation, ensure that the test target node does not crash when given exceptional input. To do this, provide exceptional input from the test_node and confirm that the node does not crash.
22+
The common map contains multiple types of usable inputs, including shoulder lanes, intersections, and some regulatory elements. The common map is named `lanelet2_map.osm` in the folder.
2023

21-
(WIP)
24+
![common](./images/common.png)
2225

23-
## Usage
26+
### 2 km Straight
2427

25-
```cpp
28+
The 2 km straight lanelet map consists of two lanes that run in the same direction. The map is named `2km_test.osm`.
2629

27-
TEST(PlanningModuleInterfaceTest, NodeTestWithExceptionTrajectory)
28-
{
29-
rclcpp::init(0, nullptr);
30+
![two_km](./images/2km-test.png)
3031

31-
// instantiate test_manager with PlanningInterfaceTestManager type
32-
auto test_manager = std::make_shared<planning_test_utils::PlanningInterfaceTestManager>();
32+
The following illustrates the design of the map.
3333

34-
// get package directories for necessary configuration files
35-
const auto planning_test_utils_dir =
36-
ament_index_cpp::get_package_share_directory("planning_test_utils");
37-
const auto target_node_dir =
38-
ament_index_cpp::get_package_share_directory("target_node");
34+
![straight_diagram](./images/2km-test.svg)
3935

40-
// set arguments to get the config file
41-
node_options.arguments(
42-
{"--ros-args", "--params-file",
43-
planning_test_utils_dir + "/config/test_vehicle_info.param.yaml", "--params-file",
44-
planning_validator_dir + "/config/planning_validator.param.yaml"});
36+
## Example use cases
4537

46-
// instantiate the TargetNode with node_options
47-
auto test_target_node = std::make_shared<TargetNode>(node_options);
38+
### Autoware Planning Test Manager
4839

49-
// publish the necessary topics from test_manager second argument is topic name
50-
test_manager->publishOdometry(test_target_node, "/localization/kinematic_state");
51-
test_manager->publishMaxVelocity(
52-
test_target_node, "motion_velocity_smoother/input/external_velocity_limit_mps");
53-
54-
// set scenario_selector's input topic name(this topic is changed to test node)
55-
test_manager->setTrajectoryInputTopicName("input/parking/trajectory");
56-
57-
// test with normal trajectory
58-
ASSERT_NO_THROW(test_manager->testWithNominalTrajectory(test_target_node));
59-
60-
// make sure target_node is running
61-
EXPECT_GE(test_manager->getReceivedTopicNum(), 1);
62-
63-
// test with trajectory input with empty/one point/overlapping point
64-
ASSERT_NO_THROW(test_manager->testWithAbnormalTrajectory(test_target_node));
65-
66-
// shutdown ROS context
67-
rclcpp::shutdown();
68-
}
69-
```
70-
71-
## Implemented tests
72-
73-
| Node | Test name | exceptional input | output | Exceptional input pattern |
74-
| -------------------------- | ----------------------------------------------------------------------------------------- | ----------------- | -------------- | ------------------------------------------------------------------------------------- |
75-
| planning_validator | NodeTestWithExceptionTrajectory | trajectory | trajectory | Empty, single point, path with duplicate points |
76-
| motion_velocity_smoother | NodeTestWithExceptionTrajectory | trajectory | trajectory | Empty, single point, path with duplicate points |
77-
| obstacle_cruise_planner | NodeTestWithExceptionTrajectory | trajectory | trajectory | Empty, single point, path with duplicate points |
78-
| obstacle_stop_planner | NodeTestWithExceptionTrajectory | trajectory | trajectory | Empty, single point, path with duplicate points |
79-
| obstacle_velocity_limiter | NodeTestWithExceptionTrajectory | trajectory | trajectory | Empty, single point, path with duplicate points |
80-
| obstacle_avoidance_planner | NodeTestWithExceptionTrajectory | trajectory | trajectory | Empty, single point, path with duplicate points |
81-
| scenario_selector | NodeTestWithExceptionTrajectoryLaneDrivingMode NodeTestWithExceptionTrajectoryParkingMode | trajectory | scenario | Empty, single point, path with duplicate points for scenarios:LANEDRIVING and PARKING |
82-
| freespace_planner | NodeTestWithExceptionRoute | route | trajectory | Empty route |
83-
| behavior_path_planner | NodeTestWithExceptionRoute NodeTestWithOffTrackEgoPose | route | route odometry | Empty route Off-lane ego-position |
84-
| behavior_velocity_planner | NodeTestWithExceptionPathWithLaneID | path_with_lane_id | path | Empty path |
85-
86-
## Important Notes
87-
88-
During test execution, when launching a node, parameters are loaded from the parameter file within each package. Therefore, when adding parameters, it is necessary to add the required parameters to the parameter file in the target node package. This is to prevent the node from being unable to launch if there are missing parameters when retrieving them from the parameter file during node launch.
89-
90-
## Future extensions / Unimplemented parts
91-
92-
(WIP)
40+
The goal of the [Autoware Planning Test Manager](https://autowarefoundation.github.io/autoware.universe/main/planning/autoware_planning_test_manager/) is to test planning module nodes. The `PlanningInterfaceTestManager` class ([source code](https://github.com/autowarefoundation/autoware.universe/blob/main/planning/autoware_planning_test_manager/src/autoware_planning_test_manager.cpp)) creates wrapper functions based on the `test_utils` functions.
5.45 KB
Loading

0 commit comments

Comments
 (0)