Java 类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(rightMotorChannel),
      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, "Drive", "Front Right");
        rearLeftPID = new PIDSpeedController(rearLeftEncoder, rearLeftTalon, "Drive", "Rear Left");
        rearRightPID = new PIDSpeedController(rearRightEncoder, rearRightTalon, "Drive", "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));
}