An error when simulating WPI_TalonSRX

l want to run my code on simulation. Everything seems to be good except that there is something wrong when it new the TalonSRX.

My whole code is below: (30.3 MB)

You’re likely creating more than one WPI_TalonSRX with the same device ID. That will cause the exact error you’re seeing. This is unique to sim - we have a fix for the next release that prevents the exception, but having multiples with the same ID is still something you want to avoid.

l didn’t use the same port id. l think l have checked it twice.

1 Like

The problem doesn’t happen immediately on robotInit() but only when Teleop is started.
We successfully ran simulations with Talons this year but without encoders. This post discusses encoders and using simulationPeriodic() which doesn’t seem to be in your drive subsystem.

[CTRE simulation discussion]