-
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
Add tolerance time to tolerance exit conditions #87
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
@@ -41,10 +41,11 @@ ExitConditions& ExitConditions::add_timeout(int timeout) { | |||
} | |||
|
|||
ExitConditions& ExitConditions::add_tolerance(double linear_tolerance, |
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: 2 adjacent parameters of 'add_tolerance' of similar type ('double') are easily swapped by mistake [bugprone-easily-swappable-parameters]
ExitConditions& ExitConditions::add_tolerance(double linear_tolerance,
^
Additional context
src/VOSS/exit_conditions/ExitConditions.cpp:42: the first parameter in the range is 'linear_tolerance'
ExitConditions& ExitConditions::add_tolerance(double linear_tolerance,
^
src/VOSS/exit_conditions/ExitConditions.cpp:43: the last parameter in the range is 'angular_tolerance'
double angular_tolerance,
^
@@ -5,14 +5,26 @@ | |||
|
|||
namespace voss::controller { | |||
|
|||
ToleranceAngularExitCondition::ToleranceAngularExitCondition(double tolerance) | |||
: tolerance(voss::to_radians(tolerance)) { | |||
ToleranceAngularExitCondition::ToleranceAngularExitCondition(double tolerance, double tolerance_time) |
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: constructor does not initialize these fields: current_time [cppcoreguidelines-pro-type-member-init]
include/VOSS/exit_conditions/ToleranceAngularExitCondition.hpp:11:
- double current_time;
+ double current_time{};
@@ -5,14 +5,26 @@ | |||
|
|||
namespace voss::controller { | |||
|
|||
ToleranceAngularExitCondition::ToleranceAngularExitCondition(double tolerance) | |||
: tolerance(voss::to_radians(tolerance)) { | |||
ToleranceAngularExitCondition::ToleranceAngularExitCondition(double tolerance, double tolerance_time) |
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: 2 adjacent parameters of 'ToleranceAngularExitCondition' of similar type ('double') are easily swapped by mistake [bugprone-easily-swappable-parameters]
ToleranceAngularExitCondition::ToleranceAngularExitCondition(double tolerance, double tolerance_time)
^
Additional context
src/VOSS/exit_conditions/ToleranceAngularExitCondition.cpp:7: the first parameter in the range is 'tolerance'
ToleranceAngularExitCondition::ToleranceAngularExitCondition(double tolerance, double tolerance_time)
^
src/VOSS/exit_conditions/ToleranceAngularExitCondition.cpp:7: the last parameter in the range is 'tolerance_time'
ToleranceAngularExitCondition::ToleranceAngularExitCondition(double tolerance, double tolerance_time)
^
if (thru) { | ||
return true; | ||
} | ||
current_time += 10; |
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: 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]
current_time += 10;
^
} | ||
} | ||
|
||
void ToleranceExitCondition::add_ang_exit(double angular_tolerance, double tolerance_time) { |
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: 2 adjacent parameters of 'add_ang_exit' of similar type ('double') are easily swapped by mistake [bugprone-easily-swappable-parameters]
void ToleranceExitCondition::add_ang_exit(double angular_tolerance, double tolerance_time) {
^
Additional context
src/VOSS/exit_conditions/ToleranceExitCondition.cpp:35: the first parameter in the range is 'angular_tolerance'
void ToleranceExitCondition::add_ang_exit(double angular_tolerance, double tolerance_time) {
^
src/VOSS/exit_conditions/ToleranceExitCondition.cpp:35: the last parameter in the range is 'tolerance_time'
void ToleranceExitCondition::add_ang_exit(double angular_tolerance, double tolerance_time) {
^
if (thru) { | ||
return true; | ||
} | ||
current_time += 10; |
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: 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]
current_time += 10;
^
@@ -11,12 +11,12 @@ | |||
#define RIGHT_MOTORS \ | |||
{ 10, 3, 9, -7, -15 } | |||
|
|||
auto odom = voss::localizer::IMELocalizerBuilder::new_builder() | |||
auto odom = voss::localizer::TrackingWheelLocalizerBuilder::new_builder() |
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 'odom' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]
auto odom = voss::localizer::TrackingWheelLocalizerBuilder::new_builder()
^
@@ -11,12 +11,12 @@ | |||
#define RIGHT_MOTORS \ | |||
{ 10, 3, 9, -7, -15 } | |||
|
|||
auto odom = voss::localizer::IMELocalizerBuilder::new_builder() | |||
auto odom = voss::localizer::TrackingWheelLocalizerBuilder::new_builder() | |||
.with_right_motor(10) |
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: 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]
.with_right_motor(10)
^
@@ -50,7 +50,7 @@ auto arc = voss::controller::ArcPIDControllerBuilder(odom) | |||
pros::Controller master(pros::E_CONTROLLER_MASTER); | |||
auto ec = voss::controller::ExitConditions::new_conditions() | |||
.add_settle(400, 0.5, 400) | |||
.add_tolerance(1.0, 2.0) | |||
.add_tolerance(1.0, 2.0, 200) |
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: 2.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]
.add_tolerance(1.0, 2.0, 200)
^
@@ -50,7 +50,7 @@ auto arc = voss::controller::ArcPIDControllerBuilder(odom) | |||
pros::Controller master(pros::E_CONTROLLER_MASTER); | |||
auto ec = voss::controller::ExitConditions::new_conditions() | |||
.add_settle(400, 0.5, 400) | |||
.add_tolerance(1.0, 2.0) | |||
.add_tolerance(1.0, 2.0, 200) |
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: 200 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]
.add_tolerance(1.0, 2.0, 200)
^
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.
Rocky review says "All clean, LGTM! 👍"
No description provided.