2025-03-20 19:23:22 -07:00
|
|
|
// 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.
|
|
|
|
|
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "wpi/simulation/PWMMotorControllerSim.hpp"
|
2025-03-20 19:23:22 -07:00
|
|
|
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "wpi/hal/SimDevice.h"
|
|
|
|
|
#include "wpi/units/length.hpp"
|
2025-03-20 19:23:22 -07:00
|
|
|
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "wpi/simulation/SimDeviceSim.hpp"
|
2025-03-20 19:23:22 -07:00
|
|
|
|
|
|
|
|
using namespace frc;
|
|
|
|
|
using namespace frc::sim;
|
|
|
|
|
|
|
|
|
|
PWMMotorControllerSim::PWMMotorControllerSim(
|
|
|
|
|
const PWMMotorController& motorctrl)
|
|
|
|
|
: PWMMotorControllerSim(motorctrl.GetChannel()) {}
|
|
|
|
|
|
|
|
|
|
PWMMotorControllerSim::PWMMotorControllerSim(int channel) {
|
|
|
|
|
frc::sim::SimDeviceSim deviceSim{"PWMMotorController", channel};
|
|
|
|
|
m_simSpeed = deviceSim.GetDouble("Speed");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double PWMMotorControllerSim::GetSpeed() const {
|
|
|
|
|
return m_simSpeed.Get();
|
|
|
|
|
}
|