Package com.grt192.controller

Examples of com.grt192.controller.DashBoardController


        return driveMode;
    }
   
    public void executeCommand(Command c) {

        Command c1 = this.dequeue();
        switch (driveMode) {
            case 0: {
                if(c1 == null)
                    c1 = c;
                driveTrain.tankDrive(c.getValue(), c1.getValue());
                //left.set(c.getValue());
                //right.set(c1.getValue());
                break;
            }
            case 1: {
                driveTrain.arcadeDrive(c.getValue(), c1.getValue(), false);
                break;
            }
            case 2: {
                driveTrain.arcadeDrive(c.getValue(), c1.getValue(), true);
                break;
            }
            case 3: {
                driveTrain.drive(c.getValue(), c1.getValue());
                break;
            }
        }
    }
View Full Code Here


        addActuator("bottom4", bottomJag4);
    }

    public void testTimedPorts() {
        System.out.println("Running 1");
        bottomJag1.enqueueCommand(new Command(1.0, WAIT_TIME, true));
        try {
            Thread.sleep(WAIT_TIME);
        } catch (Exception e) {
        }
        ;
        System.out.println("Running 2");
        bottomJag2.enqueueCommand(new Command(1.0, WAIT_TIME, true));
        try {
            Thread.sleep(WAIT_TIME);
        } catch (Exception e) {
        }

        System.out.println("Running 3");
        bottomJag3.enqueueCommand(new Command(1.0, WAIT_TIME, true));
        try {
            Thread.sleep(WAIT_TIME);
        } catch (Exception e) {
        }

        System.out.println("Running 4");
        bottomJag4.enqueueCommand(new Command(1.0, WAIT_TIME, true));
        try {
            Thread.sleep(WAIT_TIME);
        } catch (Exception e) {
        }

        System.out.println("Running t1");
        topJag1.enqueueCommand(new Command(1.0, WAIT_TIME, true));
        try {
            Thread.sleep(WAIT_TIME);
        } catch (Exception e) {
        }

        System.out.println("Running t2");
        topJag2.enqueueCommand(new Command(1.0, WAIT_TIME, true));
        try {
            Thread.sleep(WAIT_TIME);
        } catch (Exception e) {
        }

        System.out.println("Running t3");
        topJag3.enqueueCommand(new Command(1.0, WAIT_TIME, true));
        try {
            Thread.sleep(WAIT_TIME);
        } catch (Exception e) {
        }

        System.out.println("Running t4");
        topJag4.enqueueCommand(new Command(1.0, WAIT_TIME, true));
        try {
            Thread.sleep(WAIT_TIME);
        } catch (Exception e) {
        }

        System.out.println("Running t5");
        topJag5.enqueueCommand(new Command(1.0, WAIT_TIME, true));
        try {
            Thread.sleep(WAIT_TIME);
        } catch (Exception e) {
        }
    }
View Full Code Here

                                this.halt();
                        }
                        for(int i=0; i<actuatorCommandListeners.size(); i++){
                            ((ActuatorCommandListener)
                                actuatorCommandListeners.elementAt(i)).commandDidComplete(
                                           new ActuatorEvent(this,
                                           ActuatorEvent.COMMAND_COMPLETE,
                                           this.current));
                        }
                       
                    }
                }
                //minimum loop sleep
                sleep(SLEEP_INTERVAL);
            }catch(Exception e){
                //On exception kill this actuator, as it is
                //unsafe to continue operation
                for(int i=0; i<actuatorCommandListeners.size(); i++){
                    ((ActuatorCommandListener)
                        actuatorCommandListeners.elementAt(i)).commandDidComplete(
                                           new ActuatorEvent(this,
                                           ActuatorEvent.COMMAND_FAILED,
                                           this.current));
                }
                e.printStackTrace();
                stopActuator();
View Full Code Here

                                this.halt();
                        }
                        for(int i=0; i<actuatorCommandListeners.size(); i++){
                            ((ActuatorCommandListener)
                                actuatorCommandListeners.elementAt(i)).commandDidComplete(
                                           new ActuatorEvent(this,
                                           ActuatorEvent.COMMAND_COMPLETE,
                                           this.current));
                        }
                       
                    }
                }
                //minimum loop sleep
                sleep(SLEEP_INTERVAL);
            }catch(Exception e){
                //On exception kill this actuator, as it is
                //unsafe to continue operation
                for(int i=0; i<actuatorCommandListeners.size(); i++){
                    ((ActuatorCommandListener)
                        actuatorCommandListeners.elementAt(i)).commandDidComplete(
                                           new ActuatorEvent(this,
                                           ActuatorEvent.COMMAND_FAILED,
                                           this.current));
                }
                e.printStackTrace();
                stopActuator();
View Full Code Here

        }
    }

    protected void notifyGlobalListeners(String key) {
        for (int i = 0; i < globalListeners.size(); i++) {
            ((GlobalListener) globalListeners.elementAt(i)).globalChanged(new GlobalEvent(GlobalEvent.DEFAULT, key,
                    globals));
        }
    }
View Full Code Here

        }
    }

    protected void notifyGlobalListeners(String key) {
        for (int i = 0; i < globalListeners.size(); i++) {
            ((GlobalListener) globalListeners.elementAt(i)).globalChanged(new GlobalEvent(GlobalEvent.DEFAULT, key,
                    globals));
        }
    }
View Full Code Here

    private void notifyButtonListeners(String button, double previousState) {
        for (int i = 0; i < buttonListeners.size(); i++) {
            if (getState(button) == TRUE && getState(button) != previousState) {
                ((ButtonListener) buttonListeners.elementAt(i)).buttonDown(
                        new SensorEvent(this,
                        SensorEvent.DATA_AVAILABLE,
                        this.state), button);
            } else if (getState(button) != TRUE && getState(button) != previousState) {
                ((ButtonListener) buttonListeners.elementAt(i)).buttonUp(
                        new SensorEvent(this,
                        SensorEvent.DATA_AVAILABLE,
                        this.state),
                        button);
            }
        }
View Full Code Here

  }

  protected void notifyDataListeners() {
    for (int i = 0; i < sensorDataListeners.size(); i++) {
      ((SensorDataListener) sensorDataListeners.elementAt(i))
          .didRecieveData(new SensorEvent(this,
              SensorEvent.DATA_AVAILABLE, this.state));
    }
  }
View Full Code Here

  protected void notifySensorChangeListeners(String key, double previousState) {
    for (int i = 0; i < sensorChangeListeners.size(); i++) {
      if (getState(key) != previousState) {
        ((SensorChangeListener) sensorChangeListeners.elementAt(i))
            .sensorStateChanged(new SensorEvent(this,
                SensorEvent.DATA_AVAILABLE, this.state), key);
      }
    }
  }
View Full Code Here

  }

  protected void notifyAccelerometerSpike(int axis, double value) {
    for (int i = 0; i < accelerometerListeners.size(); i++) {
      ((ADXL345Listener) accelerometerListeners.elementAt(i))
          .didAccelerationSpike(new ADXL345Event(this, axis, value));
    }
  }
View Full Code Here

TOP

Related Classes of com.grt192.controller.DashBoardController

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.