;;; ******************************************************************** ;;; behaviors.ss ;;; Susan Fox ;;; January 2, 2001 ;;; Contains the set of procedures which communicate to the robot's ;;; C library functions, those having to do with turning on or off ;;; behaviors ;;; Requires utilities to be loaded ;(if (not (top-level-bound? 'UTIL.SSLOADED)) ; (load "util.ss")) (define BEHAVIORS.SSLOADED #t) ;;; ******************************************************************** ;;; Activation functions, one for each behavior ;;; Activate stop ;;; (define beh-stop (lambda (priority) ;; call external C code here priority)) ;;; Activate moveForward ;;; (define beh-moveForward (lambda (velocity priority) ;; call external C code here priority)) ;;; Activate goStraight ;;; (define beh-goStraight (lambda (velocity direction priority) ;; call external C code here priority)) ;;; Activate avoidObstaclet ;;; (define beh-avoidObstaclet (lambda (distance velocity priority) ;; call external C code here priority)) ;;; Activate avoidCollision ;;; (define beh-avoidCollision (lambda (distance turn-rate priority) ;; call external C code here priority)) ;;; Activate slowAvoid ;;; (define beh-slowAvoid (lambda (distance velocity priority) ;; call external C code here priority)) ;;; Activate goToPos ;;; (define beh-goToPos (lambda (position velocity priority) ;; call external C code here priority)) ;;; Activate followHallway ;;; (define beh-followHallway (lambda (corridor priority) ;; call external C code here priority)) ;;; Activate enterDoorway ;;; (define beh-enterDoorway (lambda (door direction priority) ;; call external C code here priority)) ;;; Activate turnToPos ;;; (define beh-turnToPos (lambda (position priority) ;; call external C code here priority)) ;;; Activate turnToAngle ;;; (define beh-turnToAngle (lambda (direction angle priority) ;; call external C code here priority)) ;;; Activate localize ;;; (define beh-localize (lambda (priority) ;; call external C code here priority)) ;;; ******************************************************************** ;;; Procedures to turn off behaviors, one by one or a whole list ;;; ;;; turn-off takes a list of behavior names and turns off ;;; each one ;;; (define turn-off (lambda (behav-names) (if (not (null? behav-names)) (begin (case (car behav-names) [(stop) (turn-off-stop)] [(moveForward) (turn-off-moveForward)] [(goStraight) (turn-off-goStraight)] [(avoidObstacle) (turn-off-avoidObstacle)] [(avoidCollision) (turn-off-avoidCollision)] [(slowAvoid) (turn-off-slowAvoid)] [(goToPos) (turn-off-goToPos)] [(followHallway) (turn-off-followHallway)] [(enterDoorway) (turn-off-enterDoorway)] [(turnTo) (turn-off-turnTo)] [(localize) (turn-off-localize)] [else (error 'turn-off "Unknown behavior ~s" (car behav-names))]) (turn-off (cdr behav-names)))))) (define turn-off-stop (lambda () ;; call C code to turn off behavior #f)) (define turn-off-moveForward (lambda () ;; call C code to turn off behavior #f)) (define turn-off-goStraight (lambda () ;; call C code to turn off behavior #f)) (define turn-off-avoidObstacle (lambda () ;; call C code to turn off behavior #f)) (define turn-off-avoidCollision (lambda () ;; call C code to turn off behavior #f)) (define turn-off-slowAvoid (lambda () ;; call C code to turn off behavior #f)) (define turn-off-goToPos (lambda () ;; call C code to turn off behavior #f)) (define turn-off-followHallway (lambda () ;; call C code to turn off behavior #f)) (define turn-off-enterDoorway (lambda () ;; call C code to turn off behavior #f)) (define turn-off-turnTo (lambda () ;; call C code to turn off behavior #f)) (define turn-off-localize (lambda () ;; call C code to turn off behavior #f))