Go to Post FIRST is not all about the competitions. FIRST is about what you learn to get to wherever you got to, whether that be first seed or last. - StephLee [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 06-12-2016, 17:31
GoldenGollem's Avatar
GoldenGollem GoldenGollem is offline
Java Programmer
FRC #2509 (Hutchinson Tigerbots)
Team Role: Programmer
 
Join Date: Dec 2015
Rookie Year: 2015
Location: Minnesota
Posts: 24
GoldenGollem is an unknown quantity at this point
Repeated Error

Everytime I attempt to run a command based robot code I get this error. It only happens as soon as I add subsystems and is a command based.
Code:
ERROR
Unhandled exception instantiating robot
org.usfirst.frc2509.Robot2015d.v3.Robot java.lang.NullPointerException
at [org.usfirst.frc2509.Robot2015d.v3.Robot.<init>(Robot.java:46),
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method),
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62),
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45),
java.lang.reflect.Constructor.newInstance(Constructor.java:408),
java.lang.Class.newInstance(Class.java:433),
edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:204)
If anyone can help me go in the right direction to fix this error that would be great. Here is the link to the code.
__________________
GoldenGollem -Hutchinson Tigerbots 2509
2015 - Mini-MN Regional 2nd Place Finalist
2016 - Mini-MN Regional 1st Place Finalist
Reply With Quote
  #2   Spotlight this post!  
Unread 06-12-2016, 17:40
bdaroz's Avatar
bdaroz bdaroz is offline
Programming Mentor
AKA: Brian Rozmierski
FRC #5881 (TVHS Dragons)
Team Role: Mentor
 
Join Date: Jan 2016
Rookie Year: 2016
Location: Albany, NY
Posts: 366
bdaroz has much to be proud ofbdaroz has much to be proud ofbdaroz has much to be proud ofbdaroz has much to be proud ofbdaroz has much to be proud ofbdaroz has much to be proud ofbdaroz has much to be proud ofbdaroz has much to be proud ofbdaroz has much to be proud of
Re: Repeated Error

Quick and Dirty Answer:

You refer to Robot.oi.lStick on line 46 of Robot.java. (See the top of the stack trace). At that point of code execution Robot.oi has been declared (see line 35), but not assigned a value yet. That doesn't happen until late inside the robotInit() function (function starts line 52, assigned value at 67).

If you just declare the variable, and remove the assignment at 46 (and 47) and assign the value in robotInit() after line 67, you should get past that problem.

(Sorry I didn't check for any others you might run into after this.)
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:42.

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