Menu

Using_the_Library

Using the Library



There is a gui client that should be easier to work with, see Getting Started with the GUI.


Download the wpilibj and library JARs or get the code from Subversion. Build it if necessary and replace your project's reference to wpilibj with a reference to our library.

Running in the simulator.

  1. Create a new Java project that references your code as a library or create a main class/main method in your existing code. There are 2 main ways of doing this:

Make a seperate main class

public class SimAppName{
    public static void main(String[] args){
        // Start simulator here
    }
}

Put the main class in your existing code

public class RobotAppName extends SimpleRobot{ //Extends IterativeRobot, RobotBase, etc.
    public static void main(String[] args){
        // Start simulator here
    }
    //disabled,autonomous,operatorControl, and other methods
}
  1. Create a new Simulator object and start it.

Starting the simulator

Simulator sim = null;
try{
    sim = new Simulator("your.robot.app.package.RobotAppName");
} catch(Exception e){
    // Print an error message here
    System.exit(2);
}
sim.start();

This will work, but as you may have noticed, will fail when it tries to reference any modules. To solve this, see Using the CRIO class.