-
Notifications
You must be signed in to change notification settings - Fork 2
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
Limit lin_speed, scale ang_speed in PIDController and BoomerangController #95
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
@@ -50,24 +49,18 @@ BoomerangController::get_command(bool reverse, bool thru, | |||
} | |||
lin_speed *= dir; | |||
|
|||
double pose_error = voss::norm_delta(target.theta.value() - current_angle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'pose_error' is not initialized [cppcoreguidelines-init-variables]
double pose_error = voss::norm_delta(target.theta.value() - current_angle); | |
double pose_error = NAN = voss::norm_delta(target.theta.value() - current_angle); |
// reduce the linear speed if the bot is tangent to the target | ||
ang_speed = angular_pid.update(pose_error); | ||
} else if (distance_error < 2 * min_error) { | ||
double scale_factor = (distance_error - min_error) / min_error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'scale_factor' of type 'double' can be declared 'const' [misc-const-correctness]
double scale_factor = (distance_error - min_error) / min_error; | |
double const scale_factor = (distance_error - min_error) / min_error; |
ang_speed = angular_pid.update(pose_error); | ||
} else if (distance_error < 2 * min_error) { | ||
double scale_factor = (distance_error - min_error) / min_error; | ||
double scaled_angle_error = voss::norm_delta(scale_factor * angle_error + (1 - scale_factor) * pose_error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'scaled_angle_error' of type 'double' can be declared 'const' [misc-const-correctness]
double scaled_angle_error = voss::norm_delta(scale_factor * angle_error + (1 - scale_factor) * pose_error); | |
double const scaled_angle_error = voss::norm_delta(scale_factor * angle_error + (1 - scale_factor) * pose_error); |
Limit lin_speed in PIDController and Boomerang controller so it scales better in DiffChassis
Scale ang_speed for a smoother transition between being outside of min_error and being within min_error.