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

Communicating with Sensors and Actuators (Robotics Module)

LabVIEW 2013 Robotics Module Help

Edition Date: June 2013

Part Number: 372983D-01

»View Product Info

Traditional LabVIEW device drivers communicate with real devices. Use the traditional drivers on the Device I/O palette to communicate with sensors and actuators commonly used in robotics systems.

Communicating with Simulated Devices

Use Device I/O with Simulation drivers in a robotics simulation application to communicate with simulated sensors and actuators similarly to how you use traditional LabVIEW drivers with real devices. For example, both types of drivers consist of a set of VIs that communicate with a device, and each VI corresponds to a programmatic operation, such as configuring, reading from, or writing to the device. However, the Device I/O with Simulation drivers allow you to communicate with both real and simulated devices. Thus, you can create and simulate a robotics application that includes sensor and actuator drivers and then deploy the application to a real hardware target with minimal changes to your code.

Switching between Real and Simulated Connections

To specify whether you want a Device I/O with Simulation driver to connect to a real or simulated device, use the appropriate initialization VI in the driver. Each driver palette contains an Initialize subpalette with one initialization VI for simulated devices and one initialization VI for each type of communication you can perform with real devices, such as VISA or FPGA communication. An initialization VI returns a reference to the connection it opens. When you wire that reference to other driver VIs for the device, the VIs automatically communicate through the same connection.

To switch between connecting to real and simulated devices, you must replace only the initialization VI. All other VIs in the driver work regardless of the type of device.

Note  To check which types of connections a driver supports, refer to the Initialize subpalette for the driver.

Refer to the Robot Balance.lvproj in the labview\examples\robotics\Simulator\Robot Balance directory for an example of using Device I/O with Simulation drivers in a simulation application.

Refer to the Sharp IR GP2D12 HAIOL.lvproj in the instr.lib\Sharp IR GP2D12\HAIOL directory for examples of using a Device I/O with Simulation driver with a real device.

To run an application that communicates with simulated devices on a hardware target, you must prepare the application for deployment.

Reading from and Writing to TDMS Files

Many of the Device I/O with Simulation drivers can interface with .tdms files to play back data as if a device is acquiring the data. To play back data from an existing .tdms file, use the TDMS initialization VI on the Initialize subpalette of the main driver palette to begin communicating with the file. Then use the appropriate driver VI to read from the .tdms file.

Some drivers provide VIs on a Utility subpalette you can use to write data to .tdms files. To write data to a .tdms file as a real or simulated device operates, you initialize a communication session for the connection to the device itself. You do not need to initialize a TDMS communication session.

Refer to the Sharp IR GP2D12 HAIOL.lvproj in the instr.lib\Sharp IR GP2D12\HAIOL directory for an example of using a Device I/O with Simulation driver to interface with .tdms files.


 

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