mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
The HAL will only contain the output period and the raw microseconds. Higher level things such as SimDevice can handle everything else.
27 lines
791 B
C++
27 lines
791 B
C++
// 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/PWMMotorControllerSim.h"
|
|
|
|
#include <hal/SimDevice.h>
|
|
#include <units/length.h>
|
|
|
|
#include "frc/simulation/SimDeviceSim.h"
|
|
|
|
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();
|
|
}
|