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

Add acceleration constraints to MPPI controller #18

Open
wants to merge 5 commits into
base: noetic
Choose a base branch
from

Conversation

Nisarg236
Copy link
Member

@Nisarg236 Nisarg236 commented Feb 5, 2025

AB#49690

Don't allow new velocity to be such that the resulting acceleration is more than what the robot could perform
backported from nav2: ros-navigation/navigation2#4352

@Nisarg236
Copy link
Member Author

simplescreenrecorder-2025-02-07_12.22.04.mp4

@Nisarg236 Nisarg236 marked this pull request as ready for review February 7, 2025 06:56
@renan028
Copy link
Member

simplescreenrecorder-2025-02-07_12.22.04.mp4

@Nisarg236 you need to increase the buffer, otherwise we cannot see the ramp up of the velocity.
And without the ramp up, we cannot estimate the actual acceleration.
Can you rerun showing the ramp up?
Btw, you can use plotjuggler and create a custom series that derivates the velocity for you.

@Nisarg236
Copy link
Member Author

Nisarg236 commented Feb 13, 2025

@renan028 I used the derivative feature of plotjuggler and set the acceleration limit in x between 0.7 and -0.7 this is what I got. When the robot is making a turn it goes out of the limits mostly in negative side.

simplescreenrecorder-2025-02-13_18.05.58.mp4

float vy_last = state.vy(i, 0);
float wz_last = state.wz(i, 0);
for (unsigned int j = 1; j != state.vx.shape(1); j++) {
double cvx_curr = state.cvx(i, j - 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F: in the original, this is reference, thus it is changing both state.cvx(i, j - 1) and state.vx(i, j)

state.vx(i, j) = cvx_curr;
vx_last = cvx_curr;

double cwz_curr = state.cwz(i, j - 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F: also reference here

wz_last = cwz_curr;

if (is_holo) {
double cvy_curr = state.cvy(i, j - 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F: reference

break;
default:
ROS_WARN_NAMED("Optimizer",
"Model %d is not valid! Valid options are DiffDrive, Omni, or Ackermann; defaulting to DiffDrive",
model);
motion_model_ = std::make_shared<DiffDriveMotionModel>();
motion_model_->initialize(settings_.constraints, settings_.model_dt);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q/R: can't we do a single call motion_model_->initialize(settings_.constraints, settings_.model_dt);
after the switch case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I changed it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants