the host computer and the RT target execute different parts of the same VI. On the host computer, LabVIEW displays the front panel of the VI while the RT target executes the block diagram. Front panel communication is a good communication method to use during development, because you can quickly monitor and interface with Vis running on an RT target. With network communication, a host VI runs on the host computer and communicates with the VI running on the RT target using specific network communication methods such as network-published shared variables, Network Stream functions, or other protocols like TCP. You might use network communication for the following reasons: • To run another VI on the host computer. • To control the data exchanged between the host computer and the RT target. You can customize the communication code to specify which front panel objects to update and when. You also can control which components are visible on the front panel because some controls and indicators might be more important than others. • To control timing and sequencing of the data transfer. • To perform additional data processing or logging. Use the Network Streams functions for network communication when you need to transfer every point of data. Use cases include: • Transferring data losslessly between RT target and host computer • Transferring data from an RT target to host computer for logging data to file • Transferring data from an RT target to host computer for data processing and analysis that requires more memory than the RT target has available Stream data continuously between two LabVIEW applications with network streams. A network stream is a lossless, unidirectional, one-to-one communication channel that consists of a writer and a reader endpoint. You can use network streams to stream any data type between two applications, but the following data types stream at the fastest rates: • Numeric scalars • Booleans • 1D arrays of numeric scalars • 1D arrays of Booleans You can accomplish bidirectional communication by using two streams, where each computer contains a reader and a writer that is paired to a writer and reader on the opposite computer. Each endpoint uses a FIFO buffer to transfer data. A buffer is a region of memory that stores data. FIFO means first in and first out. With a FIFO buffer, the writer adds data to the buffer in a sequence, and the reader removes it in the same sequence. The writer and reader can operate at different rates and no data will be lost if the buffer size is large enough and the
applications are thoroughly tested. Network streams creates a buffer on the writer and another one on the reader. As shown in Figure 69, data flows in the following order: 1. The writer endpoint writes data to a FIFO buffer, on the sbRIO in this instance. 2. The Network streams software (called the Network Streams Engine or NSE) transfers data over a network (via the ethernet cable in this instance) to another FIFO buffer on the reader endpoint, the host computer in this instance. 3. The reader endpoint reads the data from that FIFO buffer. Figure 69. Network streams concept diagram Complete the following steps to create and stream data with a network stream: 1. Create the endpoints and establish the stream connection. 2. Read or write data. 3. Destroy the endpoints. Use information from the VIs developed previously and additional information in the following to modify the Acquire and Display Range Data VI to build the Acquire Display & Write Range Data VI shown in Figure 610 and the Read Display & Save Range Data VI shown in Figure 611. The Read Display & Save Range Data VI should reside under My Computer in the project as shown in Figure 612 and not under the sbRIO target. Figure 610. Acquire Display & Write Range Data VI on the real-time sbRIO Figure 611. Read & Save Range Data on the Windows host computer Figure 612. Project showing Read Display & Save Range Data under the host computer LabVIEW identifies each stream endpoint with a URL (uniform resource locator). To connect two endpoints and create a valid network stream, you must specify the URL of a remote endpoint with the Create Network Stream Endpoint Reader or Create Network Stream Endpoint Writer function. The URL of a stream endpoint must contain at least
the gaps, scores the gaps, calculates the direction the largest gap, and outputs the steering frame velocity. Figure 617. Calculate Driving Direction VI input and output connections Figure 618. Calculate Driving Direction block diagram The Calculate Driving Direction VI the Simple Vector Field Histogram (VFH) VI (Functions>>Robotics>>Obstacle Avoidance palette) whose connections are shown in Figure 619 that identifies obstacles and gaps, or open areas, in the robot environment. You can use the gap information in a variety of robots, not just DaNI 2.0, to implement reactionary motion. The VFH VI outputs the largest gap data, which is a cluster of two values, the location of the largets gap and the size of the gap. Largest gap describes the largest open area in the robot environment. Angle to gap contains the direction of the open area with respect to the robot sensor. Size of gap contains the angular size, or visual diameter, of the open area, measured as an angle. Figure 619. Simple Vector Histogram VI input and output connections The VFH VI also determines if is an obstacle within the panid range. Panic range is an area of the environment to avoid, i.e. the obstacle is too close to continue driving forward and avoiding. The Roaming VI code commands DaNI to back away If there are obstacles in the panic range. The panic range data structure is a cluster of two elements. The panic threshold distance specifies the maximum distance at which obstacle within panic range is TRUE. Panic threshold angle specifies the maximum angle at which obstacle within panic range is TRUE. Obstacle within panic range is TRUE if an object within panic threshold angle is nearer to the sensor than the panic threshold distance. Distances and direction angles inputs are obtained from the scanned obstacles data structure. Distances is an array of range data to obstacles. Direction angles is an array of angles with respect to the center of the sensor corresponding to each of the distances. Positive values of angles represent locations to the right of the center of the sensor, and negative values represent positions to the left of the center of the sensor.