当前位置: 首页>>代码示例>>Java>>正文


Java AnalogGyro类代码示例

本文整理汇总了Java中edu.wpi.first.wpilibj.AnalogGyro的典型用法代码示例。如果您正苦于以下问题:Java AnalogGyro类的具体用法?Java AnalogGyro怎么用?Java AnalogGyro使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AnalogGyro类属于edu.wpi.first.wpilibj包,在下文中一共展示了AnalogGyro类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DrivetrainSubsystem

import edu.wpi.first.wpilibj.AnalogGyro; //导入依赖的package包/类
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);
	
	
}
 
开发者ID:Millerbots,项目名称:FRC2549-2016,代码行数:19,代码来源:DrivetrainSubsystem.java

示例2: robotInit

import edu.wpi.first.wpilibj.AnalogGyro; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:ArcticWarriors,项目名称:snobot-2017,代码行数:41,代码来源:Snobot.java

示例3: Drive

import edu.wpi.first.wpilibj.AnalogGyro; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:CraftSpider,项目名称:Stronghold2016-340,代码行数:10,代码来源:Drive.java

示例4: Robot

import edu.wpi.first.wpilibj.AnalogGyro; //导入依赖的package包/类
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);
}
 
开发者ID:wjaneal,项目名称:liastem,代码行数:11,代码来源:Robot.java

示例5: Robot

import edu.wpi.first.wpilibj.AnalogGyro; //导入依赖的package包/类
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);
}
 
开发者ID:wjaneal,项目名称:liastem,代码行数:10,代码来源:Robot.java

示例6: initialize

import edu.wpi.first.wpilibj.AnalogGyro; //导入依赖的package包/类
public static void initialize()
{
	if (!initialized) {
		
        myGyro = new AnalogGyro(GYRO_CHANNEL);
        myGyro.setSensitivity(GYRO_SENSITIVITY);
        
        myGyro.calibrate();

		initialized = true;
	}
}
 
开发者ID:MTHSRoboticsClub,项目名称:FRC-2017,代码行数:13,代码来源:GyroSensor.java

示例7: ShooterSubsystem

import edu.wpi.first.wpilibj.AnalogGyro; //导入依赖的package包/类
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);
}
 
开发者ID:Millerbots,项目名称:FRC2549-2016,代码行数:11,代码来源:ShooterSubsystem.java

示例8: DriveTrain

import edu.wpi.first.wpilibj.AnalogGyro; //导入依赖的package包/类
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);
}
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:39,代码来源:DriveTrain.java

示例9: init

import edu.wpi.first.wpilibj.AnalogGyro; //导入依赖的package包/类
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
}
 
开发者ID:alpal23,项目名称:2017TestBench,代码行数:22,代码来源:RobotMap.java

示例10: Drive

import edu.wpi.first.wpilibj.AnalogGyro; //导入依赖的package包/类
public Drive() {
	leftDrive = new TalonSRX(RobotMap.DriveLeftMotor);
	rightDrive = new TalonSRX(RobotMap.DriveRightMotor);
	
	gyro = new AnalogGyro(RobotMap.DriveGyro);
}
 
开发者ID:CraftSpider,项目名称:Stronghold2016-340,代码行数:7,代码来源:Drive.java

示例11: Drive

import edu.wpi.first.wpilibj.AnalogGyro; //导入依赖的package包/类
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);
	}
 
开发者ID:chopshop-166,项目名称:frc-2015,代码行数:59,代码来源:Drive.java

示例12: init

import edu.wpi.first.wpilibj.AnalogGyro; //导入依赖的package包/类
@Override
public void init(Environment environment) {
	gyro = new AnalogGyro(RobotMap.GYRO);
	gyro.initGyro();
}
 
开发者ID:Impact2585,项目名称:FRC2015,代码行数:6,代码来源:GyroSystem.java

示例13: TurtleAnalogGyro

import edu.wpi.first.wpilibj.AnalogGyro; //导入依赖的package包/类
public TurtleAnalogGyro(int port) {
	g = new AnalogGyro(port);
}
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:4,代码来源:TurtleAnalogGyro.java

示例14: TurtleAnalogGyro

import edu.wpi.first.wpilibj.AnalogGyro; //导入依赖的package包/类
public TurtleAnalogGyro(int port) {
	gyro = new AnalogGyro(port);
}
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:4,代码来源:TurtleAnalogGyro.java

示例15: GyroscopeModule

import edu.wpi.first.wpilibj.AnalogGyro; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:Team4334,项目名称:atalibj,代码行数:14,代码来源:GyroscopeModule.java


注:本文中的edu.wpi.first.wpilibj.AnalogGyro类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。