-
Notifications
You must be signed in to change notification settings - Fork 611
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
[wpilib] Clean up drive class implementations #1691
Conversation
b28e760
to
cc7919c
Compare
What is the merge plan for this? |
Good question. The Drive, PIDController, LinearFilter, and command-based rewrites are all in the same boat, so whatever we decide can be applied to all of them, essentially. The main issue is namespace conflicts. We can put them in an "experimental" namespace, but having effectively half the API like that feels strange. We could also try making a subpackage based on the year. Either way, there would be breakage (albeit minor) when it gets moved out of the subpackage after the old package's deprecation period. |
public void normalize(double maxSpeed) { | ||
double maxMagnitude = Math.max(Math.abs(left), Math.abs(right)); | ||
if (maxMagnitude > maxSpeed) { | ||
left /= maxMagnitude * maxSpeed; |
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.
Why are other classes
out *= speed/magnitude
but this is
out /= magnitude*speed
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.
Dangit. I missed that one.
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.
Is one better than the other?
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.
Yeah. One is actually correct. :)
15fc72c
to
ef98998
Compare
008d99f
to
4863903
Compare
2d8fb54
to
b65817b
Compare
a7765d5
to
108eb04
Compare
ca71ded
to
b78fa05
Compare
b2ea89b
to
875b617
Compare
2afafc3
to
d7ebe6f
Compare
@@ -31,7 +33,7 @@ bool GenericHID::GetRawButtonReleased(int button) { | |||
} | |||
|
|||
double GenericHID::GetRawAxis(int axis) const { | |||
return m_ds->GetStickAxis(m_port, axis); | |||
return ApplyDeadband(m_ds->GetStickAxis(m_port, axis), m_deadband); |
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.
Commonly teams would want to apply different deadbands to different axes, for example the twist on a joystick, or the triggers on a gamepad, will likely have different deadzones to the X/Y axes.
It seems that this would not be useful to teams that want to utilise these other axes.
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.
That use case isn't supported by the current drive class implementation either; the same deadband in the drive class applies to all axes.
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.
Sure, but it looks like this would apply regardless of whether you're using the axis for driving.
b76a2ef
to
15da046
Compare
Left and right sides of the differential drive and mecanum drive classes are now both forward and the "inversion multiplier" was removed. The deadband functionality was moved to GenericHID::GetRawAxis() since the deadband is generally applied to joystick axes. MotorSafety was removed since that's handled by the drivetrain's motor controllers already.
Superseded by #3340. |
These return the inverse kinematic values, so they can be composed with
feedback controllers. The internal implementation for DifferentialDrive
was massively simplified as well.
Input limits were removed since the normalization takes care of that.
The deadband functionality was moved to GenericHID::GetRawAxis class
since the deadband is generally applied to joystick axes.
MotorSafety was removed since that's handled by the drivetrain's motor
controllers already.