View Single Post
  #7   Spotlight this post!  
Unread 17-02-2012, 07:23
dbeckwith's Avatar
dbeckwith dbeckwith is offline
Lead Programmer
AKA: Daniel Beckwith
FRC #3205 (The Patriots)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: USA
Posts: 84
dbeckwith is an unknown quantity at this point
Re: Help! RobotDrive Error in all 3 languages

In the Java example you initialize the RobotDrive object at its declaration:
Quote:
public class RobotTemplate extends SimpleRobot {
RobotDrive drivetrain = new RobotDrive(1,2);
I'm not sure that's a good way to do it. The constructor might need some resources that are initialized later in order to work properly. I would move it to the robotInit() method just to be safe.
Quote:
public class RobotTemplate extends SimpleRobot {
RobotDrive drivetrain;

public void robotInit() {
drivetrain = new RobotDrive(1,2);
}
}
__________________
q = (2*b) | ~(2*b);

if (life.getLemons() != null) this.lemonade = new Drink(life.getLemons());
else throw new NoLemonsException("What now?");