Problems with drive train simulation

So I am trying to run a trajectory with on the wpilib drive train simulation but the bot starts the trajectory and than just disappears. Here is the code:

am I doing something wrong with the rev physics simulation?

Looking at the debug statements, it looks like the velocities and voltages get very large very quickly. Look for unit errors, and positive feedback (ie inversion errors). It would probably be helpful to start with a simpler project that commands known voltages so you can verify all inputs and outputs without the complexity of trajectory following.

1 Like

So I stopped trying to use the physics sim that rev uses and used the simdevicesim class to work with the cansparkmax objects properly instead. The problem is that when following the simulation tutorial from wpilib, the .get() method for the motor controllers is outputting 0 so the robot doesn’t move in autonomous:

leftMotor.get(): 0.0 rightMotor.get(): 0.0

why does this work for the pwmsparkmax but not the cansparkmax?

updated code is in the github link