[sim] Fix ADXRS450_GyroSim and DutyCycleEncoderSim (#2963)

These were broken by #2952.

Also fix Java ADXRS450_Gyro angle/rate SimValue names.
This commit is contained in:
Peter Johnson
2020-12-24 12:23:38 -08:00
committed by GitHub
parent 240c629cda
commit a8bb2ef1c3
8 changed files with 23 additions and 14 deletions

View File

@@ -18,10 +18,10 @@ using namespace frc::sim;
ADXRS450_GyroSim::ADXRS450_GyroSim(const frc::ADXRS450_Gyro& gyro) {
wpi::SmallString<128> fullname;
wpi::raw_svector_ostream os(fullname);
os << "ADXRS450_Gyro" << '[' << gyro.GetPort() << ']';
os << "Gyro:ADXRS450" << '[' << gyro.GetPort() << ']';
frc::sim::SimDeviceSim deviceSim{fullname.c_str()};
m_simAngle = deviceSim.GetDouble("Angle");
m_simRate = deviceSim.GetDouble("Rate");
m_simAngle = deviceSim.GetDouble("angle_x");
m_simRate = deviceSim.GetDouble("rate_x");
}
void ADXRS450_GyroSim::SetAngle(units::degree_t angle) {

View File

@@ -18,10 +18,11 @@ using namespace frc::sim;
DutyCycleEncoderSim::DutyCycleEncoderSim(const frc::DutyCycleEncoder& encoder) {
wpi::SmallString<128> fullname;
wpi::raw_svector_ostream os(fullname);
os << "DutyCycleEncoder" << '[' << encoder.GetFPGAIndex() << ']';
os << "DutyCycle:DutyCycleEncoder" << '[' << encoder.GetSourceChannel()
<< ']';
frc::sim::SimDeviceSim deviceSim{fullname.c_str()};
m_simPosition = deviceSim.GetDouble("Position");
m_simDistancePerRotation = deviceSim.GetDouble("DistancePerRotation");
m_simPosition = deviceSim.GetDouble("position");
m_simDistancePerRotation = deviceSim.GetDouble("distance_per_rot");
}
void DutyCycleEncoderSim::Set(units::turn_t turns) {