University of Calgary
Rob Kremer
Group Assignment: Basic Robotic Agents in CASA



CPSC 662/568: Agent Communication
(Formerly CPSC 601.68/599.68)
Fall 2015

Department of Computer Science
Computer
Science

Note: This is an group assignment. The work is shared among the group members and each member is responsible for all of the work. For example, if there is plagiarism is found in the assignment, every member is responsible. The group is expected to do it's own work, and must properly cite any and all work taken from external sources.
Each member is responsible to carry their own portion of the workload. To this end, there is a peer assessment process where each member must assess each other member's contribution. Individual marks may differ based on the peer assessment, the instructor's assessment, and other factors.
Another note: You will need to download the CASA project and the iRobotCreate project to this assignment. For details, see the getting CASA and the iRobot code page.

room diagram Implement a CASA agent that measures one wall of a room. The wall that is to be measured has a "virtual wall" device pointed at it. Your robot will start in a random, unknown location in the room and must find the appropriate wall, measure it, then play a short victory song while displaying the wall measurement on your agent's console ("command" tab). Your robot agent should communicate with the robot-proxy class, iRobotCreate, and should make use of

You should implement several command-line interface commands (specified below) using CASA's @LispAccesable annotation or its CasaLispOperator class (as discussed in class, see the class notes). You may implement other interface commands if you wish.

The basic requirements are:

Startup

At startup, the robot should just acknowledge it's ready by flashing lights, playing a short song, or something appropriate of your choice.

Commands

The agent should accept the following run-time commands:

You may implement other commands as appropriate.

Measurement

The length of the wall is to be reported in meters to the nearest centimeter. If a report is requested before the completion of the task, any unmeasured variables are to be reported as "unknown", but all measured variables should be reported. Be sure to account for the size of the robot when measuring the wall.

Agent Termination

When the agent has completed the task, the robot should acknowledge by playing a victory song and power down.

Time Limit

Your agent will be limited to 10 minutes to complete the task from the time of the robot's startup acknowledgement. If the agent has not completed the task in the allotted time, the robot should signal this by playing a pathetic song, and displaying a red power light. The robot may continue on the task, however.

Figure 3: The display for the environment specified in Figure 2.
simulation display

Notes

You must account for recovering from bumping into walls or other obstructions in your search for the correct wall. However, it is guaranteed that no obstacle will be within 2 robot diameters of the wall to be measured.

You can detect the virtual wall using register 13, "Virtual Wall", which will have values 0 or 1. You can detect a wall using the bump sensors (register 7, "BumpsAndWheelDrops") or using the wall detector (register 8 "Wall" [0 or 1], or register 27 "WallSignal" [0-4095]). In the unlikely event you are backing up, you may detect a wall by an overcurrent (register 14 "Overcurrents").

The State pattern is highly recommended to implement your controller.

You can down load the basic iRobot software, just like CASA download, at the iRobotCreate download site.

Hints

To get your initial strategies right, you can use the robot simulator, which is provided in the iRobotCreate project. You the simulator is embodied in the iRobotCreate.simulator.Environment agent, which you can run just like any other agent. To make a robot agent (any subclass of iRobotCreate.iRobotCreate), you create the agent by setting the key parameters :outstream and :instream to different file names. (You connect an iRobotCreate agent to a real robot by setting both the key parameters :outstream and :instream to the file that represents the bluetooth serial I/O channel for that robot.) An example Lisp file (that starts up an Environment agent, populates it with object consistent with this assignment, and adds a iRobotCreate agent into the simulation) is given below (Figure 2). This yields a simulated environment as shown in Figure 3. The iRobotCreate agent started up here is CreateBounce agent that just inherits from iRobotCreate, but has a mind of it's own to move about. For the assignment, you should use a simple iRobotCreate agent, and control it using your own subclass of iRobotCreate.Controller.

Figure 2: An example Lisp file that starts up an Environment agent, populates it with objects consistent with this assignment, and adds an iRobotCreate agent into the simulation.
(let* (
; trace tags for all agents
(trace-tags "warning,info,msg,-msgHandling,-commitments,-policies,-lisp,-eventqueue,-conversations")
(trace-code 10) ; bit 1=off, 2=on, 4=to-monitor-window, 8=trace-to-file
(sleep-time 2) ; time to sleep between starting dependent agents, adjust for slower machines
(n 10) ; n is the number of chat agents to start up
)

;; Set the options for the agent running the commandline
(agent.options :options.tracing T)
(agent.options :options.tracetags trace-tags)

(agent.new-agent "iRobotCreate.simulator.Environment" "RoomEnvironment" 5780
:process "CURRENT"
:trace trace-code
:traceTags trace-tags)

(sleep-ignoring-interrupts sleep-time)
(agent.tell ":5780" "(iRobot-env.delete-all)")
(agent.tell ":5780" "(iRobot-env.new-bounds 2000 2000)")
(agent.tell ":5780"
"(iRobot-env.new \"vWall field\" \"Rectangle2D\" 1000 500 300 1000 :vwall T :corporeal NIL :color #xF4FFF4)")
(agent.tell ":5780"
"(iRobot-env.new \"vWall emitter\" \"Rectangle2D\" 1000 1050 50 100 :corporeal T :color #xFF00FE)")
(agent.tell ":5780"
"(iRobot-env.new \"p1\" \"Line2D\" 500 1500 1500 1500 :paint T :corporeal NIL :color #x202020)")

(sleep-ignoring-interrupts sleep-time)

;; start up N iRobot agents
(do ((i 0 (+ i 1)))
((>= i n))
; CreateBounce is a subclass of iRobotCreate
(agent.new-agent "iRobotCreate.iRobotCreate"
(concatenate 'string "Robbie" (write-to-string i))
(+ 6900 i)
:LAC 9000 :trace trace-code :traceFile :traceTags trace-tags :process "CURRENT"
:outstream (concatenate 'string "Robbie" (write-to-string i) ".out")
:instream (concatenate 'string "Robbie" (write-to-string i) ".in")
:sim
:color (+ #x202000 (* i 5))
)
)
;; start up N Controller agents
(do ((i 0 (+ i 1)))
((>= i n))
; CreateBounce is a subclass of iRobotCreate
(agent.new-agent "iRobotCreate.LineFollower"
(concatenate 'string "RobbieController" (write-to-string i))
(+ 6800 i)
:LAC 9000 :trace trace-code :traceFile :traceTags trace-tags :process "CURRENT"
:controls (concatenate 'string ":" (write-to-string (+ 6900 i))) ; use ":controls <URL>" to connect to the controlled robot.
)
)

) ; end let

 


UofC
CPSC 662/568: Agent Communication
Department of Computer Science

Last updated 2015-02-03 18:58
Rob Kremer