I hope all of your builds are going well. My team is using the NavX MXP again (we used it last year) but initialization is proving to be a pain. Our code can be found on GitHub but the basics are as follows:
We have a header file (PenguinEmpire.h) with our robot class declaration, including the line
AHRS *ahrs;
In our source file, Robot.cpp, we are simply trying to call the ahrs constructor within the Robot constructor via
ahrs = new AHRS(SerialPort::kMXP);
Whenever we try to compile, we get the error
invalid new-expression of abstract class type "AHRS"
The code worked perfectly last year, what’s the difference? How can I fix it?
Thanks in advance,
Noah
President and Programmer, 2551
There was a change to the WPI Libraries for the 2018 season that required a change to the navX-MXP libraries (a parent class of the AHRS class changed). From the detail you provided, it appears the navX-MXP libraries are out of sync with the WPI Library.
This sorted out the original issue, but now we have a general error:
The type 'AHRS' must implement the inherited pure virtual method 'frc::Sendable::InitSendable'
I’m convinced it will sort itself out as it seems to be a WPI issue and we’ve had similar ones that just disappeared in the past, so it doesn’t seem to be a big deal.
We’ve updated the navX-MXP for RoboRIO installer; the latest version is 3.0.346. Please install this, rebuild your application and let us know the results.
I was not able to replicate the compile error you reported, so there might still be a configuration problem on the development computer you are using. If you still have problems after running the latest install, please check the path to the navx_frc_cpp library in your build. It’s possible that it does not point to C:\Users<curr_user_name>\wpilib\user\cpp\lib - which is the current location for the navX-MXP for RoboRIO C++ Library.
Thanks, I got it working. It ended up being some combination of reinstalling eclipse, the WPI plugins, the AHRS library, and then wiping and re-pulling from our GitHub. Thanks for the help!