WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
ExpansionHubPidConstants.hpp
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
10
11namespace wpi {
13
14/** This class contains PID constants for an ExpansionHub motor. */
16 public:
17 /**
18 * Sets the PID Controller gain parameters.
19 *
20 * Sets the proportional, integral, and differential coefficients.
21 *
22 * @param p The proportional coefficient. Must be >= 0.
23 * @param i The integral coefficient. Must be >= 0.
24 * @param d The differential coefficient. Must be >= 0.
25 */
26 void SetPID(double p, double i, double d);
27
28 /**
29 * Sets the feed forward gains to the specified values.
30 *
31 * The units should be radians for angular systems and meters for linear
32 * systems.
33 *
34 * The PID control period is 10ms
35 *
36 * @param s The static gain in volts.
37 * @param v The velocity gain in V/(units/s).
38 * @param a The acceleration gain in V/(units/s²).
39 */
40 void SetFF(double s, double v, double a);
41
42 /**
43 * Enables continuous input.
44 *
45 * Rather then using the max and min input range as constraints, it considers
46 * them to be the same point and automatically calculates the shortest route
47 * to the setpoint.
48 *
49 * @param minimumInput The minimum value expected from the input.
50 * @param maximumInput The maximum value expected from the input.
51 */
52 void EnableContinousInput(double minimumInput, double maximumInput);
53
54 /**
55 * Disables continuous input.
56 */
58
61
64
65 friend class ExpansionHubMotor;
66
67 private:
68 ExpansionHubPidConstants(int usbId, int channel, bool isVelocityPid);
69
70 wpi::nt::DoublePublisher m_pPublisher;
71 wpi::nt::DoublePublisher m_iPublisher;
72 wpi::nt::DoublePublisher m_dPublisher;
73 wpi::nt::DoublePublisher m_sPublisher;
74 wpi::nt::DoublePublisher m_vPublisher;
75 wpi::nt::DoublePublisher m_aPublisher;
76
77 wpi::nt::BooleanPublisher m_continuousPublisher;
78 wpi::nt::DoublePublisher m_continuousMinimumPublisher;
79 wpi::nt::DoublePublisher m_continuousMaximumPublisher;
80};
81} // namespace wpi
This class controls a specific motor and encoder hooked up to an ExpansionHub.
Definition ExpansionHubMotor.hpp:23
void SetPID(double p, double i, double d)
Sets the PID Controller gain parameters.
ExpansionHubPidConstants & operator=(ExpansionHubPidConstants &&)=default
ExpansionHubPidConstants(ExpansionHubPidConstants &)=delete
ExpansionHubPidConstants(ExpansionHubPidConstants &&)=default
void DisableContinousInput()
Disables continuous input.
void EnableContinousInput(double minimumInput, double maximumInput)
Enables continuous input.
void SetFF(double s, double v, double a)
Sets the feed forward gains to the specified values.
friend class ExpansionHubMotor
Definition ExpansionHubPidConstants.hpp:65
ExpansionHubPidConstants & operator=(ExpansionHubPidConstants &)=delete
NetworkTables Boolean publisher.
Definition BooleanTopic.hpp:127
NetworkTables Double publisher.
Definition DoubleTopic.hpp:127
T * p
Definition format.h:758
Definition CvSource.hpp:15