Is joystick declared so that these two methods are actually referring to the same variable, and is it something which is a valid type for Joystick *? If not, initializing the one will not initialize the other.
I did have two methods referring to the same variable.
Now I just get an error for the setDefaultCommand still.
It appears that the joystick is not properly initialized.
I get the following errors now:
Description Resource Path Location Type
The type ‘Joystick’ must implement the inherited pure virtual method ‘GenericHID::GetPOV’ OI.cpp /GrabNGo/src line 30 Code Analysis Problem
The type ‘Joystick’ must implement the inherited pure virtual method ‘GenericHID::GetRawAxis’ OI.cpp /GrabNGo/src line 30 Code Analysis Problem
The type ‘Joystick’ must implement the inherited pure virtual method ‘GenericHID::GetRawButton’ OI.cpp /GrabNGo/src line 30 Code Analysis Problem
The type ‘Lift_Down’ must implement the inherited pure virtual method ‘ITableListener::ValueChanged’ OI.cpp /GrabNGo/src line 41 Code Analysis Problem
The type ‘Lift_Up’ must implement the inherited pure virtual method ‘ITableListener::ValueChanged’ OI.cpp /GrabNGo/src line 39 Code Analysis Problem
Joystick is a wpilib class, so it should inherit everything from GenericHID, with implementations.
From the opening paragraph in the javadoc for Joystick in WPIlibj (I’m assuming C/C++ is similar):
Handle input from standard Joysticks connected to the Driver Station. This class handles standard input that comes from the Driver Station. Each time a value is requested the most recent value is returned. There is a single class instance for each joystick and the mapping of ports to hardware buttons depends on the code in the driver station.
Three things I can think of to check:
Is Joystick in this context wpilib.Joystick, or something else?
Are you using a controller which does not match the description of the Joystick class?
Did you include configuration/code to map the joystick ports to hardware buttons in your Driver Station?
“Joystick was not initialized in the constructor” is not an error. It is a warning. You should still be able to build (FRCUserProgram file should still appear under Binaries).
I can reproduce this by creating a new Commandbased C++ project, adding a Joystick * joystick to IO header and heap allocating it in the constructor just as you have.
Clean the project, rebuild the index, right-click delete the errors and warnings in the “Problems” Tab, then full-rebuild.
At this point the warning will be gone.
You will will still see this warning…
libstdc++.so.6, needed by :\Users\ozrie_000/wpilib/cpp/current/lib\libFRC_NetworkCommunication.so.1.5.0
… that’s ok, you should still get a new FRCUserProgram executable.