Go to Post At the competitions you can look like an idiot and nobody cares, that makes me happy... - Laura 1547 [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 07-03-2015, 18:47
Technette Technette is offline
Registered User
FRC #2404
 
Join Date: Jan 2014
Location: Glendale, California
Posts: 6
Technette is an unknown quantity at this point
Angry Joystick not initialized Error

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;
}
Reply With Quote
  #2   Spotlight this post!  
Unread 07-03-2015, 18:56
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,575
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
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.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #3   Spotlight this post!  
Unread 07-03-2015, 20:02
Technette Technette is offline
Registered User
FRC #2404
 
Join Date: Jan 2014
Location: Glendale, California
Posts: 6
Technette is an unknown quantity at this point
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
Reply With Quote
  #4   Spotlight this post!  
Unread 07-03-2015, 20:28
nandeeka's Avatar
nandeeka nandeeka is offline
Registered User
FRC #1868
Team Role: Programmer
 
Join Date: May 2014
Rookie Year: 2013
Location: United States
Posts: 53
nandeeka is on a distinguished road
Re: Joystick not initialized Error

Did you try indexing?
Reply With Quote
  #5   Spotlight this post!  
Unread 07-03-2015, 21:47
Technette Technette is offline
Registered User
FRC #2404
 
Join Date: Jan 2014
Location: Glendale, California
Posts: 6
Technette is an unknown quantity at this point
Wink Re: Joystick not initialized Error

Yes,

I tried indexing. I am going to pull up the documentation to see how to correctly implement it.
Reply With Quote
  #6   Spotlight this post!  
Unread 08-03-2015, 09:55
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,575
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Joystick not initialized Error

These three are the most obvious issue:
Quote:
Originally Posted by Technette View Post
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
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):
Quote:
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:
  1. Is Joystick in this context wpilib.Joystick, or something else?
  2. Are you using a controller which does not match the description of the Joystick class?
  3. Did you include configuration/code to map the joystick ports to hardware buttons in your Driver Station?
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #7   Spotlight this post!  
Unread 08-03-2015, 20:25
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 521
ozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant future
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
... that's ok, you should still get a new FRCUserProgram executable.
Reply With Quote
  #8   Spotlight this post!  
Unread 08-03-2015, 20:43
Technette Technette is offline
Registered User
FRC #2404
 
Join Date: Jan 2014
Location: Glendale, California
Posts: 6
Technette is an unknown quantity at this point
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
Reply With Quote
  #9   Spotlight this post!  
Unread 08-03-2015, 20:48
Technette Technette is offline
Registered User
FRC #2404
 
Join Date: Jan 2014
Location: Glendale, California
Posts: 6
Technette is an unknown quantity at this point
Smile Re: Joystick not initialized Error

I do see that the build did complete though! Wooo Whooo!

Now I can help the team work on the autonomous modes.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 14:02.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi