All Packages Class Hierarchy This Package Previous Next Index
Interface EDU.gatech.cc.is.simulation.SimulatedObject
- public interface SimulatedObject
If you want to include a new object for JavaBot simulation,
you must implement this interface.
Most of these methods are used by other simulated objects to either
generate simulated sensor values or reproduce accurate dynamic results.
Copyright
(c)1997 Georgia Tech Research Corporation
- Version:
- $Revision: 1.5 $
- Author:
- Tucker Balch
-
clearTrail()
- Clear the trail.
-
draw(Graphics, int, int, double, double, double, double)
- Draw the object.
-
draw(Vec2, Graphics, int, int, double, double, double, double)
- Draw the object in a specific spot, regardless of where it really
is.
-
drawID(Graphics, int, int, double, double, double, double)
- Draw the object's ID.
-
drawState(Graphics, int, int, double, double, double, double)
- Draw the object's state.
-
drawTrail(Graphics, int, int, double, double, double, double)
- Draw the object's trail.
-
getCenter(Vec2)
- Find the center point of the object from a particular location.
-
getClosestPoint(Vec2)
- Find the closest point on the object from a particular location.
-
getID()
- Return the id.
-
getPosition()
- Find the center point of the object in absolute coordinates.
-
getVisionClass()
- Return the vision class of the object.
-
init(double, double, double, double, Color, Color, int, int, long)
- Initialize a simulated object.
-
isObstacle()
- true if the object should be considered an obstacle, false otherwise.
-
isPickupable()
- true if the object can be picked up, false otherwise.
-
isPushable()
- true if the object is pushable false otherwise.
-
pickUp(SimulatedObject)
- Try to pick up the object.
-
push(Vec2, Vec2)
- Try to push the object.
-
putDown(Vec2)
- Try to put down the object.
-
quit()
- Clean up.
-
receive(Message)
- Receive a message.
-
setID(int)
- Set the id of the object.
-
setTrailLength(int)
- Set the length of the trail (in movement steps).
-
setVisionClass(int)
- Change the way the object is perceived by vision hardware.
-
takeStep(long, SimulatedObject[])
- Take a simulated step.
init
public abstract void init(double x,
double y,
double t,
double r,
Color fg,
Color bg,
int vc,
int id,
long s)
- Initialize a simulated object. Called automatically by
JavaBotSim.
- Parameters:
- x - the initial x position.
- y - the initial y position.
- t - orientation.
- r - radius.
- fg - the foreground color of the object when drawn.
- bg - the background color of the object when drawn.
- vc - the vision class of the object - for use
by simulated vision.
- id - a unique ID number fore the object.
- s - random number seed.
takeStep
public abstract void takeStep(long time_increment,
SimulatedObject all_objects[])
- Take a simulated step.
- Parameters:
- time_increment - how much time has elapsed since
the last call.
- all_objects - the other objects in the simulation.
isObstacle
public abstract boolean isObstacle()
- true if the object should be considered an obstacle, false otherwise.
- Returns:
- true if the object should be considered an obstacle,
false otherwise.
isPushable
public abstract boolean isPushable()
- true if the object is pushable false otherwise.
- Returns:
- true if the object is pushable, false otherwise.
isPickupable
public abstract boolean isPickupable()
- true if the object can be picked up, false otherwise.
- Returns:
- true if the object can be picked up, false otherwise.
getClosestPoint
public abstract Vec2 getClosestPoint(Vec2 from)
- Find the closest point on the object from a particular location.
This is useful for obstacle avoidance and so on.
- Parameters:
- from - the place from which the point is determined.
- Returns:
- the closest point.
getPosition
public abstract Vec2 getPosition()
- Find the center point of the object in absolute coordinates.
- Returns:
- the point.
getCenter
public abstract Vec2 getCenter(Vec2 from)
- Find the center point of the object from a particular location.
- Parameters:
- from - the place from which the point is determined.
- Returns:
- the center point.
push
public abstract void push(Vec2 d,
Vec2 v)
- Try to push the object.
- Parameters:
- d - the direction and distance of the push.
- v - the velocity of the push.
pickUp
public abstract void pickUp(SimulatedObject o)
- Try to pick up the object.
- Parameters:
- o - the object picking it up - this is used for
drawing purposes.
putDown
public abstract void putDown(Vec2 p)
- Try to put down the object.
- Parameters:
- p - the location of deposit.
setVisionClass
public abstract void setVisionClass(int v)
- Change the way the object is perceived by vision hardware.
This can be used to make old targets invisible (a simulation
hack.... sorry).
- Parameters:
- v - the new vision class.
getVisionClass
public abstract int getVisionClass()
- Return the vision class of the object.
- Parameters:
- v - the new vision class.
getID
public abstract int getID()
- Return the id.
setID
public abstract void setID(int id)
- Set the id of the object.
- Parameters:
- id - the new id.
receive
public abstract void receive(Message m)
- Receive a message. This is principally for robot to robot
communication. Most objects can safely ignore this.
- Parameters:
- m - the message.
quit
public abstract void quit()
- Clean up.
draw
public abstract void draw(Graphics g,
int w,
int h,
double t,
double b,
double l,
double r)
- Draw the object.
- Parameters:
- g - graphics area to draw the object.
- w - the width in pixels of g.
- h - the height in pixels of g.
- t - the y coordinate represented by the top boundary of
the drawing area.
- b - the y coordinate represented by the bottom boundary of
the drawing area.
- l - the x coordinate represented by the left boundary of
the drawing area.
- r - the x coordinate represented by the right boundary of
the drawing area.
drawID
public abstract void drawID(Graphics g,
int w,
int h,
double t,
double b,
double l,
double r)
- Draw the object's ID.
- Parameters:
- g - graphics area to draw the object.
- w - the width in pixels of g.
- h - the height in pixels of g.
- t - the y coordinate represented by the top boundary of
the drawing area.
- b - the y coordinate represented by the bottom boundary of
the drawing area.
- l - the x coordinate represented by the left boundary of
the drawing area.
- r - the x coordinate represented by the right boundary of
the drawing area.
drawTrail
public abstract void drawTrail(Graphics g,
int w,
int h,
double t,
double b,
double l,
double r)
- Draw the object's trail.
- Parameters:
- g - graphics area to draw the object.
- w - the width in pixels of g.
- h - the height in pixels of g.
- t - the y coordinate represented by the top boundary of
the drawing area.
- b - the y coordinate represented by the bottom boundary of
the drawing area.
- l - the x coordinate represented by the left boundary of
the drawing area.
- r - the x coordinate represented by the right boundary of
the drawing area.
setTrailLength
public abstract void setTrailLength(int l)
- Set the length of the trail (in movement steps).
Non-robots can ignore this.
- Parameters:
- l - int, the length of the trail.
clearTrail
public abstract void clearTrail()
- Clear the trail.
Non-robots can ignore this.
drawState
public abstract void drawState(Graphics g,
int w,
int h,
double t,
double b,
double l,
double r)
- Draw the object's state.
- Parameters:
- g - graphics area to draw the object.
- w - the width in pixels of g.
- h - the height in pixels of g.
- t - the y coordinate represented by the top boundary of
the drawing area.
- b - the y coordinate represented by the bottom boundary of
the drawing area.
- l - the x coordinate represented by the left boundary of
the drawing area.
- r - the x coordinate represented by the right boundary of
the drawing area.
draw
public abstract void draw(Vec2 p,
Graphics g,
int w,
int h,
double t,
double b,
double l,
double r)
- Draw the object in a specific spot, regardless of where it really
is.
- Parameters:
- p - location to draw it at.
- g - graphics area to draw the object.
- w - the width in pixels of g.
- h - the height in pixels of g.
- t - the y coordinate represented by the top boundary of
the drawing area.
- b - the y coordinate represented by the bottom boundary of
the drawing area.
- l - the x coordinate represented by the left boundary of
the drawing area.
- r - the x coordinate represented by the right boundary of
the drawing area.
All Packages Class Hierarchy This Package Previous Next Index