Functional Languages Meet Vision in addition to Robotics: FRP in Action Gregory D. Hager De

Functional Languages Meet Vision in addition to Robotics: FRP in Action Gregory D. Hager De www.phwiki.com

Functional Languages Meet Vision in addition to Robotics: FRP in Action Gregory D. Hager De

Bellis, Bill, Meteorologist has reference to this Academic Journal, PHwiki organized this Journal Functional Languages Meet Vision in addition to Robotics: FRP in Action Gregory D. Hager Department of Computer Science Johns Hopkins University John Peterson Yale University Copyright c2002, Gregory D. Hager All rights reserved. in collaboration with Paul Hudak in addition to Henrik Nilsson Yale University Izzet Pembeci in addition to Xiangtian Dai Johns Hopkins University Outline Motivation in addition to History Brief introduction to FRP FRP-style systems as long as vision in addition to robotics Some current in addition to future applications Motivation XVision: 20,000 lines C++ Vision, Graphics,UI XWindows: 1 lines C Graphics, UI ServoMatic: 20,000 lines C++ Control

Dartmouth College US www.phwiki.com

This Particular University is Related to this Particular Journal

How Best to Integrate The “Unix” approach x = torobot(control(track(objects))) or callbacks or worker functions The “Windows” approach threads threads threads A “language gap” between what we want to express in terms of component domain constructs in addition to the “glue” we have to put components together The common thread here is time flow – each sub-system has to advance its clock in addition to communicate with other sub-systems. “Integration by as long as loop” “Integration by appeal to a higher power” Other Problems Typical recurring implementation chores Writing loops to step as long as ward discretely in time Time slicing time-varying components that operate in parallel Synchronizing updates across components Code reuse Two pieces of code need to do almost the same thing, but not quite interconnection patterns among components What’s correct The design doesn’t look at all like the code Hard to tell if its a bug in the code, or a bug in the design Declarative Programming! Our Goal We make use of Functional Reactive Programming (FRP) Extends any programming language with a uni as long as m notion of time flow Continuous time (control system) in addition to discrete time (event oriented) Dynamic switching (generate new connection patterns on the fly) Fully explicit component interfaces Sequential in addition to parallel process combination Explicit h in addition to le on resource use as long as some subsets of FRP FRP lets us describe what to do not how to do it To use modern programming language ideas in the design of domain-specific languages in addition to environments as long as sensor-driven robot programming.

Software Architectures A good DSL does not impose an architecture on the application. It captures architectural families in addition to allows different architectures to be used at different levels of the system. Functional abstraction is used to capture architectural patterns. We use FRP as a substrate on which to build languages in domains that involve time flow. Why FRP as long as Vision in addition to Robotics Continuous in addition to discrete semantic domains Clear expression programs are close to the design programs express what we want to do, not how to do it Architecture neutral create abstractions as needed common “look- in addition to -feel” Potentially rich component interfaces Modular Domain Specific Languages in addition to Tools, Paul Hudak, ICSR 98 History Conal Elliott (Microsoft Research) develops Fran, a language of interactive animations, an embedded language in Haskell. The “core” of Fran is separated in addition to generalized, yielding FRP. FRP is used to build FROB as long as robot control in addition to FVision as long as visual tracking. FROB is used to teach robotics at Yale using Scouts in addition to a simulator. Serious per as long as mance problems in FRP delay general release in addition to AFRP ( as long as Arrowized FRP) is developed. AFRP is nearly ready to release. AFRP is implemented as a Haskell library. RT-FRP in addition to E-FRP dialects are developed to address resource constraints. These languages are implemented via compilation in addition to can be used in embedded systems. RaPID is developed at JHU to incorporate the FRP programming style into C++. Rapid is incorporated into XVision2. FROB is ported to AFRP in addition to used in demos. This is not yet in release.

Functions in addition to Types All of these examples are written in Haskell – a functional language. But Haskell isn’t essential to our methodology. Parens not needed as long as function application: f x y Polymorphic types are an essential part of the system: f :: Integer -> Float -> Bool f is a function with two arguments, Integer in addition to Float, in addition to returning Bool Types may have parameters: g :: SF Integer Bool SF is a type with two arguments Type variables represent dependencies among parameters h :: a -> SF a a h is a function from a value of any type (“a”) to a value of type SF a a, where the a’s in the output must be the same type as the input FROB Basics Dynamics (time variation) is fundamental to interaction: s f d FROB Basics Dynamics (time variation) is fundamental to interaction: d

FROB Basics Dynamics (time variation) is fundamental to interaction: d FROB Basics Dynamics (time variation) is fundamental to interaction: d FROB Basics Dynamics (time variation) is fundamental to interaction: d

FROB Basics Dynamics (time variation) is fundamental to interaction: d Signal Functions Components are encapsulated as signal functions. Input Signals Output Signals Integer Float Integer Float Bool Signal Functions Components are encapsulated as signal functions. Input Signals Output Signals Integer Float Integer Float Bool Type signature as long as this component: f :: SF (Integer, Float, Integer) (Float, Bool)

Signal Functions Components are encapsulated as signal functions. Integer Float Integer Float Bool Type signature as long as this component: f :: SF (Integer, Float, Integer) (Float, Bool) f = proc (i, f, j) -> (g,b) where i f j g b Names as long as input in addition to output signals Signal Functions Components are encapsulated as signal functions. Integer Float Integer Float Bool Type signature as long as this component: f :: SF (Integer, Float, Integer) (Float, Bool) f = proc (i, f, j) -> (g,b) where b = i > j i f j g b Pointwise computations on instantaneous values > Signal Functions Components are encapsulated as signal functions. c2 c1 Integer Float Integer Float Bool Type signature as long as this component: f :: SF (Integer, Float, Integer) (Float, Bool) f = proc (i, f, j) -> (g,b) where b = i > j o1 <- c1 <- i1 o2 <- c2 <- i2 i f j g b Subcomponents i1 i2 o1 o2 Signal Functions c2 c1 Integer Float Integer Float Bool f = proc (i, f, j) -> (g,b) where b = i > j o1 <- c1 <- i1 o2 <- c2 <- i2 g = o1+o2 i1 = f i2 = f i f j g b i1 i2 o1 o2 Full definition of a signal function A FROB Wall Follower wallFollow :: Distance -> SF (Velocity, Distance, Distance) (Velocity, RotVel) wallFollow d-star = proc (v-curr, f, s) -> (v, omega) where v = limit v-max (f – d-star) s-dot <- derivative <- s omega = rerror - s-dot rerror = limit (v-curr sin theta-max) (d-star - s) Events An event is a signal that occurs only at some times. Events carry a value; we write “Event a” as the type of an event carrying type “a”. A signal function that uses an event has a type such as f :: SF (Event a) a Here f reads a signal of events carrying type “a” in addition to produces a continuous output also of type “a” Functions on events: .. :: Event a -> Event a -> Event a Merging of event streams tag :: Event a -> b -> Event b Changing the value of an event edge :: SF Bool (Event ()) Watch as long as an edge in a boolean signal. () = “void”.

Bellis, Bill ABC15 News at 5 PM - KNXV-TV Meteorologist www.phwiki.com

Basic Signal Functions integral :: Fractional a => SF a a t t hold :: a -> SF (Event a) a t t hold 3 5 1 5 3 1 Switching Switching allows the network of components to be dynamically altered. until :: SF a b -> SF a (Event (SF a b)) -> SF a b Initial component Switching event defines a new component Overall circuit has type SF a b There are many different ways to do switching; AFRP contains a number of different switching constructs. But We Need More Turn Left No Wall Wall left Wall Follow Left Turn Right Blocked Free

But We Need More Turn Left No Wall Wall left Wall Follow Left Turn Right Blocked Free But We Need More Turn Left No Wall Wall left Wall Follow Left Turn Right Blocked Free But We Need More Turn Left No Wall Wall left Wall Follow Left Turn Right Blocked Free

FRP-Relevant links Haskell: http://haskell.org FRP http://haskell.org/FRP CIRL lab http://www.cs.jhu.edu/CIRL XVision2 http://www.cs.jhu.edu/CIRL/XVision2

Bellis, Bill Meteorologist

Bellis, Bill is from United States and they belong to ABC15 News at 5 PM – KNXV-TV and they are from  Phoenix, United States got related to this Particular Journal. and Bellis, Bill deal with the subjects like Meteorology

Journal Ratings by Dartmouth College

This Particular Journal got reviewed and rated by Dartmouth College and short form of this particular Institution is US and gave this Journal an Excellent Rating.