|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I'm using one joystick and when I added it, I'm getting an error that the Joystick was not initialized in the constructor. I'd really appreciate help. I also had to comment out the default command because of the errors it was causing. Code:
OI::OI() {
// Process operator interface input here.
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
joystick = new Joystick(0);
// SmartDashboard Buttons
SmartDashboard::PutData("Drive_Arcade", new Drive_Arcade());
SmartDashboard::PutData("Autonomous Command", new AutonomousCommand());
SmartDashboard::PutData("Lift_Up", new Lift_Up());
SmartDashboard::PutData("Lift_Down", new Lift_Down());
SmartDashboard::PutData("Drive_To_Platform", new Drive_To_Platform());
SmartDashboard::PutData("Backup", new Backup());
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=FUNCTIONS
Joystick* OI::getJoystick() {
return joystick;
}
|
|
#2
|
|||||
|
|||||
|
Re: Joystick not initialized Error
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.
|
|
#3
|
|||
|
|||
|
Re: Joystick not initialized Error
Thank you for responding GeeTwo!
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 |
|
#4
|
||||
|
||||
|
Re: Joystick not initialized Error
Did you try indexing?
|
|
#5
|
|||
|
|||
|
Yes,
I tried indexing. I am going to pull up the documentation to see how to correctly implement it. |
|
#6
|
|||||
|
|||||
|
Re: Joystick not initialized Error
These three are the most obvious issue:
Quote:
From the opening paragraph in the javadoc for Joystick in WPIlibj (I'm assuming C/C++ is similar): Quote:
|
|
#7
|
||||
|
||||
|
Re: Joystick not initialized Error
"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... Code:
libstdc++.so.6, needed by :\Users\ozrie_000/wpilib/cpp/current/lib\libFRC_NetworkCommunication.so.1.5.0 |
|
#8
|
|||
|
|||
|
Re: Joystick not initialized Error
Thank you for responding Ozrien!
After rebuilding I get the following error: Description Resource Path Location Type Program "make" not found in PATH GrabNGo C/C++ Problem |
|
#9
|
|||
|
|||
|
I do see that the build did complete though! Wooo Whooo!
Now I can help the team work on the autonomous modes. ![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|