View Single Post
  #2   Spotlight this post!  
Unread 13-01-2011, 13:07
omalleyj omalleyj is offline
Registered User
AKA: Jim O'Malley
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: New Jersey
Posts: 132
omalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to behold
Re: Working with java classes

Quote:
Originally Posted by correnos View Post
With most Java programs, creating an object from a class is the advisable path. However, I am unaware of how to accomplish this from the setup used by wpilibj. It is configured on the JVM of the cRIO to run the main class, and if there is a way to tell it to work with an instance of said class instead of the class itself I have not found it yet.
I think you may be misinterpreting what is happening. When you create a class from SimpleRobot (for instance), you also create (generally) a constructor for it. Your class is instantiated, its constructor is called, and at some point the autonomous() and operatorControl() methods are called.

Unlike a normal desktop app, you are not running the show, the overarching layer is instantiating your robot class and running specific methods at appropriate times.