RoboticsTOOLBOXforMATLAB(Release7.1)0.60.8 Puma 560xyz!4!2024!4!202422.533.544.555.5q2q3I11PeterI.CorkePeter.Corke@csiro.auApril2002http://www.cat.csiro.au/cmst/staff/pic/robot
PeterI.CorkeCSIROManufacturingScienceandTechnologyPullenvale,AUSTRALIA,4069.2002http://www.cat.csiro.au/cmst/staff/pic/robotc!2002byPeterI.Corke.
31Preface1IntroductionThis,theseventhreleaseoftheToolbox,representsnearlyadecadeoftinkeringandasub-stantiallevelofmaturity.ItfinallyincludesmanyofthefeaturesI’vebeenplanningtoaddforsometime,particularlyMEXfiles,SimulinksupportandmodifiedDenavit-Hartenbergsupport.Thepreviousreleasehashadthousandsofdownloadsandthemailinglisthashundredsofsubscribers.TheToolboxprovidesmanyfunctionsthatareusefulinroboticsincludingsuchthingsaskinematics,dynamics,andtrajectorygeneration.TheToolboxisusefulforsimulationaswellasanalyzingresultsfromexperimentswithrealrobots.TheToolboxisbasedonaverygeneralmethodofrepresentingthekinematicsanddynam-icsofserial-linkmanipulators.TheseparametersareencapsulatedinMatlabobjects.Robotobjectscanbecreatedbytheuserforanyserial-linkmanipulatorandanumberofexamplesareprovidedforwellknowrobotssuchasthePuma560andtheStanfordarm.TheToolboxalsoprovidesfunctionsformanipulatingandconvertingbetweendatatypessuchasvec-tors,homogeneoustransformationsandunit-quaternionswhicharenecessarytorepresent3-dimensionalpositionandorientation.Theroutinesarewritteninastraightforwardmannerwhichallowsforeasyunderstanding,perhapsattheexpenseofcomputationalefficiency.MyguideinallofthisworkhasbeenthebookofPaul[1],nowoutofprint,butwhichIgrewupwith.Ifyoufeelstronglyaboutcomputationalefficiencythenyoucanalwaysrewritethefunctiontobemoreefficient,compiletheM-fileusingtheMatlabcompiler,orcreateaMEXversion.1.1What’snewThisreleasehassomesignificantnewfunctionalityaswellassomebugfixes.•Fullsupportformodified(Craig’s)Denavit-Hartenbergnotation,forwardandinversekinematics,Jacobiansandforwardandinversedynamics.•Simulinkblocksetlibraryanddemonstrationsincluded,seeSection2•MEXimplementationofrecursiveNewton-EuleralgorithmwritteninportableC.Speedimprovementsofatleast1000.TestedonSolaris,LinuxandWindows.SeeSection1.9.•Fixedstillmorebugsandmissingfilesinquaternioncode.•Remove‘@’notationfromfdyntoallowoperationunderMatlab5and6.•Fairlymajorupdateofdocumentationtoensureconsistencybetweencode,onlinehelpandthismanual.
1INTRODUCTION4AllcodeisnowunderCVScontrolwhichshouldeliminatemanyoftheversioningproblemsIhadpreviouslyduetodevelopingthecodeacrossmultiplecomputers.1.2ContactTheToolboxhomepageisathttp://www.cat.csiro.au/cmst/staff/pic/robotThispagewillalwayslistthecurrentreleasedversionnumberaswellasbugfixesandnewcodeinbetweenmajorreleases.AMailingListisalsoavailable,subscriptionsdetailsareavailableoffthatwebpage.1.3HowtoobtaintheToolboxTheRoboticsToolboxisfreelyavailablefromtheToolboxhomepageathttp://www.cat.csiro.au/cmst/staff/pic/robotThefilesareavailableineithergzippedtarformat(.gz)orzipformat(.zip).Thewebpagerequestssomeinformationfromyouregardingsuchasyourcountry,typeoforganizationandapplication.Thisisjustameansformetogaugeinterestandtohelpconvincemybosses(andmyself)thatthisisaworthwhileactivity.Thefilerobot.pdfisacomprehensivemanualwithatutorialintroductionanddetailsofeachToolboxfunction.Amenu-drivendemonstrationcanbeinvokedbythefunctionrtdemo.1.4MATLABversionissuesTheToolboxworkswithMATLABversion6andgreaterandhasbeentestedonaSunwithversion6.TheToolboxdoesnotfunctionunderMATLABv3.xorv4.xsincethoseversionsdonotsupportobjects.AnolderversionoftheToolbox,availablefromtheMatlab4ftpsiteisworkablebutlackssomefeaturesofthiscurrentToolboxrelease.1.5AcknowledgementsIamgratefulforthesupportofmyemployer,CSIRO,forsupportingmeinthisactivityandprovidingmewiththeMatlabtoolsandwebserver.IhavecorrespondedwithagreatmanypeopleviaemailsincethefirstreleaseofthisTool-box.Somehaveidentifiedbugsandshortcomingsinthedocumentation,andevenbetter,somehaveprovidedbugfixesandevennewmodules,thankyou.
1INTRODUCTION51.6Support,useinteaching,bugfixes,etc.I’malwayshappytocorrespondwithpeoplewhohavefoundgenuinebugsordeficienciesintheToolbox,orwhohavesuggestionsaboutwaystoimproveitsfunctionality.HoweverIdrawthelineatprovidinghelpforpeoplewiththeirassignmentsandhomework!ManypeopleareusingtheToolboxforteachingandthisissomethingthatIwouldencour-age.Ifyouplantoduplicatethedocumentationforclassusetheneverycopymustincludethefrontpage.IfyouwanttocitetheToolboxpleaseuse@ARTICLE{Corke96b,AUTHOR={P.I.Corke},JOURNAL={IEEERoboticsandAutomationMagazine},MONTH=mar,NUMBER={1},PAGES={24-32},TITLE={ARoboticsToolboxfor{MATLAB}},VOLUME={3},YEAR={1996}}whichisalsogiveninelectronicformintheREADMEfile.1.7AnoteonkinematicconventionsManypeoplearenotawarethattherearetwoquitedifferentformsofDenavit-Hartenbergrepresentationforserial-linkmanipulatorkinematics:1.Classicalaspertheoriginal1955paperofDenavitandHartenberg,andusedintext-bookssuchasbyPaul[1],Fuetal[2],orSpongandVidyasagar[3].2.ModifiedformasintroducedbyCraig[4]inhistextbook.Bothnotationsrepresentajointas2translations(AandD)and2rotationangles(!and").Howevertheexpressionsforthelinktransformmatricesarequitedifferent.Inshort,youmustknowwhichkinematicconventionyourDenavit-Hartenbergparametersconformto.Unfortunatelymanysourcesintheliteraturedonotspecifythiscrucialpieceofinformation.Mosttextbookscoveronlyoneanddonotevenalludetotheexistenceoftheother.TheseissuesarediscussedfurtherinSection3.TheToolboxhasfullsupportforboththeclassicalandmodifiedconventions.1.8CreatinganewrobotdefinitionLet’stakeasimpleexamplelikethetwo-linkplanarmanipulatorfromSpong&Vidyasagar[3](Figure3-6,p73)whichhasthefollowing(standard)Denavit-Hartenberglinkparameters
1INTRODUCTION6Linkai!idi"i1100"∗12100"∗2wherewehavesetthelinklengthsto1.Nowwecancreateapairoflinkobjects:>>L1=link([01000],’standard’)L1=0.0000001.0000000.0000000.000000R(std)>>L2=link([01000],’standard’)L2=0.0000001.0000000.0000000.000000R(std)>>r=robot({L1L2})r=noname(2axis,RR)grav=[0.000.009.81]standardD&HparametersalphaAthetaDR/P0.0000001.0000000.0000000.000000R(std)0.0000001.0000000.0000000.000000R(std)>>Thefirstfewlinescreatelinkobjects,oneperrobotlink.NotethesecondargumenttolinkwhichspecifiesthatthestandardD&Hconventionsaretobeused(thisisactuallythedefault).Theargumentstothelinkobjectcanbefoundfrom>>helplink..LINK([alphaAthetaDsigma],CONVENTION)..whichshowstheorderinwhichthelinkparametersmustbepassed(whichisdifferenttothecolumnorderofthetableabove).Thefifthelementofthefirstargument,sigma,isaflagthatindicateswhetherthejointisrevolute(sigmaiszero)orprimsmatic(sigmaisnonzero).
1INTRODUCTION7!2!1012!2!1012!2!1.5!1!0.500.511.52XYZ nonamexyzFigure1:Simpletwo-linkmanipulatormodel.Thelinkobjectsarepassedasacellarraytotherobot()functionwhichcreatesarobotobjectwhichisinturnpassedtomanyoftheotherToolboxfunctions.Notethatdisplaysoflinkdataincludethekinematicconventioninbracketsonthefarright.(std)forstandardform,and(mod)formodifiedform.Therobotjustcreatedcanbedisplayedgraphicallyby>>plot(r,[00])whichwillcreatetheplotshowninFigure1.1.9UsingMEXfilesTheRoboticsToolboxRelease7includesportableCsourcecodetogenerateaMEXfileversionofthernefunction.TheMEXfilerunsupto500timesfasterthantheinterprettedversionrne.mandthisiscriticalforcalculationsinvolvingforwarddynamics.Theforwarddynamicsrequiresthecalculationofthemanipulatorinertiamatrixateachintegrationtimestep.TheToolboxusesacomputationallysimplebutinefficientmethodthatrequiresevaluatingthernefunctionn+1times,wherenisthenumberofrobotaxes.Forforwarddynamicstherneisthebottleneck.TheToolboxstoresallrobotkinematicandinertialparametersinarobotobject,butac-cessingtheseparametersfromaClanguageMEXfileissomewhatcumbersomeandmustbedoneoneachcall.Thereforethespeedadvantageincreaseswiththenumberofrowsintheq,qdandqddmatricesthatareprovided.Inotherwordsitisbettertocallrnewithatrajectory,thanforeachpointonatrajectory.TobuildtheMEXfile:1.ChangedirectorytothemexsubdirectoryoftheRoboticsToolbox.
1INTRODUCTION82.OnaUnixsystemjusttypemake.ForotherplatformsfollowtheMathworksguide-lines.Youneedtocompileandlinkthreefileswithacommandsomethinglikemexfrne.cne.cvmath.c.3.Ifsuccessfulyounowhaveafilecalledfrne.extwhereextisthefileextensionanddependsonthearchitecture(mexsolforSolaris,mexlxforLinux).4.FromwithinMatlabcdintothissamedirectoryandrunthetestscript>>cdROBOTDIR/mex>>check***************************************************************************************Puma560********************************************************************************************************************normalcase*****************************DH:FastRNE:(c)PeterCorke2002Speedupis17,worstcaseerroris0.000000MDH:Speedupis1565,worstcaseerroris0.000000************************nogravity*****************************DH:Speedupis1501,worstcaseerroris0.000000MDH:Speedupis1509,worstcaseerroris0.000000************************extforce*****************************DH:Speedupis1497,worstcaseerroris0.000000MDH:Speedupis637,worstcaseerroris0.000000*************************************************************************************Stanfordarm******************************************************************************************************************normalcase*****************************DH:Speedupis1490,worstcaseerroris0.000000MDH:Speedupis1519,worstcaseerroris0.000000************************nogravity*****************************DH:Speedupis1471,worstcaseerroris0.000000MDH:Speedupis1450,worstcaseerroris0.000000************************extforce*****************************DH:Speedupis417,worstcaseerroris0.000000MDH:Speedupis1458,worstcaseerroris0.000000>>ThiswillruntheM-fileandMEX-fileversionsofthernefunctionforvariousrobotmodelsandoptionswithvariousoptions.Foreachcaseitshouldreportaspeedupgreaterthanone,andanerrorofzero.TheresultsshownaboveareforaSparcUltra10.5.CopytheMEX-filefrne.extintotheRoboticsToolboxmaindirectorywiththenamerne.ext.ThusallfuturereferencestornewillnowinvoketheMEX-fileinsteadoftheM-file.ThefirsttimeyouruntheMEX-fileinanyMatlabsessionitwillprintaone-lineidentificationmessage.