Changes between Version 9 and Version 10 of ControlSystems/SoftwareTeam/Training/GettingStarted/UltrasonicRangefinder
- Timestamp:
- Nov 3, 2019, 10:49:21 PM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ControlSystems/SoftwareTeam/Training/GettingStarted/UltrasonicRangefinder
v9 v10 3 3 Robots need to sense the environment around them, particularly when driving autonomously. Ultrasonic sensors are like the sonar used by bats. [[Image(UltrasonicSensor.jpg,right,250px,margin=10)]] They emit a chirp of sound and measure the time it takes to hear an echo of that chirp. The longer the time, the further the sound traveled. Since sound travels at a particular speed (about 1125 ft/s) through air, we can use the echo delay to calculate distance to the object was that reflected the sound. You can read more about ultrasonic sensors on [https://wpilib.screenstepslive.com/s/currentCS/m/java/l/599715-ultrasonic-sensors-measuring-robot-distance-to-a-surface ScreenStepsLive] 4 4 5 Ultrasonic sensors are connected to the RoboRIO using DIO ports. In the example below, a sensor's Ping/Trig and Echo wires are connected to DIO8 and DIO9 respectively.5 Ultrasonic sensors are connected to the RoboRIO using DIO ports. In the example below, a sensor's !Ping/Trig and Echo wires are connected to DIO8 and DIO9 respectively. 6 6 7 7 Create another program using the !TimedRobot java template and name it !UltrasonicTest. Modify the auto-generated template code as follows: