Go to Post A big bowl of popcorn and FIRST. It doesn't get much better than that. - Warren Boudreau [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 12-01-2013, 15:37
mitchellweb1 mitchellweb1 is offline
Registered User
AKA: Mitchell W
FRC #0190
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2009
Location: Acton, MA
Posts: 30
mitchellweb1 is an unknown quantity at this point
Re: Initialization Error

Oh ok. So your problem is that your code creates multiple instances of the Team3373 class which extends SimpleRobot. This causes the SimpleRobot/RobotBase constructor to be called multiple times which causes some initialization code to run twice. Even if the SimpleRobot constructor didn't fail you would still have errors because you would be creating multiple Tallon objects on the same port (Team3373:32-33). I would suggest that instead you look to take the code in line 30-81 and break it out into a helper base class and declare the your motors and sensors static so that they don't get created multiple times. You probably also want to make all of the fields with sensor values methods because currently they will only get values once when the code loads and will not change after that.
Reply With Quote
  #2   Spotlight this post!  
Unread 12-01-2013, 20:29
Peragore's Avatar
Peragore Peragore is offline
CEO of Black Magic
AKA: Philip Mulford
FRC #3373 (Team Robohawk)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: US
Posts: 50
Peragore is an unknown quantity at this point
Re: Initialization Error

Thanks for the write-up! We took a second look at the code, and pretty much found the same thing, with Shooter extending the main file, and then having the main file referencing shooter methods, thereby breaking it. So we went (I believe it is on the GitHub at this point), and used the "this" pointer to make it so we can access the variables of the main class in the Shooter class. So, we fixed it! Thank you for your input!
__________________


Code:
 
while (life){
  frcObsession = true;
  obs.ProgramAndObsess();
}
if (!life) life = true;
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 10:08.

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