View Single Post
  #1   Spotlight this post!  
Unread 14-02-2012, 00:55
Brian Selle's Avatar
Brian Selle Brian Selle is offline
Mentor
FRC #3310 (Black Hawk Robotics)
Team Role: Engineer
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Texas
Posts: 162
Brian Selle has a spectacular aura aboutBrian Selle has a spectacular aura aboutBrian Selle has a spectacular aura about
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.
Reply With Quote