L a m b d a i n M o t i o n C o n t r o l l i n g R o b o t s W i t h H a s k e l l J o h n P e t e r s o n P a u l H u d a k a n d C o n a l E l l i o t t 1 Y a l e U n i v e r s i t y p e t e r s o n j o h n c s y a l e e d u a n d p a u l h u d a k y a l e e d u 2 M i c r o s o f t R e s e a r c h c o n a l m i c r o s o f t c o m A b s t r a c t W e p r e s e n t o u r e x p e r i e n c e s u s i n g a p u r e l y f u n c t i o n a l l a n g u a g e H a s k e l l i n w h a t h a s b e e n t r a d i t i o n a l l y t h e r e a l m o f l o w l e v e l l a n g u a g e s r o b o t c o n t r o l F r o b F u n c t i o n a l R o b o t i c s i s a d o m a i n s p e c i c l a n g u a g e e m b e d d e d i n H a s k e l l f o r r o b o t c o n t r o l F r o b i s b a s e d o n F u n c t i o n a l R e a c t i v e P r o g r a m m i n g F R P a s i n i t i a l l y d e v e l o p e d f o r F r a n a l a n g u a g e o f r e a c t i v e a n i m a t i o n s F r o b p r e s e n t s t h e i n t e r a c t i o n b e t w e e n a r o b o t a n d i t s s t i m u l i b o t h o n b o a r d s e n s o r s a n d m e s s a g e s f r o m o t h e r a g e n t s i n a p u r e l y f u n c t i o n a l m a n n e r T h i s s e r v e s a s a b a s i s f o r c o m p o s a b l e h i g h l e v e l a b s t r a c t i o n s s u p p o r t i n g c o m p l e x c o n t r o l r e g i m e n s i n a c o n c i s e a n d r e u s a b l e m a n n e r I n t r o d u c t i o n R o b o t i c s i s a a n e x c e l l e n t p r o b l e m d o m a i n t o d e m o n s t r a t e t h e p o w e r a n d e x i b i l i t y o f d e c l a r a t i v e p r o g r a m m i n g l a n g u a g e s A m o n g t h e m o r e i n t e r e s t i n g p r o b l e m a r e a s i n t h i s d o m a i n a r e c o n t r o l s y s t e m s c o n s t r a i n t s o l v i n g r e a c t i v e p r o g r a m m i n g s e n s o r f u s i o n a n d r e a l t i m e c o n t r o l W e h a v e d e v e l o p e d F r o b f o r F u n c t i o n a l R o b o t i c s a s a d o m a i n s p e c i c l a n g u a g e e m b e d d e d i n H a s k e l l P H f o r u s e i n r o b o t i c s y s t e m s F r o b h i d e s t h e d e t a i l s o f l o w l e v e l r o b o t o p e r a t i o n s a n d p r o m o t e s a s t y l e o f p r o g r a m m i n g l a r g e l y i n d e p e n d e n t o f t h e u n d e r l y i n g h a r d w a r e O u r c o n t r i b u t i o n s i n c l u d e I d e n t i c a t i o n o f f a c t o r s t h a t d i s t i n g u i s h r o b o t i c s p r o g r a m m i n g f r o m o t h e r u s e s o f f u n c t i o n a l r e a c t i v e p r o g r a m m i n g A c h a r a c t e r i z a t i o n o f c e r t a i n a s p e c t s o f r o b o t i c s p r o g r a m m i n g a s c o n t r o l s y s t e m d e s i g n a n d t h e u s e o f c o n t i n u o u s m u t u a l l y r e c u r s i v e e q u a t i o n s i n F r o b t o d e s c r i b e t h e m H i g h l e v e l a b s t r a c t i o n s t h a t g e n e r a l i z e p a t t e r n s o f c o n t r o l i n c l u d i n g a m o n a d i c s e q u e n c i n g o f c o n t r o l t a s k s C o m b i n a t o r s t h a t i n t e l l i g e n t l y f u s e c o m p e t i n g v i e w s o f s e n s o r d a t a o r s t r a t e g i e s f o r r o b o t c o n t r o l T h e P r o b l e m D o m a i n O u r o v e r a l l g o a l i s t o s t u d y c o n t r o l l a n g u a g e s f o r g e n e r a l r o b o t i c s y s t e m s A t p r e s e n t w e h a v e f o c u s e d o n a s p e c i c h a r d w a r e c o n g u r a t i o n a s e t o f s m a l l

worrisomebelgianΤεχνίτη Νοημοσύνη και Ρομποτική

2 Νοε 2013 (πριν από 3 χρόνια και 9 μήνες)

60 εμφανίσεις

mobilerobots comm unicatingviaa radiomodem.These robots are Nomadics
Superscouts con trolledb yanon boardLin uxsystem.Therobots con tainthree
t ypesofsensors:abeltof16sonars,bumpersforcollisiondetection,andavideo
camera.Thesonarsgiv eonlyanappro ximateideaofho wclosetherobotisto
anobject:objectswhic haretooshortordonotre ect sonararenotdetected.
The driv e mec hanismuses t w o independen t driv e wheels and is con trolled b y
settingtheforw ardv elocit yandturnrate.Therobotk eepstrac kofitslocation
viadeadrec k oning.
Therobotsarecon trolledb yaF robprogramrunningontopofHugs,asmall
portableHask ellin terpreter.Librariessuppliedb yNomadics,writteninC++,
performlo w-lev elcon trolandsensorfunctions.Theselibrariesareimportedin to
Hugs using GreenCard II,a C/C++ in terface language for Hask ell.The run-
ningF robprogramin teractswitharemoteconsolewindo wviatelnet,allo wing
the programto respond to k eyboard input as w ellas its sensors.Robotsma y
alsosend messagesto eac h other viathe radiomodem,allo wingus toexplore
cooperativ ebeha viors.
Indev elopingF robw eha v ereliedonourexperiencew orkingwith   ,aDSL
em beddedin Hask ellfor  unctional  eactiv e  imation[EH97,Ell98b,Ell98a ].
Speci cally,w e ha v e borro w ed the core   and    componen ts of
F ran,whic htogether w ecall  (for        ).Ho w-
ev er,FRPitselfisnotenoughtodealwiththeadditionalcomplexitiesthatarise
intherealmofrobotics(foronething,ananimated gurewillalw a ysdowhat
y ouask;butarobotwillnot!).AmongstthedistinguishingfeaturesofF robare:
1.Roboticsisc haracterizedb ym ultiple,tigh tlycoupledclosed-loopcon trolsys-
tems.Theequationalandhighlyrecursiv enatureoffunctionalprogramming
lendsitselfw elltothistask.
2.Robotsliv einarealw orldwhereerrorsofallsortscanoccuralmostan ywhere
at an ytime.In F rob,w e can build exible error handlingsc hemes directly
in toourabstractions.
3.Anequallyimportan tkindoffailurearisesfromunreliable/noisydatafrom
sensors,requiring lters or correlation measures with other sensors.F rob
m ustdealin telligen tlywithuncertainlyinitsinputs.
4.Robotsarefullofgadgetsthatoftenundergocon gurationc hanges.These
devicesma yrunatv aryingratesandrequirev ariousdegrees ofresponsiv e-
nessfromthecon troller.Thisraisestheneedfor exibilit y,modularit y,and
platformindependenceinoursoft w are.
5.F robprogramsm ustallo wprecisecon trolo v erman y\lo w er-lev el"aspectsof
thesystemsuc hassensorsamplingratesandotherhardw are-lev elconcerns.
6.Finally,thereisaneed for    .Oneofourlong-term
goalsistoprogramrobotswithsomereasonablelev elofin telligence.High-
lev elabstractionsinafunctionalprogrammingsettingshouldhelpusonce
againtostepbac kfromlo w-lev eldetailsandconcen trateonthebigpicture.