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

CPSC 601.68/599.68: Agent Communication
Fall 2011
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 plagirism 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.

iRobot Create

Implement a CASA agent that controls an iRobot Create robot to measure the length of a reflective tape line on the floor. Your robot agent should communicate with the robot-proxy class, iRobotCreate, and should make use of the request, query-ref, query-if, and subscribe messages and conversations supported by iRobotCreate, the iRobot commands (see iRobot Create Open Interface) available via the iRobot.execute lisp function in iRobotCreate. Use these to find the line, then travel along the line, keeping track of the travel distance so that it can discover the length of the line. 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 line is to be reported in meters to the nearest centimeter. If a report is requested before the completion of the task, any unmeasured variable are to be reported as "unknown", but all measured variables should be reported.

Agent Termination

When the agent has completed the task, the robot should acknowledge (in a manner similar to startup) and power down.

Time Limit

Your agent will be limited to 5 minutes to complete the task from the time of the robot's startup acknowledgement. If the agent has not completed the task in the alloted time, the robot should signal this by playing a pathetic song, and displaying a red power light before powering down.

Notes

The line to be measured will be between 2cm and 4cm wide. To make your life easier, the line will be terminated at both ends by a circular(ish) dot (of a similar IR reflexivity to the line) wider than the distance between to the two front cliff sensors, but narrow than the distance between the to lateral cliff sensors. Other than the terminating dots, there will no other dots or other anomalies on the line. Moreover, the terminal dots will be distinct from one another, the line will not cross itself, and the line will not curve to pass within one robot diameter of itself.

The line may be straight or curved, but any curve radius will be at least 20cm.

You must account for recovering from bumping into walls or other obstructions in your search for the line. However, it is guaranteed that no part of the line you are measuring will be within one robot diameter of any wall or other obstruction.

You should use the cliff sensor signals (packet IDs 28 through 31) to recognize the change in color of the floor to detect the line on the floor. However, keep in mind that the cliff sensors are real devices and have no specific calibration, so you need to be sensitive to changes in their values, not absolute values: Even for the same surface, two different cliff sensors may produce radically different absolute values on the same or different robots. In addition, you should note that small changes are probably irrelevant, and you my encounter random transient spikes in the signal as well. Lighting conditions can also affect the cliff sensor signals, so calibrating your thresholds once and for all at the start point could lead to errors as you cross the room. You should therefore be wary of slow changes in the signal strength.

Example scenarios

The following scripts should be read in using the lisp command "(load <filename>)" in the Environment agent (command tab). The number in the file name indicates it's nominal length in millimeters.

line1000h.txt

(iRobot-env.delete-all)
(iRobot-env.new-bounds 2000 2000)

(iRobot-env.new "v1" "Ellipse2D" 500 1000 120 120 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "v2" "Ellipse2D" 1500 1000 120 120 :paint T :corporeal NIL :color #x202020)

(iRobot-env.new "p1" "Line2D" 500 1000 1500 1000 :paint T :corporeal NIL :color #x202020)

line1400v.txt

(iRobot-env.delete-all)
(iRobot-env.new-bounds 2000 2000)

(iRobot-env.new "v1" "Ellipse2D" 1000 300 120 120 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "v2" "Ellipse2D" 1000 1700 120 120 :paint T :corporeal NIL :color #x202020)

(iRobot-env.new "p1" "Line2D" 1000 300 1000 1700 :paint T :corporeal NIL :color #x202020)

line1700d.txt

(iRobot-env.delete-all)
(iRobot-env.new-bounds 2000 2000)

(iRobot-env.new "v1" "Ellipse2D" 400 400 120 120 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "v2" "Ellipse2D" 1600 1600 120 120 :paint T :corporeal NIL :color #x202020)

(iRobot-env.new "p1" "Line2D" 400 400 1600 1600 :paint T :corporeal NIL :color #x202020)

curve1570.txt

(iRobot-env.delete-all)
(iRobot-env.new-bounds 2000 2000)

(iRobot-env.new "v1" "Ellipse2D" 500 1000 120 120 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "v2" "Ellipse2D" 1500 1000 120 120 :paint T :corporeal NIL :color #x202020)

(iRobot-env.new "p1" "Line2D" 500 1000 510 1098 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p2" "Line2D" 510 1098 538 1192 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p3" "Line2D" 538 1192 584 1278 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p4" "Line2D" 584 1278 647 1354 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p5" "Line2D" 647 1354 722 1416 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p6" "Line2D" 722 1416 809 1462 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p7" "Line2D" 809 1462 903 1490 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p8" "Line2D" 903 1490 1000 1500 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p9" "Line2D" 1000 1500 1098 1490 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p10" "Line2D" 1098 1490 1191 1462 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p11" "Line2D" 1191 1462 1278 1416 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p12" "Line2D" 1278 1416 1354 1354 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p13" "Line2D" 1354 1354 1416 1278 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p14" "Line2D" 1416 1278 1462 1191 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p15" "Line2D" 1462 1191 1490 1098 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p16" "Line2D" 1490 1098 1500 1000 :paint T :corporeal NIL :color #x202020)

curve1570.txt

(iRobot-env.delete-all)
(iRobot-env.new-bounds 3000 2000)

(iRobot-env.new "v1" "Ellipse2D" 500 1000 120 120 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "v2" "Ellipse2D" 2500 1000 120 120 :paint T :corporeal NIL :color #x202020)

(iRobot-env.new "p1" "Line2D" 500 1000 510 1098 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p2" "Line2D" 510 1098 538 1192 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p3" "Line2D" 538 1192 584 1278 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p4" "Line2D" 584 1278 647 1354 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p5" "Line2D" 647 1354 722 1416 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p6" "Line2D" 722 1416 809 1462 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p7" "Line2D" 809 1462 903 1490 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p8" "Line2D" 903 1490 1000 1500 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p9" "Line2D" 1000 1500 1098 1490 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p10" "Line2D" 1098 1490 1191 1462 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p11" "Line2D" 1191 1462 1278 1416 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p12" "Line2D" 1278 1416 1354 1354 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p13" "Line2D" 1354 1354 1416 1278 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p14" "Line2D" 1416 1278 1462 1191 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p15" "Line2D" 1462 1191 1490 1098 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p16" "Line2D" 1490 1098 1500 1000 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p17" "Line2D" 1500 1000 1510 902 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p18" "Line2D" 1510 902 1538 808 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p19" "Line2D" 1538 808 1584 722 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p20" "Line2D" 1584 722 1647 646 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p21" "Line2D" 1647 646 1722 584 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p22" "Line2D" 1722 584 1809 538 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p23" "Line2D" 1809 538 1903 510 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p24" "Line2D" 1903 510 2000 500 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p25" "Line2D" 2000 500 2098 510 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p26" "Line2D" 2098 510 2191 538 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p27" "Line2D" 2191 538 2278 584 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p28" "Line2D" 2278 584 2354 646 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p29" "Line2D" 2354 646 2416 722 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p30" "Line2D" 2416 722 2462 809 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p31" "Line2D" 2462 809 2490 902 :paint T :corporeal NIL :color #x202020)
(iRobot-env.new "p32" "Line2D" 2490 902 2500 1000 :paint T :corporeal NIL :color #x202020)

 


UofC
CPSC 601.68/599.68: Agent Communication
Department of Computer Science

Last updated 2011-09-13 23:15
Rob Kremer