/*
   * If vx=0 and vy=0, and omega=100 the robot will rotate
   * counterclockwise at roughly its maximum speed.  If vx=0 and
   * vy=100 and omega=0, the robot will go "north" at roughly
   * its maximum speed.
   */
  public void vectorDrive(int vx, int vy, int omega) {
    int bb = 72 * omega;
    int bx = 50 * vx;
    int by = 87 * vy;

    servoDirect.setPosition(scaleToServoSpeed(((-100 * vx) + bb) / 100), 0);
    servoDirect.setPosition(scaleToServoSpeed(((bx - by) + bb) / 100), 1);
    servoDirect.setPosition(scaleToServoSpeed(((bx + by) + bb) / 100), 2);
  }
  /**
   * Creates a new JobotBaseController object.
   *
   * @param factory TODO PARAM: DOCUMENT ME!
   */
  public JobotBaseController(PeripheralFactory factory) {
    servoDirect = factory.createMultiServoController(MultiServoController.IMPLEMENTATION_DIRECT);
    servoMax = servoDirect.getMaxPosition();
    servoMid = servoMax >> 1;
    adc = factory.createADCReader(0, ADCReader.READ_INT);
    mouse = new Agilent2051();

    try {
      servoDirect.start();
    } catch (Exception e) {
      System.out.println("Failed!");
    }
  }
 /*
  * Drive directly drives the servo's
  */
 public void drive(int x, int y, int z) {
   servoDirect.setPosition(scaleToServoSpeed(x), 0);
   servoDirect.setPosition(scaleToServoSpeed(y), 1);
   servoDirect.setPosition(scaleToServoSpeed(z), 2);
 }
 /**
  * TODO METHOD: DOCUMENT ME!
  *
  * @param value TODO PARAM: param description
  * @param servo TODO PARAM: param description
  */
 public void setServo(int value, int servo) {
   servoDirect.setPosition(value, servo);
 }