本文整理汇总了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();
}
示例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);
}
示例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);
}
示例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;
}
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}