Go to Post I say we all stop flaming and pointing out what went wrong or what bad calls were made and start pointing out how much fun we all have at the regionals and what FIRST actually has done for us. - burkechrs1 [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 12-02-2013, 05:21
r0306 r0306 is offline
Registered User
AKA: Robert Lu
FRC #0253 (MRT)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2010
Location: California
Posts: 13
r0306 is an unknown quantity at this point
NullPointerException at drivecode

When we run our drive code, it throws the following error:
Code:
[cRIO] java.lang.NullPointerException
[cRIO]     at edu.wpi.first.wpilibj.RobotDrive.arcadeDrive(RobotDrive.java:342)
[cRIO]     at edu.wpi.first.wpilibj.RobotDrive.arcadeDrive(RobotDrive.java:354)
[cRIO]     at Robot2013.RobotMain.teleopPeriodic(RobotMain.java:90)
[cRIO]     at edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:165)
[cRIO]     at edu.wpi.first.wpilibj.RobotBase.startApp(RobotBase.java:169)
[cRIO]     in virtual method #10 of javax.microedition.midlet.MIDlet(bci=17)
[cRIO]     at javax.microedition.midlet.MIDletTunnelImpl.callStartApp(64)
[cRIO]     at com.sun.squawk.imp.MIDletMainWrapper.main(110)
[cRIO]     in virtual method #95 of com.sun.squawk.Klass(bci=25)
[cRIO]     at com.sun.squawk.Isolate.run(1506)
[cRIO]     at java.lang.Thread.run(231)
[cRIO]     in virtual method #47 of com.sun.squawk.VMThread(bci=42)
[cRIO]     in static method #3 of com.sun.squawk.VM(bci=6)
Code:
public class RobotMain extends IterativeRobot
{

    public static RobotDrive driveTrain;
    public static Joystick leftStick; 
    
    public void robotInit()
    {

        driveTrain = new RobotDrive(4, 3, 1, 2);

        driveTrain.setSafetyEnabled(false);

    }


    public void autonomousPeriodic()
    {
        
    }

    public void teleopPeriodic()
    {

        driveTrain.arcadeDrive(leftStick); //line 90

    }

    public void testPeriodic() {

    }
}
The motors aren't running at all and I don't get what could've gone wrong here as the code seems fine.
__________________
Scrambled Eggs for the children
Reply With Quote
  #2   Spotlight this post!  
Unread 12-02-2013, 05:44
MagiChau's Avatar
MagiChau MagiChau is offline
Registered User
AKA: Michael Chau
FRC #0085 (B.O.B. (Built on Brains))
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Zeeland, Michigan
Posts: 875
MagiChau is just really niceMagiChau is just really niceMagiChau is just really niceMagiChau is just really nice
Re: NullPointerException at drivecode

You never instantiated the joystick so there is no Joystick to get any values from.

Code:
Joystick leftStick = new Joystick(1);
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:10.

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