mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
SCRIPT namespace replacements
This commit is contained in:
committed by
Peter Johnson
parent
ae6c043632
commit
9aca8e0fd6
@@ -7,7 +7,7 @@
|
||||
#include "wpi/system/Errors.hpp"
|
||||
#include "wpi/system/SystemServer.hpp"
|
||||
|
||||
using namespace frc;
|
||||
using namespace wpi;
|
||||
|
||||
ExpansionHubServo::ExpansionHubServo(int usbId, int channel)
|
||||
: m_hub{usbId}, m_channel{channel} {
|
||||
@@ -22,7 +22,7 @@ ExpansionHubServo::ExpansionHubServo(int usbId, int channel)
|
||||
|
||||
auto systemServer = SystemServer::GetSystemServer();
|
||||
|
||||
nt::PubSubOptions options;
|
||||
wpi::nt::PubSubOptions options;
|
||||
options.sendAll = true;
|
||||
options.keepDuplicates = true;
|
||||
options.periodic = 0.005;
|
||||
@@ -67,14 +67,14 @@ void ExpansionHubServo::Set(double value) {
|
||||
SetPulseWidth(rawValue);
|
||||
}
|
||||
|
||||
void ExpansionHubServo::SetAngle(units::degree_t angle) {
|
||||
void ExpansionHubServo::SetAngle(wpi::units::degree_t angle) {
|
||||
angle = std::clamp(angle, m_minServoAngle, m_maxServoAngle);
|
||||
|
||||
// NOLINTNEXTLINE(bugprone-integer-division)
|
||||
Set((angle - m_minServoAngle) / GetServoAngleRange());
|
||||
}
|
||||
|
||||
void ExpansionHubServo::SetPulseWidth(units::microsecond_t pulseWidth) {
|
||||
void ExpansionHubServo::SetPulseWidth(wpi::units::microsecond_t pulseWidth) {
|
||||
m_pulseWidthPublisher.Set(pulseWidth.to<double>());
|
||||
}
|
||||
|
||||
@@ -82,20 +82,20 @@ void ExpansionHubServo::SetEnabled(bool enabled) {
|
||||
m_enabledPublisher.Set(enabled);
|
||||
}
|
||||
|
||||
void ExpansionHubServo::SetFramePeriod(units::microsecond_t framePeriod) {
|
||||
void ExpansionHubServo::SetFramePeriod(wpi::units::microsecond_t framePeriod) {
|
||||
m_framePeriodPublisher.Set(framePeriod.to<double>());
|
||||
}
|
||||
|
||||
units::microsecond_t ExpansionHubServo::GetFullRangeScaleFactor() {
|
||||
wpi::units::microsecond_t ExpansionHubServo::GetFullRangeScaleFactor() {
|
||||
return m_maxPwm - m_minPwm;
|
||||
}
|
||||
|
||||
units::degree_t ExpansionHubServo::GetServoAngleRange() {
|
||||
wpi::units::degree_t ExpansionHubServo::GetServoAngleRange() {
|
||||
return m_maxServoAngle - m_minServoAngle;
|
||||
}
|
||||
|
||||
void ExpansionHubServo::SetPWMRange(units::microsecond_t minPwm,
|
||||
units::microsecond_t maxPwm) {
|
||||
void ExpansionHubServo::SetPWMRange(wpi::units::microsecond_t minPwm,
|
||||
wpi::units::microsecond_t maxPwm) {
|
||||
if (maxPwm <= minPwm) {
|
||||
throw FRC_MakeError(err::ParameterOutOfRange,
|
||||
"Max PWM must be greater than Min PWM");
|
||||
@@ -106,8 +106,8 @@ void ExpansionHubServo::SetPWMRange(units::microsecond_t minPwm,
|
||||
|
||||
void ExpansionHubServo::SetReversed(bool reversed) {}
|
||||
|
||||
void ExpansionHubServo::SetAngleRange(units::degree_t minAngle,
|
||||
units::degree_t maxAngle) {
|
||||
void ExpansionHubServo::SetAngleRange(wpi::units::degree_t minAngle,
|
||||
wpi::units::degree_t maxAngle) {
|
||||
if (maxAngle <= minAngle) {
|
||||
throw FRC_MakeError(err::ParameterOutOfRange,
|
||||
"Max angle must be greater than Min angle");
|
||||
|
||||
Reference in New Issue
Block a user