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

Controller rejects goals when its last setpoint does not agree with odom velocity (on init_vel_method pid_odom) #94

Open
rokusottervanger opened this issue Feb 23, 2022 · 0 comments

Comments

@rokusottervanger
Copy link
Contributor

Talking about this piece of code in setPlan(), intended to avoid putting steps on the velocity setpoint:

// Feasability check, but only when not resuming with odom-vel
if (
pid_controller_.getConfig().init_vel_method != Pid_Odom &&
pid_controller_.getConfig().init_vel_max_diff >= 0.0 &&
std::abs(
latest_odom_.twist.twist.linear.x - pid_controller_.getControllerState().current_x_vel) >
pid_controller_.getConfig().init_vel_max_diff) {
ROS_ERROR(
"Significant diff between odom (%f) and controller_state (%f) detected. Aborting!",
latest_odom_.twist.twist.linear.x, pid_controller_.getControllerState().current_x_vel);
return false;
}

Currently, the controller rejects any new goal when the error between actual and setpoint velocity is too large. It is unknown what happens then, because the controller will not send any velocities anymore. So this depends on what third party control action or disturbance made this happen.

IMO, we should accept this goal (as there is nothing wrong with the goal itself. The goal doesn't say anything about velocities). In computeVelocityCommands, we should check that this error does not become too large. If that does happen, we should abort the goal, set the setpoint to the current odom and decrease that to zero, respecting our acceleration limits.

The behavior of the robot stays the same in the special case this was designed for: a manual override while controlling. Because if the actual velocity is zero, the error is too large, the goal is accepted, but it is aborted right away, controlling the velocity to zero (which it already is) and resetting the controller state.

But it should now also produce the desired behavior in all other cases: where the actual velocity is nonzero, but not similar to the controller state. The goal is accepted, but aborted due to a controller error. The velocity is smoothly decreased to zero, and the controller state is again in sync with the robot state.

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

No branches or pull requests

1 participant