mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[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:
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user