TableofContents 1. Introduction i. BeagleBoneBlack ii. PixHawkFirecape iii. Anti-vibrationsystem iv. Specifications v. References 2. Erle-Brain i. TechnologyDescription i. Processor ii. Memory iii. SystemPower iv. CurrentMeasurement v. USB vi. EEPROM vii. ADC viii. I/O ix. Sensors x. HardwareMap ii. ComplementaryDevices i. PowerModule ii. GPS iii. Buzzer iv. Dongles 3. Software i. Quickstart ii. Updatingthesofware i. Fromsource iii. OperatingSystem iv. Autopilot v. RealTime i. SCHED_DEBUG ii. ThreadPriorities iii. Linuxkernel vi. Clockproblems vii. PRU viii. ROS i. Concepts ii. TechnicalOverview ix. LinksArdupilot 4. Vehicles i. Copter i. Connections ii. Plane i. Connections iii. Rover i. Connections 5. Tutorials i. Peripherals i. BlinkaLED ii. BlinkaLEDinC++ ii. Miscelaneous i. Backup ii. CopyimagetomicroSDcard iii. ExpandingtheFileSystemPartitionontheSD iv. ResizeyourmicroSDcard v. Howtofetserialoverusb vi. HowtoinstantiateI2Cfromtheuserspace iii. ROStutorials i. InstallingandConfiguringYourROSEnvironment ii. NavigatingtheROSFilesystem iii. CreatingaROSPackage iv. BuildingaROSPackage v. UnderstandingROSNodes vi. UnderstandingROSTopics 6. Contactinformation 7. Legalnote Erle-brain Erle-brainisanopenhardwareandopensourceLinux-basedautopilotformakingdrones.ItconsistsofaBeagleBone BlackandaPixHawkFireCapeandcomeswithaDebianimageflashed,ROSpreinstalledandthelatestreadytoflycode ;). ThePixHawkFireCape(PXF)isadaugtherboardfortheBeagleBoneBlack(BBB)developmentboardthatallowsto createafullyfunctionalLinuxautopilotfordrones.ThecombinationofBBBandPXFallowstohaveaLinuxcomputerthat cancreaterobots. WeshipErle-brainwiththefollowingcharacteristics: DebianWheezy7.5 ROSHydroMedusa APM3.2-rc14 4GBeMMCandmicroSDcardcapable Cortex-A8@1GHz 512MBRAM 12PWMoutputs RCInputusingeitherPPM-SUMorS.Bus 1USBHost,1UART,3I2C,Buzzerconnector,Failsafeconnector. Thehardwarehasmanymoreperipheralsandweareworkinghardtobringthemout. Toacquiretheboardvisiterleroboticsstore. NOTE:ThePixHawkFireCapeisstillindevelopmenttherebysomeofthesystemsincludedmightnothavefull supportatthetimeofshipment. About Foryearswe'vebeenworkingintheroboticsfield,particularlywithdrones.WehavepassedthroughdifferentUniversities andresearchcentersandinalltheseplacesweactuallyfoundthatmostofthedronesareblackboxes(checkoutour 60spitch).Notmeanttobeusedforlearning,research.Thesoftwaretheyuseisinmostofthecasesunknown,closed sourceornotdocumented.Giventheseconditions,howarewegoingtoeducatethenextgenerationsonthis technologies?Howdoyougetstartedprogrammingdronesifyoudon'thave$1000+budget?Whichplatformallowsmeto getstartedwithdroneswithoutriskingahand? Wearecomingupwithananswertoallthesequestions,ourtechnologyatErleRoboticsandourdronesbrain:Erle-brain. InspiredbytheBeagleBonedevelopmentboard,wehavedesignedasmallcomputerwithabout36+sensors,plentyofI/O andprocessingpowerforreal-timeanalysis.Erleistheenablingtechnologyforthenextgenerationofaerialandterrestrial robotsthatwillbeusedincitiessolvingtaskssuchassurveillance,enviromentalmonitoringorevenprovidingaidat catastrophes. Oursmall-sizeLinuxcomputerisbringingroboticstothepeopleandbusinesses. License Unlessspecified,thiscontentislicensedundertheCreativeCommonsAttribution-NonComercial-ShareAlike3.0Unported License.Toviewacopyofthislicense,visithttp://creativecommons.org/licenses/by-sa/3.0/orsendalettertoCreative Commons,171SecondStreet,Suite300,SanFrancisco,California,94105,USA. AllderivativeworksaretobeattributedtoErleRoboticsS.L..Foralistofauthorsreferto erle_gitbook_erlebrain/graphs/contributors. Foranyquestions,concerns,orissuessubmitthemtosupport[at]erlerobot.com. BeagleBoneBlack BeagleBoneBlack(BBB)isanopen-hardwarelow-costboarddesignedfordevelopersandhobbyists.Thisboardhasbeen developedbytheBeagleBoardorganization,aisnon-profitcompromisedwiththedevelopmentofopenhardwarewitha hugecommunityofdevelopersandusers. Thisspecificboardhasbecomeverypopularduetoitslowcost(~35€/~55$)andhighfeatures: ItcanbootLinux(Debian,Ubuntu,Angströmdistros)in10secondsthankstotheCortex-A8processor,isableto workasastand-alonecomputer,ithasreal-time2xPRUmicrocontrollers,itslargeconnectivityoptions(USB, Ethernet,HDMI,SPI,I2C,GPIOs,...)andlargeamountofcapesavailable. IfyouwouldreadmoreabouttheBBBchecktheBeagleBoard'sweb. PixHawkFireCape ThePixHwakFireisacapedesignedfortheBeagleBoneBlackthatallowstocreateafullyfunctionalLinuxautopilot.This capehasallthesensors,conectorsandbusesneededthatallowstheautopilot'ssoftwaretoexecuteproperly.Thisboard isanopen-hardwarecape.Youcancheckthedesignhere. TheunionoftheBeagleBoneBlackandthePixHawkFire,makestheErle-Brainahighlymodularandcustomizable system. Note:Thiscapeisstillindevelopmentstage.Therefore,newfunctionalitiesandversioncouldberealeased. ThePixHawkFireCapecanbepurchasedfromtheErleRoboticsstore. Anti-vibrationsystem Asithasbeenintroducedinprevioussections,Erle-brainputstogethertheBBBandthePXF.Wewantedtomakeiteven bettertherebywe'veaddedananti-vibrationsystemthatmakesthesensingmorerobust: Erle-BrainSpecifications Electricalspecifications Powersupply 5Vsupply Powermoduleconector ESCsignalcables(needdomesoldering) Indicators 3normalLEDs RGBLED Connectors 4xUARTs 1ADCconector 1CAN 3xI2C 1Buzzerout 1Safetyswitch 12PWMoutchannels 1PPM/S.Busout 1PPM/S.Busin 1Spectrumin 1Powerbrickin 1Backupbatteryconector Powerconsumption MODE consumption(mA) Idling@UBoot 235 KernelBooting(Peak) 442 KernelIdling 323 DongleWiFicreatinghotspot 469 Autopilot(APM)+ROS 397 Autopilot(APM)+ROS+Dongleinhotspot 569 Mechanicalspecifications Size 95.6x75.27x36.2mm Layers 6(BBB)+6(PXF) PCBThickness 1.6 Weight 110grams References V.Mayoralet.al.,"Towardsanopensourcelinuxautopilotfordrones".LibreCon2014,November2014[pdf] Erle-Brain InspiredbytheBeagleBonedevelopmentboard,wehavedesignedasmallcomputerwithabout36+sensors,plentyofI/O andprocessingpowerforreal-timeanalysis.Erleistheenablingtechnologyforthenextgenerationofaerialandterrestrial robotsthatwillbeusedincitiessolvingtaskssuchassurveillance,enviromentalmonitoringorevenprovidingaidat catastrophes. Erle-BrainTechnologyDescription Overview BelowthemostrelevantfeaturesoftheErle-Brainarepicturedinatable: Feature Processor AM3359,ARMCortexA8720MHz Memory 256MBDDR2400MHz Power Management TPS65217B,PowerRegulators,LiIONSinglecellbatterycharger,20mALEDBacklightdriver,39V, PWM Debug Support USBtoSerialAdapter,OnBoardJTAGviaUSB(boththroughtheminiUSBport),4UserLEDs Power USB(onlyboardispowered),2SLiPobatterywithBEC(5V) Indicators PowerLED USB USB2.0ClientPort(miniUSB),USB2.0HostPort(USBTypeASocket,500mALS/FS/HS) SD/MMC Connector microSD,3.3V User Interface ResetButton,Bootbutton Overvoltage Protection Shutdown@5.6VMAX(onlyboard) Expansion Connectors Power5V,3.3V,VDD_ADC(1.8V),3.3VI/Oonallsignals,McASP0,SPI,I2C,GPIO(65),LCD, GPMC,MMC1,MMC2,7AIN(1.8VMAX),4Timers,3SerialPorts,CAN0,eHRPWM(8),XDMA Interrupt,LEDBacklight Weight 110grams Processor TherobotcurrentlyusestheAM3359(achangetoAM3358,whichprovides1GHzspeedisexpected)inthe15x15 package.Actualprocessorspeedwillbedeterminedbytheactualdevicessuppliedbutitwon'tbelowerthan720MHz. Memory Asingle16bitDDR2memorydeviceisused.Thedesignsupports128MBor256MBofmemory.Thestandard configurationis256MBat400MHz. ThedesignusesasingleMT47H128M16RT-25E:C400MHZmemoryfromMicronwhichcomesinan84-Ball9.0mmx 12.5mmFBGApackage.Theaddressingconfigurationisshowninthefollowingtable: Parameter 128Megx16 Configuration 16Megx16x8banks RefreshCount 8K RowAddress A[13:0](16K) BankAddress BA[2:0](8) ColumnAddress A[9:0](1K) TheDDR2connectsdirecttotheprocessorandnoexternalinterfacedevicesarerequired.PowerissuppliedtotheDDR2 viathe1.8VrailontheTPS65217B. SystemPower Theselectionofeitherthe5VDCortheUSBasthepowersourceishandledinternallytotheTPS65217Bandautomatically switchesto5VDCpowerifbothareconnected.SWcanchangethepowerconfigurationviatheI2Cinterfacefromthe processor.Inaddition,theSWcanreadtheTPS65217Banddetermineiftheboardisrunningonthe5VDCinputorthe USBinput.Thiscanbebeneficialtoknowthecapabilityoftheboardtosupplycurrentforthingslikeoperatingfrequency andexpansioncards. PowerManagementIntegratedCircuit(PMIC) ThemainPowerManagementIC(PMIC)inthesystemistheTPS65217B.TheTPS65217Bisasinglechippower managementICconsistingofalineardual-inputpowerpath,threestep-downconverters,fourLDOs,andahigh-efficiency boostconvertertopowertwostringsofupto10LEDsinseries.ThesystemissuppliedbyaUSBportorDCadapter. Threehigh-efficiency2.25MHzstep-downconvertersaretargetedatprovidingthecorevoltage,MPU,andmemoryvoltage fortheboard. Thestep-downconvertersenteralowpowermodeatlightloadformaximumefficiencyacrossthewidestpossiblerangeof loadcurrents.Forlow-noiseapplicationsthedevicescanbeforcedintofixedfrequencyPWMusingtheI2Cinterface.The step-downconvertersallowtheuseofsmallinductorsandcapacitorstoachieveasmallsolutionsize. LDO1andLDO2areintendedtosupportsystem-standbymode.InSLEEPstateoutputcurrentislimitedto100uAto reducequiescentcurrentwhereasinnormaloperationtheycansupportupto100mAeach.LDO3andLDO4cansupport upto285mAeach.BydefaultonlyLDO1isalwaysONbutanyrailcanbeconfiguredtoremainupinSLEEPstate. EspeciallytheDCDCconverterscanremainupinalow-powerPFMmodetosupportprocessorSuspendmode.The TPS65217Boffersflexiblepower-upandpower-downsequencingandseveralhouse-keepingfunctionssuchaspowergoodoutput,pushbuttonmonitor,hardwareresetfunctionandtemperaturesensortoprotectthebattery. Theselectionofeitherthe5VDCortheUSBasthepowersourceishandledinternallytotheTPS65217Bandautomatically switchesto5VDCpowerifbothareconnected.SoftwarecanchangethepowerconfigurationviatheI2Cinterfacefromthe processor.Inaddition,thesoftwarecanreadtheTPS65217Banddetermineiftheboardisrunningonthe5VDCinput ortheUSBinput.Thiscanbebeneficialtoknowthecapabilityoftheboardtosupplycurrentforthingslikeoperating frequencyandexpansioncards. 5VDCPowerInput A5VDCsupplycanbeusedtoprovidepowertotheboard.Thepowersupplycurrentdependsonhowmanyandwhat typeofaddonboardsareconnectedtotheboard.Fortypicaluse,a5VDCsupplyratedat1Ashouldbesufficient.If heavieruseoftheexpansionheadersorUSBhostportisexpected,thenahighercurrentsupplywillberequired.A NCP349overvoltagedeviceisusedtopreventtheplugginginof7to12Vpowersuppliesbymistake.TheNCP349will shutdownandtheboardwillnotpoweron.Novisibleindicatorisprovidedtoindicatethatanovervoltageconditionexists. Theboardwillnotpowerup. USBPower TheboardcanalsobepoweredfromtheUSBport.AtypicalUSBportislimitedto500mAmaximum.Whenpowering fromtheUSBport,theVDD_5Vrailisnotprovidedtotheexpansionheader.SoCapesthatrequirethatrailwillnothavethat railavailableforuse. The5VDCsupplyfromtheUSBportisprovidedontheSYS_5VrailoftheexpansionheaderforusebyaCape. Powerconsumption MODE USB(mA) DC(mA)* DC+USB(mA) Reset 200 80 220 UBoot 370 250 330 Kernelbooting(peak) 510 360 470 KernelIdling 300 180 300 *ThiscolumnshowstheapproximateconsumptionoftheboardwhenpoweredfromtheESCs(5VBEC). WhentheUSBisconnected,theFT2232andHUBarepoweredupwhichcausesanincreaseinthecurrent.IftheUSBis notconnected,thesedevicesareinlowpowerstate,thereforethissavesroughly120mAofcurrentandisthereasonfor theincreasedcurrentwhentheUSBisconnected. Thecurrentwillfluctuateasvariousactivatesoccur,suchastheLEDsonandSDcardaccesses. CurrentMeasurement TheBeagleBonehasamethodunderwhichthecurrentconsumptionoftheboard,notcountingtheUSBHostportand expansionboards,canbemeasured.Thevoltagedropacrossa.1ohmresistorismeasuredtodeterminethecurrent consumption. SYS_5VConnection TheSYS_5Vrailismeasuredtodeterminethehighsideoftheseriesresistor.TheSYS_5VrailisconnectedtotheMUX_OUT pin.Priortobeingconnectedtotheinternalsecondmultiplexer,thevoltageisdividedby3.A5Vsignalwillresultina voltageof1.66VattheMUX_OUTpin. SYS_VOLTConnection TheSYS_VOLTrailismeasuredtodeterminethehighsideoftheseriesresistor.TheSYS_VOLTrailisconnectedtothe MUX_OUTbysettingtheregistersinsidetheTPS65217B.TheresistorsR2andR1areprovidedtokeepthesame voltagedividerconfigurationasfoundintheSYS_5VraillocatedinternaltotheTPS65217B.However,a5Vrailwillgiveyou 1.41Vasopposedtothe1.66VfoundinternaltotheTPS65217B.Thisworksouttoadivisorof2.8.Besureandworkthis intoyourfinalcalculations. MUX_OUTConnection TheMUX_OUTconnectionisdividedby2beforebeingconnectedtotheprocessor.Thereasonforthisisthatifthebattery voltageisconnected,ithasnovoltagedividerinternally.Ifconnecteditcoulddamagetheprocessor.Whencalculatingthe voltagesforeithersideoftheresistors,thatvoltageisdividedby2.Besureandincludethisinyourcalculations. CurrentCalculation Thecalculationforthecurrentisbasedon.1mVisequalto1mA.Youcanusethefollowingformulatocalculatethecurrent usingthevoltagereadingsasreadbytheprocessor. (((SYS_5V*2)*3.3)-((SYS_VOLT*2)*3.54)))/.1=Total(mA) USB USB0Port TheHUBconnectsdirecttotheUSB0portontheprocessor.ThisallowsthatporttobeaccessiblefromthesameUSB connectorastheSerialandJTAGports. USBClientPort AccesstoUSB0isprovidedviatheonboardUSBHub.ItwillshowuponaPCasastandardUSBserialdevice(usually /dev/tty[something]). USB1Port OntheboardisasingleUSBTypeAconnectorwithfullLS/FS/HSHostsupportthatconnectstoUSB1ontheprocessor. Theportcanprovidepoweron/offcontrolandupto500mAofcurrentat5V. UnderUSBpower,theboardwillnotbeabletosupplythefull500mA,butshouldbesufficienttosupplyenoughcurrentforalowerpow Ifmorecurrentisneededwerecommendusingabattery. Youcanuseawirelesskeyboard/mouse/screenconfigurationoryoucanaddaHUBforinterfacingwithdevicesifrequired. ElectricallyErasableProgrammableReadOnlyMemory (EEPROM) TherobotErleisequippedwithasingleCAT24C256WEEPROMtoallowtheSoftwaretoidentifytheboard. Name Size (bytes) Contents Header 4 0xAA,0x55,0x33,0xEE BoardName 8 NameforboardinASCII:A335BONE Version 4 HardwareversioncodeforboardinASCII:00A3forRevA3,00A4forRevA4,00A5 forRevA5,00A6forRevA6 Serial Number 12 Serialnumberoftheboard.12characterstringisASCIIwiththefollowingscheme: WWYY4P16nnnn,whereWWisa2digitweekoftheyearofproduction,YYcorresponds totheyearofproduction,nnnnisanincrementingboardnumber. Configuration option 32 ASCII:0000000000000000000000000000000(640sinhex) RSVD 6 ASCII:000000 RSVD 6 ASCII:000000 RSVD 6 ASCII:000000 Security 20 Boardtheftprotection Available 32682 Availableforothernon-volatilecode/data ADC Theprocessorhas8ADC(AnalogtoDigital)converterinputs.Thesignalsare1.8Vonlyinterfaces.Oneofthese,AD7,is connectedtothePMIC(PowerManagementIntegratedCircuit)TPS65217Bandusedformeasuringvoltagesandcurrent viatheTPS65217B. ADCInputs TheprimarypurposeoftheADCpinswasintendedforuseasaTouchscreencontrollerbutcanbeusedasageneral purposeADC.Eachsignalisa12bitsuccessiveapproximationregister(SAR)ADC.Samplerateis100Ksamplesper second.ThereisonlyoneADCintheprocessoranditcanbeconnectedtoanyofthe8ADCpins. VDD_ADCInterface ThesignalVDD_ADCisprovidedviatheexpansionheader,butisnotavoltagerailthatistobeusedtopoweranything onanexpansionboard.Itissuppliedfromthe1.8VrailoftheTPS65217Bandisrunthroughaninductorfornoise isolation.ItisthereifneedforexternalcircuitrytohaveaccesstotheVREFrailoftheADCortoaddadditionalfilteringvia acapacitorifneeded. MoreaboutI/O InterIntegratedCircuits(I²C) I²C(Inter-IntegratedCircuit)(alternatelyspelledI2CorIIC,mostcommonlypronouncedI-squared-C)isamultimasterserial single-endedcomputerbusinventedbythePhilipssemiconductordivision,todayNXPSemiconductors,andusedfor attachinglow-speedperipheralstoamotherboard,embeddedsystem,cellphone,orotherdigitalelectronic devices. Severalcompetitors,suchasSiemensAG(laterInfineonTechnologiesAG,nowIntelmobilecommunications),NEC,Texas Instruments,STMicroelectronics(formerlySGS-Thomson),Motorola(laterFreescale),andIntersil,haveintroduced compatibleI²Cproductstothemarketsincethemid-1990s. SinceOctober10,2006,nolicensingfeesarerequiredtoimplementtheI²Cprotocol.However,feesarestillrequiredto obtainI²CslaveaddressesallocatedbyNXP. Interestingremark SMBus,definedbyIntelin1995,isasubsetofI²Cthatdefinestheprotocolsmorestrictly.OnepurposeofSMBusistopromoterobust I²CintheErle-Brain TheeducationaldroneErleincludes3I²Cbussesavailableunder/dev:/dev/i2c-0,/dev/i2c-1and/dev/i2c-2. /dev/i2c-2isbydefaultnotactivated.Inordertoactivateityoushouldtype: echoBB-I2C1>$SLOTS Youcanverifythatithasbeenactivatedtyping: cat$SLOTS InspectingI²C AgoodtooltoinspecttheI²Cbusisthei2cdetectbashcommand: i2cdetect-r1 WARNING!ThisprogramcanconfuseyourI2Cbus,causedatalossandworse! Iwillprobefile/dev/i2c-1usingreadbytecommands. Iwillprobeaddressrange0x03-0x77. Continue?[Y/n] 0123456789abcdef 00:-------------------------10:------13-----------------------20:-------------------------------30:-------------------------------40:-------------------------------50:--------UUUUUUUU---------------60:----------------68-------------70:---------------- Thiscommandsendsapingtothe0x03-0x77range(inhexadecimal)andrecordstheanswersineveryaddressthereby it'sabletofigureoutifthereareanydevices.Particularlywecanseethattheaddresses0x13and0x68answeredwhich correspondtotheIRandIMUsensorsrespectively. InstantiateI²Cdevicesfromtheuserspace TheLinuxkernelalsoallowstomanuallyconfigureI²Cdevicesthroughasysfsinterface: Ingeneral,thekernelshouldknowwhichI2Cdevicesareconnectedandwhataddressestheyliveat.However,in certaincases,itdoesnot,soasysfsinterfacewasaddedtolettheuserprovidetheinformation.Thisinterfaceis madeof2attributefileswhicharecreatedineveryI2Cbusdirectory:new_deviceanddelete_device.Bothfilesare writeonlyandyoumustwritetherightparameterstotheminordertoproperlyinstantiate,respectivelydelete,anI2C device. Filenew_devicetakes2parameters:thenameoftheI2Cdevice(astring)andtheaddressoftheI2Cdevice(a number,typicallyexpressedinhexadecimalstartingwith0x,butcanalsobeexpressedindecimal.) Filedelete_devicetakesasingleparameter:theaddressoftheI2Cdevice.Asnotwodevicescanliveatthesame addressonagivenI2Csegment,theaddressissufficienttouniquelyidentifythedevicetobedeleted. Example:echoeeprom0x50>/sys/bus/i2c/devices/i2c-3/new_device Whilethisinterfaceshouldonlybeusedwhenin-kerneldevicedeclarationcan'tbedone,thereisavarietyofcases whereitcanbehelpful: TheI2Cdriverusuallydetectsdevices(method3above)butthebussegmentyourdevicelivesondoesn'thave theproperclassbitsetandthusdetectiondoesn'ttrigger. TheI2Cdriverusuallydetectsdevices,butyourdevicelivesatanunexpectedaddress. TheI2Cdriverusuallydetectsdevices,butyourdeviceisnotdetected,eitherbecausethedetectionroutineis toostrict,orbecauseyourdeviceisnotofficiallysupportedyetbutyouknowitiscompatible. Youaredevelopingadriveronatestboard,whereyousolderedtheI2Cdeviceyourself. Thisinterfaceisareplacementfortheforce_*moduleparameterssomeI2Cdriversimplement.Beingimplemented ini2c-coreratherthanineachdevicedriverindividually,itismuchmoreefficient,andalsohastheadvantagethat youdonothavetoreloadthedrivertochangeasetting.Youcanalsoinstantiatethedevicebeforethedriveris loadedorevenavailable,andyoudon'tneedtoknowwhatdriverthedeviceneeds. Consideringthis,wecouldinstantiateasensor(hih6130)connectedto/dev/i2c-1andwithaddress0x27doing: echohih61300x27>/sys/bus/i2c/devices/i2c-1/new_device Afterthat,thedevicewillbeavailableunder/sys/bus/i2c/drivers/hih6130/1-0027. Toremovethedeviceyoucanuse: echo0x27>/sys/bus/i2c/devices/i2c-1/delete_device Sources Wikipedia Linuxkerneldocumentation Sensors BelowthesensorsincludedinErle-Brainaredescribed: InertialMeasurementUnits(IMUs) Sensor Features MPU6000 3-axisgyroscopeand3-axisaccelerometer.I2CandSPI MPU9250 3-axisgyroscope,3-axisaccelerometerand3-axismagnetometer.I2CandSPI LSM9DS0 3-axisgyroscope,3-axisaccelerometerand3-axismagnetometer.I2CandSPI Barometers Sensor MS5611-01BA03 Features Barometer.SPI Whysomanysensors? Well,thinkaboutthepossibilitiesofusingnewalgorithmsandcontroltechniqueswithmanysourcesofinformation. Webelievethatthelackofprecisioncanbegreatlycompensatedwiththequantityweprovideachievingbothanaffordable priceandamazingresults;). HardwareMap BelowwepresentthehardwaremappinoutofthePXF: Pin Function Pin Function P8.1 GND P9.1 GND P8.2 GND P9.2 GND P8.3 MMC1_DAT6 P9.3 3V3 P8.4 MMC1_DAT7 P9.4 3V3 P8.5 MMC1_DAT2 P9.5 VDD_5V P8.6 MMC1_DAT3 P9.6 VDD_5V P8.7 MPU_6500_DRDY P9.7 SYS_5V P8.8 ACCEL_DRDY P9.8 SYS_5V P8.9 GYRO_CS P9.9 PWR_BUT P8.10 MAG_DRDY P9.10 3v3_EN P8.11 SBUS_OUTPUT_EN P9.11 USART4_RX P8.12 FRAM_CS P9.12 VDD_5V_PERIPH_EN P8.13 VDD_5V_PERIPH_OC P9.13 USART4_TX P8.14 MPU_6000_DRDY P9.14 UBLED-SCL P8.15 PPM_INPUT P9.15 LED_BLUE P8.16 SERVO_RAIL_IN_EN P9.16 UBLED-SDA P8.17 VDD_3V3_SEPKTRUM_EN P9.17 ACCEL_MAG_CS P8.18 VDD_SERVO_IN_FAULT P9.18 SPI_0_MISO P8.19 VDD_5V_HIPOWER_OC P9.19 I2C2_SCL P8.20 MMC1_CMD P9.20 I2C2_SDA P8.21 MMC1_CLK P9.21 SPI_0_MOSI P8.22 MMC1_DAT5 P9.22 SPI_0_SCK P8.23 MMC1_DAT4 P9.23 SPI_1_MPU_CS2 P8.24 MMMC1_DAT1 P9.24 CAN1_RX_1 P8.25 MMC1_DAT0 P9.25 LED_AMBER P8.26 LED_SAFETY P9.26 CAN1_TX_1 P8.27 CH_2 P9.27 3V3_EN P8.28 CH_1 P9.28 SPI_1_MPU_CS P8.29 CH_4 P9.29 SPI_1_MOSI P8.30 CH_3 P9.30 SPI_1_MISO P8.31 USART5_CTS P9.31 SPI_1_SCK P8.32 USART5_RTS P9.32 VDD_ADC P8.33 USART4_RTS P9.33 VDD_5V_SENS P8.34 GYRO_DRDY P9.34 GND_ADC P8.35 USART4_CTS P9.35 BATT_CURRENT_SENS P8.36 ALARM P9.36 BATT_VOLTAGE_SENS P8.37 USART5_TX P9.37 AUX_ADC1 P8.38 USART5_RX P9.38 AUX_ADC2 P8.39 CH_6 P9.39 VDD_SERVO_SENS P8.40 CH_5 P9.40 PRESSURE_SENS P8.41 CH_8 P9.41 SAFETY P8.42 CH_7 P9.42 SPI_1_BARO_CS P8.43 CH_10 P9.43 GND P8.44 CH_9 P9.44 GND P8.45 CH_12 P9.45 GND P8.46 CH_11 P9.46 GND ComplementaryDevices ComplementaryhardwarecanbeconnectedtoErle-Brainthankstotheconnectors(I2C,CAN,buzzer,safety,...).This enablesthecustomizationofErle-Coptertoapplicationneeds.Inthenextpages,alistofavailablematerialisdescribed. Thisdevicesaresoldinourstore. PowerModule ThePowerModuleincorporatesbothawaytopoweryourautopilot,accessoriesandreportbatteryvoltageandcurrentto thePXF.Allthroughasingleandtightlyincluded6-pincablethatdirectlymatchesthePXF’sconnector.Theon-board switchingregulatoroutputs5.3Vatamaximumof2.25A,andcanbeusedupto18Volts(4SLiPo)andatamaximumof90 amps.ThePowerModuleisreadytousewithXT60connectorspre-fitted,andshrinkwrappedforprotection. Note:ThePowerModuleisratedat2.25AmpstopowerthePXF’s,receiverandperipherals(GPSandTelemetryradio) ONLY.TopowerservosuseanESCwithanadequateBECorastandaloneBECpluggedintotheoutputbus,andremove jumper1toisolatethetwopowerlines. Description Name Values MaxInputVoltage 18V MaxCurrentSensing 90A Switchingregulatoroutputs 5.3Vat2.25Amax Checkmoreinformationinproduct'spageinourstore. GPS ThisdesignincorporatesaGPSuBloxNeo-7MandtheHMC5883Ldigitalcompass.Thekitalsoincludesamoldedcase andpedestalmountwhichprovidesaconvenientwayofmountingthemodulehighandawayfrompossiblesourcesof interference. ThisGPSmodulesignificantlyoutperformstheMediatekGPSduetothelargerantennaandnext-genchipset.Anexcellent solutionformulticoptersandroversinparticular,whereGPSaccuracyisparamount.Itfeaturesactivecircuitryforthe ceramicpatchantenna,rechargeablebackupbatteryforwarmstarts,andI2CEEPROMforconfigurationstorage. ThemoduleiscompatiblewithAPM-basedautopilotssuchasErle-brain. Features 38400bauds uBloxNeo-7Mmodule 56-channel GPSL1C/A,GLONASSL1FDMA QZSSL1C/A GalileoE1B/C SBAS:WAAS,EGNOS,MSAS 10Hzupdaterate 25x25x2[mm]Ceramicpatchantenna Rechargeable3VBackupbattery Lownoise3.3Vregulator I2CEEPROMstorage PowerandfixLED’s PedestalMount/Case APMcompatible LNAMAX2659ELT+ Pre-configured38,400Baudandprams Specifications Size:60×11.5mm Mount:140mmlength Cablelength:200mm Weight:26g Connection:DF13(compass)4pin/(GPS)6pin(APMcompatible) Cables GPS6pinsconnector: Red:Vcc(5v) Yellow:TX Green:RX NC NC Black:GND Compass4pinsconnector: Red:SDA Black:SCL Checkmoreinformationinproduct'spageinourstore. Buzzer Thebuzzerisanusefuldevicetoknowthestateofthedrone.Thankstothesoundsthattheautopilotemits,youcanknow inwhichstatethedroneis(armed,disarmed,ESCcalibration,...)Itcanbeusedalsotogeneratecustomsounds. Checkmoreinformationinproduct'spageinourstore. Dongles DonglescanbepluggedintotheBeagleBoneBlackUSBport.Thisdevicesenablestheuseofdifferentcommunication networks,suchus:WiFi,3G,4Gandtelemetry.Nowadays,ErleBrainlaunchesan5GhzWifithatisusedtocommunicate withtheGCS.Wearelookingforwardtosupport/integrateinourproducts3G/4Gnetworks. Software ThefollowingsectionswilldescribethesoftwareusedwithinErle-Brain.Briefly: Linux3.8kernelcompiledwiththePREEMPToption(bestresultswemeasured) DebianWheezyfilesystem ROSHydromedusa APMrunningnativelyinLinux(Copterimagepreinstalled) mavrosROSpackage(bridgebetweenROSandAPM) preconfigureddaemonsforlaunchingeverythingautomatically,WiFidonglessupport QuickstartwithErle-Brain Checkingtheprocesses ps-e YoushouldseeArduCopter.elfandapm4-startup.shrunning. Changingtoothervehicle Let'sassumeyouwishtouseErle-Brainwithplane: cdardupilot/ArduPlane makeconfigure makepxf #thiswillcreateabinarycalledArduPlane.elfat~/build cp~/ArduPlane.elf~/ Nowyou'llneedtoupdatethestartupscriptstolaunchplaneinsteadofcopter.Todosoeditthe/etc/init.d/apm4startup.shfileandatthebottomofthefilemodifytheArduCopterlaunchcallforanArduPlaneone. LaunchingROS roscore& Nowmakecheckthenodesantopicsavailable: rosnodelist rostopiclist UpdatingErle-Brain'ssoftware Erle-braincomeswiththelastavailableimageatthetimeofshippinghoweverwearecontinuoslydevelopingnew capabilitiessoeventuallyyoumightliketoupdateit. Weexpecttoautomatethissoon. Updatingtheautopilot Installingthetools: sudoapt-getinstallgawkgcc-arm-linux-gnueabihfg++-arm-linux-gnueabihf Downloadingthecode gitclonehttp://github.com/erlerobot/ardupilot Compilingthecode cdardupilot/ArduCopter makeconfigure makepxf Thecodebinariesshouldbedeployedunder/tmpsocopythebinaryinto/root(ormodify/etc/init.d/apm4-startup.sh andpointtothebinaryyouwish). ReflashingeverythingontheeMMC Generally,updatingtheautopilotwillbeenoughbutifyoumessthingsupweareprovidingawaytoreflashErle-brain.The easiestwayofdoingitisusingourready-to-flasheMMClastimage. Downloadtheimageandthecopyitintoa>8GBmicroSDcard: Linux Findoutthedrivedevice(e.g./dev/sdb)andcopythecontentoftheimagejustdownloaded: zcaterlerobot-ubuntu.img.gz|sudoddof=/dev/sdbbs=8M MacOS InMacOSyougenerallyneedtounmountthediskbeforedoinganykindofcopying: diskutillist diskutilunmountDisk/dev/disk2 ThensimilarlytoLinux: zcaterlerobot-ubuntu.img.gz|sudoddof=/dev/rdisk1bs=8m Windows ToburnanimagetoanSDcardinwindowsyoufirstneedthefollowingtools: 7-ziporotherdecompressorthatcanextractgzippedfile(extensiongz). ImageWriterforWindowstowritetheimgfiletotheSDCard. AlaptopwithSDCardreader,oranexternalUSBSDCardreader. Here’stheproceduretopreparetheSDCard DownloadUbuntugzippedimagefileforOMAP4boards. Extractimgfileusing7-zip. InsertSDCardintoreader. ExecuteWin32DiskImager.exe–itrequestsadminprivilegesonWindows7. Selecttheimagefile. SelectthedevicethatcorrespondstotheSDCardreader. Writetheimagefile.Thiswilltakeawhile. EjecttheSDCard. UpdateErle-Brainfromsource Forthoseofyouthatwouldlikehackthesystemweareprovidingastep-by-stepguideonhowtoputapreemptibleLinux kernelinErle-Brainaswellastheautopilot: TheprocesswillendwithaprebuiltDebianimage,thesamecouldbedonewithaUbuntuone. GetDebianrunningonErle-Brain Makingthertkernel InstallingtheRTkernel Adjustingtheclock InstallingandMakingArduPilot Sources GetDebianrunningonErle-Brain GetaDebianimage: wgethttps://rcn-ee.net/deb/flasher/wheezy/BBB-eMMC-flasher-debian-7.1-2013-10-08.img.xz VerifyImagewith: md5sumBBB-eMMC-flasher-debian-7.1-2013-10-08.img.xz 706322a17e5f2251892ad19bec1e5829BBB-eMMC-flasher-debian-7.1-2013-10-08.img.xz NowyouneedtofindoutwhereyourmicroSDcardisbeingloadedintheFileSystem(inMacOSit'susually /dev/tty.usbserial-00002114BandinUbuntu/dev/ttyUSB1).ThisisneededinthefollowingsteptocopytheDebian imagethatwejustdownloadedintothemicroSDcard.Ifyouarenotsureyoucanfollowthesesimplesteps: BeforepluggingyourSDcardintoyourcomputer,typedf-h. Thiswilllistthecurrentmounteddrives.NowpluginyourSDcardandtype:df-h Comparebothoutputsandseewhichisthenewdrive. WARNING:IFYOUGETTHISWRONGYOUCANWIPEYOURHARDDISK CopytheDebianimagetothemicroSD(executedasrootonthisform): xzcatBBB-eMMC-flasher-debian-7.1-2013-10-08.img.xz|ddof=/dev/sdbbs=1M Waituntiltheflashingisfinished,unplugthemicroSDcardandplugitintoErle.Debianshouldloadandyoushouldbe abletologinwithuser:rootandpassword:root. Makingthertkernel Prerequisites ARMCrossCompiler TocompilethelinuxkernelfortheBeagleBoneBlack,youmustfirsthaveanARMcrosscompilerinstalled.Toinstallthe compilerrun: apt-getinstallgcc-arm-linux-gnueabi git TheBeagleBonepatchesandbuildscriptsarestoredinagitrepository.Installgit: apt-getinstallgit Andconfigurewithyouridentity. gitconfig--globaluser.email"your.email@here.com" lzopCompression Thekerneliscompressedusinglzop.Installthelzopparallelfilecompressor: apt-getinstalllzop uBootmkimage ThebootloaderusedontheBeagleBoneblackisu-boot.u-boothasaspecialimageformatcalleduImage.Itincludes parameterssuchasdescriptions,themachine/architecturetype,compressiontype,loadaddress,checksumsetc.Tomake theseimages,youneedtohaveamkimagetoolthatcomespartoftheu-Bootdistribution.Downloadu-boot,makeand installtheu-boottools: wgetftp://ftp.denx.de/pub/u-boot/u-boot-latest.tar.bz2 tar-xjfu-boot-latest.tar.bz2 cdu-boot-2013.10(looktoseewhatthisiscalled,itmayhavechanged) maketools installtools/mkimage/usr/local/bin CompilingtheLinuxKernelwiththeRTpatch HerewecompiletheBeagleBoneBlackKernel,andgenerateanuImagefilewiththeDTBblobappendedtothekernelfor easeofuse. NOTE:WhenmakingtheLinuxkernelforErle,theEthernetmoduleshouldbedeactivatedtoavoidproblems.Thiscanbe doneusingthemenuconfigutility. gitclonegit://github.com/beagleboard/kernel.git cdkernel gitcheckout3.8-rt ./patch.sh cpconfigs/beaglebonekernel/arch/arm/configs/beaglebone_defconfig wgethttp://arago-project.org/git/projects/?p=am33x-cm3.git\;a=blob_plain\;f=bin/am335x-pm-firmware.bin\;hb=HEAD-Okernel/firmware/am3 cdkernel makeARCH=armCROSS_COMPILE=arm-linux-gnueabi-beaglebone_defconfig-j4 makeARCH=armCROSS_COMPILE=arm-linux-gnueabi-uImagedtbs-j4 makeARCH=armCROSS_COMPILE=arm-linux-gnueabi-uImage-dtb.am335x-boneblack-j4 Nowwebuildanykernelmodules: makeARCH=armCROSS_COMPILE=arm-linux-gnueabi-modules-j4 Andifyouhaveyourrootfsready,youcaninstallthem(thisisassumingthatyourmicroSDcardmountstherootfspartition at/media/rootfs): makeARCH=armCROSS_COMPILE=arm-linux-gnueabi-INSTALL_MOD_PATH=/media/rootfs modules_install InstallingtheRTkernel Option1:MountingthemicroSDcardinthebuildmachine FigureoutwhereyourmicroSDwasmounted(mineat/dev/sdf). ThemicroSDcardshouldalsobemountedunder/mediaasrootfs(thefilesystem)andBOOT(thebootpartition containingthebootloaderandthekernel). Updatethemodulesusingthefollowinginstruction: sudomakeARCH=armCROSS_COMPILE=arm-linux-gnueabi-INSTALL_MOD_PATH=/media/rootfsmodules_install Verifythatthemoduleshavebeeninstalledproperly: ls/media/rootfs/lib/modules 3.12.0-rc4-armv7-x33.7.10-x133.8.13-bone283.8.13-rt9-00899-g40bdb63 3.8.13-rt9-00899-g40bdb63verifiesit. InstallthenewkernelintotheBOOTpartitionofyourmicroSD: sudocparch/arm/boot/zImage/media/BOOT/zImage Option2:DirectlyonErle Oncewe'vefinishedmakingthekernelwecanconnecttherobottotheUSBcableandlogin: user:root password:root Thestepsrequirednowaredescribedhere. Nomatterwhichmethodyouchoose,verifyyourinstallationafterwards: root@arm:~#uname-a Linuxarm3.8.13-rt9-00899-g40bdb63#1SMPPREEMPTWedFeb516:34:58CET2014armv7lGNU/Linux Adjustingtheclock Installcpufrequtils: apt-getinstallcpufrequtils Thenexecutecpufreq-info: cpufreq-info cpufrequtils007:cpufreq-info(C)DominikBrodowski2004-2009 Reporterrorsandbugstocpufreq@vger.kernel.org,please. analyzingCPU0: driver:generic_cpu0 CPUswhichrunatthesamehardwarefrequency:0 CPUswhichneedtohavetheirfrequencycoordinatedbysoftware:0 maximumtransitionlatency:300us. hardwarelimits:275MHz-720MHz availablefrequencysteps:275MHz,500MHz,600MHz,720MHz availablecpufreqgovernors:conservative,ondemand,userspace,powersave,performance currentpolicy:frequencyshouldbewithin275MHzand720MHz. Thegovernor"ondemand"maydecidewhichspeedtouse withinthisrange. currentCPUfrequencyis275MHz(assertedbycalltohardware). cpufreqstats:275MHz:nan%,500MHz:nan%,600MHz:nan%,720MHz:nan% Noweditnano/etc/default/cpufrequtilsandaddthefollowing: #validvalues:userspaceconservativepowersaveondemandperformance #getthemfromcat/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors GOVERNOR="performance" Nowreboot(shutdown-r0)andrunagaincpufreq-info: cpufreq-info cpufrequtils007:cpufreq-info(C)DominikBrodowski2004-2009 Reporterrorsandbugstocpufreq@vger.kernel.org,please. analyzingCPU0: driver:generic_cpu0 CPUswhichrunatthesamehardwarefrequency:0 CPUswhichneedtohavetheirfrequencycoordinatedbysoftware:0 maximumtransitionlatency:300us. hardwarelimits:275MHz-720MHz availablefrequencysteps:275MHz,500MHz,600MHz,720MHz availablecpufreqgovernors:conservative,ondemand,userspace,powersave,performance currentpolicy:frequencyshouldbewithin275MHzand720MHz. Thegovernor"performance"maydecidewhichspeedtouse withinthisrange. currentCPUfrequencyis720MHz(assertedbycalltohardware). cpufreqstats:275MHz:nan%,500MHz:nan%,600MHz:nan%,720MHz:nan% InstallingandMakingArduPilot Installgit,make,gawk,g++,arduino-coreonyourBBB apt-getinstallgitmakegawkg++arduino-core NowgettheArduPilotcode(43.40MB): gitclonegit://github.com/diydrones/ardupilot.git ConfiguretheArduCoptercode: cdardupilot/ArduCopter makeconfigure afileconfig.mkshouldhavebeencreatedattheardupilotdirectory(..).Editthisfileaccordingtoyourpreferences. Then: makelinux CompilingArduPilotintherobottakesapproximately5minutes.Aftertheprocesshasfinishedyouwillhaveanew directory/tmp/ArduCopter.build/containing: ArduCopter.cppArduCopter.elfArduCopter.maplibraries ArduCopter.dArduCopter.lstArduCopter.o fromthisdirectory,runtheArduCopter.elf. Sources: ArduPilotfortheBeagleBoneBlack OperatingSystems Erle-BrainusestheLinuxkernel,anopensourceUnix-likecomputeroperatingsystemkernel. TheLinuxkernelisawidelyusedoperatingsystemkernelworld-wide;theLinuxoperatingsystemisbasedonitand deployedonbothtraditionalcomputersystems,usuallyintheformofLinuxdistributions,andonembeddeddevices suchasrouters.TheAndroidoperatingsystemfortabletcomputersandsmartphonesisalsobasedontheLinux kernel. TheLinuxkernelwasinitiallyconceivedandcreatedin1991byFinnishcomputersciencestudentLinusTorvaldsfor hispersonalcomputerandwithnocross-platformintentions,buthassinceexpandedtosupportahugearrayof computerarchitectures,morethananyotheroperatingsystemorkernel.Linuxrapidlyattracteddevelopersand userswhoadaptedcodefromotherfreesoftwareprojectsforusewiththenewoperatingsystem. TheLinuxkernelAPI,theapplicationprogramminginterface(API)throughwhichuserprogramsinteractwiththe kernel,ismeanttobeverystableandtonotbreakuserspaceprograms(someprograms,suchasthosewithGUIs, relyonotherAPIsaswell).Aspartofthekernel'sfunctionality,devicedriverscontrolthehardware;"mainlined" devicedriversarealsomeanttobeverystable.However,theinterfacebetweenthekernelandloadablekernel modules(LKMs),unlikeinmanyotherkernelsandoperatingsystems,isnotmeanttobeverystablebydesign. Wikipedia BesidestheLinuxkernel,there'reseveralchoicesforthefilesystem.Belowwedescribesomeofthem: FileSystems Debian DebianisthenameforaLinuxdistributionthatiscomposedprimarilyoffreeandopen-sourcesoftware,mostofwhichis undertheGNUGeneralPublicLicense,andpackagedbyagroupofindividualsknownastheDebianproject. AsoneoftheearliestLinuxdistributions,itwasenvisionedthatDebianwastobedevelopedopenlyinthespiritofLinux andGNU.ThisvisiondrewtheattentionandsupportoftheFreeSoftwareFoundation,whichsponsoredtheprojectforthe firstpartofitslife. Aready-to-flyimageforErle-brainwithDebianisavailablehere. Ubuntu UbuntuisaDebian-basedLinuxoperatingsystem.ItisbasedonfreesoftwareandnamedaftertheSouthernAfrican philosophyofubuntu(literally,"human-ness"),whichoftenistranslatedas"humanitytowardsothers"or"thebeliefina universalbondofsharingthatconnectsallhumanity". DevelopmentofUbuntuisledbyUK-basedCanonicalLtd.,acompanyownedbySouthAfricanentrepreneurMark Shuttleworth.CanonicalgeneratesrevenuethroughthesaleoftechnicalsupportandotherservicesrelatedtoUbuntu.The Ubuntuprojectispubliclycommittedtotheprinciplesofopensourcedevelopment;peopleareencouragedtousefree software,studyhowitworks,improveuponit,anddistributeit. Ångström TheÅngströmdistributionisaLinuxdistributionforavarietyofembeddeddevices.Thedistributionistheresultofa unificationofdevelopersfromtheOpenZaurus,OpenEmbedded,andOpenSIMpadprojects. AmongstotheroptionstheuserinterfaceinoneofthereferencebuildsachieveablewithBitBakeistheGPEPalmtop Environment.Ångströmusesopkgforpackagemanagement. Android Androidisamobileoperatingsystem(OS)basedontheLinuxkernelandcurrentlydevelopedbyGoogle.It'suser interface-oriented,Androidisdesignedprimarilyfortouchscreenmobiledevicessuchassmartphonesandtablet computers,withspecializeduserinterfacesfortelevisions(AndroidTV),cars(AndroidAuto),andwristwatches(Android Wear).TheOSusestouchinputsthatlooselycorrespondtoreal-worldactions,likeswiping,tapping,pinching,andreverse pinchingtomanipulateon-screenobjects,andavirtualkeyboard.Despitebeingprimarilydesignedfortouchscreeninput,it alsohasbeenusedingameconsoles,digitalcameras,regularPCs(e.g.theHPSlate21)andotherelectronics. Howaboutrobotics;)? Doyouneedanspecificdistributionorfilesystem?.Letusknowandwe'llworktogetherwithyoutobringit. RealTime ThissectionwillcoverarealtimeanalysisofErleBrain. SCHED_DEBUGAPMparameter WithintheAPMparameters,SCHED_DEBUGallowsyoutoseethedebuggingmessagesofthescheduler.Theoptionsofthe parameterare: VALUE MEANING 0 Disabled 2 ShowSlips 3 ShowOverruns Settingtheparameterto2printsoutthefollowing: PERF:3/100023319 PERF:5/100021594 PERF:5/100022235 PERF:4/100020590 PERF:6/100022863 PERF:5/100023568 PERF:5/100023275 PERF:4/100021487 PERF:3/100022118 PERF:3/100023658 PERF:4/100023123 PERF:4/100023441 PERF:3/100018775 Thefirstnumberwithinthese"PERF"printoutsshowthenumberofloopsthattooklongerthanexpected(e.g.ifthe autopilotisrunningat100Hzthenweexpecttaskstobecompletedwithin10ms). Thesecondnumberrepresentsthemaximumtimeacycletookinmilliseconds. Threadpriorities root@beaglebone:~#ps-eouser,pid,nice,pri,rtprio,command USERPIDNIPRIRTPRIOCOMMAND root1019-/lib/systemd/systemd root2019-[kthreadd] root3019-[ksoftirqd/0] root5-2039-[kworker/0:0H] root7-2039-[kworker/u:0H] root8-13999[migration/0] root9019-[rcu_preempt] root10019-[rcu_bh] root11019-[rcu_sched] root12-13999[watchdog/0] root13-2039-[khelper] root14019-[kdevtmpfs] root15-2039-[netns] root17019-[bdi-default] root18-2039-[kintegrityd] root19-2039-[kblockd] root20019-[khubd] root21-9050[irq/70-44e0b000] root22019-[kworker/u:1] root25-9050[irq/7-tps65217] root28-9050[irq/30-4819c000] root37-2039-[rpciod] root39019-[khungtaskd] root40019-[kswapd0] root41019-[fsnotify_mark] root42-2039-[nfsiod] root43-2039-[crypto] root46-2039-[pencrypt] root47-2039-[pdecrypt] root54-2039-[OMAPUART0] root56-2039-[kpsmoused] root57-9050[irq/134-mmc0] root69-2039-[binder] root70-2039-[deferwq] root71019-[kworker/u:2] root74019-[mmcqd/1] root75019-[mmcqd/1boot0] root76019-[mmcqd/1boot1] root126-2039-[kworker/0:1H] root175019-[jbd2/mmcblk0p2-] root176-2039-[ext4-dio-unwrit] root207019-[kworker/0:2] root209019-/lib/systemd/systemd-journald root221019-/sbin/udevd root305019-/sbin/udevd root306019-/sbin/udevd avahi570019-avahi-daemon:running[beaglebone.local] root577019-/usr/sbin/acpid 101587019-/usr/bin/dbus-daemon--system--address=systemd: root590019-/bin/bash/etc/init.d/apm4-startup.sh root594019-/sbin/wpa_supplicant-u-s-O/var/run/wpa_suppl root595019-/usr/bin/nodeautorun.js root599019-/lib/systemd/systemd-logind root603019-/usr/sbin/rsyslogd-n-c5 root629019-/sbin/agettytty138400 root631019-/sbin/agetty-sttyO0115200384009600 avahi653019-avahi-daemon:chroothelper root661019-[spi1] root674019-[spi2] root686-2039-[OMAPUART5] xrdp691019-/usr/sbin/xrdp root697-2039-[OMAPUART4] root774019-/usr/sbin/xrdp-sesman root795-2039-[OMAPUART2] root835019-/usr/sbin/cron root838019-[file-storage] root851019-/usr/sbin/sshd root910019-/sbin/agetty-sttyGS0115200384009600 root1020019-/bin/bash/etc/init.d/apm4-startup.sh root1025-5212./ArduCopter.elf-Audp:192.168.7.1:6000-B/dev root1047019-sshd:root@pts/0 root1049019--bash root1076019-sshd:root@pts/1 root1078019--bash root1109019-[kworker/0:0] root1110019-stress--cpu8--io8--vm2--vm-bytes128M root1111019-stress--cpu8--io8--vm2--vm-bytes128M root1112019-stress--cpu8--io8--vm2--vm-bytes128M root1113019-stress--cpu8--io8--vm2--vm-bytes128M root1114019-stress--cpu8--io8--vm2--vm-bytes128M root1115019-stress--cpu8--io8--vm2--vm-bytes128M root1116019-stress--cpu8--io8--vm2--vm-bytes128M root1117019-stress--cpu8--io8--vm2--vm-bytes128M root1118019-stress--cpu8--io8--vm2--vm-bytes128M root1119019-stress--cpu8--io8--vm2--vm-bytes128M root1120019-stress--cpu8--io8--vm2--vm-bytes128M root1121019-stress--cpu8--io8--vm2--vm-bytes128M root1122019-stress--cpu8--io8--vm2--vm-bytes128M root1123019-stress--cpu8--io8--vm2--vm-bytes128M root1124019-stress--cpu8--io8--vm2--vm-bytes128M root1125019-stress--cpu8--io8--vm2--vm-bytes128M root1126019-stress--cpu8--io8--vm2--vm-bytes128M root1127019-stress--cpu8--io8--vm2--vm-bytes128M root1128019-stress--cpu8--io8--vm2--vm-bytes128M root1129019-[flush-179:0] root1132019-ps-eouser,pid,nice,pri,rtprio,command Linuxkernel TheLinuxkernelhasnotbeendesignedtomeetreal-timeconstraintshowevertherearesometechniquesthatcanhelp tunethekerneltomeetingcertaindeadlines.Fourkernelshavebeenevaluated(someavailablehere): ThefollowingtestswillbeformedwithavanillakernelcompiledwiththePREEMPToption.Wewillmakeuseofcylictests codeandwewillalsotorturethekernelwithstresstoobtainthemaximumlatencies. Torturingthekernel ForthispurposeweusethestressLinuxcommandlinetool. Whilerunningtheautopilotandusing: stress--cpu8--io8--vm2--vm-bytes128M Wecanseethattheloadofthesystemraisesupto17approximately: root@beaglebone:~#uptime 03:20:20up14min,3users,loadaverage:17.07,7.86,3.21 Let'spushabitmorelaunchingmorethreadsandiooperations: stress--cpu64--io64--vm2--vm-bytes128M Withthis,theuptimecommandreturns: root@beaglebone:~#uptime 03:27:10up21min,3users,loadaverage:129.08,81.93,36.63 Runningcyclictests Nowthatwehavetheprocessorstressedweusecyclicteststomeasurethelatencies(us): root@beaglebone:~#cyclictest-t1-p80-n-i10000-l10000 #/dev/cpu_dma_latencysetto0us policy:fifo:loadavg:0.470.650.441/981312 T:0(1307)P:80I:10000C:3892Min:19Act:26Avg:67Max:13743 Clockproblems SometimeswhencompilingorfetchingfilesfromtheInternetyougeterrorssuchas: error:newlycreatedfileisolderthandistributedfiles! InordertofixthisissueyouhavetousethefollowingcommandinUbuntu: sudontpdatepool.ntp.org (InAngstromyoucanuse/usr/bin/ntpdate-b-s-upool.ntp.org) GettingstartedwiththePRU ThisshorttutorialwillexplainhowtogetstartedwiththeProgrammableRealtimeUnitSubSystemusingtheexamples providedattheBeagleBoardPRUpackage: FirstwegettheBeagleBoardPRUpackage: gitclonegit://github.com/beagleboard/am335x_pru_package.git cdam335x_pru_package/pru_sw/app_loader/interface makeCROSS_COMPILE=""#we'recompilingrightonthesystem,sononeedtocrosscompile Nowwecompilepasm: cd../../utils/pasm_source ./linuxbuild andfinallysomeexamples: cd../../example_apps Herewehavetochangethislinefor: PASM?=../utils/pasm Afterthatsmallchange,theexamplesshouldcross-compilenatively: makeCROSS_COMPILE="" Then,cdbiny: modprobeuio_pruss#loadthekernelmodule echoBB-BONE-PRU-01>/sys/devices/bone_capemgr.8/slots#activatethePRU ./PRU_memAccessPRUDataRam Theresultshouldlikelike: INFO:StartingPRU_memAccessPRUDataRamexample. INFO:Initializingexample. INFO:Executingexample. INFO:WaitingforHALTcommand. INFO:PRUcompletedtransfer. INFO:Exampleexecutedsuccesfully. Sources: Blogpost am335x_pru_package/#12 am335x_pru_package/#16 TheRobotOperativeSystem(ROS),poweringtheworld's robots Concepts TechnicalOverview Tutorials InstallingandConfiguringYourROSEnvironment NavigatingtheROSFilesystem CreatingaROSPackage BuildingaROSPackage UnderstandingROSNodes UnderstandingROSTopics WhatisROS? TheRobotOperativeSystem(ROS)isanopen-source,meta-operatingsystemforyourrobotmantainedbytheOpen SourceRoboticsFoundation(OSRF).Itprovidestheservicesyouwouldexpectfromanoperatingsystem,including hardwareabstraction,low-leveldevicecontrol,implementationofcommonly-usedfunctionality,message-passingbetween processes,andpackagemanagement.Italsoprovidestoolsandlibrariesforobtaining,building,writing,andrunningcode acrossmultiplecomputers.ROSissimilarinsomerespectsto'robotframeworks,'suchasPlayer,YARP,Orocos, CARMEN,Orca,MOOS,andMicrosoftRoboticsStudio. TheROSruntime"graph"isapeer-to-peernetworkofprocessesthatarelooselycoupledusingtheROScommunication infrastructure.ROSimplementsseveraldifferentstylesofcommunication,includingsynchronousRPC-stylecommunication overservices,asynchronousstreamingofdataovertopics,andstorageofdataonaParameterServer. ROSisnotarealtimeframework,thoughitispossibletointegrateROSwithrealtimecode.ROSalsohasseamless integrationwiththeOrocosReal-timeToolkit. Goals TheprimarygoalofROSistosupportcodereuseinroboticsresearchanddevelopment.ROSisadistributed frameworkofprocesses(akaNodes)thatenablesexecutablestobeindividuallydesignedandlooselycoupledatruntime. TheseprocessescanbegroupedintoPackagesandStacks,whichcanbeeasilysharedanddistributed.ROSalso supportsafederatedsystemofcodeRepositoriesthatenablecollaborationtobedistributedaswell.Thisdesign,fromthe filesystemleveltothecommunitylevel,enablesindependentdecisionsaboutdevelopmentandimplementation,butallcan bebroughttogetherwithROSinfrastructuretools. Insupportofthisprimarygoalofsharingandcollaboration,thereareseveralothergoalsoftheROSframework: Thin:ROSisdesignedtobeasthinaspossible--wewon'twrapyourmain()--sothatcodewrittenforROScanbe usedwithotherrobotsoftwareframeworks.AcorollarytothisisthatROSiseasytointegratewithotherrobotsoftware frameworks:ROShasalreadybeenintegratedwithOpenRAVE,Orocos,andPlayer. ROS-agnosticlibraries:thepreferreddevelopmentmodelistowriteROS-agnosticlibrarieswithcleanfunctional interfaces. Languageindependence:theROSframeworkiseasytoimplementinanymodernprogramminglanguage.Wehave alreadyimplementeditinPython,C++,andLisp,andwehaveexperimentallibrariesinJavaandLua. Easytesting:ROShasabuiltinunit/integrationtestframeworkcalledrostestthatmakesiteasytobringupandtear downtestfixtures. Scaling:ROSisappropriateforlargeruntimesystemsandforlargedevelopmentprocesses. OperativeSystems ROScurrentlyonlyrunsonUnix-basedplatforms.SoftwareforROSisprimarilytestedonUbuntuandMacOSX systems. Distributions ThefollowingdistributionshavebeentestedintherobotErle-Brain. BydefaulttheimagesprovidedforErle-BraincomewithROSpre-installedandfullyfunctional. Distro Releasedate Poster Instuctions ROSHydroMedusa September4th, 2013 Installation ROSGroovy Galapagos December31, 2012 Installation License SomeofthismaterialhasbeentakenfromtheROSwiki.Exceptwhereotherwisenoted,theROSwikiislicensedunder CreativeCommonsAttribution3.0. ROS:Concepts ROShasthreelevelsofconcepts:theFilesystemlevel,theComputationGraphlevel,andtheCommunitylevel.These levelsandconceptsaresummarizedbelowandlatersectionsgointoeachoftheseingreaterdetail. Inadditiontothethreelevelsofconcepts,ROSalsodefinestwotypesofnames:PackageResourceNamesandGraph ResourceNames,alsodiscussedbelow. Filesystemlevel ThefilesystemlevelconceptsmainlycoverROSresourcesthatyouencounterondisk,suchas: Packages:PackagesarethemainunitfororganizingsoftwareinROS.ApackagemaycontainROSruntime processes(nodes),aROS-dependentlibrary,datasets,configurationfiles,oranythingelsethatisusefullyorganized together.PackagesarethemostatomicbuilditemandreleaseiteminROS.Meaningthatthemostgranularthingyou canbuildandreleaseisapackage. Metapackages:MetapackagesarespecializedPackageswhichonlyservetorepresentagroupofrelatedother packages.Mostcommonlymetapackagesareusedasabackwardscompatibleplaceholderforconvertedrosbuild Stacks. PackageManifests:Manifests(package.xml)providemetadataaboutapackage,includingitsname,version, description,licenseinformation,dependencies,andothermetainformationlikeexportedpackages.Thepackage.xml packagemanifestisdefinedinREP-0127. Repositories:AcollectionofpackageswhichshareacommonVCSsystem.PackageswhichshareaVCSsharethe sameversionandcanbereleasedtogetherusingthecatkinreleaseautomationtoolbloom.Oftentheserepositories willmaptoconvertedrosbuildStacks.Repositoriescanalsocontainonlyonepackage. Message(msg)types:Messagedescriptions,storedinmy_package/msg/MyMessageType.msg,definethedata structuresformessagessentinROS. Service(srv)types:Servicedescriptions,storedinmy_package/srv/MyServiceType.srv,definetherequestand responsedatastructuresforservicesinROS. ComputationGraphlevel TheComputationGraphisthepeer-to-peernetworkofROSprocessesthatareprocessingdatatogether.Thebasic ComputationGraphconceptsofROSarenodes,Master,ParameterServer,messages,services,topics,andbags,allof whichprovidedatatotheGraphindifferentways. Theseconceptsareimplementedintheros_commrepository. Nodes:Nodesareprocessesthatperformcomputation.ROSisdesignedtobemodularatafine-grainedscale;a robotcontrolsystemusuallycomprisesmanynodes.Forexample,onenodecontrolsalaserrange-finder,onenode controlsthewheelmotors,onenodeperformslocalization,onenodeperformspathplanning,oneNodeprovidesa graphicalviewofthesystem,andsoon.AROSnodeiswrittenwiththeuseofaROSclientlibrary,suchasroscppor rospy. Master:TheROSMasterprovidesnameregistrationandlookuptotherestoftheComputationGraph.Withoutthe Master,nodeswouldnotbeabletofindeachother,exchangemessages,orinvokeservices. ParameterServer:TheParameterServerallowsdatatobestoredbykeyinacentrallocation.Itiscurrentlypartof theMaster. Messages:Nodescommunicatewitheachotherbypassingmessages.Amessageissimplyadatastructure, comprisingtypedfields.Standardprimitivetypes(integer,floatingpoint,boolean,etc.)aresupported,asarearraysof primitivetypes.Messagescanincludearbitrarilynestedstructuresandarrays(muchlikeCstructs). Topics:Messagesareroutedviaatransportsystemwithpublish/subscribesemantics.Anodesendsoutamessage bypublishingittoagiventopic.Thetopicisanamethatisusedtoidentifythecontentofthemessage.Anodethatis interestedinacertainkindofdatawillsubscribetotheappropriatetopic.Theremaybemultipleconcurrentpublishers andsubscribersforasingletopic,andasinglenodemaypublishand/orsubscribetomultipletopics.Ingeneral, publishersandsubscribersarenotawareofeachothers'existence.Theideaistodecoupletheproductionof informationfromitsconsumption.Logically,onecanthinkofatopicasastronglytypedmessagebus.Eachbushasa name,andanyonecanconnecttothebustosendorreceivemessagesaslongastheyaretherighttype. Services:Thepublish/subscribemodelisaveryflexiblecommunicationparadigm,butitsmany-to-many,one-way transportisnotappropriateforrequest/replyinteractions,whichareoftenrequiredinadistributedsystem.Request/ replyisdoneviaservices,whicharedefinedbyapairofmessagestructures:onefortherequestandoneforthereply. Aprovidingnodeoffersaserviceunderanameandaclientusestheservicebysendingtherequestmessageand awaitingthereply.ROSclientlibrariesgenerallypresentthisinteractiontotheprogrammerasifitwerearemote procedurecall. Bags:BagsareaformatforsavingandplayingbackROSmessagedata.Bagsareanimportantmechanismfor storingdata,suchassensordata,thatcanbedifficulttocollectbutisnecessaryfordevelopingandtestingalgorithms. TheROSMasteractsasanameserviceintheROSComputationGraph.Itstorestopicsandservicesregistration informationforROSnodes.NodescommunicatewiththeMastertoreporttheirregistrationinformation.Asthesenodes communicatewiththeMaster,theycanreceiveinformationaboutotherregisterednodesandmakeconnectionsas appropriate.TheMasterwillalsomakecallbackstothesenodeswhenthisregistrationinformationchanges,whichallows nodestodynamicallycreateconnectionsasnewnodesarerun. Nodesconnecttoothernodesdirectly;theMasteronlyprovideslookupinformation,muchlikeaDNSserver.Nodesthat subscribetoatopicwillrequestconnectionsfromnodesthatpublishthattopic,andwillestablishthatconnectionoveran agreeduponconnectionprotocol.ThemostcommonprotocolusedinaROSiscalledTCPROS,whichusesstandard TCP/IPsockets. Thisarchitectureallowsfordecoupledoperation,wherethenamesaretheprimarymeansbywhichlargerandmore complexsystemscanbebuilt.NameshaveaveryimportantroleinROS:nodes,topics,services,andparametersallhave names.EveryROSclientlibrarysupportscommand-lineremappingofnames,whichmeansacompiledprogramcanbe reconfiguredatruntimetooperateinadifferentComputationGraphtopology. Forexample,tocontrolaHokuyolaserrange-finder,wecanstartthehokuyo_nodedriver,whichtalkstothelaserand publishessensor_msgs/LaserScanmessagesonthescantopic.Toprocessthatdata,wemightwriteanodeusing laser_filtersthatsubscribestomessagesonthescantopic.Aftersubscription,ourfilterwouldautomaticallystartreceiving messagesfromthelaser. Notehowthetwosidesaredecoupled.Allthehokuyo_nodenodedoesispublishscans,withoutknowledgeofwhether anyoneissubscribed.Allthefilterdoesissubscribetoscans,withoutknowledgeofwhetheranyoneispublishingthem. Thetwonodescanbestarted,killed,andrestarted,inanyorder,withoutinducinganyerrorconditions. Laterwemightaddanotherlasertoourrobot,soweneedtoreconfigureoursystem.Allweneedtodoisremapthenames thatareused.Whenwestartourfirsthokuyo_node,wecouldtellitinsteadtoremapscantobase_scan,anddothesame withourfilternode.Now,bothofthesenodeswillcommunicateusingthebase_scantopicinsteadandnothearmessages onthescantopic.Thenwecanjuststartanotherhokuyo_nodeforthenewlaserrangefinder. Communitylevel TheROSCommunityLevelconceptsareROSresourcesthatenableseparatecommunitiestoexchangesoftwareand knowledge.Theseresourcesinclude: Distributions:ROSDistributionsarecollectionsofversionedstacksthatyoucaninstall.Distributionsplayasimilar roletoLinuxdistributions:theymakeiteasiertoinstallacollectionofsoftware,andtheyalsomaintainconsistent versionsacrossasetofsoftware. Repositories:ROSreliesonafederatednetworkofcoderepositories,wheredifferentinstitutionscandevelopand releasetheirownrobotsoftwarecomponents. TheROSWiki:TheROScommunityWikiisthemainforumfordocumentinginformationaboutROS.Anyonecansign upforanaccountandcontributetheirowndocumentation,providecorrectionsorupdates,writetutorials,andmore. BugTicketSystem:PleaseseeTicketsforinformationaboutfiletickets. MailingLists:Theros-usersmailinglististheprimarycommunicationchannelaboutnewupdatestoROS,aswellas aforumtoaskquestionsaboutROSsoftware. ROSAnswers:AQ&AsiteforansweringyourROS-relatedquestions. Blog:TheWillowGarageBlogprovidesregularupdates,includingphotosandvideos. Naming GraphResourceNames GraphResourceNamesprovideahierarchicalnamingstructurethatisusedforallresourcesinaROSComputation Graph,suchasNodes,Parameters,Topics,andServices.ThesenamesareverypowerfulinROSandcentraltohow largerandmorecomplicatedsystemsarecomposedinROS,soitiscriticaltounderstandhowthesenamesworkandhow youcanmanipulatethem. Beforewedescribenamesfurther,herearesomeexamplenames: /(theglobalnamespace) /foo /stanford/robot/name /wg/node1 GraphResourceNamesareanimportantmechanisminROSforprovidingencapsulation.Eachresourceisdefinedwithin anamespace,whichitmaysharewithmanyotherresources.Ingeneral,resourcescancreateresourceswithintheir namespaceandtheycanaccessresourceswithinorabovetheirownnamespace.Connectionscanbemadebetween resourcesindistinctnamespaces,butthisisgenerallydonebyintegrationcodeabovebothnamespaces.This encapsulationisolatesdifferentportionsofthesystemfromaccidentallygrabbingthewrongnamedresourceorglobally hijackingnames. Namesareresolvedrelatively,soresourcesdonotneedtobeawareofwhichnamespacetheyarein.Thissimplifies programmingasnodesthatworktogethercanbewrittenasiftheyareallinthetop-levelnamespace.WhentheseNodes areintegratedintoalargersystem,theycanbepusheddownintoanamespacethatdefinestheircollectionofcode.For example,onecouldtakeaStanforddemoandaWillowGaragedemoandmergethemintoanewdemowithstanfordand wgsubgraphs.IfbothdemoshadaNodenamed'camera',theywouldnotconflict.Tools(e.g.graphvisualization)aswell asparameters(e.g.demo_name)thatneedtobevisibletotheentiregraphcanbecreatedbytop-levelNodes. ValidNames Avalidnamehasthefollowingcharacteristics: 1. Firstcharacterisanalphacharacter([a-z|A-Z]),tilde(~)orforwardslash(/) 2. Subsequentcharacterscanbealphanumeric([0-9|a-z|A-Z]),underscores(_),orforwardslashes(/) Exception:basenames(describedbelow)cannothaveforwardslashes(/)ortildes(~)inthem. Resolving TherearefourtypesofGraphResourceNamesinROS:base,relative,global,andprivate,whichhavethefollowing syntax: base relative/name /global/name ~private/name Bydefault,resolutionisdonerelativetothenode'snamespace.Forexample,thenode/wg/node1hasthenamespace /wg,sothenamenode2willresolveto/wg/node2. Nameswithnonamespacequalifierswhatsoeverarebasenames.Basenamesareactuallyasubclassofrelativenames andhavethesameresolutionrules.Basenamesaremostfrequentlyusedtoinitializethenodename. Namesthatstartwitha"/"areglobal--theyareconsideredfullyresolved.Globalnamesshouldbeavoidedasmuchas possibleastheylimitcodeportability. Namesthatstartwitha"~"areprivate.Theyconvertthenode'snameintoanamespace.Forexample,node1in namespace/wg/hastheprivatenamespace/wg/node1.Privatenamesareusefulforpassingparameterstoaspecific nodeviatheparameterserver. Herearesomenameresolutionexamples: Node Relative(default) Global Private /node1 bar->/bar /bar->/bar ~bar->/node1/bar /wg/node2 bar->/wg/bar /bar->/bar ~bar->/wg/node2/bar /wg/node3 foo/bar->/wg/foo/bar /foo/bar->/foo/bar ~foo/bar->/wg/node3/foo/bar Remapping AnynamewithinaROSNodecanberemappedwhentheNodeislaunchedatthecommand-line.Formoreinformationon thisfeature,seeRemappingArguments. PackageResourceNames PackageResourceNamesareusedinROSwithFilesystem-Levelconceptstosimplifytheprocessofreferringtofilesand datatypesondisk.PackageResourceNamesareverysimple:theyarejustthenameofthePackagethattheresourceis inplusthenameoftheresource.Forexample,thenamestd_msgs/Stringreferstothe"String"messagetypeinthe "std_msgs"Package. SomeoftheROS-relatedfilesthatmaybereferredtousingPackageResourceNamesinclude: Message(msg)types Service(srv)types Nodetypes PackageResourceNamesareverysimilartofilepaths,excepttheyaremuchshorter.ThisisduetotheabilityofROSto locatePackagesondiskandmakeadditionalassumptionsabouttheircontents.Forexample,Messagedescriptionsare alwaysstoredinthemsgsubdirectoryandhavethe.msgextension,sostd_msgs/Stringisshorthandfor path/to/std_msgs/msg/String.msg.Similarly,theNodetypefoo/barisequivalenttosearchingforafilenamedbarin Packagefoowithexecutablepermissions. ValidNames PackageResourceNameshavestrictnamingrulesastheyareoftenusedinauto-generatedcode.Forthisreason,aROS packagecannothavespecialcharactersotherthananunderscore,andtheymuststartwithanalphabeticalcharacter.A validnamehasthefollowingcharacteristics: 1. Firstcharacterisanalphacharacter([a-z|A-Z]) 2. Subsequentcharacterscanbealphanumeric([0-9|a-z|A-Z]),underscores(_)oraforwardslash(/) 3. Thereisatmostoneforwardslash('/'). TechnicalOverview ThistechnicaloverviewgoesintogreaterdetailabouttheimplementationofROS.MostROSusersdonotneedtoknow thesedetails,buttheyareimportantforthosewishingtowritetheirownROSclientlibrariesorthosewishingtointegrate othersystemswithROS. ThistechnicaloverviewassumesthatyouarealreadyfamiliarwiththeROSsystemanditsconcepts.Forexample,the ROSconceptualoverviewprovidesanoverviewoftheComputationGrapharchitecture,includingtheroleoftheROS Masterandnodes. Master TheMasterisimplementedviaXMLRPC,whichisastateless,HTTP-basedprotocol.XMLRPCwaschosenprimarilybecause itisrelativelylightweight,doesnotrequireastatefulconnection,andhaswideavailabilityinavarietyofprogramming languages.Forexample,inPython,youcanstartanyPythoninterpreterandbegininteractingwiththeROSMaster: $python >>>fromxmlrpclibimportServerProxy >>>importos >>>master=ServerProxy(os.environ['ROS_MASTER_URI']) >>>master.getSystemState('/') [1,'currentsystemstate',[[['/rosout_agg',['/rosout']]],[['/time',['/rosout']],['/rosout',['/rosout']],['/clock' TheMasterhasregistrationAPIs,whichallownodestoregisteraspublishers,subscribers,andserviceproviders.The MasterhasaURIandisstoredintheROS_MASTER_URIenvironmentvariable.ThisURIcorrespondstothehost:portofthe XML-RPCserveritisrunning.Bydefault,theMasterwillbindtoport11311. Formoreinformation,includinganAPIlisting,pleaseseeMasterAPI. ParameterServer AlthoughtheParameterServerisactuallypartoftheROSMaster,wediscussitsAPIasaseparateentitytoenable separationinthefuture. LiketheMasterAPI,theParameterServerAPIisalsoimplementedviaXMLRPC.TheuseofXMLRPCenableseasy integrationwiththeROSclientlibrariesandalsoprovidesgreatertypeflexibilitywhenstoringandretrievingdata.The ParameterServercanstorebasicXML-RPCscalars(32-bitintegers,booleans,strings,doubles,iso8601dates), lists,andbase64-encodedbinarydata.TheParameterServercanalsostoredictionaries(i.e.structs),butthesehavea specialmeaning. TheParameterServerusesadictionary-of-dictionaryrepresentationfornamespaces,whereeachdictionary representsalevelinthenaminghierarchy.Thismeansthateachkeyinadictionaryrepresentsanamespace.Ifavalueisa dictionary,theParameterServerassumesthatitisstoringthevaluesofanamespace.Forexample,ifyouweretosetthe parameter/ns1/ns2/footothevalue1,thevalueof/ns1/ns2/wouldbeadictionary{foo:1}andthevalueof/ns1/ wouldbeadictionary{ns2:{foo:1}}. TheXMLRPCAPImakesitveryeasytointegrateParameterServercallswithoutevenhavingtouseaROSclientlibrary. AssumingyouhaveaccesstoanXMLRPCclientlibrary,youcanmakecallsdirectly.Forexample: $python >>>fromxmlrpclibimportServerProxy >>>importos >>>ps=ServerProxy(os.environ['ROS_MASTER_URI']) >>>ps.getParam('/','/foo') [-1,'Parameter[/bar]isnotset',0] >>>ps.setParam('/','/foo','value') [1,'parameter/fooset',0] >>>ps.getParam('/','/foo') [1,'Parameter[/foo]','value'] PleaseseeParameterServerAPIforadetailedAPIlisting. Node AROSnodehasseveralAPIs: 1. AslaveAPI.TheslaveAPIisanXMLRPCAPIthathastworoles:receivingcallbacksfromtheMaster,andnegotiating connectionswithothernodes.ForadetailedAPIlisting,pleaseseeSlaveAPI. 2. Atopictransportprotocolimplementation(seeTCPROSandUDPROS).Nodesestablishtopicconnectionswitheach otherusinganagreedprotocol.ThemostgeneralprotocolisTCPROS,whichusespersistent,statefulTCP/IPsocket connections. 3. Acommand-lineAPI.Everynodeshouldsupportcommand-lineremappingarguments,whichenablenameswithina nodetobeconfiguredatruntime. EverynodehasaURI,whichcorrespondstothehost:portoftheXMLRPCserveritisrunning.TheXMLRPCserverisnot usedtotransporttopicorservicedata:instead,itisusedtonegotiateconnectionswithothernodesandalsocommunicate withtheMaster.ThisserveriscreatedandmanagedwithintheROSclientlibrary,butisgenerallynotvisibletotheclient libraryuser.TheXMLRPCservermaybeboundtoanyportonthehostwherethenodeisrunning. TheXMLRPCserverprovidesaSlaveAPI,whichenablesthenodetoreceivepublisherupdatecallsfromtheMaster. ThesepublisherupdatescontainatopicnameandalistofURIsfornodesthatpublishthattopic.TheXMLRPCserverwill alsoreceivecallsfromsubscribersthatarelookingtorequesttopicconnections.Ingeneral,whenanodereceivesa publisherupdate,itwillconnecttoanynewpublishers. Topictransportsarenegotiatedwhenasubscriberrequestsatopicconnectionusingthepublisher'sXMLRPCserver.The subscribersendsthepublisheralistofsupportedprotocols.Thepublisherthenselectsaprotocolfromthatlist,suchas TCPROS,andreturnsthenecessarysettingsforthatprotocol(e.g.anIPaddressandportofaTCP/IPserversocket).The subscriberthenestablishesaseparateconnectionusingtheprovidedsettings. TopicTransports Therearemanywaystoshipdataaroundanetwork,andeachhasadvantagesanddisadvantages,dependinglargelyon theapplication.TCPiswidelyusedbecauseitprovidesasimple,reliablecommunicationstream.TCPpacketsalways arriveinorder,andlostpacketsareresentuntiltheyarrive.WhilegreatforwiredEthernetnetworks,thesefeaturesbecome bugswhentheunderlyingnetworkisalossyWiFiorcellmodemconnection.Inthissituation,UDPismoreappropriate. Whenmultiplesubscribersaregroupedonasinglesubnet,itmaybemostefficientforthepublishertocommunicatewith allofthemsimultaneouslyviaUDPbroadcast. Forthesereasons,ROSdoesnotcommittoasingletransport.GivenapublisherURI,asubscribingnodenegotiatesa connection,usingtheappropriatetransport,withthatpublisher,viaXMLRPC.Theresultofthenegotiationisthatthetwo nodesareconnected,withmessagesstreamingfrompublishertosubscriber. Eachtransporthasitsownprotocolforhowthemessagedataisexchanged.Forexample,usingTCP,thenegotiation wouldinvolvethepublishergivingthesubscribertheIPaddressandportonwhichtocallconnect.Thesubscriberthen createsaTCP/IPsockettothespecifiedaddressandport.ThenodesexchangeaConnectionHeaderthatincludes informationliketheMD5sumofthemessagetypeandthenameofthetopic,andthenthepublisherbeginssending serializedmessagedatadirectlyoverthesocket. Toemphasize,nodescommunicatedirectlywitheachother,overanappropriatetransportmechanism.Datadoesnotroute throughthemaster.DataisnotsentviaXMLRPC.TheXMLRPCsystemisusedonlytonegotiateconnectionsfordata. Developerlinks: ROS/TCPROS ROS/UDPROS MessageserializationandmsgMD5sums Messagesareserializedinaverycompactrepresentationthatroughlycorrespondstoac-struct-likeserializationofthe messagedatainlittleendianformat.Thecompactrepresentationmeansthattwonodescommunicatingmustagreeonthe layoutofthemessagedata. Messagetypes(msgs)inROSareversionedusingaspecialMD5sumcalculationofthemsgtext.Ingeneral,client librariesdonotimplementthisMD5sumcalculationdirectly,insteadstoringthisMD5suminauto-generatedmessage sourcecodeusingtheoutputofroslib/scripts/gendeps.Forreference,thisMD5sumiscalculatedfromtheMD5textof the.msgfile,wheretheMD5textisthe.msgtextwith: commentsremoved whitespaceremoved packagenamesofdependenciesremoved constantsreorderedaheadofotherdeclarations Inordertocatchchangesthatoccurinembeddedmessagetypes,theMD5textisconcatenatedwiththeMD5textofeach oftheembeddedtypes,intheorderthattheyappear. Establishingatopicconnection Puttingitalltogether,thesequencebywhichtwonodesbeginexchangingmessagesis: 1. Subscriberstarts.Itreadsitscommand-lineremappingargumentstoresolvewhichtopicnameitwilluse.(Remapping Arguments) 2. Publisherstarts.Itreadsitscommand-lineremappingargumentstoresolvewhichtopicnameitwilluse.(Remapping Arguments) 3. SubscriberregisterswiththeMaster.(XMLRPC) 4. PublisherregisterswiththeMaster.(XMLRPC) 5. MasterinformsSubscriberofnewPublisher.(XMLRPC) 6. SubscribercontactsPublishertorequestatopicconnectionandnegotiatethetransportprotocol.(XMLRPC) 7. PublishersendsSubscriberthesettingsfortheselectedtransportprotocol.(XMLRPC) 8. SubscriberconnectstoPublisherusingtheselectedtransportprotocol.(TCPROS,etc...) TheXMLRPCportionofthiswilllooklike: /subscriber_node→master.registerSubscriber(/subscriber_node,/example_topic,std_msgs/String,http://hostname:1234) Masterreturnsthattherearenoactivepublishers. /publisher_node→master.registerPublisher(/publisher_node,/example_topic,std_msgs/String,http://hostname:5678) Masternoticesthat/subscriber_nodeisinterestedin/example_topic,soitmakesacallbacktothesubscriber master→subscriber.publisherUpdate(/publisher_node,/example_topic,[http://hostname:5678]) Subscribernoticesthatithasnotconnectedtohttp://hostname:5678yet,soitcontactsittorequestatopic. subscriber→publisher.requestTopic(/subscriber_node,/example_topic,[[TCPROS]]) PublisherreturnsTCPROSastheselectedprotocol,sosubscribercreatesanewconnectiontothepublishersTCPROS host:port. Establishingaserviceconnection Wehavenotdiscussedservicesasmuchinthisoverview,buttheycanbeviewedasasimplifiedversionoftopics. Whereastopicscanhavemanypublishers,therecanonlybeasingleserviceprovider.Themostrecentnodetoregister withthemasterisconsideredthecurrentserviceprovider.Thisallowsforamuchsimplersetupprotocol--infact,aservice clientdoesnothavetobeaROSnode. 1. ServiceregisterswithMaster 2. ServiceclientlooksupserviceontheMaster 3. ServiceclientcreatesTCP/IPtotheservice 4. ServiceclientandserviceexchangeaConnectionHeader 5. Serviceclientsendsserializedrequestmessage 6. Servicereplieswithserializedresponsemessage. Ifthelastseveralstepslookfamiliar,itsbecausetheyareanextensionoftheTCPROSprotocol.Infact,rospyandroscpp bothusethesameTCP/IPserversockettoreceivebothtopicandserviceconnections. AsthereisnocallbackfromtheMasterwhenanewserviceisregistered,manyclientlibrariesprovidea"waitforservice" APImethod,thatsimplypollstheMasteruntilaserviceregistrationappears. InterestinglinksfromArduPilot: ParameterList UsingtheCommandLineInterface(CLI)toconfigureArduCopter APM:CopterCodeOverview 3DRRadios: Manual Using3DRRadios Using3DRradios,plannerversion MotorSetupforthedifferentconfigurations Vehicles TheErle-Braincanbeintegratedindifferentvehiclesthankstoitsmodularity.ThePixHawkFirecapehasbeendesignto supportAPM(ardupilot)projecttherebyitcanbeusedindifferentvehiclesandconfigurations. Thisarethevehiclesthatweoffer: Erle-Copter Erle-Plane Erle-Rover ThisvehiclesareavailablefromtheErleRoboticsstore Thisspecificsolutionsarenottheonlyones,inthefuture,wearesurethatnewvehicleswillbereleased. Erle-Copter Erle-CopterisaLinux-baseddrone.Ifyouwantmoreinformationcheckthevehicle'sspecificbookorourwebpage. Erle-CoptercanbepurchsasedfromErleRoboticsstore. Erle-CopterConnections Inordertoflyproperlythedrone,theconnectionsbetweenErle-Brainanddrone'sESCs,RCreceiverandGPSneedstobe doneproperly. Thenextimagesshowshowtodoso: Erle-Plane Erle-planeisthefirstLinux-basedplane.Ifmoreinformationiswanted,checkourwebpage Erle-PlaneConnections Inordertoflyproperlytheplane,theconnectionsbetweenErle-Brainandplane'sESC,servo,RCreceiverandGPSneeds tobedoneproperly. Thenextimagesshowshowtodoso: Erle-Rover Erle-roveisthefirstLinux-basedrover,thisvehiclehasbeenspeciallydevelopedforeducationalpurposes.Ifmore informationiswanted,checkourwebpage Erle-roverConnections Inordertoroadproperlytherover,theconnectionsbetweenErle-Brainandrove'sESCs,RCreceiverandGPSneedstobe doneproperly. Thenextimagesshowshowtodoso: Tutorials Intihssectionyouwillfinddifferenttutorials.Someofthemareintendedtolearnbasicsofprogramminglanguagesusing Erle-Brain,suchusC++orPython.Others,havebeencreatedinordertolearnLinuxbasics,autopilot,ROS,... Peripherals BlinkaLED BlinkaLEDinC++ Miscelaneous Backup CopyimagetomicroSDcard ExpandingtheFileSystemPartitionontheSD ResizeyourmicroSDcard Howtofetserialoverusb HowtoinstantiateI2Cfromtheuserspace ROStutorials InstallingandConfiguringYourROSEnvironment NavigatingtheROSFilesystem CreatingaROSPackage BuildingaROSPackage UnderstandingROSNodes UnderstandingROSTopics OtherGitBooks Besidesthetutorialsweprovidehere,there'remoreGitBooksavailable: LearnbasicLinux/Unix IntroductiontoNetworkinginLinux LearnPython LearnPythonNetworking LearnC++ Peripherals BlinkaLED,soundaBuzzer,readasensorusingI2C,etc. Helloworldinrobotics:blinkaLED Goal InthistutorialwewilldiveintotheapracticalexamplethatteacheshowtomakeoneoftherobotLEDsblink(thehello worldinrobotics). Material Inordertofollowthetutorialyouwillneed: TherobotErle An8GBmicroSDcard(otherscanbeused)withtheUbuntuLinuxDistributionthatweprovide. a(male)USB-to-miniUSB Acomputerwithaserialterminalinstalled(youcanusePuTTyinWindowsorminicominUnix-basedOSs) Tutorial ErlehasfouruserLEDS,usr0-usr3accesiblethroughtthesysfsinterfaceat/sys/class/leds.Thisinterfaceabstractsthe LEDsasfileswhichmeansthatwecanactuallycontrolhowtheseLEDsbehavewritinginafile.Cool,isn'tit? WewillmakeblinkoneoftheonboardUSERLedsthroughsimplebashshellcommands. First,moveyourselftotheLEDssysfsdir: cd/sys/class/leds Ifyoucheckthecontentofthisdirectory(ls)youshouldseesomethinglikethis: erlerobot:green:usr0@ erlerobot:green:usr1@ erlerobot:green:usr2@ erlerobot:green:usr3@ EachofthisdirectoriesallowsyoutointerfacewithitscorrespondingLEDandhasasetoffilesthatallowyoutoperform differenttasks.Forexample,let'splaywiththeusr0: cderlerobot:green:usr0@ ls Thecontentoflisting(doingls)thisdirectoryshouldbe: brightnessdevice@max_brightnesspower/subsystem@triggeruevent Aswesaidbefore,thesefilesallowyoutocontroltheLEDsbywrittingonthembutwecanalsocheckwhattheyaredoing rightnowbyreadingthem.Simpleblinkingcanbeachievedbywrittingonthebrightnessfile.ToswitchtheLEDusr0on type: echo1>brightness andtoswitchitofftype: echo0>brightness Exercise PutLEDusr0inheartbeatmode: #writeinhere #thesolution(assumesthatyou'reattheusr0directory) echo"heartbeat">trigger BlinkaLEDinC++ Goal InthistutorialwewillexplainhowtomakeaprograminC++thatwillswitchonandoffoneoftherobot'sLED.The programwillbecalledledc++: ledc++[parameter] parameterwillbeeitheron,off,flashorstatus. Material Inordertofollowthetutorialyouwillneed: TherobotErle An8GBmicroSDcard(otherscanbeused)withtheUbuntuLinuxDistributionthatweprovide. a(male)USB-to-miniUSB Acomputerwithaserialterminalinstalled(youcanusePuTTyinWindowsorminicominUnix-basedOSs) Tutorial Createablankfilecalledledc++.cpp: touchledc++.cpp Editthefile(wepersonallylikevimbutfeelfreetolearnanyeditoryoulike)andaddthefollowingcontent: /**SimpleOn-boardLEDflashingprogram-writtenbyDerekMolloy fortheee402module ThisprogramusesUSRLED0andcanbeexecutedinthreeways: makeLEDon makeLEDoff makeLEDflash(flashat100msintervals-on50ms/off50ms) makeLEDstatus(getthetriggerstatus) */ #include<iostream> #include<fstream> #include<string> usingnamespacestd; #defineLED0_PATH"/sys/class/leds/beaglebone:green:usr0" voidremoveTrigger(){ //removethetriggerfromtheLED std::fstreamfs; fs.open(LED0_PATH"/trigger",std::fstream::out); fs<<"none"; fs.close(); } intmain(intargc,char*argv[]){ if(argc!=2){ cout<<"UsageismakeLEDandoneof:on,off,flashorstatus" <<endl; cout<<"e.g.makeLEDflash"<<endl; } stringcmd(argv[1]); std::fstreamfs; cout<<"StartingtheLEDflashprogram"<<endl; cout<<"TheLEDPathis:"<<LED0_PATH<<endl; //selectwhetheritison,offorflash if(cmd=="on"){ removeTrigger(); fs.open(LED0_PATH"/brightness",std::fstream::out); fs<<"1"; fs.close(); } elseif(cmd=="off"){ removeTrigger(); fs.open(LED0_PATH"/brightness",std::fstream::out); fs<<"0"; fs.close(); } elseif(cmd=="flash"){ fs.open(LED0_PATH"/trigger",std::fstream::out); fs<<"timer"; fs.close(); fs.open(LED0_PATH"/delay_on",std::fstream::out); fs<<"50"; fs.close(); fs.open(LED0_PATH"/delay_off",std::fstream::out); fs<<"50"; fs.close(); } elseif(cmd=="status"){ //displaythecurrenttriggerdetails fs.open(LED0_PATH"/trigger",std::fstream::in); stringline; while(getline(fs,line))cout<<line; fs.close(); } else{ cout<<"Invalidcommand"<<endl; } cout<<"FinishedtheLEDflashprogram"<<endl; return0; } Nowcompilethecode: g++ledc++.cpp-oledc++ Finally,trycallingtheprogramwiththedifferentarguments[on,off,flashorstatus]: ./ledc++on MISCELANEOUS Inthissectionyouwillfindsomehelpfulhowtos. Index Backup CopyimagetomicroSDcard ExpandingtheFileSystemPartitionontheSD ResizeyourmicroSDcard Howtofetserialoverusb HowtoinstantiateI2Cfromtheuserspace Backup ThefollowingstepsdescribehowtobackupthecontentofyourmicroSDcardcopyingtheimagetoacompressedfile namederleimage.img.gz: ConnectthemicroSDcardtoyourcomputerusingaUSBadapteroraSDone(ifyourcomputersupportsit). Openaterminalandfigureoutthewhatistheinterfaceunder/dev(Linuxsystems,inMacOSit'susuallymounted under/Volumes)whereyourmicroSDhasbeenmounted.Let'ssuppose/dev/sdc. Backupthecontent: sudoddif=/dev/sdcbs=8M|gzip-c>erleimage.img.gz (Note:inMacOSthe8Mshouldbesubstitutedby8m.Forexample:sudoddif=/dev/disk1bs=8m|gzip-c>wheezy-rt3.8.13_9-2-14.img.gz) CopyimagetomicroSDcard Linux ThefollowingstepsdescribehowtocopyanimagetothemicroSDcard.Theusuallywillcontainthebootloader,the LinuxKernelandaFileSystem(eitherÅngströmorUbuntu,othersarepossible)fortherobotErle: Fetchtheimage. Assumingtheimagenameiserlerobot-ubuntu.img.gz,andyourmicroSDismountedunder/dev/sdb(usuallyislike thisinLinux)dothefollowingintheLinuxterminal: zcaterlerobot-ubuntu.img.gz|sudoddof=/dev/sdbbs=8M (Note:inMacOSthe8Mshouldbesubstitutedby8m) InordertomakesurethatallthecontenthasbeencopiedtothemicroSDcard,introduceintheterminal: sync EjectyourmicroSDcardandconnectittoErle.Itshouldbereadytofly;). Alternativelyifyouhaveanimageofthekinderlerobot-ubuntu.tar.xzthenyoushouldusethefollowingcommand: xz-dkcerlerobot-ubuntu.tar.xz>/dev/sdb DoitinMacOS diskutillist diskutilunmountDisk/dev/disk2 sudoddif=~/Downloads/erle-debian-11-12-14.imgof=/dev/rdisk2bs=4mconv=sync,notrunc,noerror DoitinWindows ToburnanimagetoanSDcardinwindowsyoufirstneedthefollowingtools: 7-ziporotherdecompressorthatcanextractgzippedfile(extensiongz). ImageWriterforWindowstowritetheimgfiletotheSDCard. AlaptopwithSDCardreader,oranexternalUSBSDCardreader. Here’stheproceduretopreparetheSDCard DownloadUbuntugzippedimagefileforOMAP4boards. Extractimgfileusing7-zip. InsertSDCardintoreader. ExecuteWin32DiskImager.exe–itrequestsadminprivilegesonWindows7. Selecttheimagefile. SelectthedevicethatcorrespondstotheSDCardreader. Writetheimagefile.Thiswilltakeawhile. EjecttheSDCard. ExpandingtheFileSystemPartitiononthemicroSD Generallystoragedevicesneedssomestructurethatallowstheoperatingsystemtolocateandcreatenewfiles.Thisis donebyusingPartitionsandFilesystems.Apartitionisasectionofastoragedevice,whichisformattedwithaFile System,ontowhichtheoperatingsystemcreatesadirectorystructure.ByexpandingtheFileSystemsinthemicroSDcard wecanutilizetherestoftheplaceforstoragepurpose.StepsforExpandingtheFileSystemsinExternalmicroSDcard: InsertthemicroSDcardintherobot,bootandlocateyourpartition.lsblkanddf-hhelpmefigureitout: $lsblk NAMEMAJ:MINRMSIZEROTYPEMOUNTPOINT mmcblk0179:007.5G0disk |-mmcblk0p1179:1048M0part/boot/uboot `-mmcblk0p2179:207.4G0part/ $df-h FilesystemSizeUsedAvailUse%Mountedon /dev/mmcblk0p27.2G3.3G3.6G49%/ devtmpfs122M4.0K122M1%/dev none25M200K25M1%/run none5.0M05.0M0%/run/lock none122M0122M0%/run/shm /dev/mmcblk0p148M9.4M39M20%/boot/uboot TomanageaDiskpartitionswehavetouse`fdiskcommand: $fdisk/dev/mmcblk0 ThenenterpitshouldthesizeofyourSDcard.DependingonthesizeofyourSDcard,valuesmaychange: $fdisk/dev/mmcblk0 Command(mforhelp):p Disk/dev/mmcblk0:8010MB,8010072064bytes 4heads,16sectors/track,244448cylinders,total15644672sectors Units=sectorsof1*512=512bytes Sectorsize(logical/physical):512bytes/512bytes I/Osize(minimum/optimal):512bytes/512bytes Diskidentifier:0x00000000 DeviceBootStartEndBlocksIdSystem /dev/mmcblk0p1*204810035149152eW95FAT16(LBA) /dev/mmcblk0p210035215523839771174483Linux Enterdcommandtodeleteapartitionandmentionthepartitionnumberas2.Enteringpagainwillshowthatyou havedeleted/dev/mmcblk0p2 Nowcreateanewpartitionbyenteringnthenpandthen2 n–>newpartition p–>primary(partitiontype) 2–>partitionnumber Youcanenterpagaintoseethatthe/dev/mmcblk0p2hasbeenre-appeared. Ifeverythinggoesfineenterwtocommityourchangesorifyouarefindinganyerror,Ctrl+ztostoptheprocess. Rebootyoursystem. $reboot Afterrebootingyouneedtoexpandthefilesystem.Enterthecommanddf(df–>displaysthetotalspaceandfree spaceavailableonyoursystem) Thenenterthefollowingcommandtoexpandthefilesystem.(Ittakesometimetocomplete) $resize2fs/dev/mmcblk0p2 Aftercompletingtheprocessagaintypedftocheckthespaceavailable.NowyoucanaccessfullspaceofyourSDcard. Sources: ExpandingtheFileSystemPartitiononaSDcardinBeagleBoneBlack Sources: ExpandingyourUbuntumicroSDpartition Howtogetserialoverusb LinuxorMacOS RecentOSsincludeFTDIdriverbydefaultsogettingaserialconnectionisaseasyas: ConnecttheminiUSBcable. Ifeverythingisinstalled,twonewdevicesshouldappearunder/dev:/dev/ttyUSB0and/dev/ttyUSB1. Launchaserialconnectionagainst/dev/ttyUSB1with: screen/dev/ttyUSB1115200 Ifeverythingisright(assumingSDcardisnotconnected)youshouldseesome"C"sprintedinthescreen: CCCCC (youcanalsouseminicominsteadofscreen). Windows7 Installthedrivers BONE_D64.exe(64bits) BONE_DRV.exe(32bits) FindingtheErle’svirtualserialport Start>DevicesandPrinters LookforBeagleBone/XDS100v2 Double-clickorright-clickit ClicktheHardwaretab. Under“DeviceFunctions”isalistportswiththetypeofportinthenextcolumn. Oneofthemislabeled“USBSerialPort(COMn)”.Inmycaseit’s”USBSerialPort(COM5)” Obtainingandrunningaterminalprogram Forthispurposewe'reusingPuTTY.PuTTYisasingle.EXEfile.There’snoinstaller.Icreatedadirectorycalled C:\ProgramFiles(x86)\putty. Idownloadedputty.exeandcopiedintothatdirectory.Thenright-clickedputty.exeandchose“PintoStartMenu”tomakeit easy. ConfiguretheterminalprogramtouseSSHoverthe(virtual)serialport: LaunchPuTTY.It’sasimpleprogramanditsmainwindowistitled“PuTTYConfiguration” MakesureSerialischecked.Aserialportconfigurationdialogappears. Under“Serialline”enterthenumberoftheCOMportyoudiscoveredpreviously,COM5inthiscase. Enter115200inthe“Speed”field ClicktheOpenbutton. Nowresettherobot(pressingtheresetbutton)andyoushouldsee: (ifnopropermicroSDcardwasintroduced)"CCCC.." (ifapropermicroSDcardwasintroduced)thekernelbooting. HowtoinstantiateI2Cdevicesfromtheuserspace Ingeneral,thekernelshouldknowwhichI2Cdevicesareconnectedand whataddressestheyliveat.However,incertaincases,itdoesnot,soa sysfsinterfacewasaddedtolettheuserprovidetheinformation.This interfaceismadeof2attributefileswhicharecreatedineveryI2Cbus directory:new_deviceanddelete_device.Bothfilesarewriteonlyandyou mustwritetherightparameterstotheminordertoproperlyinstantiate, respectivelydelete,anI2Cdevice. Filenew_devicetakes2parameters:thenameoftheI2Cdevice(astring) andtheaddressoftheI2Cdevice(anumber,typicallyexpressedin hexadecimalstartingwith0x,butcanalsobeexpressedindecimal.) Filedelete_devicetakesasingleparameter:theaddressoftheI2C device.AsnotwodevicescanliveatthesameaddressonagivenI2C segment,theaddressissufficienttouniquelyidentifythedevicetobe deleted. Example: echoeeprom0x50>/sys/bus/i2c/devices/i2c-3/new_device Whilethisinterfaceshouldonlybeusedwhenin-kerneldevicedeclaration can'tbedone,thereisavarietyofcaseswhereitcanbehelpful: TheI2Cdriverusuallydetectsdevices(method3above)butthebus segmentyourdevicelivesondoesn'thavetheproperclassbitsetand thusdetectiondoesn'ttrigger. TheI2Cdriverusuallydetectsdevices,butyourdevicelivesatan unexpectedaddress. TheI2Cdriverusuallydetectsdevices,butyourdeviceisnotdetected, eitherbecausethedetectionroutineistoostrict,orbecauseyour deviceisnotofficiallysupportedyetbutyouknowitiscompatible. Youaredevelopingadriveronatestboard,whereyousolderedtheI2C deviceyourself. Thisinterfaceisareplacementfortheforce_*moduleparameterssomeI2C driversimplement.Beingimplementedini2c-coreratherthanineach devicedriverindividually,itismuchmoreefficient,andalsohasthe advantagethatyoudonothavetoreloadthedrivertochangeasetting. Youcanalsoinstantiatethedevicebeforethedriverisloadedoreven available,andyoudon'tneedtoknowwhatdriverthedeviceneeds. TakenfromtheLinuxkerneldocumentation. Consideringthis,wecouldinstantiateasensor(hih6130)connectedtoi2c-1andwithaddress0x27doing: echohih61300x27>/sys/bus/i2c/devices/i2c-1/new_device Afterthat,thedevicewillbeavailableunder/sys/bus/i2c/drivers/hih6130/1-0027. Toremovethedeviceyoucanuse: echo0x27>/sys/bus/i2c/devices/i2c-1/delete_device ROSTutorials Thefollowingtutorialsprovideastep-by-stepguideusingErle-BrainonhowtodiveintotheRobotOperativeSystem. TutorialIndex InstallingandConfiguringYourROSEnvironment NavigatingtheROSFilesystem CreatingaROSPackage BuildingaROSPackage UnderstandingROSNodes UnderstandingROSTopics InstallingandConfiguringYourROSEnvironment TableofContent Prerequisites CreateacatkinWorkspace ResolvingDependencies BuildingROS Sources UbuntuPrecise(12.04) RefertoUbuntuARMinstallofROSHydro. DebianWheezy(7.5) TherearenoprecompiledbinariesofROSforDebian,whileitseemsthatmostofthedependenciesarebeingpulledinto themainrepositoriestherearestillsomemissingsocompilingrequiresthatthedependenciesbemadefromsourceas well.ThefollowingstepsdescribehowtocompileeverythingfromsourcedoingthisforamachinerunningDebianWheezy. Prerequisites ConfigureyourDebianrepositoriesSetupyourcomputertoacceptsoftwarefrompackages.ros.org: sudosh-c'echo"debhttp://packages.ros.org/ros/ubuntuwheezymain">/etc/apt/sources.list.d/ros-latest.list' Setupyourkeys: wgethttps://raw.githubusercontent.com/ros/rosdistro/master/ros.key-O-|sudoapt-keyadd- Refresh: sudoapt-getupdate Installbootstrapdependencies: sudoapt-getinstallpython-rosdeppython-rosinstall-generatorpython-wstoolbuild-essential NOTE:15thofJuly,2014 Fromtoday,whentryingtoinstallthepackagesiget: root@beaglebone:~#sudoapt-getinstallpython-rosdeppython-rosinstall-generatorpython-wstoolbuild-essential Readingpackagelists...Done Buildingdependencytree Readingstateinformation...Done build-essentialisalreadythenewestversion. Somepackagescouldnotbeinstalled.Thismaymeanthatyouhave requestedanimpossiblesituationorifyouareusingtheunstable distributionthatsomerequiredpackageshavenotyetbeencreated orbeenmovedoutofIncoming. Thefollowinginformationmayhelptoresolvethesituation: Thefollowingpackageshaveunmetdependencies: python-rosdep:Depends:python-catkin-pkgbutitisnotgoingtobeinstalled Depends:python-rosdistro(>=0.3.0)butitisnotgoingtobeinstalled python-rosinstall-generator:Depends:python-catkin-pkg(>=0.1.28)butitisnotgoingtobeinstalled Depends:python-rosdistro(>=0.3.4)butitisnotgoingtobeinstalled E:Unabletocorrectproblems,youhaveheldbrokenpackages. NOTE2:15thofJuly,2014Itseemsthatrosdepcannotbeinstalledinnon-ubuntusystemsfromapt-get.Toinstallit,run: sudopipinstall-Urosdeprosinstall_generatorwstoolrosinstall NOTE3:4thofOctober,2014nosepackageneddedtobeinsalledbeforerunningsudopipinstall-Urosdep rosinstall_generatorwstoolrosinstall. pipinstall-Unose Nextensurerosdephasbeeninitialized: sudorosdepinit rosdepupdate CreateacatkinWorkspace Inordertobuildthecorepackages,youwillneedacatkinwork-space.Createonenow: mkdir~/ros_catkin_ws cd~/ros_catkin_ws Nextwewillwanttofetchthecorepackagessowecanbuildthem.Wewillusewstoolforthis.Selectthewstoolcommand fortheparticularvariantyouwanttoinstall: AccordingtopreviousversionsofROS: Desktop-FullInstall:ROS,rqt,rviz,robot-genericlibraries,2D/3Dsimulators,navigationand2D/3Dperception [desktop-full] DesktopInstall:ROS,rqt,rviz,androbot-genericlibraries[desktop] ROS-Comm:(BareBones)ROSpackage,build,andcommunicationlibraries.NoGUItools.[ros_comm] Wereallyjustneedthecommunicationlayertherebyweareinstallingitbarebones. rosinstall_generatorros_comm--rosdistrohydro--deps--wet-only>hydro-barebones-full-wet.rosinstall wstoolinitsrchydro-barebones-full-wet.rosinstall orforIndigo: rosinstall_generatorros_comm--rosdistroindigo--deps--wet-only>indigo-barebones-full-wet.rosinstall wstoolinitsrcindigo-barebones-full-wet.rosinstall Thiswilladdallofthecatkinorwetpackagesinthegivenvariantandthenfetchthesourcesintothe~/ros_catkin_ws/src directory.ThecommandwilltakeafewminutestodownloadallofthecoreROSpackagesintothesrcfolder.Ifyouhave downloadcutsoutrestartitwiththefollowing wstoolupdate-tsrc ResolvingDependencies Beforeyoucanbuildyourcatkinwork-spaceyouneedtomakesurethatyouhavealltherequireddependencies.Weuse therosdeptoolforthis: Installingsblcmightbeneededbutatthetimeofwritingit'snotavailable,neitherwaspossibletocompileitfromsource therebytheLipsdependenciesareremoved. InordertoremoveLipsdependencies,thefollowingstepsarerequired: cdsrc wstoolrmroslisp rm-rfroslisp cd.. rosdepinstall--from-pathssrc--ignore-src--rosdistrohydro-y-r--os=debian:wheezy Thiswilllookatallofthepackagesinthesrcdirectoryandfindallofthedependenciestheyhave.Thenitwillrecursively installthedependencies. The--from-pathsoptionindicateswewanttoinstallthedependenciesforanentiredirectoryofpackages,inthiscase src.The--ignore-srcoptionindicatestorosdepthatitshouldn'ttrytoinstallanyROSpackagesinthesrcfolderfrom thepackagemanager,wedon'tneedittosincewearebuildingthemourselves.The--rosdistrooptionisrequired becausewedon'thaveaROSenvironmentsetupyet,sowehavetoindicatetorosdepwhatversionofROSweare buildingfor.The-yoptionindicatestorosdepthatwedon'twanttobebotheredbytoomanypromptsfromthepackage manager.Afterawhile(andmaybesomepromptsforyourpassword)rosdepwillfinishinstallingsystemdependenciesand youcancontinue.The-rflagcausesrosdeptoignoreminorerrors.Thisisnecessarytogetthebasedependencies installed.Afterthepackagesfollowingthissectionhavebeeninstalleditwouldbeagoodideatorunthiscommandagain withoutthe-rtoseeifthereareanydependenciesthatyouforgotordidn'thaveinyourbasesystem(i.e.packages differentfromwhattheauthorofthistutorialhadinstalled).The--osflagwasnecessaryfortheauthorbecauseof differencesinthewaythatthewheezyversionofdebianstoresversioninformationandwhatrosdepisexpecting.Ifyouare havingtroublewithanyofthedependenciesrosdepissupposedtoget,makesurethatyouhavethepackagenameright bygettingtherosdepbase.yamlfromthishttp://docs.ros.org/independent/api/rosdep/html/contributing_rules.html Onceallofthedependenciesbelowareinstalledyoushouldbeabletorunrosdepinstallexcludingthe-roptionwithout errorsbymakeingsureallyourdependenciesarelistedinthebase.yaml. NOTE:16thJuly,2014 root@beaglebone:~/ros_catkin_ws#rosdepinstall--from-pathssrc--ignore-src--rosdistrohydro-y-r--os=debian:wheezy executingcommand[sudoapt-getinstall-ypython-catkin-pkg] Readingpackagelists...Done Buildingdependencytree Readingstateinformation...Done Somepackagescouldnotbeinstalled.Thismaymeanthatyouhave requestedanimpossiblesituationorifyouareusingtheunstable distributionthatsomerequiredpackageshavenotyetbeencreated orbeenmovedoutofIncoming. Thefollowinginformationmayhelptoresolvethesituation: Thefollowingpackageshaveunmetdependencies: python-catkin-pkg:Depends:python:any(>=2.7.1-0ubuntu2)butitisnotinstallable E:Unabletocorrectproblems,youhaveheldbrokenpackages. executingcommand[sudoapt-getinstall-ypython-rosdep] Readingpackagelists...Done Buildingdependencytree Readingstateinformation...Done Somepackagescouldnotbeinstalled.Thismaymeanthatyouhave requestedanimpossiblesituationorifyouareusingtheunstable distributionthatsomerequiredpackageshavenotyetbeencreated orbeenmovedoutofIncoming. Thefollowinginformationmayhelptoresolvethesituation: Thefollowingpackageshaveunmetdependencies: python-rosdep:Depends:python-catkin-pkgbutitisnotgoingtobeinstalled Depends:python-rosdistro(>=0.3.0)butitisnotgoingtobeinstalled E:Unabletocorrectproblems,youhaveheldbrokenpackages. ERROR:thefollowingrosdepsfailedtoinstall apt:command[sudoapt-getinstall-ypython-catkin-pkg]failed apt:command[sudoapt-getinstall-ypython-rosdep]failed apt:Failedtodetectsuccessfulinstallationof[python-catkin-pkg] apt:Failedtodetectsuccessfulinstallationof[python-rosdep] Seemsliketheproblemkeepson.StillthebuildingstepisperformedandROSworks. BuildingROS Finallyrunthebuildandinstallcommand.Toinstallsomewhereotherthanyourhomedirectoryusethe--install-space option.(Checkcatkin_make_isolatedREP). cd~/ros_catkin_ws ./src/catkin/bin/catkin_make_isolated--install-DCMAKE_BUILD_TYPE=Release echo"source~/ros_catkin_ws/install_isolated/setup.bash">>~/.bashrc Note:YoumightwanttoselectadifferentCMakebuildtype(e.g.RelWithDebInfoorDebug,see http://cmake.org/cmake/help/v2.8.12/cmake.html#variable:CMAKE_BUILD_TYPE). Nowyouhavetoreboot. Sources: InstallingHydroinDebian InstallingGroovyinDebian catkin_make_isolated NavigatingtheROSFilesystem TableofContent QuickOverviewofFilesystemConcepts FilesystemTools Usingrospack Usingroscd roscdlog Usingrosls TabCompletion Review Environmentvariables ResolvingDependencies BuildingROS Sources ThistutorialintroducesROSfilesystemconcepts,andcoversusingtheroscd,rosls,androspackcommandlinetoolsusing Erleboardthroughalltheprocess. QuickOverviewofFilesystemConcepts Packages:PackagesarethesoftwareorganizationunitofROScode.Eachpackagecancontainlibraries, executables,scripts,orotherartifacts. Manifest(package.xml):Amanifestisadescriptionofapackage.Itsservestodefinedependenciesbetweenpackages andtocapturemetainformationaboutthepackagelikeversion,maintainer,license,etc... FilesystemTools CodeisspreadacrossmanyROSpackages.Navigatingwithcommand-linetoolssuchaslsandcdcanbeverytedious whichiswhyROSprovidestoolstohelpyou. Usingrospack rospackallowsyoutogetinformationaboutpackages.Inthistutorial,weareonlygoingtocoverthefindoption,which returnsthepathtopackage. Usage: #rospackfind[package_name] Ifyougetthefollowingerror: rospackfindroscpp terminatecalledafterthrowinganinstanceof'std::runtime_error' what():locale::facet::_S_create_c_localenamenotvalid Aborted youcansolveitsettingthefollowingenvironmentvariable: exportLC_ALL="en_US.UTF-8" Example: root@erlerobot:~#rospackfindroscpp /opt/ros/groovy/share/roscpp Usingroscd roscdispartoftherosbashsuite.Itallowsyoutochangedirectory(cd)directlytoapackageorastack. Usage: #roscd[locationname[/subdir]] Runthisexample: root@erlerobot:~#roscdroscpp root@erlerobot:/opt/ros/groovy/share/roscpp#pwd /opt/ros/groovy/share/roscpp Youcanseethat/opt/ros/groovy/share/roscppisthesamepaththatrospackfindgaveinthepreviousexample. Notethatroscd,likeotherROStools,willonlyfindROSpackagesthatarewithinthedirectorieslistedinyour ROS_PACKAGE_PATHenvironmentvariable.ToseewhatisinyourROS_PACKAGE_PATH,type: root@erlerobot:~#echo$ROS_PACKAGE_PATH /root/catkin_ws/src:/opt/ros/groovy/share:/opt/ros/groovy/stacks YouROS_PACKAGE_PATHshouldcontainalistofdirectorieswhereyouhaveROSpackagesseparatedbycolons. Similarlytootherenvironmentpaths,youcanaddadditionaldirectoriestoyourROS_PACKAGE_PATH,witheachpath separatedbyacolon':'. Subdirectories roscdcanalsomovetoasubdirectoryofapackageorstack. Try: root@erlerobot:~#roscdroscpp/cmake root@erlerobot:/opt/ros/groovy/share/roscpp/cmake#pwd /opt/ros/groovy/share/roscpp/cmake roscdlog roscdlogwilltakeyoutothefolderwhereROSstoreslogfiles.NotethatifyouhavenotrunanyROSprogramsyet,this willyieldanerrorsayingthatitdoesnotyetexist. root@erlerobot:~#roscdlog Noactiveroscore Ifwelaunchroscoreandthenrunthesamecommandinanotherwindow(orlaunchroscoreinbackgroundappending &attheend): root@erlerobot:~/.ros/log#roscore ...loggingto/root/.ros/log/53689ab4-bfe7-11d3-af71-1e658b3e1294/roslaunch-erlerobot-1104.log Checkinglogdirectoryfordiskusage.Thismaytakeawhile. PressCtrl-Ctointerrupt Donecheckinglogfilediskusage.Usageis<1GB. startedroslaunchserverhttp://erlerobot:55088/ ros_commversion1.9.44 SUMMARY ======== PARAMETERS */rosdistro */rosversion NODES auto-startingnewmaster process[master]:startedwithpid[1117] ROS_MASTER_URI=http://erlerobot:11311/ setting/run_idto53689ab4-bfe7-11d3-af71-1e658b3e1294 process[rosout-1]:startedwithpid[1130] startedcoreservice[/rosout] root@erlerobot:~#roscdlog root@erlerobot:~/.ros/log/53689ab4-bfe7-11d3-af71-1e658b3e1294#ls master.logroslaunch-erlerobot-1104.logrosout-1-stdout.logrosout.log Usingrosls `roslsispartoftherosbashsuite.Itallowsyoutolsdirectlyinapackagebynameratherthanbyabsolutepath. Usage: #rosls[locationname[/subdir]] Example: root@erlerobot:~/catkin_ws/devel#roslscatkin cmakepackage.xml TabCompletion Itcangettedioustotypeoutanentirepackagename.Inthepreviousexample,roscpp_tutorialsisafairlylongname. Luckily,someROStoolssupportTABcompletion. Startbytyping: #roscdcatk<<<nowpushtheTABkey>>> AfterpushingtheTABkey,thecommandlineshouldfillouttherest: $roscdcatkin/ ThisworksbecausecatkiniscurrentlytheonlyROSpackagethatstartswithcatkin. Review YoumayhavenoticedapatternwiththenamingoftheROStools: rospack=ros+pack(age) roscd=ros+cd rosls=ros+ls ThisnamingpatternholdsformanyoftheROStools. Environmentvariables ROSstronglyrelaysontheshellenvironmentvariables.Makesurethateverythingisconfiguredasexpected: root@erlerobot:~/catkin_ws/devel#export|grepROS declare-xROS_DISTRO="groovy" declare-xROS_ETC_DIR="/opt/ros/groovy/etc/ros" declare-xROS_MASTER_URI="http://localhost:11311" declare-xROS_PACKAGE_PATH="/root/catkin_ws/src:/opt/ros/groovy/share:/opt/ros/groovy/stacks" declare-xROS_ROOT="/opt/ros/groovy/share/ros" declare-xROS_TEST_RESULTS_DIR="/root/catkin_ws/build/test_results" NowthatyoucangetaroundinROS,let'screateapackage. CreatingaROSPackage Thistutorialcoversusingroscreate-pkgorcatkintocreateanewpackage,androspacktolistpackagedependencies. Thepackagethatwillbecreatedthroughthistutorialisavailablehere. TableofContent WhatmakesupacatkinPackage? PackagesinacatkinWorkspace CreatingacatkinPackage Packagedependencies First-orderdependencies Indirectdependencies CustomizingYourPackage WhatmakesupacatkinPackage? Forapackagetobeconsideredacatkinpackageitmustmeetafewrequirements: Thepackagemustcontainacatkincompliantpackage.xmlfile.Thispackage.xmlfileprovidesmetainformationabout thepackage. ThepackagemustcontainaCMakeLists.txtwhichusescatkin.Catkinmetapackagesmusthaveaboilerplate CMakeLists.txtfile. Therecanbenomorethanonepackageineachfolder.Thismeansnonestedpackagesnormultiplepackages sharingthesamedirectory Thesimplestpossiblepackagemightlooklikethis: my_package/ CMakeLists.txt package.xml PackagesinacatkinWorkspace Therecommendedmethodofworkingwithcatkinpackagesisusingacatkinworkspace,butyoucanalsobuildcatkin packagesstandalone.Atrivialworkspacemightlooklikethis: workspace_folder/--CATKINWORKSPACE src/--SOURCESPACE CMakeLists.txt--The'toplevel'CMakefile package_1/ CMakeLists.txt package.xml ... package_n/ CMakeLists.txt package.xml ... build/--BUILDSPACE CATKIN_IGNORE--Keepscatkinfromwalkingthisdirectory devel/--DEVELOPMENTSPACE(setbyCATKIN_DEVEL_PREFIX) bin/ etc/ include/ lib/ share/ .catkin env.bash setup.bash setup.sh ... install/--INSTALLSPACE(setbyCMAKE_INSTALL_PREFIX) bin/ etc/ include/ lib/ share/ .catkin env.bash setup.bash setup.sh ... AttheErle-board,thecatkinworkspaceisat/root/catkin_ws. Ifyouwishtocreateanothercatkinworkspace,followtheCreatingaworkspaceforcatkintutorial. CreatingacatkinPackage Thissectionwilldemonstratehowtousethecatkin_create_pkgscripttocreateanewcatkinpackage,andwhatyoucan dowithitafterithasbeencreated. FirstchangetothesourcespacedirectoryofthecatkinworkspaceyoucreatedintheCreatingaWorkspaceforcatkin tutorial: #YoushouldhavecreatedthisintheCreatingaWorkspaceTutorial $cd~/catkin_ws/src Nowusethecatkin_create_pkgscripttocreateanewpackagecalled'erle_beginner_tutorials'whichdependson std_msgs,roscpp,androspy: root@erlerobot:~/catkin_ws/src#catkin_create_pkgerle_beginner_tutorialsstd_msgsrospyroscpp Createdfileerle_beginner_tutorials/package.xml Createdfileerle_beginner_tutorials/CMakeLists.txt Createdfoldererle_beginner_tutorials/include Createdfoldererle_beginner_tutorials/src Successfullycreatedfilesin/root/catkin_ws/src/erle_beginner_tutorials.Pleaseadjustthevaluesinpackage.xml. Thiswillcreateaerle_beginner_tutorialsfolderwhichcontainsapackage.xmlandaCMakeLists.txt,whichhavebeen partiallyfilledoutwiththeinformationyougavecatkin_create_pkg. root@erlerobot:~/catkin_ws/src#treeerle_beginner_tutorials/ erle_beginner_tutorials/ ├──CMakeLists.txt ├──include ├──package.xml └──src 2directories,2files catkin_create_pkgrequiresthatyougiveita<package_name>andoptionallyalistofdependenciesonwhichthatpackage depends: #Thisisanexample,donottrytorunthis #catkin_create_pkg<package_name>[depend1][depend2][depend3] catkin_create_pkgalsohasmoreadvancedfunctionalitieswhichisdescribedincatkin/commands/catkin_create_pkg. Packagedependencies First-orderdependencies Whenusingcatkin_create_pkgearlier,afewpackagedependencieswereprovided.Thesefirst-orderdependenciescan nowbereviewedwiththerospacktool. root@erlerobot:~#rospackdepends1erle_beginner_tutorials roscpp rospy std_msgs Asyoucansee,rospackliststhesamedependenciesthatwereusedasargumentswhenrunningcatkin_create_pkg. Thesedependenciesforapackagearestoredinthepackage.xmlfile: root@erlerobot:~#roscderle_beginner_tutorials/ root@erlerobot:~/catkin_ws/src/erle_beginner_tutorials#catpackage.xml <?xmlversion="1.0"?> <package> <name>erle_beginner_tutorials</name> <version>0.0.0</version> <description>Theerle_beginner_tutorialspackage</description> <!--Onemaintainertagrequired,multipleallowed,onepersonpertag--> <!--Example:--> <!--<maintaineremail="jane.doe@example.com">JaneDoe</maintainer>--> <maintaineremail="root@todo.todo">root</maintainer> <!--Onelicensetagrequired,multipleallowed,onelicensepertag--> <!--Commonlyusedlicensestrings:--> <!--BSD,MIT,BoostSoftwareLicense,GPLv2,GPLv3,LGPLv2.1,LGPLv3--> <license>TODO</license> <!--Urltagsareoptional,butmutipleareallowed,onepertag--> <!--Optionalattributetypecanbe:website,bugtracker,orrepository--> <!--Example:--> <!--<urltype="website">http://ros.org/wiki/erle_beginner_tutorials</url>--> <!--Authortagsareoptional,mutipleareallowed,onepertag--> <!--Authorsdonothavetobemaintianers,butcouldbe--> <!--Example:--> <!--<authoremail="jane.doe@example.com">JaneDoe</author>--> <!--The*_dependtagsareusedtospecifydependencies--> <!--Dependenciescanbecatkinpackagesorsystemdependencies--> <!--Examples:--> <!--Usebuild_dependforpackagesyouneedatcompiletime:--> <!--<build_depend>message_generation</build_depend>--> <!--Usebuildtool_dependforbuildtoolpackages:--> <!--<buildtool_depend>catkin</buildtool_depend>--> <!--Userun_dependforpackagesyouneedatruntime:--> <!--<run_depend>message_runtime</run_depend>--> <!--Usetest_dependforpackagesyouneedonlyfortesting:--> <!--<test_depend>gtest</test_depend>--> <buildtool_depend>catkin</buildtool_depend> <build_depend>roscpp</build_depend> <build_depend>rospy</build_depend> <build_depend>std_msgs</build_depend> <run_depend>roscpp</run_depend> <run_depend>rospy</run_depend> <run_depend>std_msgs</run_depend> <!--Theexporttagcontainsother,unspecified,tags--> <export> <!--Youcanspecifythatthispackageisametapackagehere:--> <!--<metapackage/>--> <!--Othertoolscanrequestadditionalinformationbeplacedhere--> </export> </package> Indirectdependencies Inmanycases,adependencywillalsohaveitsowndependencies.Forinstance,rospyhasotherdependencies: root@erlerobot:~/catkin_ws/src/erle_beginner_tutorials#rospackdepends1rospy genpy rosgraph rosgraph_msgs roslib std_msgs Apackagecanhavequiteafewindirectdependencies.Luckilyrospackcanrecursivelydetermineallnesteddependencies. root@erlerobot:~/catkin_ws/src/erle_beginner_tutorials#rospackdependserle_beginner_tutorials cpp_common rostime roscpp_traits roscpp_serialization genmsg genpy message_runtime rosconsole std_msgs rosgraph_msgs xmlrpcpp roscpp rosgraph catkin rospack roslib rospy CustomizingYourPackage Thispartofthetutorialwilllookateachfilegeneratedbycatkin_create_pkganddescribe,linebyline,eachcomponentof thosefilesandhowyoucancustomizethemforyourpackage. Customizingthepackage.xml Thegeneratedpackage.xmlshouldbeinyournewpackage.Nowletsgothroughthenewpackage.xmlandtouchupany elementsthatneedyourattention. descriptiontag Firstupdatethedescriptiontag: <description>Theerle_beginner_tutorialspackage</description> Changethedescriptiontoanythingyoulike,butbyconventionthefirstsentenceshouldbeshortwhilecoveringthescope ofthepackage.Ifitishardtodescribethepackageinasinglesentencethenitmightneedtobebrokenup. maintainertags Nextcomesthemaintainertag: <!--Onemaintainertagrequired,multipleallowed,onepersonpertag--> <maintaineremail="victor@erlerobot.com">vmayoral</maintainer> Thisisarequiredandimportanttagforthepackage.xmlbecauseitletsothersknowwhotocontactaboutthepackage.At leastonemaintainerisrequired,butyoucanhavemanyifyoulike.Thenameofthemaintainergoesintothebodyofthe tag,butthereisalsoanemailattributethatshouldbefilledout: licensetags Nextisthelicensetag,whichisalsorequired: <!--Onelicensetagrequired,multipleallowed,onelicensepertag--> <!--Commonlyusedlicensestrings:--> <!--BSD,MIT,BoostSoftwareLicense,GPLv2,GPLv3,LGPLv2.1,LGPLv3--> <license>BSD</license> Youshouldchoosealicenseandfillitinhere.SomecommonopensourcelicensesareBSD,MIT,BoostSoftwareLicense, GPLv2,GPLv3,LGPLv2.1,andLGPLv3.YoucanreadaboutseveraloftheseattheOpenSourceInitiative.Forthistutorial we'llusetheBSDlicensebecausetherestofthecoreROScomponentsuseitalready: WestronglyrecommendtoshareyourcodeunderanOpenSourceInitiativelicense TheOpenSourceInitiative(OSI)isanon-profitcorporationwithglobalscopeformedtoeducateaboutandadvocateforthe benefitsofopensourceandtobuildbridgesamongdifferentconstituenciesintheopensourcecommunity. dependenciestags Thenextsetoftagsdescribethedependenciesofyourpackage.Thedependenciesaresplitintobuild_depend, buildtool_depend,run_depend,test_depend.Foramoredetailedexplinationofthesetagsseethedocumentationabout CatkinDependencies.Sincewepassedstd_msgs,roscpp,androspyasargumentstocatkin_create_pkg,the dependencieswilllooklikethis: <!--The*_dependtagsareusedtospecifydependencies--> <!--Dependenciescanbecatkinpackagesorsystemdependencies--> <!--Examples:--> <!--Usebuild_dependforpackagesyouneedatcompiletime:--> <!--<build_depend>message_generation</build_depend>--> <!--Usebuildtool_dependforbuildtoolpackages:--> <!--<buildtool_depend>catkin</buildtool_depend>--> <!--Userun_dependforpackagesyouneedatruntime:--> <!--<run_depend>message_runtime</run_depend>--> <!--Usetest_dependforpackagesyouneedonlyfortesting:--> <!--<test_depend>gtest</test_depend>--> <buildtool_depend>catkin</buildtool_depend> <build_depend>roscpp</build_depend> <build_depend>rospy</build_depend> <build_depend>std_msgs</build_depend> <run_depend>roscpp</run_depend> <run_depend>rospy</run_depend> <run_depend>std_msgs</run_depend> Finalpackage.xml Asyoucanseethefinalpackage.xml,withoutcommentsandunusedtags,ismuchmoreconcise: <?xmlversion="1.0"?> <package> <name>erle_beginner_tutorials</name> <version>0.0.1</version> <description>Theerle_beginner_tutorialspackage</description> <maintaineremail="victor@erlerobot.com">vmayoral</maintainer> <license>BSD</license> <buildtool_depend>catkin</buildtool_depend> <build_depend>roscpp</build_depend> <build_depend>rospy</build_depend> <build_depend>std_msgs</build_depend> <run_depend>roscpp</run_depend> <run_depend>rospy</run_depend> <run_depend>std_msgs</run_depend> <export> </export> </package> BuildingaROSPackage Thistutorialcoversthetoolchaintobuildapackage. TableofContent BuildingPackages Usingcatkin_make BuildingYourPackage BuildingPackages Aslongasallofthesystemdependenciesofyourpackageareinstalled,wecannowbuildyournewpackage. Beforecontinuingremembertosourceyourenvironmentsetupfileifyouhavenotalready(ontheprovidedimages,thisis doneinthe.bashrcfile). source/root/catkin_ws/devel/setup.bash Usingcatkin_make catkin_makeisacommandlinetoolwhichaddssomeconveniencetothestandardcatkinworkflow.Youcanimaginethat [catkin_make](http://wiki.ros.org/catkin/commands/catkin_make)combinesthecallstocmakeandmake`inthestandard CMakeworkflow. Usage: #Inacatkinworkspace $catkin_make[make_targets][-DCMAKE_VARIABLES=...] ForpeoplewhoareunfamiliarwiththestandardCMakeworkflow,itbreaksdownasfollows: Note:Ifyourunthebelowcommandsitwillnotwork,asthisisjustanexampleofhowCMakegenerallyworks. #InaCMakeproject $mkdirbuild $cdbuild $cmake.. $make $makeinstall#(optionally) ThisprocessisrunforeachCMakeproject.Incontrastcatkinprojectscanbebuilttogetherinworkspaces.Buildingzeroto manycatkinpackagesinaworkspacefollowsthisworkflow: #Inacatkinworkspace $catkin_make $catkin_makeinstall#(optionally) Theabovecommandswillbuildanycatkinprojectsfoundinthesrcfolder.Thisfollowstherecommendationssetby REP128.Ifyoursourcecodeisinadifferentplace,saymy_srcthenyouwouldcallcatkin_makelikethis: Note:Ifyourunthebelowcommandsitwillnotwork,asthedirectorymy_srcdoesnotexist. #Inacatkinworkspace $catkin_make--sourcemy_src $catkin_makeinstall--sourcemy_src#(optionally) Formoreadvancedusesofcatkin_makeseethedocumentation:catkin/commands/catkin_make. BuildingYourPackage Youshouldalreadyhaveacatkinworkspaceandanewcatkinpackagecallederle_beginner_tutorialsfromtheprevious tutorial.Gointothecatkinworkspaceifyouarenotalreadythereandlookinthesrcfolder: root@erlerobot:~#cd~/catkin_ws/src root@erlerobot:~/catkin_ws/src#ls CMakeLists.txterle_beginner_tutorials ` Wecannowbuildthatpackageusingcatkin_make: root@erlerobot:~#cd~/catkin_ws root@erlerobot:~/catkin_ws#catkin_make Basepath:/root/catkin_ws Sourcespace:/root/catkin_ws/src Buildspace:/root/catkin_ws/build Develspace:/root/catkin_ws/devel Installspace:/root/catkin_ws/install #### ####Runningcommand:"cmake/root/catkin_ws/src-DCATKIN_DEVEL_PREFIX=/root/catkin_ws/devel-DCMAKE_INSTALL_PREFIX=/root/catkin_ws/ins #### --UsingCATKIN_DEVEL_PREFIX:/root/catkin_ws/devel --UsingCMAKE_PREFIX_PATH:/root/catkin_ws/devel;/opt/ros/groovy --Thisworkspaceoverlays:/root/catkin_ws/devel;/opt/ros/groovy --Foundgtestsourcesunder'/usr/src/gtest':gtestswillbebuilt --UsingCATKIN_TEST_RESULTS_DIR:/root/catkin_ws/build/test_results --catkin0.5.65 --BUILD_SHARED_LIBSison --~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --~~traversing1packagesintopologicalorder: --~~-erle_beginner_tutorials --~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --+++processingcatkinpackage:'erle_beginner_tutorials' --==>add_subdirectory(erle_beginner_tutorials) --Configuringdone --Generatingdone --Buildfileshavebeenwrittento:/root/catkin_ws/build #### ####Runningcommand:"make-j1-l1"in"/root/catkin_ws/build" #### --UsingCATKIN_DEVEL_PREFIX:/root/catkin_ws/devel --UsingCMAKE_PREFIX_PATH:/root/catkin_ws/devel;/opt/ros/groovy --Thisworkspaceoverlays:/root/catkin_ws/devel;/opt/ros/groovy --Foundgtestsourcesunder'/usr/src/gtest':gtestswillbebuilt --UsingCATKIN_TEST_RESULTS_DIR:/root/catkin_ws/build/test_results --catkin0.5.65 --BUILD_SHARED_LIBSison --~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --~~traversing1packagesintopologicalorder: --~~-erle_beginner_tutorials --~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --+++processingcatkinpackage:'erle_beginner_tutorials' --==>add_subdirectory(erle_beginner_tutorials) --Configuringdone --Generatingdone --Buildfileshavebeenwrittento:/root/catkin_ws/build Notethatcatkin_makefirstdisplayswhatpathsitisusingforeachofthe'spaces'.Thespacesaredescribedinthe REP128andbydocumentationaboutcatkinworkspacesonthewiki:catkin/workspaces.Theimportantthingtonoticeis thatbecauseofthesedefaultvaluesseveralfoldershavebeencreatedinyourcatkinworkspace.Takealookwithls: root@erlerobot:~/catkin_ws#ls builddevelinstallsrc Thebuildfolderisthedefaultlocationofthebuildspaceandiswherecmakeandmakearecalledtoconfigureandbuild yourpackages.Thedevelfolderisthedefaultlocationofthedevelspace,whichiswhereyourexecutablesandlibrariesgo beforeyouinstallyourpackages. UnderstandingROSNodes ThistutorialintroducesROSgraphconceptsanddiscussestheuseofroscore,rosnode,androsruncommandlinetools. TableofContent QuickOverviewofGraphConcepts Nodes ClientLibraries roscore rosnode rosrun Review QuickOverviewofGraphConcepts Nodes:AnodeisanexecutablethatusesROStocommunicatewithothernodes. Messages:ROSdatatypeusedwhensubscribingorpublishingtoatopic. Topics:Nodescanpublishmessagestoatopicaswellassubscribetoatopictoreceivemessages. Master:NameserviceforROS(i.e.helpsnodesfindeachother) rosout:ROSequivalentofstdout/stderr roscore:Master+rosout+parameterserver(parameterserverwillbeintroducedlater) Nodes Anodereallyisn'tmuchmorethananexecutablefilewithinaROSpackage.ROSnodesuseaROSclientlibraryto communicatewithothernodes.NodescanpublishorsubscribetoaTopic.NodescanalsoprovideoruseaService. ClientLibraries ROSclientlibrariesallownodeswrittenindifferentprogramminglanguagestocommunicate: rospy=pythonclientlibrary roscpp=c++clientlibrary roscore roscoreisthefirstthingyoushouldrunwhenusingROS. Pleaserun: roscore ...loggingto/root/.ros/log/e8b674a4-bff3-11d3-af73-4ed34f3752c7/roslaunch-erlerobot-2990.log Checkinglogdirectoryfordiskusage.Thismaytakeawhile. PressCtrl-Ctointerrupt Donecheckinglogfilediskusage.Usageis<1GB. startedroslaunchserverhttp://erlerobot:59324/ ros_commversion1.9.44 SUMMARY ======== PARAMETERS */rosdistro */rosversion NODES auto-startingnewmaster process[master]:startedwithpid[3003] ROS_MASTER_URI=http://erlerobot:11311/ setting/run_idtoe8b674a4-bff3-11d3-af73-4ed34f3752c7 process[rosout-1]:startedwithpid[3016] startedcoreservice[/rosout] rosnode rosnodedisplaysinformationabouttheROSnodesthatarecurrentlyrunning.Therosnodelistcommandliststhese activenodes: root@erlerobot:~#rosnodelist /rosout Thisshowedusthatthereisonlyonenoderunning:rosout.Thisisalwaysrunningasitcollectsandlogsnodes'debugging output. Therosnodeinfocommandreturnsinformationaboutaspecificnode. root@erlerobot:~#rosnodeinfo/rosout -------------------------------------------------------------------------------Node[/rosout] Publications: */rosout_agg[rosgraph_msgs/Log] Subscriptions: */rosout[unknowntype] Services: */rosout/set_logger_level */rosout/get_loggers contactingnodehttp://erlerobot:49274/... Pid:3016 Now,let'sseesomemorenodes.Forthis,we'regoingtouserosruntobringupanothernode. rosrun rosrunallowsyoutousethepackagenametodirectlyrunanodewithinapackage(withouthavingtoknowthepackage path). Usage: $rosrun[package_name][node_name] Inanewterminal: root@erlerobot:~#rosrunautopilot_bridgemavlink.py--device/dev/ttyO4--baudrate115200 Startingmavlink<->ROSinterfaceoverthefollowinglink: device:/dev/ttyO4 baudrate:115200 WaitingforAPheartbeat Inanotherterminal: root@erlerobot:~#rosnodelist /autopilot /rosout OnepowerfulfeatureofROSisthatyoucanreassignNamesfromthecommand-line. Gobacktotherosrunautopilot_bridgeterminalandusectrl-C(thereseemstobeaproblemwiththisnodesoyoumight needtoopenanewterminal).Nowlet'sre-runit,butthistimeuseaRemappingArgumenttochangethenode'sname: root@erlerobot:~#rosrunautopilot_bridgemavlink.py--device/dev/ttyO4--baudrate115200__name:=my_autopilot Startingmavlink<->ROSinterfaceoverthefollowinglink: device:/dev/ttyO4 baudrate:115200 WaitingforAPheartbeat Now,ifwegobackanduserosnodelist: root@erlerobot:~#rosnodelist /my_autopilot /rosout Let'suseanotherrosnodecommand,ping,totestthatit'sup: root@erlerobot:~#rosnodepingmy_autopilot rosnode:nodeis[/my_autopilot] pinging/my_autopilotwithatimeoutof3.0s xmlrpcreplyfromhttp://erlerobot:39540/time=15.213966ms xmlrpcreplyfromhttp://erlerobot:39540/time=13.329983ms xmlrpcreplyfromhttp://erlerobot:39540/time=12.695074ms xmlrpcreplyfromhttp://erlerobot:39540/time=13.059974ms xmlrpcreplyfromhttp://erlerobot:39540/time=12.760997ms xmlrpcreplyfromhttp://erlerobot:39540/time=12.681007ms ^Cpingaverage:13.290167ms Review Whatwascovered: roscore=ros+core:master(providesnameserviceforROS)+rosout(stdout/stderr)+parameterserver(parameter serverwillbeintroducedlater) rosnode=ros+node:ROStooltogetinformationaboutanode. rosrun=ros+run:runsanodefromagivenpackage.NowthatyouunderstandhowROSnodeswork,let'slookat howROStopicswork.Also,feelfreetopressCtrl-Ctostopturtlesim_node. UnderstandingROSTopics ThistutorialintroducesROStopicsaswellasusingtherostopiccommandlinetools. Beforewemoveforward,let'sstartbymakingsurethatwehaveroscorerunning,inanewterminal: $roscore Ifyouleftroscorerunningfromthelasttutorial,youmaygettheerrormessage: roscorecannotrunasanotherroscore/masterisalreadyrunning. Pleasekillotherroscore/masterprocessesbeforerelaunching Thisisfine.Onlyoneroscoreneedstoberunning. ROSTopics TherostopictoolallowsyoutogetinformationaboutROStopics. Youcanusethehelpoptiontogettheavailablesub-commandsforrostopic root@erlerobot:~#rostopic-h rostopicisacommand-linetoolforprintinginformationaboutROSTopics. Commands: rostopicbwdisplaybandwidthusedbytopic rostopicechoprintmessagestoscreen rostopicfindfindtopicsbytype rostopichzdisplaypublishingrateoftopic rostopicinfoprintinformationaboutactivetopic rostopiclistlistactivetopics rostopicpubpublishdatatotopic rostopictypeprinttopictype Typerostopic<command>-hformoredetailedusage,e.g.'rostopicecho-h' Contactinformation Web:http://erlerobotics.com Email:contact@erlerobot.com Legalnote Thismaterialcorrespondswithaninnovativeproductthatmayincludeunfinishedcontent.Assuch,thesedesignmaterials mayormaynotbesuitableforyourpurposes.Ifused,thedesignmaterialbecomesyourresponsibilityastowhetherornot itmeetsyourspecificneedsoryourspecificapplicationsandmayrequirechangestomeetyourrequirements. Theuserassumesallresponsibilityandliabilityforproperandsafehandlingofthegoods.Further,theuserindemnifies Supplierfromallclaimsarisingfromthehandlingoruseofthegoods. License ThecontenthereislicensedunderCC-SA-NC3.0.