Files
allwpilib/wpilibc/src/main/native/cpp/simulation/PWMMotorControllerSim.cpp

25 lines
788 B
C++
Raw Normal View History

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