Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Dec 3, 2010


Feedback


Yes No

Related Links - Developer Zone

Getting Started Guide for the Robotics Prototyping Kit

12 ratings | 4.83 out of 5
Read in | Print | PDF

Overview

This getting started guide walks you through setting up a mobile robot using the NI LabVIEW Robotics Starter Kit. The prototype uses LabVIEW 2009 and the LabVIEW Real-Time and LabVIEW FPGA modules to program an NI sbRIO-9631 device. Use this document to learn how to create a mobile robot that scans for objects in its path and redirects itself to avoid them.

Required Parts

 

Product Included
NI LabVIEW Robotics Starter Kit
  •   sbRIO-9631
  •   Embedded FPGA technology 
  •   LabVIEW 2009
  •   LabVIEW Robotics Module
  •   LabVIEW FPGA Module
  •   LabVIEW Real-Time Module
  •   24 V battery charger
  •   Parallax ultrasonic sensor
  •   Chassis, two drive motors, planetary gear system

 

Software Installation

Insert the software DVD that comes with the NI LabVIEW Robotics Starter Kit and follow the on-screen instructions for installation. After you have completed the installation, reboot your machine. During this time, use the battery recharger to charge the robot.

Step-by-Step Getting Started Guide

I. Connecting the Hardware

  • Begin by connecting the sensor, power cables, and a cable to the router.


[+] Enlarge Image

 

a.  Thread and attach the open wire group to sensor.

Connecting the UDS.bmp

b.  Attach the sensor to the motor.

Attach Sensor to the Motor.bmp

c.  Connect the power cables and turn on the “MASTER” switch.

Connect Power Cables.bmp

d.  Connect the cable from a router to the board.

Connect Cable from Router to Robot.bmp

 II. Run the Hardware Setup Wizard

  • If the wizard does not automatically launch, open it from your Windows "Start" menu. Follow the on-screen instructions to connect and verify your hardware setup including sensor orientation and motor tests. 


[+] Enlarge Image

Follow the Startup Wizard from Step 1 to Step 5 to fully complete the hardware configuration.

III. Create New Robotics Project

  • Use the Robotics Project Wizard that starts automatically to configure the project for your robot. Choose Robotics Project from Create New on the LabVIEW splash screen. 

a.  On the first screen, select Robotics Starter Kit and then select next.

b.  On the second screen, enter the IP address of the robot, which you can retrieve from the hardware configuration or from NI Measurement & Automation Explorer under Remote Devices. Select Next to move to the next window.

c.  Choose a project name and a folder to save it in. Select Finish.


[+] Enlarge Image

IV. Programming the Hardware

  • Once the Robotics Project Wizard has configured the project, it opens Roaming.vi. Read the front panel of this VI to verify that everything is configured properly.

Click the “Run” button on the LabVIEW application. Follow the instructions on the application front panel to disconnect your robot.

Running the VI.bmp

V. Disconnect the Robot

After the sensor begins moving, disconnect the Ethernet cable. Place the robot on the floor and turn on the  “MOTORS” switch.

Understanding Roaming.vi and Starter Kit FPGA.vi

For this robotics kit prototype, you need to understand the code you implement to control motors, plan paths, and sense objects. Read the following information to learn more about this code.

a.  Real-Time Control

i. Moving Sensor Motor

In this section, you pan back and forth, writing that to the current sensor motor angle and inserting the data you receive from the field-programmable gate array (FPGA) into an object-detection algorithm. Use the Update Obstacle Vectors VI to update the arrays for obstacle distance and angles.

Panning Sensors

ii. Steering

The Vector Field Histogram is updated with the objects that the panning sensors have detected.

 

        Updating Vector Field Histogram

 

The Vector Field Histogram takes two inputs. First it takes in information about the objects that were last detected (obstacle distances and obstacle angles). It also takes in panic threshold distance and panic threshold angles so that the system can accurately react to any obstacles that are so close to the robot that they cause the robot to stop and back up.

Drive Toward Gap

If the obstacle distance is more than a set distance or the panic threshold has not been reached, the robot continues to drive toward the gap that the Vector Field Histogram returns. However, if these conditions are not met, the robot backs up and moves the frame in an angle toward the gap. Use the Drive Toward Gap and Drive From Obstacles VIs to control the algorithm for your robot’s reaction to obstacles.

iii. Setting Motor Velocity

Setting Motor Velocity by Way of Steering Frame

Next the program applies the wheel velocity and angles calculated in the Calculate Driving Directions VI and sends them to the Frame and Wheel Objects VI, an in-place method.

 

 Write Motor Velocity

Finally, the program retrieves the actual commands for the motor velocity and sends that to the FPGA to be written to the motors.

 b.  FPGA Software

i. Encoder Loop


[+] Enlarge Image

                   Encoder Loop

Encoders are attached to the motors to determine the motor velocity. In hardware, the encoders send digital signals back to the NI Single-Board RIO device, where, in software, you can determine velocity from the difference in phases that the encoders return.

ii. Ultrasonic Sensor Distance Loop

Ultrasonic distance sensors are used to determine the distance of an object from the robotic platform. It is implemented by setting a line high, counting how long it takes for a signal to return, and multiplying that by the speed of sound to get distance.

                Ultrasonic Sensor Distance Loop

iii. Sensor Motor Control Loop

The Sensor Motor Control Loop sends a pulse-width modulation (PWM) signal to control the pan of the sensor motor. Inputs are sensor motor angle (new desired angle) and sensor motor offset (calibrated offset to be applied).


[+] Enlarge Image

                Sensor Motor Control

iv. Motor Velocity Loop

In this loop, you receive the velocity setpoints and send them to the PID Express VI setpoint input. Setpoints specify the value that you want the process variable to attain. You write to this value from the real-time control, which is determined by object direction and the future position destination of the robot. You also insert the right and left velocities into the process variable, which is the specific variable the PID controls. Set any gains within the Express VI or change them dynamically.


[+] Enlarge Image

            Drive Motor Control Loop

 


[+] Enlarge Image

                  Controlling Motor Velocity

The Motor Control Loop also writes out to the motor. The timer controls the pulse width, while the whole loop executes at 20 ms, creating a 20 ms pulse width. By controlling the pulse width of the output, you can control the direction and velocity of the motor.

 

Related Resources

Robotics Fundamentals Series

Getting Started with the LabVIEW Robotics Module

Functional Prototyping

Robotics Main Page

12 ratings | 4.83 out of 5
Read in | Print | PDF

Reader Comments | Submit a comment »

Excellent!
This is a great resource! Good job. If only all NI products had this much detail in their getting started material.
- Mar 5, 2010

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).