Java 类edu.wpi.first.wpilibj.BuiltInAccelerometer 实例源码

项目:2015-frc-robot    文件:SensorInput.java   
/**
 * Instantiates the Sensor Input module to read all sensors connected to the roboRIO.
 */
private SensorInput() { 
    limit_left = new DigitalInput(ChiliConstants.left_limit);
    limit_right = new DigitalInput(ChiliConstants.right_limit);
    accel = new BuiltInAccelerometer(Accelerometer.Range.k2G);
    gyro = new Gyro(ChiliConstants.gyro_channel);
    pdp = new PowerDistributionPanel();
    left_encoder = new Encoder(ChiliConstants.left_encoder_channelA, ChiliConstants.left_encoder_channelB, false);
    right_encoder = new Encoder(ChiliConstants.right_encoder_channelA, ChiliConstants.right_encoder_channelB, true);
    gyro_i2c = new GyroITG3200(I2C.Port.kOnboard);

    gyro_i2c.initialize();
    gyro_i2c.reset();
    gyro.initGyro();

    left_encoder.setDistancePerPulse(ChiliConstants.kDistancePerPulse);
    right_encoder.setDistancePerPulse(ChiliConstants.kDistancePerPulse);
}
项目:Frc2017FirstSteamWorks    文件:Winch.java   
public Winch()
{
    mainMotor = new FrcCANTalon("WinchMaster", RobotInfo.CANID_WINCH_MASTER);
    slaveMotor = new FrcCANTalon("WinchSlave", RobotInfo.CANID_WINCH_SLAVE);
    slaveMotor.motor.changeControlMode(TalonControlMode.Follower);
    slaveMotor.motor.set(RobotInfo.CANID_WINCH_MASTER);
    mainMotor.setPositionSensorInverted(false);
    zAccel = new BuiltInAccelerometer();
    zAccelFilter = new TrcKalmanFilter("ZAccel");
}
项目:FRC-2015-Robot-Java    文件:RobotHardwareWoodbot.java   
public void initialize() 
{
    rearLeftMotor = new Jaguar(0);
    frontLeftMotor = new Jaguar(1);
    liftMotor = new Jaguar(2);
    liftMotor2 = new Jaguar(3);
    liftEncoder = new Encoder(6, 7, false, EncodingType.k4X);

    drivetrain = new RobotDrive(rearLeftMotor, frontLeftMotor); 

    drivetrain.setInvertedMotor(MotorType.kFrontLeft, true);
    drivetrain.setInvertedMotor(MotorType.kFrontRight, true);

    halsensor = new DigitalInput(0);

    horizontalCamera = new Servo(8);
    verticalCamera = new Servo(9);

    solenoid = new DoubleSolenoid(0,1);

    gyro = new Gyro(1);
    accelerometer = new BuiltInAccelerometer();

    liftEncoder.reset();

    RobotHardwareWoodbot hardware = (RobotHardwareWoodbot)Robot.bot;

    LiveWindow.addActuator("Drive Train", "Front Left Motor", (Jaguar)hardware.frontLeftMotor);
    LiveWindow.addActuator("Drive Train", "Back Left Motor", (Jaguar)hardware.rearLeftMotor);
    //LiveWindow.addActuator("Drive Train", "Front Right Motor", (Jaguar)hardware.frontRightMotor);
    //LiveWindow.addActuator("Drive Train", "Back Right Motor", (Jaguar)hardware.rearRightMotor);
}
项目:FRC-2015-Robot-Java    文件:RobotHardwareCompbot.java   
@Override
public void initialize()

{
    //PWM
    liftMotor = new Victor(0); //2);
    leftMotors = new Victor(1);
    rightMotors = new Victor(2); //0);
    armMotors = new Victor(3);
    transmission = new Servo(7);

    //CAN
    armSolenoid = new DoubleSolenoid(4,5);

    //DIO
    liftEncoder = new Encoder(0, 1, false, EncodingType.k4X);
    liftBottomLimit = new DigitalInput(2);
    liftTopLimit = new DigitalInput(3);
    backupLiftBottomLimit = new DigitalInput(5);

    switch1 = new DigitalInput(9);
    switch2 = new DigitalInput(8);

    //ANALOG
    gyro = new Gyro(0);

    //roboRio
    accelerometer = new BuiltInAccelerometer();

    //Stuff
    drivetrain = new RobotDrive(leftMotors, rightMotors);

    liftSpeedRatio = 1; //Half power default
    liftGear = 1;
    driverSpeedRatio = 1;
    debounceComp = 0;

    drivetrain.setInvertedMotor(MotorType.kRearLeft, true);
    drivetrain.setInvertedMotor(MotorType.kRearRight, true);
}
项目:FRC-2015-Robot-Java    文件:RobotHardwarePracticebot.java   
@Override
public void initialize()
{
    //PWM
    liftMotor = new Talon(0); //2);
    leftMotors = new Talon(1);
    rightMotors = new Talon(2); //0);
    armMotors = new Talon(3);
    transmission = new Servo(7);

    //CAN
    armSolenoid = new DoubleSolenoid(4,5);

    //DIO
    /*liftEncoder = new Encoder(0, 1, false, EncodingType.k4X);
    liftBottomLimit = new DigitalInput(2);
    liftTopLimit = new DigitalInput(3);
    backupLiftBottomLimit = new DigitalInput(4);

    switch1 = new DigitalInput(9);
    switch2 = new DigitalInput(8);*/

    //ANALOG
    gyro = new Gyro(0);

    //roboRio
    accelerometer = new BuiltInAccelerometer();

    //Stuff
    drivetrain = new RobotDrive(leftMotors, rightMotors);

    liftSpeedRatio = 1; //Half power default
    liftGear = 1;
    driverSpeedRatio = 1;
    debounceComp = 0;

    drivetrain.setInvertedMotor(MotorType.kRearLeft, true);
    drivetrain.setInvertedMotor(MotorType.kRearRight, true);
}
项目:FRC2015    文件:AccelerometerSystem.java   
@Override
public void init(Environment environment) {
    accelerometer = new BuiltInAccelerometer();
}
项目:turtleshell    文件:TurtleOnboardAccelerometer.java   
public TurtleOnboardAccelerometer() {
    acc = new BuiltInAccelerometer();
    cal = new TurtleSmartAccelerometerCalibration(0,0);
}
项目:2015RobotCode    文件:SensorTrack.java   
@Override
public void initialize() {

    //m_sensor = new AnalogInput(RobotMap.SENSOR_ANALOG_PORT);
    m_accel = new BuiltInAccelerometer();

}
项目:robot15    文件:RobotMap.java   
public static void init() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    driveTraingyro = new Gyro(0);
    LiveWindow.addSensor("DriveTrain", "gyro", driveTraingyro);
    driveTraingyro.setSensitivity(0.007);
    driveTraindriveFrontRight = new CANTalon(8);


    driveTraindriveBackLeft = new CANTalon(2);


    driveTraindriveBackRight = new CANTalon(9);


    driveTraindriveFrontLeft = new CANTalon(3);


    rangeFinderultrasonic = new AnalogInput(2);
    LiveWindow.addSensor("RangeFinder", "ultrasonic", rangeFinderultrasonic);

    collectorWheelstoteCollectorLeftTalon = new CANTalon(4);


    collectorWheelstoteCollectorRightTalon = new CANTalon(7);


    elevatorelevatorSecondStageSolenoid = new Solenoid(1, 5);
    LiveWindow.addActuator("Elevator", "elevatorSecondStageSolenoid", elevatorelevatorSecondStageSolenoid);

    elevatorelevatorFirstStageSolenoid = new Solenoid(1, 4);
    LiveWindow.addActuator("Elevator", "elevatorFirstStageSolenoid", elevatorelevatorFirstStageSolenoid);

    elevatorelevatorMagBottom = new DigitalInput(0);
    LiveWindow.addSensor("Elevator", "elevatorMagBottom", elevatorelevatorMagBottom);

    elevatorelevatorMagLow = new DigitalInput(3);
    LiveWindow.addSensor("Elevator", "elevatorMagLow", elevatorelevatorMagLow);

    elevatorelevatorMagMed = new DigitalInput(4);
    LiveWindow.addSensor("Elevator", "elevatorMagMed", elevatorelevatorMagMed);

    elevatorelevatorMagHigh = new DigitalInput(5);
    LiveWindow.addSensor("Elevator", "elevatorMagHigh", elevatorelevatorMagHigh);

    elevatorirSensor = new AnalogInput(1);
    LiveWindow.addSensor("Elevator", "irSensor", elevatorirSensor);

    elevatorlimitSwitch = new DigitalInput(2);
    LiveWindow.addSensor("Elevator", "limitSwitch", elevatorlimitSwitch);

    elevatorelevatorStackHolderSolenoid = new Solenoid(1, 1);
    LiveWindow.addActuator("Elevator", "elevatorStackHolderSolenoid", elevatorelevatorStackHolderSolenoid);

    elevatorelevatorRollerTalon = new CANTalon(6);


    binCollectorbinCollectorTalon = new CANTalon(5);


    binCollectorbinCollectorSolenoid = new Solenoid(1, 2);
    LiveWindow.addActuator("BinCollector", "binCollectorSolenoid", binCollectorbinCollectorSolenoid);

    collectorWriststoteCollectorSolenoid = new Solenoid(1, 0);
    LiveWindow.addActuator("CollectorWrists", "toteCollectorSolenoid", collectorWriststoteCollectorSolenoid);


// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS

driveTrainaccelerometer = new BuiltInAccelerometer();    

}
项目:strongback-java    文件:Hardware.java   
/**
 * Create a new {@link ThreeAxisAccelerometer} using the RoboRIO's built-in accelerometer.
 *
 * @return the accelerometer; never null
 */
public static ThreeAxisAccelerometer builtIn() {
    BuiltInAccelerometer accel = new BuiltInAccelerometer();
    return ThreeAxisAccelerometer.create(accel::getX, accel::getY, accel::getZ);
}