-
Notifications
You must be signed in to change notification settings - Fork 710
Added default PID values #8895
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
base: main
Are you sure you want to change the base?
Added default PID values #8895
Changes from all commits
60da944
3f38d22
1401246
0c0c6db
5689072
68cf7a8
0301ff7
42af667
023c603
9ea935f
04fd1f4
cfd9d49
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,9 @@ ExpansionHubVelocityConstants::ExpansionHubVelocityConstants(int hubNumber, | |
| .GetDoubleTopic(fmt::format("/rhsp/{}/motor{}/constants/velocity/kd", | ||
| hubNumber, motorNumber)) | ||
| .Publish(options); | ||
| m_pPublisher.SetDefault(1.0); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing here, use Set |
||
| m_iPublisher.SetDefault(0.0); | ||
| m_dPublisher.SetDefault(0.01); | ||
|
|
||
| m_sPublisher = | ||
| systemServer | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
|
|
||
| /** This class contains feedback and feedforward constants for an ExpansionHub motor. */ | ||
| public class ExpansionHubPositionConstants { | ||
|
|
||
| private final DoublePublisher m_pPublisher; | ||
| private final DoublePublisher m_iPublisher; | ||
| private final DoublePublisher m_dPublisher; | ||
|
|
@@ -23,35 +24,43 @@ public class ExpansionHubPositionConstants { | |
| private final DoublePublisher m_continuousMaximumPublisher; | ||
|
|
||
| ExpansionHubPositionConstants(int hubNumber, int motorNumber) { | ||
|
|
||
| NetworkTableInstance systemServer = SystemServer.getSystemServer(); | ||
|
|
||
| PubSubOption[] options = | ||
| new PubSubOption[] { | ||
| PubSubOption.SEND_ALL, PubSubOption.KEEP_DUPLICATES, PubSubOption.periodic(0.005) | ||
| PubSubOption.SEND_ALL, | ||
| PubSubOption.KEEP_DUPLICATES, | ||
| PubSubOption.periodic(0.005) | ||
| }; | ||
|
|
||
| m_pPublisher = | ||
| systemServer | ||
| .getDoubleTopic( | ||
| "/rhsp/" + hubNumber + "/motor" + motorNumber + "/constants/position" + "/kp") | ||
| "/rhsp/" + hubNumber + "/motor" + motorNumber + "/constants/position/kp") | ||
| .publish(options); | ||
|
|
||
| m_iPublisher = | ||
| systemServer | ||
| .getDoubleTopic( | ||
| "/rhsp/" + hubNumber + "/motor" + motorNumber + "/constants/position" + "/ki") | ||
| "/rhsp/" + hubNumber + "/motor" + motorNumber + "/constants/position/ki") | ||
| .publish(options); | ||
|
|
||
| m_dPublisher = | ||
| systemServer | ||
| .getDoubleTopic( | ||
| "/rhsp/" + hubNumber + "/motor" + motorNumber + "/constants/position" + "/kd") | ||
| "/rhsp/" + hubNumber + "/motor" + motorNumber + "/constants/position/kd") | ||
| .publish(options); | ||
|
|
||
| // Default PID values | ||
| m_pPublisher.setDefault(1.0); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, use set |
||
| m_iPublisher.setDefault(0.0); | ||
| m_dPublisher.setDefault(0.01); | ||
|
|
||
| m_sPublisher = | ||
| systemServer | ||
| .getDoubleTopic( | ||
| "/rhsp/" + hubNumber + "/motor" + motorNumber + "/constants/position" + "/ks") | ||
| "/rhsp/" + hubNumber + "/motor" + motorNumber + "/constants/position/ks") | ||
| .publish(options); | ||
|
|
||
| m_continuousPublisher = | ||
|
|
@@ -61,8 +70,7 @@ public class ExpansionHubPositionConstants { | |
| + hubNumber | ||
| + "/motor" | ||
| + motorNumber | ||
| + "/constants/position" | ||
| + "/continuous") | ||
| + "/constants/position/continuous") | ||
| .publish(options); | ||
|
|
||
| m_continuousMinimumPublisher = | ||
|
|
@@ -72,8 +80,7 @@ public class ExpansionHubPositionConstants { | |
| + hubNumber | ||
| + "/motor" | ||
| + motorNumber | ||
| + "/constants/position" | ||
| + "/continuousMinimum") | ||
| + "/constants/position/continuousMinimum") | ||
| .publish(options); | ||
|
|
||
| m_continuousMaximumPublisher = | ||
|
|
@@ -83,8 +90,7 @@ public class ExpansionHubPositionConstants { | |
| + hubNumber | ||
| + "/motor" | ||
| + motorNumber | ||
| + "/constants/position" | ||
| + "/continuousMaximum") | ||
| + "/constants/position/continuousMaximum") | ||
| .publish(options); | ||
| } | ||
|
|
||
|
|
@@ -123,18 +129,21 @@ public ExpansionHubPositionConstants setS(double s) { | |
| /** | ||
| * Enables continuous input. | ||
| * | ||
| * <p>Rather then using the max and min input range as constraints, it considers them to be the | ||
| * same point and automatically calculates the shortest route to the setpoint. | ||
| * <p>Rather then using the max and min input range as constraints, it considers | ||
| * them to be the same point and automatically calculates the shortest route to | ||
| * the setpoint. | ||
| * | ||
| * @param minimumInput The minimum value expected from the input. | ||
| * @param maximumInput The maximum value expected from the input. | ||
| * @return This object, for method chaining. | ||
| */ | ||
| public ExpansionHubPositionConstants enableContinuousInput( | ||
| double minimumInput, double maximumInput) { | ||
|
|
||
| m_continuousMaximumPublisher.set(maximumInput); | ||
| m_continuousMinimumPublisher.set(minimumInput); | ||
| m_continuousPublisher.set(true); | ||
|
|
||
| return this; | ||
| } | ||
|
|
||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where did the rest of this file go
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. alr i think i did it |
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.
Don't use SetDefault here, just use Set