Package com.grt192.event.component

Examples of com.grt192.event.component.GyroEvent


//    public boolean isExtended() {
//        return extended;
//    }

    public void extend() {
        solenoid.enqueueCommand(new Command(GRTSolenoid.ON));
    }
View Full Code Here


    public void extend() {
        solenoid.enqueueCommand(new Command(GRTSolenoid.ON));
    }

    public void retract() {
        solenoid.enqueueCommand(new Command(GRTSolenoid.OFF));
    }
View Full Code Here

        tankDrive(leftValue, rightValue, 0);
    }

    public void tankDrive(double leftValue, double rightValue, int time) {
        System.out.println("drive:" + leftValue + "\t" + rightValue);
        Command c1 = new Command(-leftValue, time);
        Command c2 = new Command(-rightValue, time);
        getActuator("LeftJaguar1").enqueueCommand(c1);
        getActuator("LeftJaguar2").enqueueCommand(c1);
        getActuator("RightJaguar1").enqueueCommand(c2);
        getActuator("RightJaguar2").enqueueCommand(c2);
    }
View Full Code Here

    }

    public void changeMechPos(boolean state, int side) {
        if (state) {
            if (side == LEFT) {
                this.MechShifter1.enqueueCommand(new Command(MechShifter1.ON));
            } else {
                this.MechShifter2.enqueueCommand(new Command(MechShifter2.ON));
            }
        } else {
            if (side == LEFT) {
                this.MechShifter1.enqueueCommand(new Command(MechShifter1.OFF));
            } else {
                this.MechShifter2.enqueueCommand(new Command(MechShifter2.OFF));
            }
        }

    }
View Full Code Here

    }

    public void changeDTPos(boolean state, int side) {
         if (state) {
            if (side == LEFT) {
                this.DTShifter1.enqueueCommand(new Command(DTShifter1.ON));
            } else {
                this.DTShifter2.enqueueCommand(new Command(DTShifter2.ON));
            }
        } else {
            if (side == LEFT) {
                this.DTShifter1.enqueueCommand(new Command(DTShifter1.OFF));
            } else {
                this.DTShifter2.enqueueCommand(new Command(DTShifter2.OFF));
            }
        }
    }
View Full Code Here

        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

                                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

TOP

Related Classes of com.grt192.event.component.GyroEvent

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.