Skip to content

Commit

Permalink
refactor(autoware_planning_test_manager): rename package (#6995)
Browse files Browse the repository at this point in the history
* refactor(autoware_planning_test_manager): rename package

Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp>

* rename file

Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp>

* Add maintainer for planning test utils

Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp>

* Add route handler back into package.xml

Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp>

---------

Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp>
Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp>
  • Loading branch information
zulfaqar-azmi-t4 authored May 15, 2024
1 parent d7c2288 commit 23d103f
Show file tree
Hide file tree
Showing 37 changed files with 206 additions and 58 deletions.
11 changes: 11 additions & 0 deletions planning/autoware_planning_test_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.14)
project(autoware_planning_test_manager)

find_package(autoware_cmake REQUIRED)
autoware_package()

ament_auto_add_library(autoware_planning_test_manager SHARED
src/autoware_planning_test_manager.cpp
)

ament_auto_package()
92 changes: 92 additions & 0 deletions planning/autoware_planning_test_manager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Planning Interface Test Manager

## Background

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.

## Purpose

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.

## Features

### Confirmation of normal operation

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.

### Robustness confirmation for special inputs

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.

(WIP)

## Usage

```cpp

TEST(PlanningModuleInterfaceTest, NodeTestWithExceptionTrajectory)
{
rclcpp::init(0, nullptr);

// instantiate test_manager with PlanningInterfaceTestManager type
auto test_manager = std::make_shared<planning_test_utils::PlanningInterfaceTestManager>();

// get package directories for necessary configuration files
const auto planning_test_utils_dir =
ament_index_cpp::get_package_share_directory("planning_test_utils");
const auto target_node_dir =
ament_index_cpp::get_package_share_directory("target_node");

// set arguments to get the config file
node_options.arguments(
{"--ros-args", "--params-file",
planning_test_utils_dir + "/config/test_vehicle_info.param.yaml", "--params-file",
planning_validator_dir + "/config/planning_validator.param.yaml"});

// instantiate the TargetNode with node_options
auto test_target_node = std::make_shared<TargetNode>(node_options);

// publish the necessary topics from test_manager second argument is topic name
test_manager->publishOdometry(test_target_node, "/localization/kinematic_state");
test_manager->publishMaxVelocity(
test_target_node, "motion_velocity_smoother/input/external_velocity_limit_mps");

// set scenario_selector's input topic name(this topic is changed to test node)
test_manager->setTrajectoryInputTopicName("input/parking/trajectory");

// test with normal trajectory
ASSERT_NO_THROW(test_manager->testWithNominalTrajectory(test_target_node));

// make sure target_node is running
EXPECT_GE(test_manager->getReceivedTopicNum(), 1);

// test with trajectory input with empty/one point/overlapping point
ASSERT_NO_THROW(test_manager->testWithAbnormalTrajectory(test_target_node));

// shutdown ROS context
rclcpp::shutdown();
}
```
## Implemented tests
| Node | Test name | exceptional input | output | Exceptional input pattern |
| -------------------------- | ----------------------------------------------------------------------------------------- | ----------------- | -------------- | ------------------------------------------------------------------------------------- |
| planning_validator | NodeTestWithExceptionTrajectory | trajectory | trajectory | Empty, single point, path with duplicate points |
| motion_velocity_smoother | NodeTestWithExceptionTrajectory | trajectory | trajectory | Empty, single point, path with duplicate points |
| obstacle_cruise_planner | NodeTestWithExceptionTrajectory | trajectory | trajectory | Empty, single point, path with duplicate points |
| obstacle_stop_planner | NodeTestWithExceptionTrajectory | trajectory | trajectory | Empty, single point, path with duplicate points |
| obstacle_velocity_limiter | NodeTestWithExceptionTrajectory | trajectory | trajectory | Empty, single point, path with duplicate points |
| obstacle_avoidance_planner | NodeTestWithExceptionTrajectory | trajectory | trajectory | Empty, single point, path with duplicate points |
| scenario_selector | NodeTestWithExceptionTrajectoryLaneDrivingMode NodeTestWithExceptionTrajectoryParkingMode | trajectory | scenario | Empty, single point, path with duplicate points for scenarios:LANEDRIVING and PARKING |
| freespace_planner | NodeTestWithExceptionRoute | route | trajectory | Empty route |
| behavior_path_planner | NodeTestWithExceptionRoute NodeTestWithOffTrackEgoPose | route | route odometry | Empty route Off-lane ego-position |
| behavior_velocity_planner | NodeTestWithExceptionPathWithLaneID | path_with_lane_id | path | Empty path |
## Important Notes
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.
## Future extensions / Unimplemented parts
(WIP)
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef PLANNING_TEST_UTILS__PLANNING_INTERFACE_TEST_MANAGER_HPP_
#define PLANNING_TEST_UTILS__PLANNING_INTERFACE_TEST_MANAGER_HPP_
#ifndef AUTOWARE_PLANNING_TEST_MANAGER__AUTOWARE_PLANNING_TEST_MANAGER_HPP_
#define AUTOWARE_PLANNING_TEST_MANAGER__AUTOWARE_PLANNING_TEST_MANAGER_HPP_

// since ASSERT_NO_THROW in gtest masks the exception message, redefine it.
#define ASSERT_NO_THROW_WITH_ERROR_MSG(statement) \
Expand Down Expand Up @@ -266,4 +266,4 @@ class PlanningInterfaceTestManager

} // namespace planning_test_utils

#endif // PLANNING_TEST_UTILS__PLANNING_INTERFACE_TEST_MANAGER_HPP_
#endif // AUTOWARE_PLANNING_TEST_MANAGER__AUTOWARE_PLANNING_TEST_MANAGER_HPP_
47 changes: 47 additions & 0 deletions planning/autoware_planning_test_manager/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>autoware_planning_test_manager</name>
<version>0.1.0</version>
<description>ROS 2 node for testing interface of the nodes in planning module</description>
<maintainer email="kyoichi.sugahara@tier4.jp">Kyoichi Sugahara</maintainer>
<maintainer email="takamasa.horibe@tier4.jp">Takamasa Horibe</maintainer>
<license>Apache License 2.0</license>

<author email="kyoichi.sugahara@tier4.jp">Kyoichi Sugahara</author>

<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>autoware_cmake</buildtool_depend>

<depend>autoware_auto_control_msgs</depend>
<depend>autoware_auto_mapping_msgs</depend>
<depend>autoware_auto_planning_msgs</depend>
<depend>autoware_auto_vehicle_msgs</depend>
<depend>autoware_perception_msgs</depend>
<depend>autoware_planning_msgs</depend>
<depend>component_interface_specs</depend>
<depend>component_interface_utils</depend>
<depend>lanelet2_extension</depend>
<depend>lanelet2_io</depend>
<depend>motion_utils</depend>
<depend>nav_msgs</depend>
<depend>planning_test_utils</depend>
<depend>rclcpp</depend>
<depend>route_handler</depend>
<depend>tf2_msgs</depend>
<depend>tf2_ros</depend>
<depend>tier4_api_msgs</depend>
<depend>tier4_autoware_utils</depend>
<depend>tier4_planning_msgs</depend>
<depend>tier4_v2x_msgs</depend>
<depend>unique_identifier_msgs</depend>
<depend>yaml_cpp_vendor</depend>

<test_depend>ament_cmake_ros</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

#include "motion_utils/trajectory/conversion.hpp"

#include <planning_test_utils/planning_interface_test_manager.hpp>
#include <planning_test_utils/planning_interface_test_manager_utils.hpp>
#include <autoware_planning_test_manager/autoware_planning_test_manager.hpp>
#include <planning_test_utils/planning_test_utils.hpp>

namespace planning_test_utils
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "behavior_path_planner/behavior_path_planner_node.hpp"

#include <ament_index_cpp/get_package_share_directory.hpp>
#include <planning_test_utils/planning_interface_test_manager.hpp>
#include <planning_test_utils/planning_interface_test_manager_utils.hpp>
#include <autoware_planning_test_manager/autoware_planning_test_manager.hpp>
#include <planning_test_utils/planning_test_utils.hpp>

#include <gtest/gtest.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "behavior_path_planner/behavior_path_planner_node.hpp"

#include <ament_index_cpp/get_package_share_directory.hpp>
#include <planning_test_utils/planning_interface_test_manager.hpp>
#include <planning_test_utils/planning_interface_test_manager_utils.hpp>
#include <autoware_planning_test_manager/autoware_planning_test_manager.hpp>
#include <planning_test_utils/planning_test_utils.hpp>

#include <vector>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "behavior_path_planner/behavior_path_planner_node.hpp"

#include <ament_index_cpp/get_package_share_directory.hpp>
#include <planning_test_utils/planning_interface_test_manager.hpp>
#include <planning_test_utils/planning_interface_test_manager_utils.hpp>
#include <autoware_planning_test_manager/autoware_planning_test_manager.hpp>
#include <planning_test_utils/planning_test_utils.hpp>

#include <vector>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
// limitations under the License.

#include "ament_index_cpp/get_package_share_directory.hpp"
#include "autoware_planning_test_manager/autoware_planning_test_manager.hpp"
#include "behavior_path_planner/behavior_path_planner_node.hpp"
#include "planning_test_utils/planning_interface_test_manager.hpp"
#include "planning_test_utils/planning_interface_test_manager_utils.hpp"
#include "planning_test_utils/planning_test_utils.hpp"

#include <gtest/gtest.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
// limitations under the License.

#include "ament_index_cpp/get_package_share_directory.hpp"
#include "autoware_planning_test_manager/autoware_planning_test_manager.hpp"
#include "behavior_path_planner/behavior_path_planner_node.hpp"
#include "planning_test_utils/planning_interface_test_manager.hpp"
#include "planning_test_utils/planning_interface_test_manager_utils.hpp"
#include "planning_test_utils/planning_test_utils.hpp"

#include <gtest/gtest.h>

Expand Down
2 changes: 1 addition & 1 deletion planning/behavior_path_planner/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<depend>autoware_auto_tf2</depend>
<depend>autoware_auto_vehicle_msgs</depend>
<depend>autoware_perception_msgs</depend>
<depend>autoware_planning_test_manager</depend>
<depend>behavior_path_planner_common</depend>
<depend>freespace_planning_algorithms</depend>
<depend>frenet_planner</depend>
Expand All @@ -55,7 +56,6 @@
<depend>motion_utils</depend>
<depend>object_recognition_utils</depend>
<depend>path_sampler</depend>
<depend>planning_test_utils</depend>
<depend>pluginlib</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "behavior_path_planner/behavior_path_planner_node.hpp"

#include <ament_index_cpp/get_package_share_directory.hpp>
#include <planning_test_utils/planning_interface_test_manager.hpp>
#include <planning_test_utils/planning_interface_test_manager_utils.hpp>
#include <autoware_planning_test_manager/autoware_planning_test_manager.hpp>
#include <planning_test_utils/planning_test_utils.hpp>

#include <gtest/gtest.h>

Expand Down
2 changes: 1 addition & 1 deletion planning/behavior_path_sampling_planner_module/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<depend>autoware_auto_tf2</depend>
<depend>autoware_auto_vehicle_msgs</depend>
<depend>autoware_perception_msgs</depend>
<depend>autoware_planning_test_manager</depend>
<depend>behavior_path_planner_common</depend>
<depend>bezier_sampler</depend>
<depend>frenet_planner</depend>
Expand All @@ -26,7 +27,6 @@
<depend>lanelet2_extension</depend>
<depend>motion_utils</depend>
<depend>path_sampler</depend>
<depend>planning_test_utils</depend>
<depend>pluginlib</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "behavior_path_planner/behavior_path_planner_node.hpp"

#include <ament_index_cpp/get_package_share_directory.hpp>
#include <planning_test_utils/planning_interface_test_manager.hpp>
#include <planning_test_utils/planning_interface_test_manager_utils.hpp>
#include <autoware_planning_test_manager/autoware_planning_test_manager.hpp>
#include <planning_test_utils/planning_test_utils.hpp>

#include <gtest/gtest.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "node.hpp"

#include <ament_index_cpp/get_package_share_directory.hpp>
#include <planning_test_utils/planning_interface_test_manager.hpp>
#include <planning_test_utils/planning_interface_test_manager_utils.hpp>
#include <autoware_planning_test_manager/autoware_planning_test_manager.hpp>
#include <planning_test_utils/planning_test_utils.hpp>

#include <gtest/gtest.h>

Expand Down
2 changes: 1 addition & 1 deletion planning/freespace_planner/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
<buildtool_depend>autoware_cmake</buildtool_depend>

<depend>autoware_auto_planning_msgs</depend>
<depend>autoware_planning_test_manager</depend>
<depend>freespace_planning_algorithms</depend>
<depend>geometry_msgs</depend>
<depend>motion_utils</depend>
<depend>nav_msgs</depend>
<depend>planning_test_utils</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>route_handler</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "freespace_planner/freespace_planner_node.hpp"

#include <ament_index_cpp/get_package_share_directory.hpp>
#include <planning_test_utils/planning_interface_test_manager.hpp>
#include <planning_test_utils/planning_interface_test_manager_utils.hpp>
#include <autoware_planning_test_manager/autoware_planning_test_manager.hpp>
#include <planning_test_utils/planning_test_utils.hpp>

#include <gtest/gtest.h>

Expand Down
2 changes: 1 addition & 1 deletion planning/motion_velocity_smoother/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
<buildtool_depend>eigen3_cmake_module</buildtool_depend>

<depend>autoware_auto_planning_msgs</depend>
<depend>autoware_planning_test_manager</depend>
<depend>geometry_msgs</depend>
<depend>interpolation</depend>
<depend>motion_utils</depend>
<depend>nav_msgs</depend>
<depend>osqp_interface</depend>
<depend>planning_test_utils</depend>
<depend>rclcpp</depend>
<depend>tf2</depend>
<depend>tf2_ros</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "motion_velocity_smoother/motion_velocity_smoother_node.hpp"

#include <ament_index_cpp/get_package_share_directory.hpp>
#include <planning_test_utils/planning_interface_test_manager.hpp>
#include <planning_test_utils/planning_interface_test_manager_utils.hpp>
#include <autoware_planning_test_manager/autoware_planning_test_manager.hpp>
#include <planning_test_utils/planning_test_utils.hpp>

#include <gtest/gtest.h>

Expand Down
2 changes: 1 addition & 1 deletion planning/obstacle_avoidance_planner/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
<buildtool_depend>autoware_cmake</buildtool_depend>

<depend>autoware_auto_planning_msgs</depend>
<depend>autoware_planning_test_manager</depend>
<depend>geometry_msgs</depend>
<depend>interpolation</depend>
<depend>motion_utils</depend>
<depend>nav_msgs</depend>
<depend>osqp_interface</depend>
<depend>planning_test_utils</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>std_msgs</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "obstacle_avoidance_planner/node.hpp"

#include <ament_index_cpp/get_package_share_directory.hpp>
#include <planning_test_utils/planning_interface_test_manager.hpp>
#include <planning_test_utils/planning_interface_test_manager_utils.hpp>
#include <autoware_planning_test_manager/autoware_planning_test_manager.hpp>
#include <planning_test_utils/planning_test_utils.hpp>

#include <gtest/gtest.h>

Expand Down
2 changes: 1 addition & 1 deletion planning/obstacle_cruise_planner/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
<depend>autoware_adapi_v1_msgs</depend>
<depend>autoware_auto_perception_msgs</depend>
<depend>autoware_auto_planning_msgs</depend>
<depend>autoware_planning_test_manager</depend>
<depend>geometry_msgs</depend>
<depend>interpolation</depend>
<depend>lanelet2_extension</depend>
<depend>motion_utils</depend>
<depend>nav_msgs</depend>
<depend>object_recognition_utils</depend>
<depend>osqp_interface</depend>
<depend>planning_test_utils</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>signal_processing</depend>
Expand Down
Loading

0 comments on commit 23d103f

Please sign in to comment.