edu.wpi.first.wpilibj.AnalogGyro的实例源码

项目:FRC2549-2016    文件DrivetrainSubsystem.java   
public DrivetrainSubsystem(){
    leftMotor = RobotMap.leftDriveMotor.getController();
    rightMotor = RobotMap.rightDriveMotor.getController();
    drive = new RobotDrive(leftMotor,rightMotor);

    accelerometer = new IntegratedBuiltinAccelerometer(Range.k2G);

    leftEncoder = new Encoder(RobotMap.leftEncoder[0],RobotMap.leftEncoder[1]);
    rightEncoder = new Encoder(RobotMap.rightEncoder[0],RobotMap.rightEncoder[1]);
    leftEncoder.setReverseDirection(true);
    rightEncoder.setReverseDirection(true);

    driveGyro = new AnalogGyro(RobotMap.driveGyroPort);
    driveGyro.reset();
    driveGyro.setSensitivity(0.007);


}
项目:snobot-2017    文件Snobot.java   
/**
 * This function is run when the robot is first started up and should be
 * used for any initialization code.
 */
public void robotinit()
{
    // PWM's
    mTestMotor1 = new Talon(0);
    mTestMotor2 = new Jaguar(1);
    mServo = new Servo(2);

    // Digital IO
    mDigitalOutput = new DigitalOutput(0);
    mRightEncoder = new Encoder(4,5);
    mLeftEncoder = new Encoder(1,2);
    mUltrasonic = new Ultrasonic(7,6);

    // Analog IO
    mAnalogGryo = new AnalogGyro(0);
    mPotentiometer = new AnalogPotentiometer(1);

    // Solenoid
    mSolenoid = new Solenoid(0);

    // Relay
    mRelay = new Relay(0);

    // Joysticks
    mJoystick1 = new Joystick(0);
    mJoystick2 = new XBoxController(1);

    // SPI
    mSpiGryo = new ADXRS450_Gyro();

    // Utilities
    mTimer = new Timer();
    mPDP = new PowerdistributionPanel();

    Preferences.getInstance().putDouble("Motor One Speed",.5);
}
项目:Stronghold2016-340    文件Drive.java   
/**
 * Code for driving robot
 */
public Drive() {
    leftDrive = new Talon(RobotMap.LEFT_DRIVE_TALON);
    rightDrive = new Talon(RobotMap.RIGHT_DRIVE_TALON);
    PTOMotor = new Servo(RobotMap.DRIVE_PTO);
    gyro = new AnalogGyro(0);
}
项目:liastem    文件Robot.java   
public Robot() {
    //make objects for drive train,joystick,and gyro
    myRobot = new RobotDrive(new CANTalon(leftMotorChannel),new CANTalon(leftRearMotorChannel),new CANTalon(rightMotorChannel),new CANTalon(rightRearMotorChannel));
    myRobot.setInvertedMotor(MotorType.kFrontLeft,true); // invert the left side motors
    myRobot.setInvertedMotor(MotorType.kRearLeft,true); // you may need to change or remove this to match your robot

    joystick = new Joystick(0);
    gyro = new AnalogGyro(gyroChannel);
}
项目:liastem    文件Robot.java   
public Robot()
{
    //make objects for the drive train,gyro,and joystick
    myRobot = new RobotDrive(new CANTalon(leftMotorChannel),new CANTalon(
      leftRearMotorChannel),new CANTalon(rightRearMotorChannel));
    gyro = new AnalogGyro(gyroChannel);
    joystick = new Joystick(joystickChannel);
}
项目:FRC-2017    文件GyroSensor.java   
public static void initialize()
{
    if (!initialized) {

        myGyro = new AnalogGyro(GYRO_CHANNEL);
        myGyro.setSensitivity(GYRO_SENSITIVITY);

        myGyro.calibrate();

        initialized = true;
    }
}
项目:FRC2549-2016    文件ShooterSubsystem.java   
public ShooterSubsystem(){
    liftController=RobotMap.liftMotor.getController();
    wheelController=RobotMap.wheelMotor.getController();

    liftGyro = new AnalogGyro(RobotMap.liftGyroPort);
    liftGyro.reset();
    liftGyro.setSensitivity(0.007);

    limitSwitch = new DigitalInput(RobotMap.limitSwitch);
}
项目:turtleshell    文件DriveTrain.java   
public DriveTrain() {
    super();
    front_left_motor = new Talon(1);
    back_left_motor = new Talon(2);
    front_right_motor = new Talon(3);
    back_right_motor = new Talon(4);
    drive = new RobotDrive(front_left_motor,back_left_motor,front_right_motor,back_right_motor);
    left_encoder = new Encoder(1,2);
    right_encoder = new Encoder(3,4);

    // Encoders may measure differently in the real world and in
    // simulation. In this example the robot moves 0.042 barleycorns
    // per tick in the real world,but the simulated encoders
    // simulate 360 tick encoders. This if statement allows for the
    // real robot to handle this difference in devices.
    if (Robot.isReal()) {
        left_encoder.setdistancePerpulse(0.042);
        right_encoder.setdistancePerpulse(0.042);
    } else {
        // Circumference in ft = 4in/12(in/ft)*PI
        left_encoder.setdistancePerpulse((4.0/12.0*Math.PI) / 360.0);
        right_encoder.setdistancePerpulse((4.0/12.0*Math.PI) / 360.0);
    }

    rangefinder = new AnalogInput(6);
    gyro = new AnalogGyro(1);

    // Let's show everything on the LiveWindow
    LiveWindow.addActuator("Drive Train","Front_Left Motor",(Talon) front_left_motor);
    LiveWindow.addActuator("Drive Train","Back Left Motor",(Talon) back_left_motor);
    LiveWindow.addActuator("Drive Train","Front Right Motor",(Talon) front_right_motor);
    LiveWindow.addActuator("Drive Train","Back Right Motor",(Talon) back_right_motor);
    LiveWindow.addSensor("Drive Train","Left Encoder",left_encoder);
    LiveWindow.addSensor("Drive Train","Right Encoder",right_encoder);
    LiveWindow.addSensor("Drive Train","Rangefinder",rangefinder);
    LiveWindow.addSensor("Drive Train","Gyro",gyro);
}
项目:2017TestBench    文件RobotMap.java   
public static void init() {
    // BEGIN AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    motorsVictor0 = new VictorSP(0);
    LiveWindow.addActuator("Motors","Victor0",(VictorSP) motorsVictor0);

    motorsVictor1 = new VictorSP(1);
    LiveWindow.addActuator("Motors","Victor1",(VictorSP) motorsVictor1);


    LiveWindow.addActuator("Motors","TalonSRX",(CANTalon) motorsCANTalon);

    electricalPowerdistributionPanel1 = new PowerdistributionPanel(0);
    LiveWindow.addSensor("Electrical","PowerdistributionPanel 1",electricalPowerdistributionPanel1);

    sensorsAnalogGyro1 = new AnalogGyro(0);
    LiveWindow.addSensor("Sensors","AnalogGyro 1",sensorsAnalogGyro1);
    sensorsAnalogGyro1.setSensitivity(0.007);


    // END AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
项目:Stronghold2016-340    文件Drive.java   
public Drive() {
    leftDrive = new TalonSRX(RobotMap.DriveLeftMotor);
    rightDrive = new TalonSRX(RobotMap.DriveRightMotor);

    gyro = new AnalogGyro(RobotMap.DriveGyro);
}
项目:frc-2015    文件Drive.java   
public Drive() {

        // SPEED CONTROLLER PORTS
        frontLeftTalon = new Talon(RobotMap.Pwm.FrontLeftDrive);
        rearLeftTalon = new Talon(RobotMap.Pwm.RearLeftDrive);
        frontRightTalon = new Talon(RobotMap.Pwm.FrontRightDrive);
        rearRightTalon = new Talon(RobotMap.Pwm.RearRightDrive);

        // ULTRASONIC SENSORS
        leftAngleIR = new AnalogInput(RobotMap.Analog.LeftAngleIR);
        rightAngleIR = new AnalogInput(RobotMap.Analog.RightAngleIR);

        leftCenterIR = new AnalogInput(RobotMap.Analog.LeftCenterIR);
        rightCenterIR = new AnalogInput(RobotMap.Analog.RightCenterIR);

        // YAWRATE SENSOR
        gyro = new AnalogGyro(RobotMap.Analog.Gryo);

        // ENCODER PORTS
        frontLeftEncoder = new Encoder(RobotMap.Encoders.FrontLeftDriveA,RobotMap.Encoders.FrontLeftDriveB);
        rearLeftEncoder = new Encoder(RobotMap.Encoders.RearLeftDriveA,RobotMap.Encoders.RearLeftDriveB);
        frontRightEncoder = new Encoder(RobotMap.Encoders.FrontRightDriveA,RobotMap.Encoders.FrontRightDriveB);
        rearRightEncoder = new Encoder(RobotMap.Encoders.RearRightDriveA,RobotMap.Encoders.RearRightDriveB);

        // ENCODER MATH
        frontLeftEncoder.setdistancePerpulse(distancePerpulse);
        frontLeftEncoder.setPIDSourceType(PIDSourceType.kRate);
        frontRightEncoder.setdistancePerpulse(distancePerpulse);
        frontRightEncoder.setPIDSourceType(PIDSourceType.kRate);
        rearLeftEncoder.setdistancePerpulse(distancePerpulse);
        rearLeftEncoder.setPIDSourceType(PIDSourceType.kRate);
        rearRightEncoder.setdistancePerpulse(distancePerpulse);
        rearRightEncoder.setPIDSourceType(PIDSourceType.kRate);

        // PID SPEED CONTROLLERS
        frontLeftPID = new PIDSpeedController(frontLeftEncoder,frontLeftTalon,"Drive","Front Left");
        frontRightPID = new PIDSpeedController(frontRightEncoder,frontRightTalon,"Front Right");
        rearLeftPID = new PIDSpeedController(rearLeftEncoder,rearLeftTalon,"Rear Left");
        rearRightPID = new PIDSpeedController(rearRightEncoder,rearRightTalon,"Rear Right");

        // DRIVE DECLaraTION
        robotDrive = new RobotDrive(frontLeftPID,rearLeftPID,frontRightPID,rearRightPID);
        robotDrive.setExpiration(0.1);

        // MOTOR INVERSIONS
        robotDrive.setInvertedMotor(MotorType.kFrontRight,true);
        robotDrive.setInvertedMotor(MotorType.kRearRight,true);

        LiveWindow.addActuator("Drive","Front Left Talon",frontLeftTalon);
        LiveWindow.addActuator("Drive","Front Right Talon",frontRightTalon);
        LiveWindow.addActuator("Drive","Rear Left Talon",rearLeftTalon);
        LiveWindow.addActuator("Drive","Rear Right Talon",rearRightTalon);

        LiveWindow.addSensor("Drive Encoders","Front Left Encoder",frontLeftEncoder);
        LiveWindow.addSensor("Drive Encoders","Front Right Encoder",frontRightEncoder);
        LiveWindow.addSensor("Drive Encoders","Rear Left Encoder",rearLeftEncoder);
        LiveWindow.addSensor("Drive Encoders","Rear Right Encoder",rearRightEncoder);
    }
项目:FRC2015    文件GyroSystem.java   
@Override
public void init(Environment environment) {
    gyro = new AnalogGyro(RobotMap.GYRO);
    gyro.initGyro();
}
项目:turtleshell    文件TurtleAnalogGyro.java   
public TurtleAnalogGyro(int port) {
    g = new AnalogGyro(port);
}
项目:turtleshell    文件TurtleAnalogGyro.java   
public TurtleAnalogGyro(int port) {
    gyro = new AnalogGyro(port);
}
项目:atalibj    文件gyroscopeModule.java   
/**
 * Constructs the module with the gyro object underneath this class to call
 * methods from.
 *
 * @throws NullPointerException when gyro is null
 * @param gyro the composing instance which will return values
 */
protected gyroscopeModule(AnalogGyro gyro) {
    if (gyro == null) {
        throw new NullPointerException("Null gyro given");
    }
    this.gyro = gyro;
}
项目:strongback-java    文件Hardware.java   
/**
 * Create a {@link gyroscope} that uses a WPILib {@link AnalogGyro} on the specified channel.
 *
 * @param channel the channel the gyroscope is plugged into
 * @return the gyroscope; never null
 */
public static gyroscope gyroscope(int channel) {
    return gyroscope(new AnalogGyro(channel));
}
项目:atalibj    文件gyroscopeModule.java   
/**
 * Constructs the module with the port on the analog sidecar.
 *
 * @param channel port on sidecar
 */
public gyroscopeModule(int channel) {
    this(new AnalogGyro(channel));
}
项目:atalibj    文件gyroscopeModule.java   
/**
 * Constructs the module with the channel of the gyroscope.
 *
 * @param channel analog channel to find gyro on
 */
public gyroscopeModule(AnalogInput channel) {
    this(new AnalogGyro(channel));
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...