DOC PREVIEW
GT LCC 6310 - LCC 6310 The Computer as an Expressive Medium

This preview shows page 1-2-14-15-29-30 out of 30 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

LCC 6310 The Computer as an Expressive Medium Lecture 24Overview P5 (due Friday) & A6 (not graded) reminder Programming concepts Braitenberg vehicle reminder Implement vehicles Possible extensions Free time to work on P5 and/or A6 at the end of classProject 5 Due: 5pm Friday November 13 In this project, build a collection of simple AI agents that interact with the user, each other, and their ecosystem, to give the illusion of life. You can build upon the provided framework of Braitenberg vehicles, which can produce complex agent behaviors, or code your own simulation. Provided: Braitenberg starter codeAssignment 6 Posted online, not graded A6-01: Modify the Braitenberg vehicle so that it has a different visual appearance. A6-02: Create a vehicle that responds to multiple sense modalities. The best way to do this is to overlay multiple sensory fields, each with its own source types (e.g. sound, light, heat, etc.). A6-03: Make vehicles also be sources, so that vehicles respond to each other. One way to do this is to place a moving light source on each vehicle. You can choose to make the light source visible, or sum the moving sources into an invisible sensory field (if you don’t want glowing circles or some such appearing around vehicles). A6-04: Have your vehicles interact with the environment in some way. For example, when a vehicle runs into a source, perhaps it destroys the source. Other vehicles could create sources. Vehicles could lay trails that other vehicles respond to. A vehicle could have multiple ways of moving (flying under certain conditions, moving on the ground under other conditions, etc).Vehicle 2a: coward Sensors (light sensors) connected directly to motor on same side Steers away from source Charges source directly in front Rests in darknessVehicle 2b: aggressive Turns towards source and charges Charges source directly in front Rests in darkness Sensors connected directly to motor on opposite sideVehicle 3a: love - - - - Turns towards source and rests Moves toward source and rests Moves in darkness Sensors connected through an inverter to motor on same sideVehicle 3b: explorer - - - - Turns away from source Moves in darkness Rotates away (unless exactly on target) Sensors connected through an inverter to motor on opposite sideClasses in code Vehicle (1) Abstract class, provides template for movement logic Subclassed by vehicles with specific behavior logics Draws itself and the wheels and the sensors Wheel (2) The flapping things on the vehicle Sensor (3) The "eyes" on the vehicle – glow indicates activation Can act as sensors with inverters as well Source (4) A light source - has a range of influence SensoryField (5) A collection of light sources whose influence adds up Draws itself and all the light sources in the field Let's see this run in Processing… (1) (2) (5) (4) (3)How do we implement all this? Last week: We implemented a sensory field of light sources Wrote code to implement: Source.java SensoryField.java This week: We'll create the vehicles to move around the sensory field Write code to implement: Sensor.java Wheel.java Vehicle.java (and VehicleCoward.java, VehicleAggressive.java, etc.)Concept: abstract classes Abstract classes let you define some behaviors but force your subclasses to provide others. This is useful if your class knows that it needs to do certain things, but doesn't know how to do them (because they might be particular to different subclasses for example). The abstract base class can declare these methods to be abstract, and subclasses will need to fill them in. abstract class MyAbstractBaseClass { ... abstract void myMethod(); ... } class MySubclass extends MyAbstractBaseClass { ... void myMethod() { // fill me in here } ... }Vehicles Vehicles have two sensors and two wheels each Vehicle is an abstract class It knows how to do almost everything a vehicle should do: initialize itself, draw itself (body, wheels and sensors), etc. But it doesn't know how to adjust the wheel velocities based on the sensor input: this is done differently for different kinds of vehicles (coward, aggressive, lover, explorer). Vehicle provides an abstract doSenseLogic() method Should describe the relationship between sensors and wheels. Different types of vehicles (subclasses) can implement this method in different ways to display different behaviors. doSenseLogic() will set the wheel velocities based on sensor input. doSenseLogic() is called by moveMe() to actually move the vehicle.Sensors and Wheels Sensors know how to read values from the surrounding sensory field. They also know how to draw themselves. Wheels have a radius and angular velocity which determines their displacement (and hence the displacement of their corresponding vehicle). Let's try to build some of the Vehicle-related classes…Sensor class What do we need to store for a Sensor? What should a Sensor be able to do? Let's build this class…Sensor variables What do we need to store for a Sensor? float x, y; // the sensor position float sense; // the sensor readingSensor methods What should a Sensor be able to do? drawMe() // should know how to draw itself setLocation() // so that we can move getSense() // get a sensory reading at the current location Let's fill in some of these methods…getSense Get a sensor reading (between 0-1) at the current (x,y) coordinate Need to pass in the sensory field Can return an inverse reading if the flag is set to true float getSense(SensoryField sfield, boolean inverse) { float val = sfield.getValue((int)x,(int)y) / 255.0f; sense = (inverse) ? (1-val) : val; return sense; }Wheel class What do we need to store for a Wheel? What should a Wheel be able to do? Let's build this class…Wheel variables What do we need to store for a Wheel? float x, y; // the wheel position float angvel, linvel; // angular and linear velocities float radius; // wheel radius float ang; // individual wheel angle used for wheel wiggleWheel methods What should a Wheel be able to do? drawMe() // should know how to draw itself setVelocity() // set the velocity of this wheel Let's fill in some of these methods…setVelocity Set angular velocity for this wheel and update linear velocity accordingly void setVelocity(float angvel) { this.angvel = angvel; // linear velocity updated based on wheel radius and angular velocity linvel = angvel * radius; }Vehicle class What do we need to store for a Vehicle? What should a


View Full Document

GT LCC 6310 - LCC 6310 The Computer as an Expressive Medium

Documents in this Course
Load more
Download LCC 6310 The Computer as an Expressive Medium
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view LCC 6310 The Computer as an Expressive Medium and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view LCC 6310 The Computer as an Expressive Medium 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?