Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   NetBeans CommandBasedRobotTemplate (http://www.chiefdelphi.com/forums/showthread.php?t=102772)

Brian Selle 14-02-2012 00:55

NetBeans CommandBasedRobotTemplate
 
I think there is a bug in the NetBeans CommandBasedRobotTemplateProject...

In the init() method of CommandBase.java it creates an instance of OI as shown below:

public static void init() {
// This MUST be here. If the OI creates Commands (which it very likely
// will), constructing it during the construction of CommandBase (from
// which commands extend), subsystems are not guaranteed to be
// yet. Thus, their requires() statements may grab null pointers. Bad
// news. Don't move it.
oi = new OI();

It should be using the static singleton instance:

oi = OI.getInstance();

The constructor for OI should also be private. As it stands now, if you access the static instance elsewhere, such as:

m_drive.arcadeDrive(OI.getInstance().getJoystick() );

you will have 2 instances of OI floating around.


All times are GMT -5. The time now is 22:41.

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