Skip to content

Commit

Permalink
relete unnecessary definition
Browse files Browse the repository at this point in the history
Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp>
  • Loading branch information
kyoichi-sugahara committed Mar 14, 2023
1 parent 19ce731 commit 6cd13f8
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

TEST(PlanningModuleInterfaceTest, testPlanningInterfaceWithVariousTrajectoryInput)
{
using autoware_auto_planning_msgs::msg::Trajectory;
rclcpp::init(0, nullptr);

auto test_manager = std::make_shared<planning_test_manager::PlanningIntefaceTestManager>();
Expand Down
9 changes: 9 additions & 0 deletions planning/surround_obstacle_checker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ rclcpp_components_register_node(${PROJECT_NAME}
EXECUTABLE ${PROJECT_NAME}_node
)

if(BUILD_TESTING)
ament_add_ros_isolated_gtest(test_${PROJECT_NAME}
test/test_motion_velocity_smoother_node_interface.cpp
)
target_link_libraries(test_${PROJECT_NAME}
${PROJECT_NAME}
)
endif()

ament_auto_package(
INSTALL_TO_SHARE
config
Expand Down
1 change: 1 addition & 0 deletions planning/surround_obstacle_checker/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<depend>vehicle_info_util</depend>
<depend>visualization_msgs</depend>

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

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Copyright 2023 Tier IV, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "ament_index_cpp/get_package_share_directory.hpp"
#include "motion_velocity_smoother/motion_velocity_smoother_node.hpp"
#include "planning_interface_test_manager/planning_interface_test_manager.hpp"
#include "planning_interface_test_manager/planning_interface_test_manager_utils.hpp"

#include <gtest/gtest.h>

#include <vector>

TEST(PlanningModuleInterfaceTest, testPlanningInterfaceWithVariousTrajectoryInput)
{
using autoware_auto_planning_msgs::msg::Trajectory;
rclcpp::init(0, nullptr);

auto test_manager = std::make_shared<planning_test_manager::PlanningIntefaceTestManager>();

auto node_options = rclcpp::NodeOptions{};

test_manager->declareVehicleInfoParams(node_options);
test_manager->declareNearestSearchDistanceParams(node_options);
node_options.append_parameter_override("algorithm_type", "JerkFiltered");
node_options.append_parameter_override("publish_debug_trajs", false);

const auto motion_velocity_smoother_dir =
ament_index_cpp::get_package_share_directory("motion_velocity_smoother");

node_options.arguments(
{"--ros-args", "--params-file",
motion_velocity_smoother_dir + "/config/default_motion_velocity_smoother.param.yaml",
"--params-file", motion_velocity_smoother_dir + "/config/default_common.param.yaml",
"--params-file", motion_velocity_smoother_dir + "/config/JerkFiltered.param.yaml"});

auto test_target_node =
std::make_shared<motion_velocity_smoother::MotionVelocitySmootherNode>(node_options);

// publish necessary topics from test_manager
test_manager->publishOdometry(test_target_node, "/localization/kinematic_state");
test_manager->publishMaxVelocity(
test_target_node, "motion_velocity_smoother/input/external_velocity_limit_mps");

// set subscriber for test_target_node
test_manager->setTrajectorySubscriber("motion_velocity_smoother/output/trajectory");

// setting topic name of subscribing topic
test_manager->setTrajectoryInputTopicName("motion_velocity_smoother/input/trajectory");

// test for normal trajectory
ASSERT_NO_THROW(test_manager->testWithNominalTrajectory(
test_target_node, "motion_velocity_smoother/input/trajectory"));
EXPECT_GE(test_manager->getReceivedTopicNum(), 1);

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

0 comments on commit 6cd13f8

Please sign in to comment.