GTECH 731 Lab Session 10 11/2/10 Lab 8 – Simple Agent Model Review Exploring ArcObjects Lab 9 –...

9
GTECH 731 Lab Session 10 11/2/10 Lab 8 – Simple Agent Model Review Exploring ArcObjects Lab 9 – ArcObjects

Transcript of GTECH 731 Lab Session 10 11/2/10 Lab 8 – Simple Agent Model Review Exploring ArcObjects Lab 9 –...

Page 1: GTECH 731 Lab Session 10 11/2/10 Lab 8 – Simple Agent Model Review Exploring ArcObjects Lab 9 – ArcObjects.

GTECH 731Lab Session 10

11/2/10

Lab 8 – Simple Agent Model Review

Exploring ArcObjects

Lab 9 – ArcObjects

Page 2: GTECH 731 Lab Session 10 11/2/10 Lab 8 – Simple Agent Model Review Exploring ArcObjects Lab 9 – ArcObjects.

Lab 8 – Simple Agent Model

• Create simple Agent model • With Pedestrian, Obstacle and Goal objects

• Pedestrians move towards closest Goal• Originally moved in 1 of 4 directions along longest of 2 component directions

(vertical or horizontal) • Changed pedestrian to move directly to goal along straight line

• “Obstacles” in scene blocked paths to goal• Pedestrian detected “hit” of object and could not move forward

• Problem: What do you do when a “Pedestrian” hits an object?• How does it go around an object?

Page 3: GTECH 731 Lab Session 10 11/2/10 Lab 8 – Simple Agent Model Review Exploring ArcObjects Lab 9 – ArcObjects.

Lab 8 – Original Logic Not Sophisticated Enough

1. For each tick of the clock

1. If there are goals and a goal has not been reached1. Find the closest goal

1. Look at all of the goals and select the closest one

2. Determine direction to that goal1. Calculate two component directions (vertical or horizontal) to the goal and select the

longer of the 2 directions

3. While in old position 1. Move one step in selected direction

2. If object is hit

1. Move back to old position

2. Change selected direction1. If moving North, move East2. If moving East, move South3. If moving South, move West4. If moving West, move North

2. What other options are there when a pedestrian hits an object?

Page 4: GTECH 731 Lab Session 10 11/2/10 Lab 8 – Simple Agent Model Review Exploring ArcObjects Lab 9 – ArcObjects.

Lab 8 – My “Solution” When Object Hit

1. If object is hit

1. Move back to old position

2. Count # of Tries

3. Change selected direction1. If # tries is even

1. Rotate 120

2. Else # tries is odd1. Rotate -120

3. Move “Step Distance” + # Tries

2. Negotiated around “convex” edges

3. Did not work with objects having “concave” edges

120

Page 5: GTECH 731 Lab Session 10 11/2/10 Lab 8 – Simple Agent Model Review Exploring ArcObjects Lab 9 – ArcObjects.

1. If object is hit

1. Move back to old position

2. Change selected direction1. Rotate some other fixed angle (5, 10, 25 etc.)

from the current angle

2. Move “Step Distance”

OR

1. If object is hit

1. Move back to old position

2. Change selected direction1. Set Random Angle to travel

2. Move “Step Distance”

Lab 8 – Alternatives to My “Solution”

120

Page 6: GTECH 731 Lab Session 10 11/2/10 Lab 8 – Simple Agent Model Review Exploring ArcObjects Lab 9 – ArcObjects.

Lab 8 – Follow Edge Of Obstacle

1. If object is hit1. Determine “Edge Hit”

2. Move back to old position

3. Make last point in “Edge Hit” a “Temporary Goal”

4. If temporary goal not “reached”1. Move toward “Temporary Goal”

5. Else1. Determine “Next Edge”

2. Make last point in “Next Edge” the “Temporary Goal”

• Problem might be defining “reaching” temporary goal• Does Pedestrian need to go beyond temporary goal so as not to hit the

same edge when it resumes travelling toward ultimate goal?

• Might need extra variable saying pedestrian is travelling along edge or to say which edge

• How do you tell when you are around the obstacle?

2

1

54

3

Page 7: GTECH 731 Lab Session 10 11/2/10 Lab 8 – Simple Agent Model Review Exploring ArcObjects Lab 9 – ArcObjects.

Exploring ArcObjects

• Like to Geotools, ArcObjects compiled into DLL file and included in any project

• In code, right click and select “Go to definition” for ...• Idocument• AppRef Parent { get; }

• IApplication• Variables: • bool Visible { get; set; };

• string Caption { get; set; }

• Methods: • void RefreshWindow();

• void Shutdown();

• void NewDocument(bool selectTemplate, string templatePath);

• void OpenDocument(string path);

Page 8: GTECH 731 Lab Session 10 11/2/10 Lab 8 – Simple Agent Model Review Exploring ArcObjects Lab 9 – ArcObjects.

Exploring ArcObjects

• In code, right click and select “Go to definition” for ...• MXDocumentClass• AppRef Parent { get; }

• IMxDocument• IMap FocusMap { get; }

• Imap• int LayerCount { get; }• ILayer get_Layer(int Index);• void MoveLayer(ILayer Layer, int toIndex);

• Basic information about the ArcObjects Library is available at: http://edndoc.esri.com/arcobjects/9.2/welcome.htm, under “ArcObjects Library Reference”.

Page 9: GTECH 731 Lab Session 10 11/2/10 Lab 8 – Simple Agent Model Review Exploring ArcObjects Lab 9 – ArcObjects.

Lab 9 – Preview

• Look at Lab assignment