Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Read PING))) Sensor Distance VI

LabVIEW 2013 Robotics Module Help

Edition Date: June 2013

Part Number: 372983D-01

»View Product Info

Requires: LabVIEW Robotics Starter Kit

Owning Palette: Starter Kit 1.0 VIs, Starter Kit 2.0 VIs

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.

Details  Examples

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.

Read PING))) Sensor Distance Details

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.

Examples

Refer to the following VIs for examples of using the Read PING))) Sensor Distance VI:

  • labview\examples\robotics\Starter Kit 1.0\Starter Kit 1.0.lvproj
  • labview\examples\robotics\Starter Kit 2.0\Starter Kit 2.0.lvproj

 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit