mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpilib] Remove Servo Classes (#8270)
SystemCore doesn't directly support Servos. It would be possible to still use a Servo Power Module, but those are fairly rare, and we should probably use a different class for that case, so users don't attempt to hook a servo directly up to systemcore. That will depend on what happens with the rules in 2027. Rev Servo Hubs are a current working replacement for systemcore users.
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include "frc/simulation/ServoSim.h"
|
||||
|
||||
#include <hal/SimDevice.h>
|
||||
#include <units/length.h>
|
||||
|
||||
#include "frc/simulation/SimDeviceSim.h"
|
||||
|
||||
using namespace frc;
|
||||
using namespace frc::sim;
|
||||
|
||||
ServoSim::ServoSim(const Servo& servo) : ServoSim(servo.GetChannel()) {}
|
||||
|
||||
ServoSim::ServoSim(int channel) {
|
||||
frc::sim::SimDeviceSim deviceSim{"Servo", channel};
|
||||
m_simPosition = deviceSim.GetDouble("Position");
|
||||
}
|
||||
|
||||
double ServoSim::GetPosition() const {
|
||||
return m_simPosition.Get();
|
||||
}
|
||||
|
||||
double ServoSim::GetAngle() const {
|
||||
return GetPosition() * Servo::GetServoAngleRange() + Servo::kMinServoAngle;
|
||||
}
|
||||
Reference in New Issue
Block a user