mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[sim] Use DutyCycleEncoder FPGA index for sim device number (#2803)
The source channel doesn't necessarily correspond with the HALSIM device index.
This commit is contained in:
@@ -18,7 +18,7 @@ using namespace frc::sim;
|
||||
DutyCycleEncoderSim::DutyCycleEncoderSim(const frc::DutyCycleEncoder& encoder) {
|
||||
wpi::SmallString<128> fullname;
|
||||
wpi::raw_svector_ostream os(fullname);
|
||||
os << "DutyCycleEncoder" << '[' << encoder.GetSourceChannel() << ']';
|
||||
os << "DutyCycleEncoder" << '[' << encoder.GetFPGAIndex() << ']';
|
||||
frc::sim::SimDeviceSim deviceSim{fullname.c_str()};
|
||||
m_simPosition = deviceSim.GetDouble("Position");
|
||||
m_simDistancePerRotation = deviceSim.GetDouble("DistancePerRotation");
|
||||
|
||||
Reference in New Issue
Block a user