You are on page 1of 4

LabVIEW Programming for Robot Control

Brian Lim
Wireless Signal Processors, Inc
Nov 25, 2004
Abstract
With the high adaptability re!irements "or the so"t#are that controls o!r robots, te$t
code based programming, s!ch as in %&&, can ca!se signi"icant time delays,
especially #hen poorly doc!mented' (raphical programming, a ne# paradigm in
programming, thro!gh Lab)I*W, can provide a sol!tion #ith a shorter learning
period, "aster code implementation, and easier maintainability' We have developed a
Lab)I*W program demonstrating the ease o" programming a 5+,-. robot arm to
move #ooden a ring "rom a peg to another, sim!lating a typical robot chip
man!"act!ring operation' -!r s!ccess"!l r!ns s!ggest a promise "or a "acility+#ide
employment o" Lab)I*W "or all o!r robots'
Introduction
%!rrently, the robotic systems the company employs are programmed in %&&' /o#ever,
the rapid advances in #ireless signal processor technology lead to "re!ent changes in
prod!ct speci"ications0 this re!ires the robot so"t#are employed in o!r "actory to be
!pgraded and modi"ied very reg!larly' 1ho!gh it is an e""icient lang!age that "!l"ills the
re!irements o" controlling the robots in o!r prod!ction line, "or the p!rposes o"
maintaining highly transient code, %&& is presently not the most s!itable lang!age'
.!rthermore, the e$isting code base is so poorly doc!mented that each s!ccessive
modi"ication to it re!ires an e$ponential increase in time to accomplish' We "eel that
this has no# become a bottlenec2 in o!r man!"act!ring process'
We propose !sing graphical programming to red!ce the time overhead re!ired to adapt
the robot code, th!s minimi3ing programmer e""ort "or each so"t#are !pgrade cycle' In
partic!lar, #e have investigated the !se o" National Instr!ments4 Lab)I*W program to
control a robot arm, demonstrating that the lang!age, a"ter an initial learning stage, does
help to red!ce the time and e""ort re!ired to modi"y an e$isting program'
With this ne# paradigm in programming, programmers sho!ld be able to e$pediently
implement the changes in so"t#are needed to prod!ce ne# processors, th!s eliminating
this stage as the limiting point in o!r prod!ction line'
Background
,ra#ing "rom the idea o" schematic "lo# charts !sed to plan programs, graphical
programming ta2es the process a step "!rther by seamlessly bridging the gap bet#een
planning and implementation' While laying o!t program components in the graphical
environment, coders sim!ltaneo!sly design and implement the so"t#are'
In graphical programming, a bloc2 diagram represents a proced!re analogo!s to a
se!ence o" code in a te$t+based lang!age' 5!st as te$t+based programming lang!ages are
comprised "!nctions lin2ed by syntactical str!ct!res, graphical programming lang!ages
have "!nctions as icons lin2ed by 6#ires4' ,ata o!tp!t "rom a "!nction can be streamed
into other "!nctions by connecting the icon terminals #ith #ires, #hich can branch to
allo# m!ltiple destinations per so!rce' *ach icon can have m!ltiple inp!ts and o!tp!ts0 a
bene"it over a lang!age li2e %&& that does not e$plicitly allo# the ret!rning o" more than
one data variables'
-ne #ritten, each program is saved as a virt!al instr!ment 7)I8 and can "!nction
independently' In the case o" Lab)I*W9:;, other than the diagrammatic vie#, there is
also a "ront panel vie# that lays o!t a select "e# o" components in a graphical !ser
inter"ace 7(<I8' ,esigning the (<I is m!ch in the "lavo!r o" "orm designers in certain
integrated development environments 7li2e )is!al Basic and 5B!ilder8' When the
program is e$ec!ted, the !ser #o!ld interact at the "ront panel to manip!late components
s!ch as te$t bo$es and sliders, and vie# data "rom ready+made components s!ch as
graphs and sim!lated L*,s'
=oreover, each )I that is #ritten, can be made into a component as a s!b)I, and !sed as
an icon, m!ch li2e employing a c!stom #ritten "!nction in te$t+based programming
lang!ages' *ach inp!t point in the program is mar2ed as an inp!t terminal o" its
corresponding icon and each o!tp!t point to an o!tp!t terminal' ,!e to the vis!al nat!re
o" the lang!age, it is easier to "ollo# the mod!lar str!ct!re o" code implemented in a
graphical lang!age'
Basic proced!ral lang!age "eat!res, s!ch as "or and #hile loops are also available to
provide means "or iteration' 1ho!gh the manner o" programming in Lab)I*W "eels
di""erent "rom te$t+based lang!ages li2e %, %&& and 5ava, it is still essentially a
proced!ral lang!age, so many str!ct!res employed in those lang!ages have analog!es in
Lab)I*W' .!rthermore, even tho!gh Lab)I*W is not e$plicitly an ob>ect+oriented
lang!age 7--L8, its "eat!re to allo# the b!ilding o" components and the e$tension o"
those components to a!gment their "eat!res can decently replicate the behavior o"
inheritance in --Ls'
Results
<sing Lab)I*W, #e have programmed a robot arm o" 5 degrees o" "reedom 7: "or each
servo controlling the #aist, sho!lder, elbo#, #rist and gripper8, to move a #ooden ring
"rom : #ooden peg to another, sim!lating a typical #a"er+handling operation' Servo
control is thro!gh a signal carrying digital p!lses o" 5) and variable #idths, "rom :'00ms
to 2'00ms, corresponding to the minim!m and ma$im!m servo ang!lar displacements'
1his signal originates "rom the serial port o" a Penti!m III 500=/3 encoded to represent
bytes "rom 0 to 254, "or minim!m and ma$im!m displacements respectively'
1he "inal program consists o" 2 main parts ? record.vi and playback.vi'
record.vi provides an inter"ace "or the !ser to man!ally control the robot to artic!late
to certain desired positions' 1he !ser #o!ld move sliders corresponding to each servo
"rom an @,% !nit val!e o" 0 to 254' 1he !ser can then save the chec2point position
in"ormation to a "ile' playback.vi reads the recorded "ile and repeats the locomotion,
ma2ing smooth and gentle transitions "rom each chec2point' 1his allo#s the tra>ectory to
be repeated m!ltiple times as needed by o!r robots #hen man!"act!ring the chips'
Starting "rom #riting a r!dimentary program that simply controls individ!al servos, one a
time, the program #as easily e$tended to handle all 5 servos on one "ront panel,
c!lminating in robotwrt.vi' It #as then a!gmented to allo# recording o" the
positions o" the servos to "ile' 1he "inal "orm is record.vi'
playback.vi #as created "rom a similar "o!ndation as record.vi, b!t #ith the
capability to read "rom a "ile instead' It #as noted that #hen the robot arm moved to the
recorded positions, it did so in an !nsatis"actorily >er2y manner' 1his #o!ld be
!nacceptable in the prod!ction line "or the damage to the chips that e$cessive motion can
ca!se' 1h!s a proced!re, step.vi, #as #ritten to smooth o!t the transitions "rom point
to point' 1his #as then >!st 6pl!gged4 into playback.vi to smooth o!t the tra>ectory'
@nother problem enco!ntered #as the mechanical bac2lash in the servos, partic!larly "or
the #aist and sho!lder ones, mani"ested by the arm s#inging bac2 a little a"ter reaching
each position' 1his #as resolved by programming the arm to move a little beyond its
intended position at each chec2point o" its tra>ectory'
Conclusions and Recommendations
:8 1he robot arm #as s!ccess"!lly controlled thro!gh a Lab)I*W program'
28 Learning Lab)I*W is signi"icantly "aster and more int!itive than a te$t+based
programming lang!age, in the order o" days as compared to #ee2s'
A8 1he graphical nat!re o" the lang!age ma2es it easier to vis!ali3e the schematic
arrangement o" programmatic components, s!ch that it is easier to !nderstand big
programs'
48 1h!s, comprehending e$isting Lab)I*W code is m!ch !ic2er and easier than
te$t+based lang!ages'
58 %ommenting in Lab)I*W is simple thro!gh an int!itive and attractive inter"ace,
promoting better code doc!mentation "or better maintenance'
B8 Lab)I*W is specially designed to #rite data ac!isition and control programs,
th!s it is very appropriate to o!r needs in processor man!"act!ring'
With this initial assessment o" Lab)I*W, it seems promising to implement graphical
programming "or all o!r robots in the prod!ction line' @"ter the initial learning period,
creating and modi"ying Lab)I*W programs re!ire "ar less e""ort than programs #ritten
in %&&' 1o "!rther s!pport this move, #e propose investigating the cost savings bro!ght
abo!t by !sing Lab)I*W, #hether the time savings ma2e !p "or the costs to re+train
programmers and to license the so"t#are "rom National Instr!ments' We co!ld also do a
partial implementation in Lab)I*W in some o" o!r "actory robots to determine any
de"ects that may arise d!ring r!n+time'
Further Reading
:' 1ravis, 5e""ery, LabVIEW for everyone, Prentice /all, N5, 2002'
Appendi
@ttached are the Lab)I*W code listings and doc!mentations o" relevant program "iles
!sed "or the robot arm control'
:' robotwrt.vi
1a2es n!merical byte val!es to represent displacement positions "or each servo
and concatenates the data into a string to stream thro!gh the serial port o" the
controlling comp!ter into the robot circ!it' 1he circ!it #o!ld then trans"orm the
signal into the relevant signal "or each servo'
2' record.vi
/aving initiali3ed the serial port, this allo#s the !ser to control each o" the 5
servos to a location by ad>!sting the sliders' Cobot control is delegated to
robotwrt.vi' @"ter a desired position "or the arm is reached, pressing the
record b!tton #o!ld then #rite the positional in"ormation to a speci"ied "ile'
A' playback.vi
%omplementing record.vi, this reads the recorded "ile and e$ec!tes the
motion o" the robot arm s!ch that it moves to each recorded position, b!t in a
smoothed o!t manner d!e to the contrib!tion o" step.vi, by ta2ing small step
increments to arrive at each chec2point' Cobot control is delegated to
robotwrt.vi'
4' step.vi
Simple arithmetic operation that increments or decrements an inp!t val!e to ma2e
it closer to the inp!t target val!e'
Ce"er to the "!rther reading "or e$planations on the Lab)I*W in+b!ilt "!nctions and
str!ct!res !sed'

You might also like