RobotController.getInputVoltage() returning NaN

I am trying to implement MapleSim with my team’s robot and we are running into two issues, both of which have to do with RobotController.getInputVoltage().

Firstly, it seems to be dropping to zero very quickly during robot acceleration, at least much faster than seems realistic.

Additionally, after it stays at 0 for about a second it starts permanently returning NaN and will not stop.

This causes issues with some of our simulation work as this NaN propagates through certain PathPlanner methods and ends up giving us ChassisSpeeds and SwerveModuleStates with NaN as the speed, but the issue clearly originates with RobotController.getInputVoltage().

If anyone had any information on why these two issues happen, please let me know! Thanks!

Edit:
Code if it helps:

This is an issue with maple-sim right now where certain currents would jump to infinity. We’re submitting a pull request to fix the underlying issue.

1 Like