Go to Post FIRST has stated time and again that the program is not about teaching (they always refer to the I and R in FIRST) - Dave Flowerday [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 18-01-2017, 10:43
beardo17 beardo17 is offline
Registered User
FRC #6121
 
Join Date: Jan 2017
Location: Grayling, MI
Posts: 6
beardo17 is an unknown quantity at this point
Re: No Robot Code

We did that. We have the latest image and firmware and Java on the roboRIO. We also Updated the eclipse plugins and redownloaded the update suite.
Reply With Quote
  #2   Spotlight this post!  
Unread 18-01-2017, 11:52
AustinShalit's Avatar
AustinShalit AustinShalit is offline
Registered User
AKA: אוסטין
no team (WPILib Suite Developer)
 
Join Date: Dec 2013
Rookie Year: 2008
Location: Los Angeles/Worcester/Israel
Posts: 152
AustinShalit is a glorious beacon of lightAustinShalit is a glorious beacon of lightAustinShalit is a glorious beacon of lightAustinShalit is a glorious beacon of lightAustinShalit is a glorious beacon of lightAustinShalit is a glorious beacon of light
Re: No Robot Code

You are using static initialization. This means you do not know what order Objects are going to be created in. For example, in your DriveSubsystem on line 19 you call Robot.oi.getX(). Robot.oi is null and has not been created yet.

The easiest way to fix this is to create your robot project with RobotBuilder.
__________________
Reply With Quote
  #3   Spotlight this post!  
Unread 18-01-2017, 12:07
beardo17 beardo17 is offline
Registered User
FRC #6121
 
Join Date: Jan 2017
Location: Grayling, MI
Posts: 6
beardo17 is an unknown quantity at this point
Re: No Robot Code

Quote:
Originally Posted by AustinShalit View Post
You are using static initialization. This means you do not know what order Objects are going to be created in. For example, in your DriveSubsystem on line 19 you call Robot.oi.getX(). Robot.oi is null and has not been created yet.

The easiest way to fix this is to create your robot project with RobotBuilder.
I'm not sure I quite know what you mean.. If I remove Static from it, will that fix it? (I currently don't have the robot to test on)
Reply With Quote
  #4   Spotlight this post!  
Unread 18-01-2017, 12:51
david.e.boles david.e.boles is offline
Bringer of Whales and Petunias
AKA: david476
FRC #5940 (BREAD)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2011
Location: San Francisco, CA
Posts: 30
david.e.boles is on a distinguished road
Re: No Robot Code

The problem AustinShalit is pointing out isn't so much the fact that your variables are static but more that you're not being careful about the way you initialize them. Robot.robotInit() gets called after object variable initialization, take a look at this:

Robot.driveSubsystem initialized:
driveSubsystem.x initialized from Robot.oi.getX()
driveSubsystem.y initialized from Robot.oi.getY() * (Robot.oi.getRTrigger() + 0.5)
other stuff...
Robot.robotInit() called:
Robot.oi initialized
See a problem here? In general though, the best way to work through these issues (besides implementing a better architecture/ conventions that prevent it from happening) is outlined in euhlmann's post.
Reply With Quote
  #5   Spotlight this post!  
Unread 18-01-2017, 13:08
AustinShalit's Avatar
AustinShalit AustinShalit is offline
Registered User
AKA: אוסטין
no team (WPILib Suite Developer)
 
Join Date: Dec 2013
Rookie Year: 2008
Location: Los Angeles/Worcester/Israel
Posts: 152
AustinShalit is a glorious beacon of lightAustinShalit is a glorious beacon of lightAustinShalit is a glorious beacon of lightAustinShalit is a glorious beacon of lightAustinShalit is a glorious beacon of lightAustinShalit is a glorious beacon of light
Re: No Robot Code

Quote:
Originally Posted by david.e.boles View Post
The problem AustinShalit is pointing out isn't so much the fact that your variables are static but more that you're not being careful about the way you initialize them. Robot.robotInit() gets called after object variable initialization, take a look at this:

Robot.driveSubsystem initialized:
driveSubsystem.x initialized from Robot.oi.getX()
driveSubsystem.y initialized from Robot.oi.getY() * (Robot.oi.getRTrigger() + 0.5)
other stuff...
Robot.robotInit() called:
Robot.oi initialized
See a problem here? In general though, the best way to work through these issues (besides implementing a better architecture/ conventions that prevent it from happening) is outlined in euhlmann's post.
Could not have said it better!
__________________
Reply With Quote
  #6   Spotlight this post!  
Unread 18-01-2017, 15:26
beardo17 beardo17 is offline
Registered User
FRC #6121
 
Join Date: Jan 2017
Location: Grayling, MI
Posts: 6
beardo17 is an unknown quantity at this point
Re: No Robot Code

Oh Yay!!! That fixed Evereything! Thank you all!!!!
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 09:50.

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