Package com.grt192.core

Examples of com.grt192.core.Command


        return getSensor("RecGroundSwitch").getState("State") == Sensor.TRUE;
    }

    //controls motor speed
    private void setSpeed(double input){
            getActuator("RecMotorA").enqueueCommand(new Command(input));
            getActuator("RecMotorB").enqueueCommand(new Command(input));
    }
View Full Code Here


        addSensor("rightSonar", rightSonar);
        addSensor("centerSonar", centerSonar);
    }

    public void setLeftSpeed(double input) {
        getActuator("LeftRollerMotor").enqueueCommand(new Command(input));
    }
View Full Code Here

    public void setLeftSpeed(double input) {
        getActuator("LeftRollerMotor").enqueueCommand(new Command(input));
    }

    public void setRightSpeed(double input) {
        getActuator("RightRollerMotor").enqueueCommand(new Command(input));
    }
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

    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 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

  }

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

  }

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

            }
        }
    }

    private void notifyListeners(double newVoltage){
        BatteryVoltageEvent ev = new BatteryVoltageEvent(this, newVoltage);
        for(int i = 0; i<listeners.size(); i++){
            ((BatteryVoltageListener)listeners.elementAt(i)).batteryVoltageChanged(ev);
        }
    }
View Full Code Here

TOP

Related Classes of com.grt192.core.Command

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.