39
39
#include " nav2_controller/plugins/simple_goal_checker.hpp"
40
40
#include " nav2_controller/plugins/stopped_goal_checker.hpp"
41
41
#include " nav_2d_utils/conversions.hpp"
42
+ #include " nav_msgs/msg/path.hpp"
42
43
#include " nav2_util/lifecycle_node.hpp"
43
44
44
45
using nav2_controller::SimpleGoalChecker;
@@ -49,6 +50,7 @@ void checkMacro(
49
50
double x0, double y0, double theta0,
50
51
double x1, double y1, double theta1,
51
52
double xv, double yv, double thetav,
53
+ const nav_msgs::msg::Path & path,
52
54
bool expected_result)
53
55
{
54
56
gc.reset ();
@@ -67,12 +69,12 @@ void checkMacro(
67
69
EXPECT_TRUE (
68
70
gc.isGoalReached (
69
71
nav_2d_utils::pose2DToPose (pose0),
70
- nav_2d_utils::pose2DToPose (pose1), nav_2d_utils::twist2Dto3D (v)));
72
+ nav_2d_utils::pose2DToPose (pose1), nav_2d_utils::twist2Dto3D (v), path ));
71
73
} else {
72
74
EXPECT_FALSE (
73
75
gc.isGoalReached (
74
76
nav_2d_utils::pose2DToPose (pose0),
75
- nav_2d_utils::pose2DToPose (pose1), nav_2d_utils::twist2Dto3D (v)));
77
+ nav_2d_utils::pose2DToPose (pose1), nav_2d_utils::twist2Dto3D (v), path ));
76
78
}
77
79
}
78
80
@@ -81,20 +83,22 @@ void sameResult(
81
83
double x0, double y0, double theta0,
82
84
double x1, double y1, double theta1,
83
85
double xv, double yv, double thetav,
86
+ const nav_msgs::msg::Path & path,
84
87
bool expected_result)
85
88
{
86
- checkMacro (gc0, x0, y0, theta0, x1, y1, theta1, xv, yv, thetav, expected_result);
87
- checkMacro (gc1, x0, y0, theta0, x1, y1, theta1, xv, yv, thetav, expected_result);
89
+ checkMacro (gc0, x0, y0, theta0, x1, y1, theta1, xv, yv, thetav, path, expected_result);
90
+ checkMacro (gc1, x0, y0, theta0, x1, y1, theta1, xv, yv, thetav, path, expected_result);
88
91
}
89
92
90
93
void trueFalse (
91
94
nav2_core::GoalChecker & gc0, nav2_core::GoalChecker & gc1,
92
95
double x0, double y0, double theta0,
93
96
double x1, double y1, double theta1,
94
- double xv, double yv, double thetav)
97
+ double xv, double yv, double thetav,
98
+ const nav_msgs::msg::Path & path)
95
99
{
96
- checkMacro (gc0, x0, y0, theta0, x1, y1, theta1, xv, yv, thetav, true );
97
- checkMacro (gc1, x0, y0, theta0, x1, y1, theta1, xv, yv, thetav, false );
100
+ checkMacro (gc0, x0, y0, theta0, x1, y1, theta1, xv, yv, thetav, path, true );
101
+ checkMacro (gc1, x0, y0, theta0, x1, y1, theta1, xv, yv, thetav, path, false );
98
102
}
99
103
class TestLifecycleNode : public nav2_util ::LifecycleNode
100
104
{
@@ -162,18 +166,19 @@ TEST(VelocityIterator, two_checks)
162
166
SimpleGoalChecker gc;
163
167
StoppedGoalChecker sgc;
164
168
auto costmap = std::make_shared<nav2_costmap_2d::Costmap2DROS>(" test_costmap" );
169
+ nav_msgs::msg::Path path;
165
170
166
171
gc.initialize (x, " nav2_controller" , costmap);
167
172
sgc.initialize (x, " nav2_controller" , costmap);
168
- sameResult (gc, sgc, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , true );
169
- sameResult (gc, sgc, 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , false );
170
- sameResult (gc, sgc, 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , false );
171
- sameResult (gc, sgc, 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , false );
172
- sameResult (gc, sgc, 0 , 0 , 3.14 , 0 , 0 , -3.14 , 0 , 0 , 0 , true );
173
- trueFalse (gc, sgc, 0 , 0 , 3.14 , 0 , 0 , -3.14 , 1 , 0 , 0 );
174
- trueFalse (gc, sgc, 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 );
175
- trueFalse (gc, sgc, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 );
176
- trueFalse (gc, sgc, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 );
173
+ sameResult (gc, sgc, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , path, true );
174
+ sameResult (gc, sgc, 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , path, false );
175
+ sameResult (gc, sgc, 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , path, false );
176
+ sameResult (gc, sgc, 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , path, false );
177
+ sameResult (gc, sgc, 0 , 0 , 3.14 , 0 , 0 , -3.14 , 0 , 0 , 0 , path, true );
178
+ trueFalse (gc, sgc, 0 , 0 , 3.14 , 0 , 0 , -3.14 , 1 , 0 , 0 , path );
179
+ trueFalse (gc, sgc, 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , path );
180
+ trueFalse (gc, sgc, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , path );
181
+ trueFalse (gc, sgc, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , path );
177
182
}
178
183
179
184
TEST (StoppedGoalChecker, get_tol_and_dynamic_params)
0 commit comments