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 limits to DriveOnHeading and BackUp behaviors #4810

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

RBT22
Copy link
Contributor

@RBT22 RBT22 commented Dec 20, 2024


Basic Info

Info Please fill out this column
Ticket(s) this addresses NA
Primary OS tested on Ubuntu
Robotic platform tested on own robot hardware
Does this PR contain AI generated software? No

Description of contribution in a few bullet points

Added two params: acceleration_limit and deceleration_limit for DriveOnHeading and BackUp behaviors.

Description of documentation updates required from your changes

Added new parameter, so need to add that to default configs and documentation page


Future work that may be required in bullet points

For Maintainers:

  • Check that any new parameters added are updated in docs.nav2.org
  • Check that any significant change is added to the migration guide
  • Check that any new features OR changes to existing behaviors are reflected in the tuning guide
  • Check that any new functions have Doxygen added
  • Check that any new features have test coverage
  • Check that any new plugins is added to the plugins page
  • If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists

Copy link
Contributor

mergify bot commented Dec 20, 2024

@RBT22, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

Signed-off-by: RBT22 <rozgonyibalint@gmail.com>
Signed-off-by: RBT22 <rozgonyibalint@gmail.com>
Signed-off-by: RBT22 <rozgonyibalint@gmail.com>
Signed-off-by: RBT22 <rozgonyibalint@gmail.com>
Copy link
Contributor

mergify bot commented Dec 20, 2024

@RBT22, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

@RBT22 RBT22 force-pushed the rolling/acc-drive-on-heading branch from a6633a8 to 228de3b Compare December 20, 2024 11:29
Copy link
Contributor

mergify bot commented Dec 20, 2024

@RBT22, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

Copy link
Member

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

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

Build is failing - not 100% sure why off hand other than it relates to a method added

@@ -146,6 +175,8 @@ class DriveOnHeading : public TimedBehavior<ActionT>
return ResultStatus{Status::FAILED, ActionT::Result::COLLISION_AHEAD};
}

last_vel_ = std::make_shared<double>(cmd_vel->twist.linear.x);
Copy link
Member

Choose a reason for hiding this comment

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

This is weird. If you want to initialize it so you know its valid, you could default it to numerical_limits<double>::max() and reset to that / check for it if we have a last value. I don't like this smart pointer stuff though

if (acceleration_limit_ <= 0.0 && deceleration_limit_ <= 0.0) {
cmd_vel->twist.linear.x = command_speed_;
} else {
double current_speed = last_vel_ ? *last_vel_ : 0.0;
Copy link
Member

Choose a reason for hiding this comment

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

I think the behaviors have a odom subscriber to use for the current velocity.

This actually brings up a whole topic about whether we should base the velocity closed loop (on odom speed) or open looop (on the last command sent, assuming it was executed). We have this also topic in the controllers and velocity smoother. If we're adding in dynamic constraints here, I think its sensible we decide what makes sense here as well

@@ -133,7 +134,35 @@ class DriveOnHeading : public TimedBehavior<ActionT>
cmd_vel->header.frame_id = this->robot_base_frame_;
cmd_vel->twist.linear.y = 0.0;
cmd_vel->twist.angular.z = 0.0;
cmd_vel->twist.linear.x = command_speed_;
if (acceleration_limit_ <= 0.0 && deceleration_limit_ <= 0.0) {
Copy link
Member

@SteveMacenski SteveMacenski Dec 20, 2024

Choose a reason for hiding this comment

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

||? I assume we have to set both if we want to use either. That would let you remove the 2x if in the other branch as well. ALso we can simply if the forward && to just forward and !forward

Specifying one but not the other seems like an unsupportable configuration

cmd_vel->twist.linear.x = std::clamp(command_speed_, min_feasible_speed, max_feasible_speed);

// Check if we need to slow down to avoid overshooting
bool forward = command_speed_ > 0.0 ? true : false;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
bool forward = command_speed_ > 0.0 ? true : false;
bool forward = command_speed_ > 0.0;

😉

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