mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
[wpilib] Deprecate getInstance() in favor of static functions (#3440)
Co-authored-by: Noam Zaks <imnoamzaks@gmail.com>
This commit is contained in:
@@ -26,12 +26,11 @@ using namespace frc;
|
||||
DifferentialDrive::DifferentialDrive(SpeedController& leftMotor,
|
||||
SpeedController& rightMotor)
|
||||
: m_leftMotor(&leftMotor), m_rightMotor(&rightMotor) {
|
||||
auto& registry = wpi::SendableRegistry::GetInstance();
|
||||
registry.AddChild(this, m_leftMotor);
|
||||
registry.AddChild(this, m_rightMotor);
|
||||
wpi::SendableRegistry::AddChild(this, m_leftMotor);
|
||||
wpi::SendableRegistry::AddChild(this, m_rightMotor);
|
||||
static int instances = 0;
|
||||
++instances;
|
||||
registry.AddLW(this, "DifferentialDrive", instances);
|
||||
wpi::SendableRegistry::AddLW(this, "DifferentialDrive", instances);
|
||||
}
|
||||
|
||||
void DifferentialDrive::ArcadeDrive(double xSpeed, double zRotation,
|
||||
|
||||
@@ -43,13 +43,12 @@ KilloughDrive::KilloughDrive(SpeedController& leftMotor,
|
||||
std::sin(rightMotorAngle * (wpi::numbers::pi / 180.0))};
|
||||
m_backVec = {std::cos(backMotorAngle * (wpi::numbers::pi / 180.0)),
|
||||
std::sin(backMotorAngle * (wpi::numbers::pi / 180.0))};
|
||||
auto& registry = wpi::SendableRegistry::GetInstance();
|
||||
registry.AddChild(this, m_leftMotor);
|
||||
registry.AddChild(this, m_rightMotor);
|
||||
registry.AddChild(this, m_backMotor);
|
||||
wpi::SendableRegistry::AddChild(this, m_leftMotor);
|
||||
wpi::SendableRegistry::AddChild(this, m_rightMotor);
|
||||
wpi::SendableRegistry::AddChild(this, m_backMotor);
|
||||
static int instances = 0;
|
||||
++instances;
|
||||
registry.AddLW(this, "KilloughDrive", instances);
|
||||
wpi::SendableRegistry::AddLW(this, "KilloughDrive", instances);
|
||||
}
|
||||
|
||||
void KilloughDrive::DriveCartesian(double ySpeed, double xSpeed,
|
||||
|
||||
@@ -33,14 +33,13 @@ MecanumDrive::MecanumDrive(SpeedController& frontLeftMotor,
|
||||
m_rearLeftMotor(&rearLeftMotor),
|
||||
m_frontRightMotor(&frontRightMotor),
|
||||
m_rearRightMotor(&rearRightMotor) {
|
||||
auto& registry = wpi::SendableRegistry::GetInstance();
|
||||
registry.AddChild(this, m_frontLeftMotor);
|
||||
registry.AddChild(this, m_rearLeftMotor);
|
||||
registry.AddChild(this, m_frontRightMotor);
|
||||
registry.AddChild(this, m_rearRightMotor);
|
||||
wpi::SendableRegistry::AddChild(this, m_frontLeftMotor);
|
||||
wpi::SendableRegistry::AddChild(this, m_rearLeftMotor);
|
||||
wpi::SendableRegistry::AddChild(this, m_frontRightMotor);
|
||||
wpi::SendableRegistry::AddChild(this, m_rearRightMotor);
|
||||
static int instances = 0;
|
||||
++instances;
|
||||
registry.AddLW(this, "MecanumDrive", instances);
|
||||
wpi::SendableRegistry::AddLW(this, "MecanumDrive", instances);
|
||||
}
|
||||
|
||||
void MecanumDrive::DriveCartesian(double ySpeed, double xSpeed,
|
||||
|
||||
Reference in New Issue
Block a user