NAVX AHRS import error

I would like to use NAVX gyros in my robot code so I downloaded the vendordeps from https://pdocs.kauailabs.com/navx-mxp/software/roborio-libraries/java/ . When I import com.kauailabs.navx.frc.AHRS, VSCode underlines it in red saying “The import com.kauailabs cannot be resolved.” although whenever I build the code there are no issues. However, when I go to make my Gyro object, the build fails saying “AHRS cannot be resolved to a type”. I have the right vendordeps downloaded so I was wondering the cause of this. For reference the code looks like this:

import com.kauailabs.navx.frc.AHRS; //underlined red but builds fine
import org.texastorque.torquelib.base.TorqueFeedback;

public class GyroFeedback extends TorqueFeedback{

    private final AHRS nxGyro; //underlined red and build error

    @Override
    public void update() {
        // TODO Auto-generated method stub
    }
}

Just to confirm - does “Downloaded” imply you followed the WPI Documentation steps and didn’t have errors while doing so?

Yes, I had no errors when getting the vendordeps

Hey Suhas,

I checked out your code. It built successfully for me and ran in the simulation fine. I see you upgraded the NavX library from 3.* to 4.*, which could be causing an issue. Talk to me tomorrow during the meeting, and I can work with you to fix it.

Thanks, Jack!

Issue was due to Java cache. Fixed by clearing cache and refreshing vendordeps.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.