LAB 9 MOBILE ROBOT CONTROL 1. LAB OBJECTIVE The objective of this lab is to design and implement a motion control system for a mobile robot. The developed controller has to ensure that the robot can follow a designed trajectory while avoiding obstacles. 2. BACKGROUND The National Instruments (NI) Robotics Starter Kit 1.0 is a mobile robot platform that comes equipped with sensors, motors, and a NI Single-Board RIO for embedded control. NI LabVIEW graphical programming and the LabVIEW Robotics module can be used for programming the mobile robot. Figure 1: NI Robotics Starter Kit 2.1 Robot Components The NI Robotics Starter Kit uses a NI Single-Board RIO 9631 embedded control platform and an ultrasonic range finder. The Single-Board RIO controller integrates a real-time processor, reconfigurable field-programmable gate array (FPGA), and analog and digital input/output (I/O) on a single board. It is powered by both NI LabVIEW Real-Time and FPGA technologies. The built-in analog and digital I/O can be expanded using C Series modules. The robot has two DC servomotors and 4 wheels. The DC motors are positioned between the front and rear wheels on each side and connected via a 2-1 gear train to both wheels. Each motor has a 400-tick encoder. Thus, the motor for each side (left or right) can be controlled independently. The steering method for this wheel configuration is called skid-steer.
21
Embed
LAB 9 MOBILE ROBOT CONTROL 1. LAB OBJECTIVE 2. · PDF fileFigure 2: Robot Components The robot is equipped with a Parallax PING))) ultrasonic sensor that detects objects by emitting
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
LAB 9
MOBILE ROBOT CONTROL
1. LAB OBJECTIVE
The objective of this lab is to design and implement a motion control system for a mobile robot.
The developed controller has to ensure that the robot can follow a designed trajectory while
avoiding obstacles.
2. BACKGROUND
The National Instruments (NI) Robotics Starter Kit 1.0 is a mobile robot platform that comes
equipped with sensors, motors, and a NI Single-Board RIO for embedded control. NI LabVIEW
graphical programming and the LabVIEW Robotics module can be used for programming the
mobile robot.
Figure 1: NI Robotics Starter Kit
2.1 Robot Components
The NI Robotics Starter Kit uses a NI Single-Board RIO 9631 embedded control platform and an
ultrasonic range finder. The Single-Board RIO controller integrates a real-time processor,
reconfigurable field-programmable gate array (FPGA), and analog and digital input/output (I/O)
on a single board. It is powered by both NI LabVIEW Real-Time and FPGA technologies. The
built-in analog and digital I/O can be expanded using C Series modules.
The robot has two DC servomotors and 4 wheels. The DC motors are positioned between the
front and rear wheels on each side and connected via a 2-1 gear train to both wheels. Each motor
has a 400-tick encoder. Thus, the motor for each side (left or right) can be controlled
independently. The steering method for this wheel configuration is called skid-steer.
Figure 2: Robot Components
The robot is equipped with a Parallax PING))) ultrasonic sensor that detects objects by emitting a
short ultrasonic burst and then listening for the echo. Under the control of a host microcontroller,
the sonar sensor emits a short 40 kHz (ultrasonic) burst. This burst travels through the air at
about 1130 feet per second, hits an object, and then bounces back to the sensor. The PING)))
sensor provides an output pulse to the host that terminates when the echo is detected; hence, the
width of this pulse corresponds to the distance to the target. This sensor can sense obstacles in a
range from 2 cm to 3 m. Moreover, the ultrasonic sensor is installed on a stepper motor. Thus,
the ultrasonic sensor can rotate from to degrees. (By rotating the ultrasonic sensor,
objects around the robot can be detected.)
The coordinate system of the robot is defined by Figure 3.
Figure 3: Coordinate System of the Robot
2.2 National Instruments Single Board RIO
The NI sbRIO-9631 embedded control and acquisition device (see Figure 4) integrates a real-
time processor, a user-reconfigurable field-programmable gate array (FPGA), and I/O on a single
printed circuit board (PCB). It features a 266 MHz industrial processor, a 1M gate Xilinx Spartan
FPGA, 110 3.3 V (5 V tolerant/TTL compatible) digital I/O lines, 32 single-ended/16 differential
16-bit analog input channels at 250 kS/s, and four 16-bit analog output channels at 100 kS/s. It
also has three connectors for expansion I/O using board-level NI C Series I/O modules. The
sbRIO-9631 offers a -20 to 55 °C operating temperature range along with a 19 to 30 VDC power
supply input range. It provides 64 MB of DRAM for embedded operation and 128 MB of
nonvolatile memory for storing programs and data logging.
This device features a built-in 10/100 Mbits/s Ethernet port that can be used to conduct
programmatic communication over the network and host built-in Web (HTTP) and file (FTP)
servers. The RS232 serial port can be used to control peripheral devices.
Figure 4: sbRIO-9631
2.3 Robot Control
The NI sbRIO-9631, single board RIO, is programmed by using NI LabVIEW software. Using a
LabVIEW program developed for this lab, the robot can be programmed with high-level
programming. Using the program provided, the robot and the controller transmit control signals
and data at a frequency of 100 Hz.
Figure 5: Robot Connection
For simplification, the two drive motors of the robot are programmed to operate at the same
speed in either the same or opposite direction. Accordingly, the two possible motion modes of
the robot are translation and rotation. The translation mode is controlled by sending the
“translate” command ( ). This command makes the robot left wheels and right wheels
rotate at the designated speed in rad/s ( ), forward ( ) or backward ( ). The
rotation mode is controlled by sending the “rotate” command ( ). This makes the robot
left wheels and right wheels rotate in different directions at the designated speed in rad/s ( ), counter clockwise ( ) or clockwise ( ). Lastly, the “stop” command ( ) is
used to stop the robot motors. These commands have to be sent to the sbRIO-9631 during real-
time control of the robot. The program to communicate with the robot processor is discussed in
section 3.
Table 1: Robot Commands
Command Description
Name
Stop 0 Stop motors (irrespective of specified speed, )
Translate 1 Rotate left and right wheels in same direction at specified speed, , in rad/s
Forward:
Backward:
Rotate 2 Rotate left and right wheels in different directions at specified speed, , in rad/s
Counter Clockwise:
Clockwise:
Note: When the robot is in the translation or rotation mode, the robot should be stopped before
switching to another mode. If the robot is switched between these modes while the wheels are
still in motion, an error in robot motion can occur.
2.4 System Model
The System Model with default parameters is as follows:
Figure 6: Block Diagram of Robot Motor
Figure 6 shows an open loop diagram of the motor. Raw encoder data of the wheels’ angular
positions are used to approximately compute the robot position. The position error increases as
the robot translates or rotates because of wheel slip. However, we can rely on these position
estimates if the robot moves within a short range (less than 6-8 meters). An approximation of the
robot velocity can be obtained by differentiating the encoder data. Thus, it is possible to estimate
both robot velocity and position. This estimation has been done for you, and these variables are
made available when controlling the robot motion.
3. ROBOT PROGRAMMING
3.1 Overview of LabVIEW Block Diagram
In this lab, you will program the National Instrument, sbIO-9631, a microcomputer, to control
the robot. The sbRIO-9631 is programmed using LabVIEW 2012. LabVIEW uses block
diagrams to implement a real-time program. Two basic programs have been provided to manage
the transfer of both commands and data to and from the robot. The first program, “Robot -
Manual Control” allows the robot motion to be controlled manually via user inputs on the
keyboard. The second program, “Robot - Formula Node Control”, relies on a formula node block
to control what commands are sent to the robot. The formula node allows you to perform
complicated mathematical operations and control using the C programming language. You are
encouraged to scan the help section for this block (see Appendix 10.A.2) and carefully program
the controller. (Tip: If the C code has errors, the Run button used to start the program will change
from to )
When you first open any LabVIEW program, you will see two windows, the front panel window
and a block diagram window. The front panel window allows you to monitor output variables
and set input parameters. The block diagram window displays the actual program written by
graphical programming and contains the code for controlling the robot.
Figure 7: Front Panel Window
This front panel window shows all the information obtained from the robot.
Plots:
o Sonar Plots: Time series sonar range measurements (filtered and unfiltered)
o Position Plots: Time series , , and data
o Trajectory Plot: Time series robot position and current heading
Data:
o Position: , , and with reference to starting location
o Velocity: Robot translational/rotational velocity and individual wheel velocities
o Encoder: Left/right encoder reading and calculated feedback translation/rotation
o Sonar: Sonar orientation and range measurements (filtered and unfiltered)
o Control: Commands currently being sent to the robot
Figure 8: Block Diagram Window
Figure 9: Block Diagram Primary Control Loop
Figure 8 shows the block diagram corresponding to the front panel provided in Figure 7. This
contains all code that is used for controlling the robot. The code is composed of several blocks
diagrams and sub-block diagrams (“sub-vi’s”). The primary control of the robot is contained
within the main timed while loop shown in Figure 9. Each sub-block diagram has its own sub
front panel and sub block diagram windows. These blocks are already prepared and their
programs do not have to be changed by you. However, you should make yourself familiar with
their inputs and outputs to understand how the block diagram works. Table A3 in the appendix
presents the description of the sub-block diagrams.
3.2 LabVIEW Formula Node
The most important element in the block diagram for this lab is the formula node block. An
example formula node block used to program the robot to track a reference sine wave input can
be seen in Figure 10.
Figure 10: Formula Node Block
The variables in blue and orange rectangles on the left side of the formula node are input
variables to the formula node. They have already been declared in the Labview program and can
be used directly. Similarly, the variables on the right side are pre-defined output variables. These
variables are what you will use to send the desired commands to the robot. Table 2 provides a
summary of all variables that have already been pre-defined in the program for you to use in the
formula node block. In addition to these variables, you may declare any new variable you want
using standard C syntax. For instance, in the example formula node provided in Figure 10 the
variables “f” and “t” needed to create the reference sine wave have been declared as temporary
float variables within the formula node.
Table 2 Pre-defined Formula Node Variables
Variable Data Type Description
X Double Robot X Position (in)
Y Double Robot Y Position (in)
Th Double Robot Th Position (in)
In2Cnt Double Encoder counts per inch of robot translation
Deg2Cnt Double Encoder counts per degree of robot rotation
FT Double Feedback translation (counts): feedback signal for translation
FR Double Feedback rotation (counts): feedback signal for rotation
sonar Double Filtered sonar reading (in)
count Int Current iteration (cycles)
delay Int Initial delay time (cycles)
Ts Double Sampling period (s)
state Int State (case) of the state machine program
reset Int Command to reset encoder (0 = do not reset, 1 = reset)