Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions nav2_regulated_pure_pursuit_controller/test/test_regulated_pp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ class BasicAPIRPP : public nav2_regulated_pure_pursuit_controller::RegulatedPure
dist_error, lookahead_dist, curvature, curr_speed, pose_cost,
linear_vel, sign);
}

double findDirectionChangeWrapper(
const geometry_msgs::msg::PoseStamped & pose)
{
return findDirectionChange(pose);
}
};

TEST(RegulatedPurePursuitTest, basicAPI)
Expand Down Expand Up @@ -144,6 +150,26 @@ TEST(RegulatedPurePursuitTest, createCarrotMsg)
EXPECT_EQ(rtn->point.z, 0.01);
}

TEST(RegulatedPurePursuitTest, findDirectionChange)
Comment thread
sathak93 marked this conversation as resolved.
{
auto ctrl = std::make_shared<BasicAPIRPP>();
geometry_msgs::msg::PoseStamped pose;
pose.pose.position.x = 1.0;
pose.pose.position.y = 0.0;

nav_msgs::msg::Path path;
path.poses.resize(3);
path.poses[0].pose.position.x = 1.0;
path.poses[0].pose.position.y = 1.0;
path.poses[1].pose.position.x = 2.0;
path.poses[1].pose.position.y = 2.0;
path.poses[2].pose.position.x = -1.0;
path.poses[2].pose.position.y = -1.0;
ctrl->setPlan(path);
auto rtn = ctrl->findDirectionChangeWrapper(pose);
EXPECT_EQ(rtn, sqrt(5.0));
}

TEST(RegulatedPurePursuitTest, lookaheadAPI)
{
auto ctrl = std::make_shared<BasicAPIRPP>();
Expand Down