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


Java Ultrasonic.setAutomaticMode方法代码示例

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


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

示例1: ProximitySensor

import edu.wpi.first.wpilibj.Ultrasonic; //导入方法依赖的package包/类
/**
 * Creates the ProximitySensor.
 */
public ProximitySensor() {
  logger.trace("Initializing proximity sensor");

  ultrasonicLeft =
      new Ultrasonic(RobotMap.ULTRASONIC_LEFT_TRIGGER, RobotMap.ULTRASONIC_LEFT_ECHO);
  
  ultrasonicRight =
      new Ultrasonic(RobotMap.ULTRASONIC_RIGHT_TRIGGER, RobotMap.ULTRASONIC_RIGHT_ECHO);
  ultrasonicRight.setAutomaticMode(true);

  bufferLeft = new double[12];
  bufferCopyLeft = new double[12];
  bufferIndexLeft = 0;
  
  bufferRight = new double[12];
  bufferCopyRight = new double[12];
  bufferIndexRight = 0;

  Thread averagingThread = new Thread(this::averagingThread);
  averagingThread.setName("Ultrasonic Averaging Thread");
  averagingThread.setDaemon(true);
  averagingThread.start();
}
 
开发者ID:ligerbots,项目名称:Steamworks2017Robot,代码行数:27,代码来源:ProximitySensor.java

示例2: Drive

import edu.wpi.first.wpilibj.Ultrasonic; //导入方法依赖的package包/类
private Drive()
{
    drive = new RobotDrive(new Talon(1),new Talon(2),new Talon(3),new Talon(4));
    drive.setSafetyEnabled(false);

    
    e1 = new Encoder(RobotMap.ENCODER_1_A, RobotMap.ENCODER_1_B, false, CounterBase.EncodingType.k4X);
    e2 = new Encoder(RobotMap.ENCODER_2_A, RobotMap.ENCODER_2_B, false, CounterBase.EncodingType.k4X);
    
    //A calculated constant to convert from encoder ticks to feet on 4 inch diameter wheels
    e1.setDistancePerPulse(0.0349065850388889/12);
    e2.setDistancePerPulse(0.0349065850388889/12);
    startEncoders();
    
    drive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, true);      
    drive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, true);
    
    sonic = new Ultrasonic(RobotMap.ULTRASONIC_A, RobotMap.ULTRASONIC_B);
    sonic.setAutomaticMode(true);
    sonic.setEnabled(true);
    
    
    shifter = new DoubleSolenoid(RobotMap.SHIFTER_ENGAGE, RobotMap.SHIFTER_DISENGAGE);
}
 
开发者ID:Nashoba-Robotics,项目名称:NR-2014-CMD,代码行数:25,代码来源:Drive.java

示例3: AngleFinder

import edu.wpi.first.wpilibj.Ultrasonic; //导入方法依赖的package包/类
/**
 * Constructor
 * 
 * @param goalHeight
 * @param ultra
 * @param targetX
 */
public AngleFinder(double goalHeight, Ultrasonic ultra, int targetX) {
    this.goalHeight = goalHeight;
    this.targetX = targetX;
    this.targetY = 0;
    this.ultra = ultra;
    ultra.setAutomaticMode(true);
}
 
开发者ID:FIRST-Team-1699,项目名称:team-1699-utils,代码行数:15,代码来源:AngleFinder.java

示例4: initialize

import edu.wpi.first.wpilibj.Ultrasonic; //导入方法依赖的package包/类
public static void initialize()
{
	if (!initialized) {
		//ultrasonicDevice = new AnalogInput(ANALOG_CHANNEL_ID);
		ultrasonicDevice = new Ultrasonic(TRIGGER_CHANNEL_ID,ECHO_CHANNEL_ID);
		ultrasonicDevice.setAutomaticMode(true);
		
		initialized = true;
	}
}
 
开发者ID:MTHSRoboticsClub,项目名称:FRC-2017,代码行数:11,代码来源:UltrasonicSensor.java

示例5: initialize

import edu.wpi.first.wpilibj.Ultrasonic; //导入方法依赖的package包/类
public static void initialize()
{
	if (!initialized) {
		ultrasonicDevice = new Ultrasonic(HardwareIDs.TRIGGER_CHANNEL_ID,HardwareIDs.ECHO_CHANNEL_ID);
		ultrasonicDevice.setAutomaticMode(true);
		
		initialized = true;
	}
}
 
开发者ID:MTHSRoboticsClub,项目名称:FRC-2017,代码行数:10,代码来源:UltrasonicSensor.java

示例6: robotInit

import edu.wpi.first.wpilibj.Ultrasonic; //导入方法依赖的package包/类
public void robotInit(){
    driveStick= new JoyStickCustom(1, DEADZONE);
    secondStick=new JoyStickCustom(2, DEADZONE);
    
    frontLeft= new Talon(1);
    rearLeft= new Talon(2);
    frontRight= new Talon(3);
    rearRight= new Talon(4);
    
    timer=new Timer();
    timer.start();
    
    armM = new Victor(7);
    rollers =new Victor(6);
    
    mainDrive=new RobotDrive(frontLeft,rearLeft,frontRight,rearRight);

    mainDrive.setInvertedMotor(RobotDrive.MotorType.kFrontRight,true);
    mainDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, true);
    
    armP = new AnalogPotentiometer(1);
    distance= new AnalogChannel(2);
    ultra=new Ultrasonic(6,7);
    ultra.setAutomaticMode(true);
    
    compress=new Compressor(5,1);
    
    handJoint=new Pneumatics(3,4);
    
    //ultra = new Ultrasonic(6,5);
    //ultra.setAutomaticMode(true);
    
    winch = new Winch(secondStick);
    
}
 
开发者ID:4500robotics,项目名称:4500-2014,代码行数:36,代码来源:RobotTemplate.java

示例7: DistanceReader

import edu.wpi.first.wpilibj.Ultrasonic; //导入方法依赖的package包/类
public DistanceReader(){
    sensor = new Ultrasonic(RobotMap.PING_CHANNEL, RobotMap.ECHO_CHANNEL);
    sensor.setEnabled(true);
    sensor.setAutomaticMode(true);
}
 
开发者ID:owatonnarobotics,项目名称:2014RobotCode,代码行数:6,代码来源:DistanceReader.java

示例8: digitalUltrasonic

import edu.wpi.first.wpilibj.Ultrasonic; //导入方法依赖的package包/类
/**
 * Create a digital ultrasonic {@link DistanceSensor} for an {@link Ultrasonic} sensor that uses the specified channels.
 *
 * @param pingChannel the digital output channel to use for sending pings
 * @param echoChannel the digital input channel to use for receiving echo responses
 * @return a {@link DistanceSensor} linked to the specified channels
 */
public static DistanceSensor digitalUltrasonic(int pingChannel, int echoChannel) {
    Ultrasonic ultrasonic = new Ultrasonic(pingChannel, echoChannel);
    ultrasonic.setAutomaticMode(true);
    return DistanceSensor.create(ultrasonic::getRangeInches);
}
 
开发者ID:strongback,项目名称:strongback-java,代码行数:13,代码来源:Hardware.java


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