1. Introduction to LabVIEW Robotics
The new LabVIEW Robotics Module includes all of the software tools needed to design a sophisticated autonomous or semi-autonomous system. Robots are very complex mechatronics systems, so to simplify them, we can apply a simple paradigm - sense, think, act:
Figure 1: Autonomous robots simplified
Every autonomous or semi-autonomous robot, in some form or another, must sense it's environment, make a decision, and act on the environment. The new LabVIEW Robotics module provides APIs and example programs for each step of the sense - think - act process. This whitepaper will touch on all of the areas that LabVIEW Robotics can help you with your robotics development with the new robotics palette and example programs.
Figure 2: New libraries in LabVIEW Robotics enable developers to quickly develop an autonomous robot
*The LabVIEW Robotics Bundle is a separate product that includes the LabVIEW Robotics module, in addition to LabVIEW Professional, LabVIEW Real-Time, LabVIEW FPGA, LabVIEW Control Design and Simulation, LabVIEW MathScript RT, NI Vision, NI SoftMotion, and the LabVIEW PID and Fuzzy Logic Toolkits.
2. SENSE: Retrieve Data from Sensors
The LabVIEW and NI RIO platform makes it easy for developers to connect to any sensor signal. In addition to basic digital and analog I/O, LabVIEW Robotics includes functions and examples for interfacing with signals using low-level protocols such as PWM, I2C and SPI, and high-level protocols such as NMEA and Joint Architecture for Unmanned Systems (JAUS).
Furthermore, LabVIEW Robotics includes a new set of VIs to configure, control, and retrieve data from the most commonly used sensors. The current list of sensor drivers is listed below; however, National Instruments is continuously creating new drivers and expanding this list. The FPGA based sensor drivers and examples can be found in the NI Example Finder under Robotics >> Sensor Drivers.
Figure 3: LabVIEW Robotics Sensing Palette
LIDAR – Hokuyo URG Series, SICK LMS 2XX Series, Velodyne HDL-64E S2
Infrared – Sharp IR GP2D12, Sharp IR GP2Y0D02YK
Sonar – Devantech SRF02 & SRF05, MaxSonar EZ1
GPS – Garmin GPS Series, NavCom SF-2050, u-blox 5 Series, Applanix POS LV
Compass – Devantech CMPS03 (PWM or I2C), PNI Field Force TCM
Inertial Measurement Unit (IMU) – Microstrain 3DM-GXx and 3DM-GXx, Crossbow NAV440, Ocean Server OS4000
Camera – Axis M1011 IP camera, analog cameras (MoviMED Analog Frame Grabber for CompactRIO), USB cameras (Windows only), NI Smart Cameras
Thermal - Devantech TPA81
Light - Vishay TEMT600
Encoder - Maxon encoder
RFID - APSX RW Series
Text to Speech (TTS) - V-Stamp
LabVIEW offers an intuitive environment for implementing and visualizing parallel processes. The figure below shows two sensors acquiring data in parallel on a real-time processor using the LabVIEW Robotics sensor drivers.
Figure 4: Examples of interfacing with sensors using LabVIEW Robotics
If you need to perform sensor fusion of your instrument data, you can leverage the Estimation and Extended Kalman filtering functions included in the LabVIEW Control Design and Simulation module.
Looking for a specific sensor driver that is currently not included in LabVIEW Robotics? Check out our code exchange at ni.com/code/robotics, where you can download or share example programs, instrument drivers, or even photos and documents about your LabVIEW powered robot. If you still cannot find a driver for your sensor, submit your request here.
3. SENSE: Image Processing
When integrating NI Vision with the LabVIEW Robotics Module, you will have access to examples for use with a camera such as color tracking, path following, and target tracking. The following cameras are supported by NI Vision and the IMAQdx driver, depending on your hardware platform:
Real-time and FPGA based hardware such as CompactRIO or Single-Board RIO
- The Axis M1011 IP camera is supported by the NI IMAQdx driver included with NI Vision and connects to CompactRIO or Single-Board RIO over Ethernet. This camera is used in the FIRST Robotics competition.
- Analog cameras are supported by the MoviMED Analog Frame Grabber C-Series module for CompactRIO or Single-Board RIO. This module contains an FPGA which does low-level image processing, and offers a high-level API for programming on the real-time processor. For more information on the MoviMED Analog Frame Grabber, check out this short video, or visit the MoviMED AF-1501 product page.
- Most cameras, including webcams, are supported when running IMAQdx on a Windows device. For details on the supported buses, see Knowledgebase 4PB9L9QE: Is My Camera Supported?
Figure 5: HexaQuad robot powered by LabVIEW and NI Single-Board RIO uses an Axis M1011 for vision
4. THINK: Apply Navigation Algorithms
Once you are able to acquire data from sensors and control your mobile robot’s movement, the next step might be to apply an obstacle avoidance or path planning algorithm. LabVIEW Robotics includes new VIs and examples for avoiding obstacles based on sensor feedback, and for calculating the shortest path between a start location and a goal location.
For simple obstacle avoidance, LabVIEW Robotics provides two variations of the Vector Field Histogram algorithm. This algorithm can be used when the robot does not have a target location, and is navigating an environment autonomously. All of the algorithms and functions included in LabVIEW Robotics are open-source and can be easily modified. To see the Vector Field Histogram in action, check out the video included our Robot Recipe for NIcholas.
Figure 6: LabVIEW Robotics example of using the Vector Field Histogram (VFH) obstacle avoidance algorithm
When a mobile robot must avoid obstacles while navigating to a known destination, a path planning algorithm should be applied. LabVIEW Robotics includes Path Planning VIs for calculating the optimal path for the conditions you specify. The Path Planning VIs are based on the following search algorithms:
A* - Computes the shortest path between a start node and goal node.
AD* - Computes the shortest path between a start node and goal node while taking into account that the world (or the robot's understanding of the world) is changing. It maintains more information than the A*search algorithm, so that it can backtrack and find a new path more easily if it discovers that its original path will not work.
Figure 7: Example of using LabVIEW Robotics A* VIs for path planning
Mapping functionality is also included in LabVIEW Robotics for transforming a standard map or metric space (such as a Voronoi graph) into a searchable grid in which a mobile robot can navigate. The mapping VIs can be used to generate occupancy grid maps and directed graph maps.
To learn more about A* search for path planning, see An Introduction to A* Path Planning in our LabVIEW Robotics community.
5. THINK: Implement Advanced Control Loops
When developing robots which require advanced control and estimation, the LabVIEW Control Design and Simulation module can be used in combination with the LabVIEW Robotics module. The LabVIEW Control Design and Simulation module allows users to implement the following techniques in real-time:
- State feedback control
- Localization with a Kalman filter or Extended Kalman filter
- Dynamic simulation (both offline and real-time) with built-in ODE solvers
In the image below, the LabVIEW Control Design and Simulation module is being used to demonstrate how to use a continuous Kalman filter to track the location of a 'robot' based on three different situations:
- only using the encoder measurement
- only using the accelerometer measurement
- using both the encoder and accelerometer
The robot in this example is modeled as a one-degree-of-freedom object that we are applying a force to. You could think of it as a hockey puck that allows us to track the position, velocity and acceleration. The Kalman filter can be used to track a specific position of a landmark even if the measurement is corrupted by noise. As demonstrated in the example, the Kalman filter incorporating both measurements is the most consistent over the long term and under changing acceleration. This example is included when both the LabVIEW Robotics Module and the LabVIEW Control Design and Simulation Module are installed. To learn more about using the LabVIEW Control Design and Simulation module for robotics, see Advanced Control for Robotics.
Figure 8: Example of localization included in LabVIEW Robotics which uses an Continous Kalman Filter to track the position of a one-degree-of-freedom robot
*The LabVIEW Control Design and Simulation Module is included in the LabVIEW Robotics Bundle, but is separate from the LabVIEW Robotics Module.
6. THINK: Control a Robotic Arm
Many mobile robots use a robotic arm or manipulator for completing a task. LabVIEW Robotics offers many functions that are useful for robotic arms such as kinematics, dynamics, and trajectory generation. The robotic arm libraries* are useful for simulation as well as analyzing results from experiments with with real robots.
Figure 9: Robotic arm palette included in LabVIEW Robotics
LabVIEW Robotics includes several example programs on using the robotic arm libraries for both forward and inverse kinematics, in addition to simulation with the LabVIEW Control Design and Simulation Module.
Figure 10: Example of using LabVIEW Robotics kinematics libraries to deterministically compute the forward kinematics of a Puma 560 robotic arm
*These libraries were originally written by Professor Peter Corke at the Queensland University of Technology.
7. ACT: Control Motors
LabVIEW Robotics includes drivers for connecting to a variety of motors and motor controllers. There are software examples and APIs available for controlling the following motors and motor drives:
- Dynamixel motors
- Hitec motors
- Lynxmotion SSC32 servo controllers
- TI MDL BDC24 brushed DC motor drives
- Maxon EPOS2 motor drives (requires the NI 9853 I/O module for CAN communication)
Figure 11: Example of interfacing with Lynxmotion servo controllers using LabVIEW Robotics
National Instruments also offers several I/O modules that plug into CompactRIO or Single-Board RIO. For brushed DC motors, the NI 9505 module includes a built-in H-bridge and encoder interface. For powerful stepper or servo motion control applications, the NI 951x C Series drive interface modules connect to hundreds of drives and motors. These I/O modules require the NI SoftMotion Module, which provides high-level functions for everything from single-axis to complex-coordinated motion.
8. ACT: Calculate Wheel States
To drive a wheeled robot at a certain velocity and direction, you must calculate the wheel velocities depending on the type of robot. LabVIEW Robotics includes a set of steering functions to simplify this process. These steering functions have built-in support for Ackerman, differential and mecanum steering, to be used with fixed, steering, caster, mecanum or omni-directional wheels. Developers can also use these same functions to create a custom or user-defined steering frame.
Figure 12: Example of creating a differential steering frame with LabVIEW Robotics
Sometimes it is important to test your steering algorithms in simulation prior to running them on-board the robot. The LabVIEW Robotics steering functions can be used in conjunction with the 3D Picture Control and the LabVIEW Control Design and Simulation module to simulate your robot in real-time. LabVIEW Robotics includes several example programs for simulating different steering frames.
Figure 13: Simulation of a robot with an omni-directional steering frame
9. ACT: Simulate Your Robot with 3rd Party Tools
One of the most common needs for robot development is simulation. Simulation allows developers to test code much faster than if using actual hardware. Ideally, the exact same code can run either on the actual robot or in a simulated state; the only change being the specified target. The new physics-based environment simulator, released in LabVIEW Robotics 2011, based on the Open Dynamics Engine (http://www.ode.org/), addresses this issue.
Figure 14: Cogmation’s robotSim Pro 3D simulation environment included in LabVIEW Robotics
Robotics developers can use the new simulator to simulate any sensor input and any motor output, allowing them to test algorithms like mapping, steering, and path planning in simulation, and then use the exact same code on the hardware.
The simulator has built-in support for the NI LabVIEW Robotics Starter Kit 1.1 and 2.0, the base FRC robot platform, and the iRobot Create platform. The simulator also has built-in support for the most popular sensor classes as shown below.
Figure 15: LabVIEW Robotics includes libraries for simulating sensor and motor data, which can easily be swapped out with libraries for the actual hardware
10. ACT: Deploy Deterministic Algorithms to Embedded Hardware
LabVIEW Robotics can be easily integrated with real-time and FPGA based hardware solutions from National Instruments, allowing developers to achieve highly responsive control. These products include the rugged NI CompactRIO embedded platform, and the lower cost board-only version, NI Single-Board RIO. The RIO hardware architecture enables robot designers to implement hardware interfaces, signal processing, and any time-critical control algorithms in FPGA logic, which frees up the processor to handle high-level tasks such as navigation or mission planning.
Figure 16: Real-time and FPGA based platforms from National Instruments allow developers to easily deploy deterministic algorithms to hardware
If you are new to the LabVIEW and NI RIO platform, the LabVIEW Robotics Starter Kit, “DaNI”, is available as an evaluation or prototyping platform. This pre-built platform includes an NI Single-Board RIO, a PING))) Ultrasonic distance sensor, motors, encoders, and a mechanical frame from Pitsco Education. Out-of-the-box, DaNI uses the LabVIEW Robotics Module to perform obstacle avoidance and can navigate autonomously. This expandable platform features built-in digital and analog I/O, connectors to NI C Series modules, in addition to an on-board Ethernet and serial port allowing for the connectivity of additional third-party sensors and actuators. DaNI includes a 180-day evaluation of the LabVIEW platform in addition to the LabVIEW Real-Time module, LabVIEW FPGA module, and LabVIEW Robotics module.
Figure 17: The LabVIEW Robotics Starter Kit, “DaNI”, is available as an evaluation or prototyping platform
LabVIEW Robotics 2010 provides all of the necessary software tools needed for interfacing with sensors and actuators, controlling your robot’s motion, implementing navigation algorithms and advanced control, and simulating your robot in a dynamic environment. Complete your robotic system by integrating LabVIEW with embedded real-time and FPGA based hardware platforms such as the CompactRIO and Single-Board RIO. For more information about LabVIEW Robotics, see ni.com/robotics.
(If you do not already have LabVIEW 2010 installed, download a 7-day trial prior to installing the LabVIEW Robotics module.)
View all LabVIEW Robotics offerings at ni.com/robotics
Browse academic resources for robotics at ni.com/robotics/education