FRCTeam2992 / Robot2023

FRC Team 2992's 2023 Robot Code
Other
1 stars 0 forks source link

[deps, Drivetrain] Replace navx dep with workaround #65

Closed nihonjinrxs closed 1 year ago

nihonjinrxs commented 1 year ago

Related Issues and PRs

Issue:

Original Dependency Code: in kauailabs/navxmxp Workaround: in Thunderstamps/navx2workaround

Related PRs:

Checklist

What is changing and why?

We've seen intermittent disconnects of the NavX module. This is apparently a bug in the KauaiLabs vendor library. See Chief Delphi thread here. A bug fix was created by user Programming4097 there, and published in the repo Thunderstamps/navx2workaround.

This PR pulls the src/main/java/frc/robot/NavX folder from that repo into our src/main/java/frc/lib/NavX folder here, and updated package references from frc.robot.NavX to frc.lib.NavX. It also updates our Drivetrain subsystem to pull in that new lib dependency instead of the vendor's original lib, and removes the build reference for the vendor's lib. I hope I've left enough breadcrumbs in the comment on the import and in this PR to allow us to maintain and eventually remove this alternate dependency down the road.

During testing, we found that we do indeed see [the reported issue of update rate error logs]() due to the NavX lib setting a default update rate of 60 Hz, which is incompatible with the NavX2 hardware. To fix this, we've updated that manually on AHRS creation in Drivetrain to a 50 Hz update rate.

How was this tested?

Other users have tested this lib fix with their robot code and had success with it.

Tested on our bot, and this seems to work well, once the manual update rate was set.

Is there anything the reviewer of this PR needs to know to validate that this code is correct?

We'll need to push this change to the robot and observe the robot logs. If we still see intermittent NavX disconnects, then this did not work, and we should look further or remove it. If we don't see them, things should be OK.

What do your team members need to know about this?