Skip to content
Snippets Groups Projects
Unverified Commit f1fa6181 authored by Steven Macenski's avatar Steven Macenski Committed by GitHub
Browse files

Merge pull request #1350 from bpwilcox/fix_twist_gen_test

Re-enable dwb_plugin tests
parents 7770a454 9c1524e9
No related branches found
No related tags found
No related merge requests found
ament_add_gtest(vtest velocity_iterator_test.cpp) ament_add_gtest(vtest velocity_iterator_test.cpp)
#ament_add_gtest(goal_checker goal_checker.cpp) ament_add_gtest(goal_checker goal_checker.cpp)
#target_link_libraries(goal_checker simple_goal_checker stopped_goal_checker) target_link_libraries(goal_checker simple_goal_checker stopped_goal_checker)
#ament_add_gtest(twist_gen_test twist_gen.cpp) ament_add_gtest(twist_gen_test twist_gen.cpp)
#target_link_libraries(twist_gen_test standard_traj_generator) target_link_libraries(twist_gen_test standard_traj_generator)
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "dwb_plugins/simple_goal_checker.hpp" #include "dwb_plugins/simple_goal_checker.hpp"
#include "dwb_plugins/stopped_goal_checker.hpp" #include "dwb_plugins/stopped_goal_checker.hpp"
#include "nav_2d_utils/conversions.hpp"
#include "nav2_util/lifecycle_node.hpp"
using dwb_plugins::SimpleGoalChecker; using dwb_plugins::SimpleGoalChecker;
using dwb_plugins::StoppedGoalChecker; using dwb_plugins::StoppedGoalChecker;
...@@ -61,9 +63,11 @@ void checkMacro( ...@@ -61,9 +63,11 @@ void checkMacro(
v.y = yv; v.y = yv;
v.theta = thetav; v.theta = thetav;
if (expected_result) { if (expected_result) {
EXPECT_TRUE(gc.isGoalReached(pose0, pose1, v)); EXPECT_TRUE(gc.isGoalReached(nav_2d_utils::pose2DToPose(pose0),
nav_2d_utils::pose2DToPose(pose1), nav_2d_utils::twist2Dto3D(v)));
} else { } else {
EXPECT_FALSE(gc.isGoalReached(pose0, pose1, v)); EXPECT_FALSE(gc.isGoalReached(nav_2d_utils::pose2DToPose(pose0),
nav_2d_utils::pose2DToPose(pose1), nav_2d_utils::twist2Dto3D(v)));
} }
} }
......
...@@ -71,6 +71,8 @@ std::vector<rclcpp::Parameter> getDefaultKinematicParameters() ...@@ -71,6 +71,8 @@ std::vector<rclcpp::Parameter> getDefaultKinematicParameters()
parameters.push_back(rclcpp::Parameter("max_speed_xy", 0.55)); parameters.push_back(rclcpp::Parameter("max_speed_xy", 0.55));
parameters.push_back(rclcpp::Parameter("min_speed_theta", 0.4)); parameters.push_back(rclcpp::Parameter("min_speed_theta", 0.4));
parameters.push_back(rclcpp::Parameter("use_dwa", false));
return parameters; return parameters;
} }
...@@ -237,17 +239,6 @@ TEST(VelocityIterator, dwa_gen) ...@@ -237,17 +239,6 @@ TEST(VelocityIterator, dwa_gen)
checkLimits(twists, 0.0, 0.125, -0.1, 0.1, -0.16, 0.16, hypot(0.125, 0.1), 0.0, 0.1); checkLimits(twists, 0.0, 0.125, -0.1, 0.1, -0.16, 0.16, hypot(0.125, 0.1), 0.0, 0.1);
} }
TEST(VelocityIterator, dwa_gen_no_param)
{
auto nh = makeTestNode("dwa_gen_no_param");
nh->set_parameters({rclcpp::Parameter("min_speed_theta", -1.0)});
dwb_plugins::LimitedAccelGenerator gen;
gen.initialize(nh);
std::vector<nav_2d_msgs::msg::Twist2D> twists = gen.getTwists(zero);
EXPECT_EQ(twists.size(), 20u * 20u * 5u + 100u - 1u);
checkLimits(twists, 0.0, 0.125, -0.1, 0.1, -0.16, 0.16, hypot(0.125, 0.1), 0.0, 0.1);
}
TEST(VelocityIterator, nonzero) TEST(VelocityIterator, nonzero)
{ {
auto nh = makeTestNode("nonzero"); auto nh = makeTestNode("nonzero");
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment