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

Fix bug mppi #39

Merged
merged 1 commit into from
Jul 11, 2023
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 @@ -112,7 +112,7 @@ class AckermannMotionModel : public MotionModel
auto & vx = control_sequence.vx;
auto & wz = control_sequence.wz;

auto view = xt::masked_view(wz, xt::fabs(vx) / xt::fabs(wz) > min_turning_r_);
auto view = xt::masked_view(wz, xt::fabs(vx) / xt::fabs(wz) < min_turning_r_);
view = xt::sign(wz) * vx / min_turning_r_;
}

Expand Down
4 changes: 2 additions & 2 deletions nav2_mppi_controller/test/motion_model_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ TEST(MotionModelTests, AckermannTest)
// Check that application of constraints are non-empty for Ackermann Drive
for (unsigned int i = 0; i != control_sequence.vx.shape(0); i++) {
control_sequence.vx(i) = i * i * i;
control_sequence.wz(i) = i * i * i;
control_sequence.wz(i) = i * i * i * i;
}

models::ControlSequence initial_control_sequence = control_sequence;
Expand All @@ -168,7 +168,7 @@ TEST(MotionModelTests, AckermannTest)
// Now, check the specifics of the minimum curvature constraint
EXPECT_NEAR(model->getMinTurningRadius(), 0.2, 1e-6);
for (unsigned int i = 1; i != control_sequence.vx.shape(0); i++) {
EXPECT_TRUE(fabs(control_sequence.vx(i)) / fabs(control_sequence.wz(i)) <= 0.2);
EXPECT_TRUE(fabs(control_sequence.vx(i)) / fabs(control_sequence.wz(i)) >= 0.2);
}

// Check that Ackermann Drive is properly non-holonomic and parameterized
Expand Down