mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[wpilib] separate expansion hub position and velocity constants (#8791)
this is because position and velocity control follow different rules; see #8773 Signed-off-by: Zach Harel <zach@zharel.me>
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "wpi/hardware/expansionhub/ExpansionHubMotor.hpp"
|
||||
|
||||
#include "wpi/hardware/expansionhub/ExpansionHubPositionConstants.hpp"
|
||||
#include "wpi/hardware/expansionhub/ExpansionHubVelocityConstants.hpp"
|
||||
#include "wpi/system/Errors.hpp"
|
||||
#include "wpi/system/SystemServer.hpp"
|
||||
|
||||
@@ -18,8 +20,8 @@ using namespace wpi;
|
||||
ExpansionHubMotor::ExpansionHubMotor(int usbId, int channel)
|
||||
: m_hub{usbId},
|
||||
m_channel{channel},
|
||||
m_velocityPidConstants{usbId, channel, true},
|
||||
m_positionPidConstants{usbId, channel, false} {
|
||||
m_velocityConstants{usbId, channel},
|
||||
m_positionConstants{usbId, channel} {
|
||||
WPILIB_AssertMessage(channel >= 0 && channel < ExpansionHub::NumMotorPorts,
|
||||
"ExHub Motor Channel {} out of range", channel);
|
||||
|
||||
@@ -148,12 +150,12 @@ void ExpansionHubMotor::ResetEncoder() {
|
||||
m_resetEncoderPublisher.Set(true);
|
||||
}
|
||||
|
||||
ExpansionHubPidConstants& ExpansionHubMotor::GetVelocityPidConstants() {
|
||||
return m_velocityPidConstants;
|
||||
ExpansionHubVelocityConstants& ExpansionHubMotor::GetVelocityConstants() {
|
||||
return m_velocityConstants;
|
||||
}
|
||||
|
||||
ExpansionHubPidConstants& ExpansionHubMotor::GetPositionPidConstants() {
|
||||
return m_positionPidConstants;
|
||||
ExpansionHubPositionConstants& ExpansionHubMotor::GetPositionConstants() {
|
||||
return m_positionConstants;
|
||||
}
|
||||
|
||||
void ExpansionHubMotor::Follow(const ExpansionHubMotor& leader) {
|
||||
|
||||
Reference in New Issue
Block a user