Experiencing robot deployment issues after implementing NavX MXP

Hey, CD! I’m Brady and I’m a programming mentor for the team 9430. We’re making a lot of progress on our first ever swerve bot, but now we’re stuck figuring out how to drive our bot head relative to the field rather than its own chassis. This would make it much easier to strafe, aim, and shoot as well as manuever just from a driver’s perspective alone.

We have an effective branching strategy that stores only working, tested code in our release branch. This branch deploys just fine and our robot controls as expected. We have another branch in development that also deploys just fine, though some of the features are still under testing and refinement.

The one branch that only has to deal with improving our drive subsystem to use field relative drive implements a navx controller and makes efforts to replace our original internal gyro with the AHRS gyro provided by the NavX MXP. The branch is called “fieldrelativedrive” and the source code can be found on github: 9430 HPWaffleJet-1024 Field Relative Drive

I am a new user and therefore cannot upload attachments (as I am just realizing) so I will push the test results I got last night from the driverstation that shows some sort of strange loop that prevents me from deploying code to the robot. You can find that here

I also observe messages in my terminal when deploying that files are already up to date and not being deployed. This sort of message happens even after deploying a different branch to the RoboRIO. I tried my shot at error handling with frc::DriverStation::ReportError() but it was not working as I expected. I will be doing more testing later today and can update with the error that I get.

Has anyone else experienced issues implementing NavX MXP before? How did you resolve those issues? We’ve tried putting the initialization code into the DriveSubsystem and the RobotContainer, but the docs show it should work just by putting it directly in Robot::Init() so we’re trying that now hoping it just works.

All I am currently looking for is the code to deploy – even if it doesn’t work as expected, I am stuck on just the deployment seeming not to happen and I can’t quite figure out why. All help will be appreciated immensely!

This indicates the robot code is crashing and restarting. In C++ you don’t get a nice stacktrace like you do in Java; you will need to run your code in a debugger (e.g. debug robot code) to see what is causing it to crash. This might be easier to do in desktop simulation mode.

From code inspection, it appears the crash is due to not initializing the m_ahrs variable in DriveSubsystem. It’s a pointer (so it’s not going to be default constructed), you don’t initialize it in the DriveSubsystem constructor, and you try to access it in the constructor. That access attempt is going to crash the program. You need to initialize it (e.g. by using new) or better, don’t use a pointer there and instead use a value type so it gets constructed automatically.

This usually just means that it’s not redeploying vendor and WPILib libraries (to reduce flash wear on the Rio, it checks to see if there’s different libraries that need to be deployed than are already present on the Rio), not that it’s not redeploying your robot program.

Sorry for the very late reply. I wanted to respond and give you closure that this was indeed very helpful in guiding my team to a solution. Indeed, failing to initialize the ahrs object was the cause of the problem. Seems to be a simple oversight and now the field-relative drive works great!

Our code is public for others to access and use to help guide them as well. We have updated the code on our remote repo linked earlier! Please make sure to look under the fieldrelativedrive branch.