|Download Help (Windows Only)|
Requires: LabVIEW Robotics Starter Kit
Reads and returns the distance between the PING))) ultrasonic distance sensor and the nearest obstacle the sensor detects. The PING))) sensor has a maximum detection range of three meters.
If the sensor does not detect any obstacle within range, timed out? is TRUE.
|starter kit host in is a reference to the communication session between the host VI and the FPGA on the robot. Use the Starter Kit initialization VI that is appropriate for your application to generate this LabVIEW class object.|
|default distance specifies the distance value this VI returns if the sensor does not detect an obstacle within its maximum range and the read times out. The behavior is useful because it allows you to define code to run when the robot is not within range of any obstacles. The default is NaN.|
|error in describes error conditions that occur before this node runs. This input provides standard error in functionality.|
|starter kit host out is a reference to the communication session between the host VI and the FPGA on the robot. You can wire this output to other Starter Kit VIs.|
|distance (m) returns the distance, in meters, between the distance sensor and the nearest obstacle, if the sensor detects one. Otherwise, this output returns the default distance.|
|timed out?, if TRUE, indicates the sensor did not detect an obstacle within its maximum range. If timed out? is TRUE, this output returns the default distance you specify in the distance output.|
|error out contains error information. This output provides standard error out functionality.|
You can use the Write Sensor Servo Angle VI to change the orientation of the sensor and then use this VI to read the distance to any obstacles at that sensor angle. Pair the servo angle you write with the Write Sensor Servo Angle VI and the distance value this VI reads to identify the exact location of obstacles in relation to the robot. When you know the angle and distance to an obstacle, you can write code to adjust the robot motor velocities to avoid the obstacle.
For more information about the PING))) ultrasonic sensor, refer to the Parallax Web site.
Refer to the following VIs for examples of using the Read PING))) Sensor Distance VI: