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


Java AHRS类代码示例

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


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

示例1: NavX

import com.kauailabs.navx.frc.AHRS; //导入依赖的package包/类
public NavX() {
	try {
	/***********************************************************************
	 * navX-MXP: 
	 * - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.            
	 * - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
	 * 
	 * navX-Micro:
	 * - Communication via I2C (RoboRIO MXP or Onboard) and USB.
	 * - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
	 * 
	 * Multiple navX-model devices on a single robot are supported.
	 ************************************************************************/

		ahrs = new AHRS(SerialPort.Port.kUSB);
	} catch (RuntimeException ex ) {
		DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
	}

}
 
开发者ID:FRC2832,项目名称:Robot_2017,代码行数:21,代码来源:NavX.java

示例2: HardwareAdaptor

import com.kauailabs.navx.frc.AHRS; //导入依赖的package包/类
private HardwareAdaptor(){
	pdp = new PowerDistributionPanel();
	comp = new Compressor();
	shifter = new DoubleSolenoid(SolenoidMap.SHIFTER_FORWARD, SolenoidMap.SHIFTER_REVERSE);
	
	navx = new AHRS(CoprocessorMap.NAVX_PORT);
	
	dtLeftEncoder = new Encoder(EncoderMap.DT_LEFT_A, EncoderMap.DT_LEFT_B, EncoderMap.DT_LEFT_INVERTED);
	S_DTLeft.linkEncoder(dtLeftEncoder);
	dtRightEncoder = new Encoder(EncoderMap.DT_RIGHT_A, EncoderMap.DT_RIGHT_B, EncoderMap.DT_RIGHT_INVERTED);
	S_DTRight.linkEncoder(dtRightEncoder);
	
	dtLeft = S_DTLeft.getInstance();
	dtRight = S_DTRight.getInstance();
	S_DTWhole.linkDTSides(dtLeft, dtRight);
	dtWhole = S_DTWhole.getInstance();
	
	arduino = S_Arduino.getInstance();
}
 
开发者ID:taco650,项目名称:MinuteMan,代码行数:20,代码来源:HardwareAdaptor.java

示例3: NavX

import com.kauailabs.navx.frc.AHRS; //导入依赖的package包/类
public NavX() {
     try {
/***********************************************************************
 * navX-MXP:
 * - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.            
 * - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
 * 
 * navX-Micro:
 * - Communication via I2C (RoboRIO MXP or Onboard) and USB.
 * - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
 * 
 * Multiple navX-model devices on a single robot are supported.
 ************************************************************************/
         ahrs = new AHRS(SPI.Port.kMXP); // Use SPI!!!
         //ahrs = new AHRS(I2C.Port.kMXP);
     } catch (RuntimeException ex ) {
         DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
     }
 }
 
开发者ID:cyborgs3335,项目名称:STEAMworks,代码行数:20,代码来源:NavX.java

示例4: IMU

import com.kauailabs.navx.frc.AHRS; //导入依赖的package包/类
public IMU() {
 	try {
/***********************************************************************
 * navX-MXP:
 * - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.            
 * - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
 * 
 * navX-Micro:
 * - Communication via I2C (RoboRIO MXP or Onboard) and USB.
 * - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
 * 
 * Multiple navX-model devices on a single robot are supported.
 ************************************************************************/
         ahrs = new AHRS(SPI.Port.kMXP);
     } catch (RuntimeException ex ) {
         DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
     }
 }
 
开发者ID:frc2879,项目名称:2017-newcomen,代码行数:19,代码来源:IMU.java

示例5: initHardware

import com.kauailabs.navx.frc.AHRS; //导入依赖的package包/类
/**
 * Initialize all hardware
 */
void initHardware() {
	Logger.getInstance().logRobotThread("Init hardware");
	configureTalons(true);
	AHRS gyro = HardwareAdapter.getInstance().getDrivetrain().gyro;
	if (gyro != null) {
		int i = 0;
		while (!gyro.isConnected()) {
			i++;
			if (i > 1000) {
				System.out.println("waited for gyro to connect, didn't find");
				break;
			}
		}
	}
	gyro.zeroYaw();
}
 
开发者ID:team8,项目名称:FRC-2017-Public,代码行数:20,代码来源:HardwareUpdater.java

示例6: SpatialAwarenessSubsystem

import com.kauailabs.navx.frc.AHRS; //导入依赖的package包/类
public SpatialAwarenessSubsystem() {
  super("SpatialAwarenessSubsystem");

  cameraServer = CameraServer.getInstance();
  gearCamera = cameraServer.startAutomaticCapture(0);
  gearCamera.setResolution(IMG_WIDTH, IMG_HEIGHT);
  gearCamera.setFPS(30);
  gearCamera.setBrightness(7);
  gearCamera.setExposureManual(30);
  gearVideo = cameraServer.getVideo(gearCamera);

  visionProcessing = new VisionProcessing();

  leftUltrasonic = new AnalogInput(RobotMap.ANALOG_ULTRASONIC_LEFT);
  rightUltrasonic = new AnalogInput(RobotMap.ANALOG_ULTRASONIC_RIGHT);

  leftUltrasonicKalman = new SimpleKalman(1.4d, 64d, leftUltrasonic.getAverageVoltage() * ULTRASONIC_VOLTS_TO_METERS);
  rightUltrasonicKalman = new SimpleKalman(1.4d, 64d, rightUltrasonic.getAverageVoltage() * ULTRASONIC_VOLTS_TO_METERS);

  navX = new AHRS(SPI.Port.kMXP);

  System.out.println("SpatialAwarenessSubsystem constructor finished");
}
 
开发者ID:FRC-1294,项目名称:frc2017,代码行数:24,代码来源:SpatialAwarenessSubsystem.java

示例7: DriveSubsystem

import com.kauailabs.navx.frc.AHRS; //导入依赖的package包/类
public DriveSubsystem() {
	talonFrontLeft = new CANTalon(Ports.FRONT_LEFT_MOTOR);
	talonFrontRight = new CANTalon(Ports.FRONT_RIGHT_MOTOR);
	talonBackLeft = new Talon(Ports.BACK_LEFT_MOTOR);
	talonBackRight = new Talon(Ports.BACK_RIGHT_MOTOR);
	ultraSanic.setAutomaticMode(true);
	
	talonFrontLeft.setFeedbackDevice(FeedbackDevice.QuadEncoder);
	talonFrontRight.setFeedbackDevice(FeedbackDevice.QuadEncoder);
	talonFrontLeft.configEncoderCodesPerRev(PulsesPerRevolution);
	talonFrontRight.configEncoderCodesPerRev(PulsesPerRevolution);

	try {
		ahrs = new AHRS(Port.kMXP);
	} catch (Exception ex) {
		//System.out.println(ex);
	}
	// SPEED MODE CODE
	// setDriveControlMode(TalonControlMode.Speed);
	drivingStraight = false;
	driveLowerSpeed = false;
	reversed = true;
	enableForwardSoftLimit(false);
	enableReverseSoftLimit(false);
}
 
开发者ID:Team2537,项目名称:Cogsworth,代码行数:26,代码来源:DriveSubsystem.java

示例8: initialize

import com.kauailabs.navx.frc.AHRS; //导入依赖的package包/类
public static void initialize()
{
	if (!initialized) {
			
		System.out.println("NavXSensor::initialize() called...");
		
		try {
			ahrs = new AHRS(SPI.Port.kMXP);     
		} catch (RuntimeException ex ) {
            DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
        }

		reset();
		
		initialized = true;
	}
}
 
开发者ID:MTHSRoboticsClub,项目名称:FRC-2017,代码行数:18,代码来源:NavXSensor.java

示例9: Robot

import com.kauailabs.navx.frc.AHRS; //导入依赖的package包/类
public Robot() {
     myRobot = new RobotDrive(0, 1);
     myRobot.setExpiration(0.1);
     stick = new Joystick(0);
     try {
/***********************************************************************
 * navX-MXP:
 * - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.            
 * - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
 * 
 * navX-Micro:
 * - Communication via I2C (RoboRIO MXP or Onboard) and USB.
 * - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
 * 
 * Multiple navX-model devices on a single robot are supported.
 ************************************************************************/
         ahrs = new AHRS(SPI.Port.kMXP); 
     } catch (RuntimeException ex ) {
         DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
     }
 }
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:22,代码来源:Robot.java

示例10: Robot

import com.kauailabs.navx.frc.AHRS; //导入依赖的package包/类
public Robot() {
     myRobot = new RobotDrive(frontLeftChannel, rearLeftChannel,
     		frontRightChannel, rearRightChannel);
     myRobot.setExpiration(0.1);
     stick = new Joystick(0);
     try {
/***********************************************************************
 * navX-MXP:
 * - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.            
 * - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
 * 
 * navX-Micro:
 * - Communication via I2C (RoboRIO MXP or Onboard) and USB.
 * - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
 * 
 * Multiple navX-model devices on a single robot are supported.
 ************************************************************************/
         ahrs = new AHRS(SPI.Port.kMXP); 
     } catch (RuntimeException ex ) {
         DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
     }
 }
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:23,代码来源:Robot.java

示例11: Robot

import com.kauailabs.navx.frc.AHRS; //导入依赖的package包/类
public Robot() {
    myRobot = new RobotDrive(frontLeftChannel, rearLeftChannel,
    		frontRightChannel, rearRightChannel);
    myRobot.setExpiration(0.1);
    stick = new Joystick(0);
    try {
/***********************************************************************
 * navX-MXP:
 * - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.            
 * - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
 * 
 * navX-Micro:
 * - Communication via I2C (RoboRIO MXP or Onboard) and USB.
 * - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
 * 
 * Multiple navX-model devices on a single robot are supported.
 ************************************************************************/
  	  ahrs = new AHRS(SPI.Port.kMXP); 
    } catch (RuntimeException ex ) {
        DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
    }
}
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:23,代码来源:Robot.java

示例12: Robot

import com.kauailabs.navx.frc.AHRS; //导入依赖的package包/类
public Robot() {
    myRobot = new RobotDrive(frontLeftChannel, rearLeftChannel, 
		 frontRightChannel, rearRightChannel);
    myRobot.setExpiration(0.1);
    stick = new Joystick(0);
    try {
/***********************************************************************
 * navX-MXP:
 * - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.            
 * - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
 * 
 * navX-Micro:
 * - Communication via I2C (RoboRIO MXP or Onboard) and USB.
 * - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
 * 
 * Multiple navX-model devices on a single robot are supported.
 ************************************************************************/
        ahrs = new AHRS(SPI.Port.kMXP); 
    } catch (RuntimeException ex ) {
        DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
    }
}
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:23,代码来源:Robot.java

示例13: Robot

import com.kauailabs.navx.frc.AHRS; //导入依赖的package包/类
public Robot() {
     stick = new Joystick(0);
     try {
/***********************************************************************
 * navX-MXP:
 * - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.            
 * - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
 * 
 * navX-Micro:
 * - Communication via I2C (RoboRIO MXP or Onboard) and USB.
 * - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
 * 
 * Multiple navX-model devices on a single robot are supported.
 ************************************************************************/
         ahrs = new AHRS(SPI.Port.kMXP);
     } catch (RuntimeException ex ) {
         DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
     }
 }
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:20,代码来源:Robot.java

示例14: robotInit

import com.kauailabs.navx.frc.AHRS; //导入依赖的package包/类
/**
 * This function is run when the robot is first started up and should be
 * used for any initialization code.
 */
public void robotInit()
{
    logFile = new File("/home/lvuser/log.txt");
    FileWriter fileWriter = null;
    try
    {
        logFile.createNewFile();
        fileWriter = new FileWriter(logFile);
    }
    catch(IOException e) { e.printStackTrace(); }
    LOG_OUTPUT = new PrintWriter(fileWriter == null ? new OutputStreamWriter(System.out) : fileWriter, true);

    Robot.write("tester");
    // System.out.println("writing tester");

    Log.createLogger(true);
    DRIVE_TRAIN = new DriveTrainSubsystem();
    CLIMBER = new ClimberSubsystem();
    NAVX = new AHRS(SPI.Port.kMXP);
    TRANSMISSION = new TransmissionSubsystem();
    COMPRESSOR = new Compressor();

    AutoSwitcher.putToSmartDashboard();

    SendableNavX.init();
    SendableDriveTrain.init();

    DashboardData.addUpdater(SendableDriveTrain.getInstance());
    DashboardData.addUpdater(SendableNavX.getInstance());

    OI.init();

    NAVX.resetDisplacement();
    // DashboardData.addUpdater(DRIVE_TRAIN);
}
 
开发者ID:Team-2502,项目名称:RobotCode2018,代码行数:40,代码来源:Robot.java

示例15: NavXGyroWrapper

import com.kauailabs.navx.frc.AHRS; //导入依赖的package包/类
public NavXGyroWrapper(PIDSource wrappedSource) throws IllegalSourceException {
	super(wrappedSource);
	if (wrappedSource.getClass() != AHRS.class) {
		throw new IllegalSourceException();
	}
	else {
		m_navxSource = ((AHRS) m_pidSource);
	}
}
 
开发者ID:1757WestwoodRobotics,项目名称:2017-Steamworks,代码行数:10,代码来源:NavXGyroWrapper.java


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