ProgrammingRobotswithROS
MorganQuigley,BrianGerkey,
andWilliamD.Smart
ProgrammingRobotswithROS
byMorganQuigley,BrianGerkey,andWilliamD.Smart
Copyright©2016MorganQuigley,BrianGerkey,andWilliamD.Smart.Allrights
reserved.
PrintedintheUnitedStatesofAmerica.
PublishedbyO’ReillyMedia,Inc.,1005GravensteinHighwayNorth,Sebastopol,CA
95472.
O’Reillybooksmaybepurchasedforeducational,business,orsalespromotionaluse.
Onlineeditionsarealsoavailableformosttitles().Formore
information,contactourcorporate/institutionalsalesdepartment:800-998-9938or
AcquisitionsEditor:MikeLoukides
Editors:MeghanBlanchetteandDawnSchanafelt
ProductionEditor:MatthewHacker
Copyeditor:RachelHead
Proofreader:AmandaKersey
Indexer:WordCoIndexingServices,Inc.
InteriorDesigner:DavidFutato
CoverDesigner:EllieVolckhausen
Illustrator:RebeccaDemarest
December2015:FirstEdition
RevisionHistoryfortheFirstEdition
2015-11-18FirstRelease
Seeforreleasedetails.
TheO’ReillylogoisaregisteredtrademarkofO’ReillyMedia,Inc.ProgrammingRobots
withROS,thecoverimageofaSalimAli’sfruitbat,andrelatedtradedressaretrademarks
ofO’ReillyMedia,Inc.
Whilethepublisherandtheauthorshaveusedgoodfaitheffortstoensurethatthe
informationandinstructionscontainedinthisworkareaccurate,thepublisherandthe
authorsdisclaimallresponsibilityforerrorsoromissions,includingwithoutlimitation
responsibilityfordamagesresultingfromtheuseoforrelianceonthiswork.Useofthe
informationandinstructionscontainedinthisworkisatyourownrisk.Ifanycode
samplesorothertechnologythisworkcontainsordescribesissubjecttoopensource
licensesortheintellectualpropertyrightsofothers,itisyourresponsibilitytoensurethat
yourusethereofcomplieswithsuchlicensesand/orrights.
978-1-4493-2389-9
[LSI]
Preface
ROS,theRobotOperatingSystem,isanopensourceframeworkforgettingrobotstodo
things.ROSismeanttoserveasacommonsoftwareplatformforpeoplewhoarebuilding
andusingrobots.Thiscommonplatformletspeoplesharecodeandideasmorereadily
and,perhapsmoreimportantly,meansthatyoudonothavetospendyearswriting
softwareinfrastructurebeforeyourrobotsstartmoving!
ROShasbeenremarkablysuccessful.Atthetimeofwriting,intheofficialdistributionof
ROS,thereareover2,000softwarepackages,writtenandmaintainedbyalmost600
people.Approximately80commerciallyavailablerobotsaresupported,andwecanfindat
least1,850academicpapersthatmentionROS.Wenolongerhavetowriteeverything
fromscratch,especiallyifwe’reworkingwithoneofthemanyrobotsthatsupportROS,
andcanspendmoretimethinkingaboutrobotics,ratherthanbit-fiddlinganddevice
drivers.
ROSconsistsofanumberofparts:
1. Asetofdriversthatletyoureaddatafromsensorsandsendcommandstomotors
andotheractuators,inanabstracted,well-definedformat.Awidevarietyofpopular
hardwareissupported,includingagrowingnumberofcommerciallyavailablerobot
systems.
2. Alargeandgrowingcollectionoffundamentalroboticsalgorithmsthatallowyouto
buildmapsoftheworld,navigatearoundit,representandinterpretsensordata,plan
motions,manipulateobjects,anddoalotofotherstuff.ROShasbecomevery
popularintheroboticsresearchcommunity,andalotofcutting-edgealgorithmsare
nowavailableinROS.
3. Allofthecomputationalinfrastructurethatallowsyoutomovedataaround,to
connectthevariouscomponentsofacomplexrobotsystem,andtoincorporateyour
ownalgorithms.ROSisinherentlydistributedandallowsyoutosplittheworkload
acrossmultiplecomputersseamlessly.
4. Alargesetoftoolsthatmakeiteasytovisualizethestateoftherobotandthe
algorithms,debugfaultybehaviors,andrecordsensordata.Debuggingrobot
softwareisnotoriouslydifficult,andthisrichsetoftoolsisoneofthethingsthat
makeROSaspowerfulasitis.
5. Finally,thelargerROSecosystemincludesanextensivesetofresources,suchasa
wikithatdocumentsmanyoftheaspectsoftheframework,aquestion-and-answer
sitewhereyoucanaskforhelpandsharewhatyou’velearned,andathriving
communityofusersanddevelopers.
So,whyshouldyoulearnROS?Theshortanswerisbecauseitwillsaveyoutime.ROS
providesallthepartsofarobotsoftwaresystemthatyouwouldotherwisehavetowrite.It
allowsyoutofocusonthepartsofthesystemthatyoucareabout,withoutworryingabout
thepartsthatyoudon’tcareabout.
Whyshouldyoureadthisbook?There’salotofmaterialontheROSwiki,including
detailedtutorialsformanyaspectsoftheframework.Athrivingusercommunityisready
toansweryourquestionson.WhynotjustlearnROSfromthese
resources?Whatwe’vetriedtodointhisbookistolaythingsoutinamoreorderedway
andtogivecomprehensiveexamplesofhowyoucanuseROStodointerestingthings
withrealandsimulatedrobots.We’vealsotriedtoincludetipsandhintsabouthowto
structureyourcode,howtodebugyourcodewhenitcausestherobottodosomething
unexpected,andhowtobecomepartoftheROScommunity.
There’safairamountofcomplexityinROS,especiallyifyou’renotaseasoned
programmer;distributedcomputation,multithreading,event-drivenprogramming,anda
hostofotherconceptslieattheheartofthesystem.Ifyou’renotalreadyfamiliarwithat
leastsomeofthese,ROScanhaveadauntinglearningcurve.Thisbookisanattemptto
flattenoutthatcurveabitbyintroducingyoutothebasicsofROSandgivingyousome
practicalexamplesofhowtouseitforrealapplicationsonreal(andsimulated)robots.
WhoShouldReadThisBook?
Ifyouwanttomakeyourrobotsdothingsintherealworld,butdon’twanttospendtime
reinventingthewheel,thenthisbookisforyou.ROSincludesallofthecomputational
infrastructureyou’llneedtogetyourrobotsupandrunningandenoughrobotics
algorithmstogetthemdoinginterestingthingsquickly.
Ifyou’reinterestedinsomeparticularaspect,likepathplanning,andwanttoinvestigateit
inthecontextofalargerrobotsystem,thenthisbookisforyou.We’llshowyouhowto
getyourrobotdoinginterestingthingsusingtheinfrastructureandalgorithmsinROSand
howtoswapoutsomeoftheexistingalgorithmsforyourown.
IfyouwanttogetanintroductiontothebasicmechanismsofROSandanoverviewof
someofthethingsthatarepossible,butyou’reabitdauntedbythescaleofthe
informationonthewiki,thenthisbookisforyou.We’llgiveyouatourofthebasic
mechanismsandtoolsinROSandconcreteexamplesofcompletesystemsthatyoucan
buildonandadapt.
WhoShouldNotReadThisBook?
Althoughwedon’twanttoexcludeanyonefromreadingthisbook,it’sprobablynotthe
rightresourceforeveryone.Wemakecertainimplicitassumptionsabouttherobotsthat
youwillbeusing.TheyareprobablyrunningLinux,andhavedecentcomputational
resources(atleastequivalenttoalaptopcomputer).Theyhavesophisticatedsensors,such
asaMicrosoftKinect.Theyareground-based,andprobablycanmoveabouttheworld.If
yourrobotsdon’tfallintoatleastsomeofthesecategories,theexamplesinthisbook
mightnotbeimmediatelyrelevanttoyou,althoughthematerialontheunderlying
mechanismsandtoolsshouldbe.
ThisbookisprimarilyaboutROS,andnotaboutrobotics.Whileyouwilllearnabitabout
roboticshere,wedon’tgointogreatdepthaboutmanyofthealgorithmsinROS.Ifyou’re
lookingforabroadintroductiontorobotics,thenthisbookisn’ttheoneyou’relooking
for.
WhatYou’llLearn
ThisbookismeanttobeabroadintroductiontoprogrammingrobotswithROS.We’ll
covertheimportantaspectsofthebasicmechanismsandtoolsthatmakeupthecoreof
ROSandshowyouhowtousethemtocreatesoftwaretocontrolyourrobots.We’llshow
youconcreteexamplesofhowyoucanuseROStodosomeinterestingthingswithyour
robotsandgiveyouadviceonhowtobuildontheseexamplestocreateyourownsystems.
Inadditiontothetechnicalmaterial,we’llalsoshowyouhowtonavigatethelargerROS
ecosystem,suchasthewikiandtheQ&Aforum,andhowtobecomeapartoftheglobal
ROScommunity,sharingyourcodeandnewlyfoundknowledgewithotherroboticists
acrosstheworld.
Prerequisites
Thereareafewthingsthatyouneedtoknowbeforeyoucanreallyusethematerialinthis
book.SinceROSisasoftwareframework,youreallyneedtoknowhowtoprogramto
properlyunderstandit.Althoughit’spossibletoprograminROSinavarietyoflanguages,
inthisbookwe’regoingtobeusingPython.Ifyoudon’tknowPython,thenalotofthe
codehereisn’tgoingtomakemuchsense.Fortunately,Pythonisaneasylanguageto
learn!Therearemanyexcellentreferencebooksandfreewebsitesavailableforlearning
Python,startingwiththeofficialPythonwebsite:.
ROSworksbestinanUbuntuLinuxenvironment,andhavingsomepreviousexposureto
Linuxwillmakeyourlifealoteasier.We’lltrytointroducetheimportantpartsofLinux
aswego,buthavingabasicunderstandingofthefilesystem,thebashcommandshell,and
atleastonetexteditorwillhelpyouconcentrateontheROS-specificmaterial.
Abasicunderstandingofrobotics,whilenotstrictlynecessarytolearnROS,willalsobe
helpful.Knowingsomethingabouttheunderlyingmathematicsusedbyrobotics,suchas
coordinatetransformsandkinematicchains,willbeusefulforunderstandingsomeofthe
ROSmechanismsthatwetalkabout.Again,we’lltrytogiveabriefintroductiontosome
ofthismaterial,butifyou’renotfamiliarwithit,youmightwanttotakeasidetrackand
digintotheroboticsliteraturetofillinsomebackground.
ConventionsUsedinThisBook
Thefollowingtypographicalconventionsareusedinthisbook:
Italic
Indicatesnewterms,URLs,emailaddresses,directoryandpathnames,filenames,and
fileextensions.
Constantwidth
Usedforprogramlistings,aswellaswithinparagraphstorefertoprogramelements
suchasvariableorfunctionnames,namespaces,datatypes,environmentvariables,
statements,andkeywords.Alsousedforcommands,command-lineutilities,and
ROSpackages,nodes,topics,etc.
Constantwidthbold
Showscommandsorothertextthatshouldbetypedliterallybytheuser.
Constantwidthitalic
Showstextthatshouldbereplacedwithuser-suppliedvaluesorbyvaluesdetermined
bycontext.
NOTE
Thisiconindicatesageneralnote.
TIP
Thisiconsignifiesatiporsuggestion.
WARNING
Thisiconindicatesawarningorcaution.
UsingCodeExamples
Supplementalmaterial(codeexamples,exercises,etc.)isavailablefordownload:
/>Thisbookisheretohelpyougetyourjobdone.Tothatend,theexamplesintheabovelinkedrepositoryareavailableundertheApache2.0License,whichpermitsverybroad
reuseofthecode.
Weappreciate,butdonotrequire,attribution.Anattributionusuallyincludesthetitle,
author,publisher,andISBN.Forexample:“ProgrammingRobotswithROSbyMorgan
Quigley,BrianGerkey,andWilliamD.Smart(O’Reilly).Copyright2015Morgan
Quigley,BrianGerkey,andWilliamD.Smart,978-1-4493-2389-9.”
Ifyoufeelyouruseofcodeexamplesfallsoutsidefairuseorthepermissiongivenabove,
feelfreetocontactusat
Safari®BooksOnline
NOTE
SafariBooksOnlineisanon-demanddigitallibrarythatdeliversexpertcontentinboth
bookandvideoformfromtheworld’sleadingauthorsintechnologyandbusiness.
Technologyprofessionals,softwaredevelopers,webdesigners,andbusinessandcreative
professionalsuseSafariBooksOnlineastheirprimaryresourceforresearch,problem
solving,learning,andcertificationtraining.
SafariBooksOnlineoffersarangeofplansandpricingforenterprise,government,
education,andindividuals.
Membershaveaccesstothousandsofbooks,trainingvideos,andprepublication
manuscriptsinonefullysearchabledatabasefrompublisherslikeO’ReillyMedia,
PrenticeHallProfessional,Addison-WesleyProfessional,MicrosoftPress,Sams,Que,
PeachpitPress,FocalPress,CiscoPress,JohnWiley&Sons,Syngress,Morgan
Kaufmann,IBMRedbooks,Packt,AdobePress,FTPress,Apress,Manning,NewRiders,
McGraw-Hill,Jones&Bartlett,CourseTechnology,andhundredsmore.Formore
informationaboutSafariBooksOnline,pleasevisitusonline.
HowtoContactUs
Pleaseaddresscommentsandquestionsconcerningthisbooktothepublisher:
O’ReillyMedia,Inc.
1005GravensteinHighwayNorth
Sebastopol,CA95472
800-998-9938(intheUnitedStatesorCanada)
707-829-0515(internationalorlocal)
707-829-0104(fax)
Wehaveawebpageforthisbook,wherewelisterrata,examples,andanyadditional
information.Youcanaccessthispageat />Tocommentorasktechnicalquestionsaboutthisbook,sendemailto
Formoreinformationaboutourbooks,courses,conferences,andnews,seeourwebsiteat
.
FindusonFacebook: />FollowusonTwitter: />WatchusonYouTube: />
Acknowledgments
Firstandforemost,wewouldliketothankoureditorsatO’Reilly,MikeLoukides,Meg
Blanchette,andDawnSchanafelt,allofwhomshowedgreatpatienceanduncommon
restraintwithusasweputthisbooktogether.We’dalsoliketothankeveryonewhogave
usfeedbackonearlydraftsofthebook,especiallyAndreasBihlmaier,JonBohren,Zach
Dodds,andKatScott.Theircommentsandsuggestionsmadethisamuchbetterbook.
Thanks,also,toeveryonewho’shelpedusfigureouthowtomakeROSdotherightthing
onourrobots.MikeFergusonhelpedwiththeFetchexamples.StevePeters,NateKoenig,
andJohnHsufromtheOpenSourceRoboticsFoundation(OSRF)answeredsomegnarly
Gazebosimulationquestions.WilliamWoodallandTullyFoote(bothfromtheOSRF)
fieldedanumberofgeneralROShackingquestions.
ThanksaswelltoDylanJones,whocaughtacodebugatthelastminutebeforethebook
wenttopress.
Finally,we’dliketothankalloftheauthors,maintainers,andusersintheworldwideROS
community.Ifitwasn’tforthem,ROSwouldnotbewhatitistoday,andwewouldnotbe
writingthispreface.
PartI.Fundamentals
Chapter1.Introduction
TheRobotOperatingSystem(ROS)isaframeworkforwritingrobotsoftware.Itisa
collectionoftools,libraries,andconventionsthataimtosimplifythetaskofcreating
complexandrobustrobotbehavioracrossawidevarietyofroboticplatforms.
Why?Becausecreatingtrulyrobust,general-purposerobotsoftwareishard.Fromthe
robot’sperspective,manyproblemsthatseemtrivialtohumanscanactuallyencompass
wildvariationsbetweeninstancesoftasksandenvironments.
Considerasimple“fetchanitem”task,whereanoffice-assistantrobotisinstructedto
retrieveastapler.First,therobotmustunderstandtherequest,eitherverballyorthrough
someothermodality,suchasawebinterface,email,orevenSMS.Then,therobotmust
startsomesortofplannertocoordinatethesearchfortheitem,whichwilllikelyrequire
navigatingthroughvariousroomsinabuilding,perhapsincludingelevatorsanddoors.
Oncearrivinginaroom,therobotmustsearchdesksclutteredwithsimilarlysizedobjects
(sinceallhandheldobjectsareroughlythesamesize)andfindastapler.Therobotmust
thenretraceitsstepsanddeliverthestaplertothedesiredlocation.Eachofthose
subproblemscanhavearbitrarynumbersofcomplicatingfactors.Andthiswasarelatively
simpletask!
Dealingwithreal-worldvariationsincomplextasksandenvironmentsissodifficultthat
nosingleindividual,laboratory,orinstitutioncanhopetobuildacompletesystemfrom
scratch.Asaresult,ROSwasbuiltfromthegrounduptoencouragecollaborative
roboticssoftwaredevelopment.Forexample,inthe“fetchastapler”problem,one
organizationmighthaveexpertsinmappingindoorenvironmentsandcouldcontributea
complexyeteasy-to-usesystemforproducingindoormaps.Anothergroupmighthave
expertiseinusingmapstorobustlynavigateindoorenvironments.Yetanothergroup
mighthavediscoveredaparticularcomputervisionapproachthatworkswellfor
recognizingsmallobjectsinclutter.ROSincludesmanyfeaturesspecificallydesignedto
simplifythistypeoflarge-scalecollaboration.
BriefHistory
ROSisalargeprojectthathasmanyancestorsandcontributors.Theneedforanopen
collaborationframeworkwasfeltbymanypeopleintheroboticsresearchcommunity.
VariousprojectsatStanfordUniversityinthemid-2000sinvolvingintegrative,embodied
AI,suchastheSTanfordAIRobot(STAIR)andthePersonalRobots(PR)program,
createdin-houseprototypesofthetypesofflexible,dynamicsoftwaresystemsdescribed
inthisbook.In2007,WillowGarage,Inc.,anearbyroboticsincubator,provided
significantresourcestoextendtheseconceptsmuchfurtherandcreatewell-tested
implementations.Theeffortwasboostedbycountlessresearcherswhocontributedtheir
timeandexpertisetothecoreofROSanditsfundamentalsoftwarepackages.Throughout,
thesoftwarewasdevelopedintheopenusingthepermissiveBSDopensourcelicense,
anditgraduallybecamewidelyusedintheroboticsresearchcommunity.
Fromthestart,ROSwasbeingdevelopedatmultipleinstitutionsandformultiplerobots.
Atfirst,thisseemedlikeaheadache,sinceitwouldhavebeenfarsimplerforall
contributorstoplacetheircodeonthesameservers.Ironically,overtheyears,thishas
emergedasoneofthegreatstrengthsoftheROSecosystem:anygroupcanstarttheirown
ROScoderepositoryontheirownservers,andtheywillmaintainfullownershipand
controlofit.Theydon’tneedanyone’spermission.Iftheychoosetomaketheirrepository
publiclyvisible,theycanreceivetherecognitionandcredittheydeservefortheir
achievementsandbenefitfromspecifictechnicalfeedbackandimprovementslikeallopen
sourcesoftwareprojects.
TheROSecosystemnowconsistsoftensofthousandsofusersworldwide,workingin
domainsrangingfromtabletophobbyprojectstolargeindustrialautomationsystems.
Philosophy
Allsoftwareframeworksimposetheirdevelopmentphilosophiesontheircontributors
directlyorindirectly,throughtheiridiomsandcommonpractices.Broadlyspeaking,ROS
followstheUnixphilosophyofsoftwaredevelopmentinseveralkeyaspects.Thistendsto
makeROSfeel“natural”fordeveloperscomingfromaUnixbackgroundbutsomewhat
“cryptic”atfirstforthosewhohaveprimarilyusedgraphicaldevelopmentenvironments
onWindowsorMacOSX.Thefollowingparagraphsdescribeseveralphilosophical
aspectsofROS:
Peertopeer
ROSsystemsconsistofnumeroussmallcomputerprogramsthatconnecttoone
anotherandcontinuouslyexchangemessages.Thesemessagestraveldirectlyfrom
oneprogramtoanother;thereisnocentralroutingservice.Althoughthismakesthe
underlying“plumbing”morecomplex,theresultisasystemthatscalesbetterasthe
amountofdataincreases.
Tools-based
AsdemonstratedbytheenduringarchitectureofUnix,complexsoftwaresystemscan
becreatedfrommanysmall,genericprograms.Unlikemanyotherroboticssoftware
frameworks,ROSdoesnothaveacanonicalintegrateddevelopmentandruntime
environment.Taskssuchasnavigatingthesourcecodetree,visualizingthesystem
interconnections,graphicallyplottingdatastreams,generatingdocumentation,
loggingdata,etc.areallperformedbyseparateprograms.Thisencouragesthe
creationofnew,improvedimplementations,since(ideally)theycanbeexchangedfor
implementationsbettersuitedforaparticulartaskdomain.RecentversionsofROS
allowmanyofthesetoolstobecomposedintosingleprocessesforefficiencyorto
createcoherentinterfacesforoperatorsordebugging,buttheprincipleremainsthe
same:theindividualtoolsthemselvesarerelativelysmallandgeneric.
Multilingual
Manysoftwaretasksareeasiertoaccomplishin“high-productivity”scripting
languagessuchasPythonorRuby.However,therearetimeswhenperformance
requirementsdictatetheuseoffasterlanguages,suchasC++.Therearealsovarious
reasonsthatsomeprogrammerspreferlanguagessuchasLisporMATLAB.Endless
emailflamewarshavebeenwaged,arecurrentlybeingwaged,andwilldoubtless
continuetobewagedoverwhichlanguageisbestsuitedforaparticulartask.
Acknowledgingthatalloftheseopinionshavemerit,thatlanguageshavedifferent
utilitiesindifferentcontexts,andthateachprogrammer’suniquebackgroundis
hugelyimportantwhenchoosingalanguage,ROSchoseamultilingualapproach.
ROSsoftwaremodulescanbewritteninanylanguageforwhichaclientlibraryhas
beenwritten.Atthetimeofwriting,clientlibrariesexistforC++,Python,LISP,Java,
JavaScript,MATLAB,Ruby,Haskell,R,Julia,andothers.ROSclientlibraries
communicatewithoneanotherbyfollowingaconventionthatdescribeshow
messagesare“flattened”or“serialized”beforebeingtransmittedoverthenetwork.
ThisbookwillusethePythonclientlibraryalmostexclusively,tosavespaceinthe
codeexamplesandforitsgeneraleaseofuse.However,thetasksdescribedinthis
bookcanbeaccomplishedwithanyoftheclientlibraries.
Thin
TheROSconventionsencouragecontributorstocreatestandalonelibrariesandthen
wrapthoselibrariessotheycansendandreceivemessagestoandfromotherROS
modules.ThisextralayerisintendedtoallowthereuseofsoftwareoutsideofROS
forotherapplications,anditgreatlysimplifiesthecreationofautomatedtestsusing
standardcontinuousintegrationtools.
Freeandopensource
ThecoreofROSisreleasedunderthepermissiveBSDlicense,whichallows
commercialandnoncommercialuse.ROSpassesdatabetweenmodulesusing
interprocesscommunication(IPC),whichmeansthatsystemsbuiltusingROScan
havefine-grainedlicensingoftheirvariouscomponents.Commercialsystems,for
example,oftenhaveseveralclosedsourcemodulescommunicatingwithalarge
numberofopensourcemodules.Academicandhobbyprojectsareoftenfullyopen
source.Commercialproductdevelopmentisoftendonecompletelybehindafirewall.
Alloftheseusecases,andmore,arecommonandperfectlyvalidundertheROS
license.
Installation
AlthoughROShasbeenmadetoworkonawidevarietyofsystems,inthisbookwewill
beusingUbuntuLinux,apopularandrelativelyuser-friendlyLinuxdistribution.Ubuntu
providesaneasy-to-useinstallerthatallowscomputerstodual-bootbetweentheoperating
systemtheywereshippedwith(typicallyWindowsorMacOSX)andUbuntuitself.That
beingsaid,itisimportanttobackupyourcomputerbeforeinstallingUbuntu,incase
somethingunexpectedhappensandthedriveiscompletelyerasedintheprocess.
AlthoughtherearevirtualizationenvironmentssuchasVirtualBoxandVMwarethatallow
LinuxtorunconcurrentlywithahostoperatingsystemsuchasWindowsorMacOSX,
thesimulatorusedinthisbookisrathercompute-andgraphics-intensive,andmightbe
overlysluggishinavirtualizedenvironment.Assuch,werecommendrunningUbuntu
LinuxnativelybyfollowingtheinstructionsontheUbuntuwebsite.
UbuntuLinuxcanbedownloadedfreelyfrom.Theremainderofthis
bookassumesthatROSisbeingrunonUbuntu14.04LTS,alsoknownasUbuntuTrusty
Tahr,andwillusetheROSIndigodistribution.
TheROSinstallationstepsrequireafewshellcommandsthatinvolvesomecareful
typing.Thesecanbeeitherhand-copiedfromthefollowingblock(notethatthefirst
commandhasbeenbrokenacrosslinestofitthepagemargins;youcanenterthisona
singleline,withoutthebackslashes),orcopiedandpastedfromtheROSwiki.The
followingcommandswilladdros.orgtothesystem’slistofsoftwaresources,download
andinstalltheROSpackages,andsetuptheenvironmentandROSbuildtools:
user@hostname$sudosh-c\
'echo"debtrustymain">\
/etc/apt/sources.list.d/ros-latest.list'
user@hostname$wget-O-|sudoapt-keyadduser@hostname$sudoapt-getupdate
user@hostname$sudoapt-getinstallros-indigo-desktop-fullpython-rosinstall
user@hostname$sudorosdepinit
user@hostname$rosdepupdate
user@hostname$echo"source/opt/ros/indigo/setup.bash">>~/.bashrc
user@hostname$source~/.bashrc
Thatseemslikeagnarlyblockofshellcommands!Someofthemareindeedabitunusual,
butotherswillbecommonlyusedwhenusingROSandotherlargesoftwarepackageson
Ubuntusystems.Inparticular,theapt-getcommandisacommonlyusedcommandon
UbuntuLinuxdistributions(amongothers),anditwillbeusedfrequentlythroughoutthe
booktoinstalladditionalsoftwarepackages.Thiscommandwillinstallthedesired
softwarepackage(s)requestedonthecommandline,aswellastheirdependencies,and
theirdependencies’dependencies,andsoon.Ifyou’dratheruseagraphicalapplicationto
installandmanageyourUbuntupackagefiles,youcaninstallsynaptic.Ofcourse,you
mighthavetodothisonthecommandline:
user@hostname$sudoapt-getinstallsynaptic