Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

min_turning_r_ getting param fix #4510

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ class AckermannMotionModel : public MotionModel
/**
* @brief Constructor for mppi::AckermannMotionModel
*/
explicit AckermannMotionModel(ParametersHandler * param_handler)
explicit AckermannMotionModel(ParametersHandler * param_handler, const std::string & name)
{
auto getParam = param_handler->getParamGetter("AckermannConstraints");
auto getParam = param_handler->getParamGetter(name + ".AckermannConstraints");
getParam(min_turning_r_, "min_turning_r", 0.2);
}

Expand Down
2 changes: 1 addition & 1 deletion nav2_mppi_controller/src/optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ void Optimizer::setMotionModel(const std::string & model)
} else if (model == "Omni") {
motion_model_ = std::make_shared<OmniMotionModel>();
} else if (model == "Ackermann") {
motion_model_ = std::make_shared<AckermannMotionModel>(parameters_handler_);
motion_model_ = std::make_shared<AckermannMotionModel>(parameters_handler_, name_);
} else {
throw nav2_core::ControllerException(
std::string(
Expand Down
2 changes: 1 addition & 1 deletion nav2_mppi_controller/test/critics_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ TEST(CriticTests, ConstraintsCritic)
// Now with ackermann, all in constraint so no costs to score
state.vx = 0.40 * xt::ones<float>({1000, 30});
state.wz = 1.5 * xt::ones<float>({1000, 30});
data.motion_model = std::make_shared<AckermannMotionModel>(&param_handler);
data.motion_model = std::make_shared<AckermannMotionModel>(&param_handler, node->get_name());
critic.score(data);
EXPECT_NEAR(xt::sum(costs, immediate)(), 0, 1e-6);

Expand Down
2 changes: 1 addition & 1 deletion nav2_mppi_controller/test/motion_model_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ TEST(MotionModelTests, AckermannTest)
auto node = std::make_shared<rclcpp_lifecycle::LifecycleNode>("my_node");
ParametersHandler param_handler(node);
std::unique_ptr<AckermannMotionModel> model =
std::make_unique<AckermannMotionModel>(&param_handler);
std::make_unique<AckermannMotionModel>(&param_handler, node->get_name());

// Check that predict properly populates the trajectory velocities with the control velocities
state.cvx = 10 * xt::ones<float>({batches, timesteps});
Expand Down
Loading