Getting Started With LabVIEW Robotics
Getting Started With LabVIEW Robotics
Version 2011
The LabVIEW Robotics Module is a software package that allows you to develop and deploy a robotics
application using LabVIEW, other National Instruments software, and device drivers.
This document discusses how to develop a robotics project in LabVIEW and deploy the application to
a hardware target, such as a real-time controller. Use this manual to access information about robotics
programming concepts and to complete exercises to teach you how to set up hardware controllers and
build and deploy applications. This document provides references to the LabVIEW Help and other
National Instruments documents for more information as you create the robotics application.
Contents
Overview of the LabVIEW Robotics Module......................................................................................1
Accessing LabVIEW Robotics Software......................................................................................2
Related National Instruments Software........................................................................................3
Related Documentation.........................................................................................................................4
Components of a LabVIEW Robotics System......................................................................................4
Host Computer..............................................................................................................................5
Real-Time Controller....................................................................................................................6
Sensors and Actuators...................................................................................................................7
Configuring Software and Hardware for a Robotics System................................................................7
Installing Software and Device Drivers on the Host Computer...................................................7
Configuring an RT Target.............................................................................................................8
Creating a Robotics Project..................................................................................................................8
Creating a Starter Kit Project Using the Robotics Project Wizard...............................................9
Exploring the Project in the Project Explorer Window..............................................................10
Exploring VIs that Control the Starter Kit Robot.......................................................................11
Configuring Target Properties.....................................................................................................13
Overview of Robotics Application Architectures.......................................................................14
Deploying and Downloading VIs to a Target.....................................................................................14
Building a Robotics Application that Runs at Startup........................................................................15
Creating a Build Specification....................................................................................................15
Building and Running a Startup Application..............................................................................16
Where to Go from Here......................................................................................................................17
Many LabVIEW modules and toolkits and other National Instruments software products add functionality
to the LabVIEW Development System. The LabVIEW Robotics Module adds the following components
to LabVIEW:
VIs and sensor driversRobotics Module VIs provide algorithms for navigation, steering, and
so on. The Robotics Module also provides drivers that allow you to acquire data from certain sensors
and actuators commonly used in robotics systems.
To access the Robotics VIs and most sensor drivers, select ViewFunctions Palette from the block
diagram in LabVIEW and navigate to the Robotics palette. The items on the Robotics palette are
divided into subpalettes according to the functionality they provide, such as steering, simulation,
and communicating with sensors and actuators.
Note The Robotics Module also includes drivers that provide connectivity to sensors
on FPGA targets. To browse or search for these drivers, use the NI Example Finder,
available by selecting HelpFind Examples in LabVIEW. The RoboticsSensor Drivers
category contains these drivers.
Hardware Setup WizardThis wizard configure the basic settings of NI-RIO hardware
targets and installs software on the targets. Select ViewGetting Started Window and click
the Hardware Setup Wizard link in the Getting Started section of the Getting Started
window to launch this wizard.
Robotics Project WizardThis wizard allows you to create a new LabVIEW project
configured with your hardware or a simulation project. Refer to the Creating a Robotics Project
section for information about using the Robotics Project Wizard. Click the Robotics Project
link in the Create New section of the Getting Started window to launch the Robotics Project
Wizard.
SimulatorA built-in robotics simulator renders 3D simulation scenes and models the motion of
robots in a real-world environment. Refer to the Robotics ModuleSimulating Mobile Robots
topic on the Contents tab of the LabVIEW Help for more information about simulating robots.
ExamplesExample VIs demonstrate robotics concepts, such as path planning, kinematics, and
acquiring data from sensors. You can modify an example VI to fit an application, or you can copy
and paste from one or more example VIs into a VI that you create. Use the NI Example Finder,
available in LabVIEW by selecting HelpFind Examples to browse or search for example VIs.
The Robotics category opens automatically.
Note Some robotics examples require additional software. In the NI Example Finder,
select an example and refer to the Information section for a list of software you must
install to run the example.
You also can access robotics-specific example VIs from the labview\examples\robotics
directory. Access examples for certain sensor and actuator drivers in the
labview\instr.lib\device directory, where device is the name of a device for which you
have drivers installed.
ni.com
If LabVIEW is already open, select ToolsChoose Environment to display the Choose Environment
Settings dialog box, which you can use to change environments.
Figure 1 shows the Getting Started window in the LabVIEW Robotics environment.
located in the labview\instr.lib\device directory, where device is the name of a sensor or actuator
for which you have drivers installed.
Documentation
After you install a LabVIEW add-on such as a module, toolkit, or driver, the documentation for that
add-on appears in the LabVIEW Help or appears in a separate help system you can access by selecting
HelpAdd-On Help, where Add-On Help is the name of the separate help system for the add-on.
For add-on help that appears in the LabVIEW Help, you can locate help for the add-on you installed on
the Contents tab of the LabVIEW Help, in one of the following places.
In a book titled Add-On, where Add-On is the name of the product you installed
In the Toolkits book, in a book titled Add-On, where Add-On is the name of the product you
installed.
Related Documentation
The following documents contain information that you might find helpful as you use the Robotics
Module.
ManualsUser manuals and other documents, such as the Getting Started with LabVIEW manual,
are available as PDFs when you install LabVIEW. Access these documents by navigating to the
labview\manuals directory.
Product ReadmesThe readme_Robotics.html file contains additional help resources you
can use while working with the Robotics Module, including information on known issues with the
module. Access this document and readmes for other products by navigating to the labview\readme
directory.
Host computerDevelop and debug robotics applications on a host computer. You also can
communicate with the robot and log data it acquires using the host computer. Run applications you
develop on the host computer, or deploy them to a Windows-based system or real-time controller.
Robot control systemConstruct a robot steering frame that includes the following components:
Real-time controllerDeterministically run the programs you create in LabVIEW and control
data input and output with a real-time, or RT, controller, which serves as the brain of the
system.
Sensors and actuatorsAcquire data about the robot environment with sensors, such as laser
range finders, and control robot motion with actuators.
ni.com
The LabVIEW Robotics Starter Kit is an example of a robotics system that consists of these components
and runs LabVIEW and Robotics Module software. On the Starter Kit robot, a Single-Board RIO
controller, mounted on top of the robot base, includes a real-time processor and Field-Programmable
Gate Array (FPGA) on a single board. By default, the FPGA has a sensor and motors wired to digital
I/O: an ultrasonic distance sensor, a servo motor on which the sensor is mounted, and two DC drive
motors.
Note Refer to the Robotics ModuleLabVIEW Robotics Starter Kit book on the Contents
tab of the LabVIEW Help for more information about the Robotics Starter Kit.
The remainder of this manual uses the Robotics Starter Kit as an example to explain the process of
getting started with a typical robotics system and the Robotics Module.
Host Computer
The host computer is a computer with the LabVIEW Development System and LabVIEW modules and
toolkits installed on which you develop the VIs for the robotics system. After you develop the robotics
VIs, you can download and run the VIs on RT and FPGA targets, such as CompactRIO and Single-Board
RIO products. The host computer also can run VIs that communicate with the VIs running on targets to
provide a user interface.
LabVIEW Projects
Use LabVIEW projects on the host computer (1) to group LabVIEW files and files not specific to
LabVIEW, create stand-alone applications, and deploy or download VIs (3) and applications to RT (2)
and FPGA targets that contain I/O modules (4). When you save a project, LabVIEW creates a project
file (.lvproj), which can include references to files in the project, configuration information, build
information, and deployment information. Figure 2 shows the parts of a typical LabVIEW project.
2
3
1.
2.
3.
4.
Host computer
Real-time controller
RT VI
I/O modules
Figure 2. Parts of a LabVIEW Project
From the Getting Started window, select Blank Project in the Create New section to create a new
LabVIEW project. You also can use the Robotics Project Wizard to create a LabVIEW project from a
template. Refer to the Creating a Starter Kit Project Using the Robotics Project Wizard section of this
manual for information about creating a LabVIEW robotics project using the Robotics Project Wizard.
Real-Time Controller
Real-time controllers run programs you create in LabVIEW. On the Starter Kit robot, the Single-Board
RIO is the real-time controller. Some real-time controllers, such as NI Single-Board RIO products,
consist of a real-time processor and operating system and a Field Programmable Gate Array (FPGA).
Other NI real-time controllers, such as PXI products, contain only a real-time processor. You also can
use certain third-party hardware, such as ARM microcontrollers, to run LabVIEW programs. Use the
Project Explorer window to configure third-party hardware similarly to how you configure an NI RT
or FPGA target.
Real-Time Target
The real-time processor and operating system, or RT target, serves as the brain of the robotics system,
running VIs you create using LabVIEW. Robotics applications require many tasks to complete
deterministically, or within a guaranteed time period. The RT Engine, a version of LabVIEW that runs
ni.com
on RT targets, deterministically executes VIs in which you prioritize tasks so that the most critical task
can take control of the processor when necessary.
FPGA Target
An FPGA is an embedded chip that you can configure to match the requirements of a specific system.
Some controllers, such as CompactRIO and Single-Board RIO products, contain integrated FPGA targets,
which are directly connected to the I/O modules that access sensor and actuator data. FPGAs automatically
communicate with I/O modules and provides deterministic I/O to the real-time processor. Thus, you
typically program the FPGA to perform the lowest-level I/O and control tasks with the most critical
level of timing in a robotics application.
On the Starter Kit robot, you might want to program the FPGA to read obstacle data from the distance
sensor and adjust the drive motors accordingly to run deterministically so the robot avoids obstacles.
You can use LabVIEW programming techniques to develop an FPGA VI on the host computer and
download the VI on the target.
I/O Modules
National Instruments offers a variety of I/O modules that directly connect to sensors and actuators. On
the Starter Kit robot, built-in I/O connects the FPGA to the sensor and actuators. You typically write an
FPGA VI to access I/O, and then use an RT VI to read from and write to the I/O in the FPGA VI.
Configuring an RT Target
Before you can deploy robotics applications to an RT target, you must configure the basic settings of
the target and install software on the target. To configure the Single-Board RIO on the Starter Kit robot,
use the National Instruments Robotics Hardware Setup Wizard, which launches after you install the
LabVIEW Robotics software on the host computer. You also can click the Hardware Setup Wizard
link in the Getting Started section of the Getting Started window to launch this wizard manually.
If you use a CompactRIO or non-Starter Kit Single-Board RIO, you also can use this wizard. However,
if you use any other type of target, use the National Instruments Measurement & Automation Explorer
(MAX) to detect, configure, and test an RT target. MAX provides access to National Instruments devices
and systems, so you can use MAX to communicate with networked RT targets located on the same
subnet as the host computer. Select StartAll ProgramsNational InstrumentsMeasurement &
Automation to launch MAX and refer to the MAX help for more information about configuring targets
in MAX.
In the Robotics Hardware Setup Wizard, complete the instructions that appear on the screen to perform
the following tasks:
Download software to the target that can run VIs you deploy to the target
ni.com
3.
4.
5.
6.
7.
Project rootContains the host computer, the Starter Kit RT target and I/O, and VIs that control
the target.
Starter Kit 2.0 sbRIORepresents the real-time controller on the Starter Kit robot and
contains the I/O through which you access sensors and actuators. The Project Explorer
window also includes Dependencies and Build Specifications sections under this target.
VIs and libraries that you add to a hardware target appear under the target to indicate that you can run
the VI on that target. Figure 4 shows a project similar to the Robotics Project.lvproj file you
created with the Robotics Project Wizard.
10
ni.com
On the previous block diagram, the following VIs from the Starter Kit palette allow you to communicate
with the sensor and actuators connected to I/O on the Starter Kit robot. Although this VI is fairly simple,
the block diagram illustrates a common workflow for controlling RIO-based mobile robots.
The Initialize Starter Kit 2.0 (sbRIO-9632) VI begins a communication session with the FPGA on
the robot and returns a reference you use to read from or write to the FPGA.
The Write Sensor Servo Angle VI writes an angle to the servo on which the distance sensor is
mounted to turn the servo to that angle.
The Read PING))) Sensor Distance VI reads and returns the distance between the ultrasonic distance
sensor and the nearest obstacle the sensor detects.
The Close Starter Kit VI terminates the communication session with the FPGA on the Starter Kit
robot.
Tip Select HelpShow Context Help to display the Context Help window, which displays
basic information about LabVIEW objects and the LabVIEW environment when you move the
cursor over each object.
These VIs and others from the Starter Kit palette allow you to control the Starter Kit FPGA from an RT
VI without writing an FPGA VI. To control a non-Starter Kit robot whose real-time controller contains
an FPGA target, you typically must write an FPGA VI that runs on the real-time controller and accesses
I/O. Figure 6 shows the block diagram for a simple RT VI that communicates with an FPGA VI to
perform the same task as the Test Ultrasonic Sensor VI.
11
Refer to the Robotics ModuleLabVIEW Robotics Starter KitProgramming a Starter Kit Robot
topic on the Contents tab of the LabVIEW Help for more information about using traditional FPGA
programming versus the VIs on the Starter Kit palette.
Return to the block diagram for the Test Ultrasonic Sensors VI and complete the following steps to
continue exploring the VI.
1. Select WindowShow Front Panel to display the front panel of the VI, as shown in Figure 7.
12
ni.com
When the VI runs, the graph indicator displays data that represents the distances to objects in range
of the sensor. Also, the Object Detected indicator is TRUE when the sensor detects an object in
range.
2.
3.
4.
5.
Notice that LabVIEW displays the project and target in which the VI exists at the bottom-left corner
of the front panel and block diagram windows. This text indicates the application instance in which
the VI exists.
Close the front panel of the VI. The block diagram closes automatically.
In the Project Explorer window, double-click the Starter Kit 2.0 Roaming.vi.
Select WindowShow Block Diagram to display the block diagram of the VI, as shown in Figure 8.
This VI shows a more complex Starter Kit application. The Timed Loop controls the code that
acquires obstacle data from the distance sensor, calculates the heading to which the vehicle drives,
and applies the correct velocity to the drive motors.
6.
Close the Starter Kit 2.0 Roaming VI and return to the project.
13
14
ni.com
15
6.
7.
Click the OK button to accept the settings and close the Real-Time Application Properties dialog
box. The build specification name appears in the Project Explorer window under Build
Specifications for the RT target.
Select ProjectSave Project from the Project Explorer window to save the project and the build
specification settings.
16
ni.com
3.
After you restart the RT target, the application generated from the build specification launches
automatically and begins running the simulated navigation program.
Note If you plan to continue editing the RT VI, you might not want the application to
run every time you power on the RT target. To unconfigure the application as startup,
right-click the build specification and select Unset as startup and then Deploy from the
shortcut menu.
LabVIEW Help
The Robotics Module book on the Contents tab of the LabVIEW Help includes procedural and conceptual
information about developing robotics applications and reference information about built-in VIs on the
Robotics palette.
The LabVIEW Help also contains the following resources for LabVIEW modules that are useful in
developing robotics applications:
The Real-Time Module book on the Contents tab of the LabVIEW Help includes conceptual
information about real-time programming techniques and application architectures. Refer to the
Real-Time Module help for information about creating a deterministic real-time application.
The FPGA ModuleGetting Started with the FPGA Module topic on the Contents tab of the
LabVIEW Help includes links to topics on LabVIEW, FPGA Module, and hardware concepts you
should be familiar with before you begin working with the FPGA Module.
The Control Design and Simulation Module book on the Contents tab of the LabVIEW Help
includes information about using LabVIEW to design, analyze, and deploy controllers for dynamic
systems.
17
LabVIEW, National Instruments, NI, ni.com, the National Instruments corporate logo, and the Eagle logo are
trademarks of National Instruments Corporation. Refer to the Trademark Information section at ni.com/trademarks
for other National Instruments trademarks. Other product and company names mentioned herein are trademarks
or trade names of their respective companies. For patents covering National Instruments products/technology,
refer to the appropriate location: HelpPatents in your software, the patents.txt file on your media, or the
National Instruments Patent Notice at ni.com/patents. Refer to the Export Compliance Information at
ni.com/legal/export-compliance for the National Instruments global trade compliance policy and how to
obtain relevant HTS codes, ECCNs, and other import/export data.
375286B-01
June11