|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--EDU.gatech.cc.is.abstractrobot.Simple | +--EDU.gatech.cc.is.abstractrobot.RescueVanSim
RescueVanSim implements RescueVanSim for simulation. Also includes code implementing communication, gripper and vision.
Copyright (c)1998 Tucker Balch
RescueVanSim
Field Summary | |
protected java.awt.Color |
background
|
protected double |
base_speed
|
protected double |
bottom
|
static boolean |
DEBUG
|
protected java.awt.Color |
foreground
|
protected double |
left
|
protected Vec2 |
position
|
protected double |
right
|
protected Vec2 |
steer
|
protected double |
top
|
Fields inherited from class EDU.gatech.cc.is.abstractrobot.Simple |
dictionary,
displayVectors,
unique_id |
Fields inherited from interface EDU.gatech.cc.is.abstractrobot.RescueVan |
MAX_CAPACITY,
MAX_STEER,
MAX_TRANSLATION,
PICKUP_CAPTURE_RADIUS,
RADIUS,
VISION_FOV_DEG,
VISION_FOV_RAD,
VISION_RANGE |
Constructor Summary | |
RescueVanSim()
Instantiate a RescueVanSim object. |
Method Summary | |
void |
broadcast(Message m)
Broadcast a message to all teammates, except self. |
boolean |
checkCollision(Circle2 c)
determine if the object is intersecting with a specified circle. |
boolean |
checkCollision(Polygon2 p)
determine if the object is intersecting with a specified polygon. |
void |
clearTrail()
Clear the trail. |
boolean |
connected()
Check to see if the transceiver is connected to the server. |
void |
draw(java.awt.Graphics g,
int w,
int h,
double t,
double b,
double l,
double r)
Draw the robot. |
void |
draw(Vec2 pos,
java.awt.Graphics g,
int w,
int h,
double t,
double b,
double l,
double r)
Draw the robot in a specific spot. |
void |
drawIcon(java.awt.Graphics g,
int w,
int h,
double t,
double b,
double l,
double r)
Draw the robot as an icon. |
void |
drawID(java.awt.Graphics g,
int w,
int h,
double t,
double b,
double l,
double r)
Draw the robot's ID. |
void |
drawState(java.awt.Graphics g,
int w,
int h,
double t,
double b,
double l,
double r)
Draw the robot's state. |
void |
drawTrail(java.awt.Graphics g,
int w,
int h,
double t,
double b,
double l,
double r)
Draw the robot's Trail. |
void |
drop(long timestamp)
Drop something out of the van in Last-In-First-Out (LIFO) order. |
java.awt.Color |
getBackgroundColor()
Gets the background color of the robot. |
Vec2 |
getCenter(Vec2 from)
Find the center point of the object from a particular location. |
Vec2 |
getClosestPoint(Vec2 from)
Find the closest point on the object from a particular location. |
java.awt.Color |
getForegroundColor()
Gets the foreground color of the robot. |
int |
getNumObjectsCarrying(long timestamp)
Report how many things are loaded in the van. |
Vec2[] |
getObstacles(long timestamp)
Get an array of Vec2s that point egocentrically from the center of the robot to the obstacles currently sensed by the bumpers and sonars. |
Vec2[] |
getOpponents(long timestamp)
Get an array of Vec2s that point egocentrically from the center of the robot to the opponents currently sensed by the robot |
int |
getPlayerNumber(long timestamp)
Return an int represting the player's ID on the team. |
Vec2 |
getPosition()
Get the position of the robot in global coordinates. |
Vec2 |
getPosition(long timestamp)
Get the position of the robot in global coordinates. |
CircularBufferEnumeration |
getReceiveChannel()
Get an enumeration of the incoming messages. |
double |
getSteerHeading(long timestamp)
Get the current heading of the steering motor. |
Vec2[] |
getTeammates(long timestamp)
Get an array of Vec2s that point egocentrically from the center of the robot to the teammates currently sensed by the robot. |
long |
getTime()
Gets time elapsed since the robot was instantiated. |
int |
getVisionClass()
Return the vision class of the object. |
double[] |
getVisualAxes(long timestamp,
int channel)
NOT IMPLEMENTED: Get an array of doubles that represent the major axis orientation of the visually sensed objects. |
Vec2[] |
getVisualObjects(long timestamp,
int channel)
Get an array of Vec2s that represent the locations of visually sensed objects egocentrically from center of the robot to the objects currently sensed by the vision system. |
double[] |
getVisualSizes(long timestamp,
int channel)
NOT IMPLEMENTED: Get an array of doubles that represent an estimate of the size in square meters of the visually sensed objects. |
void |
init(double xp,
double yp,
double tp,
double ignore,
java.awt.Color f,
java.awt.Color b,
int v,
int i,
long s)
Initialize a RescueVanSim object. |
boolean |
isObstacle()
true if the object should be considered an obstacle, false otherwise. |
boolean |
isPickupable()
true if the object can be picked up, false otherwise. |
boolean |
isPushable()
true if the object is pushable false otherwise. |
void |
multicast(int[] ids,
Message m)
Transmit a message to specific teammates. |
boolean |
pickup(long timestamp)
Pick up the closest pickupable object. |
void |
pickUp(SimulatedObject o)
Try to pick up the object. |
void |
push(Vec2 d,
Vec2 v)
Try to push the object. |
void |
putDown(Vec2 p)
Try to put down the object. |
void |
quit()
Clean up. |
void |
receive(Message m)
Receive a message. |
void |
resetPosition(Vec2 posit)
Reset the odometry of the robot in global coordinates. |
void |
resetSteerHeading(double heading)
Reset the steering odometry of the robot in global coordinates. |
void |
setBaseSpeed(double speed)
Set the base speed for the robot (translation) in meters per second. |
void |
setCommunicationMaxRange(double m)
Set the maximum range at which communication can occur. |
void |
setDisplayString(java.lang.String s)
Set the String that is printed on the robot's display. |
void |
setGripperHeight(long timestamp,
double position)
NOT IMPLEMENTED |
void |
setKinMaxRange(double range)
Set the maximum range at which a sensor reading should be considered kin. |
void |
setObstacleMaxRange(double range)
Set the maximum range at which a sensor reading should be considered an obstacle. |
void |
setSpeed(long timestamp,
double speed)
Set the desired speed for the robot (translation). |
void |
setSteerHeading(long timestamp,
double heading)
Set the desired heading for the steering motor. |
void |
setTrailLength(int l)
Set the length of the trail (in movement steps). |
void |
setVisionClass(int v)
Change the way the object is perceived by vision hardware. |
void |
setVisionNoise(double mean,
double stddev,
long seed)
this is a dummy implementation to keep compatibility with VisualSensorObject. |
void |
takeStep(long time_increment,
SimulatedObject[] all_objs)
Take a simulated step. |
void |
unicast(int id,
Message m)
Transmit a message to just one teammate. |
Methods inherited from class EDU.gatech.cc.is.abstractrobot.Simple |
getDictionary,
getID,
getID,
setDictionary,
setID |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected Vec2 position
protected Vec2 steer
protected java.awt.Color foreground
protected java.awt.Color background
protected double left
protected double right
protected double top
protected double bottom
public static final boolean DEBUG
protected double base_speed
Constructor Detail |
public RescueVanSim()
init(double, double, double, double, java.awt.Color, java.awt.Color, int, int, long)
Method Detail |
public void init(double xp, double yp, double tp, double ignore, java.awt.Color f, java.awt.Color b, int v, int i, long s)
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.public void takeStep(long time_increment, SimulatedObject[] all_objs)
time_increment
- how much time has elapsed since
the last call.all_objects
- the other objects in the simulation.public int getNumObjectsCarrying(long timestamp)
timestamp
- only get new information
if timestamp > than last call or timestamp == -1.public boolean pickup(long timestamp)
timestamp
- only get new information
if timestamp > than last call or timestamp == -1.public void drop(long timestamp)
timestamp
- only get new information
if timestamp > than last call or timestamp == -1.position
- the desired position from 0 to 1.public boolean isObstacle()
public boolean isPushable()
public boolean isPickupable()
public Vec2 getClosestPoint(Vec2 from)
from
- the place from which the point is determined.public boolean checkCollision(Circle2 c)
c
- the circle which may be intersecting the current object.public boolean checkCollision(Polygon2 p)
p
- the polygon which may be intersecting the current object.public Vec2 getCenter(Vec2 from)
from
- the place from which the point is determined.public void push(Vec2 d, Vec2 v)
d
- the direction and distance of the push.v
- the velocity of the push.public void pickUp(SimulatedObject o)
o
- the object picking it up - this is used for
drawing purposes.public void putDown(Vec2 p)
p
- the location of deposit.public void setVisionClass(int v)
v
- the new vision class.public int getVisionClass()
v
- the new vision class.public java.awt.Color getForegroundColor()
public java.awt.Color getBackgroundColor()
public void drawID(java.awt.Graphics g, int w, int h, double t, double b, double l, double r)
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.public void drawTrail(java.awt.Graphics g, int w, int h, double t, double b, double l, double r)
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.public void setDisplayString(java.lang.String s)
s
- String, the text to display.public void drawState(java.awt.Graphics g, int w, int h, double t, double b, double l, double r)
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.public void setTrailLength(int l)
l
- int, the length of the trail.public void clearTrail()
public void draw(Vec2 pos, java.awt.Graphics g, int w, int h, double t, double b, double l, double r)
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.public void drawIcon(java.awt.Graphics g, int w, int h, double t, double b, double l, double r)
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.public void draw(java.awt.Graphics g, int w, int h, double t, double b, double l, double r)
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.public void quit()
public long getTime()
public Vec2[] getObstacles(long timestamp)
timestamp
- only get new information
if timestamp > than last call or timestamp == -1 .public void setObstacleMaxRange(double range)
range
- the range in meters.public Vec2[] getVisualObjects(long timestamp, int channel)
timestamp
- only get new information
if timestamp > than last call or timestamp == -1 .channel
- (1-6) which type/color of object to retrieve.public void setVisionNoise(double mean, double stddev, long seed)
mean
- this is the mean of the distribution. most cases this will be 0stddev
- this is the standard deviation of the noise (>= 0.0)
if equal to 0, then noise will not affect the sensorseed
- this is the value used to seed the number generator, for
repeatable pseudorandom noise.public double[] getVisualSizes(long timestamp, int channel)
timestamp
- only get new information if
timestamp > than last call or timestamp == -1 .channel
- (1-6) which type/color of object to retrieve.public double[] getVisualAxes(long timestamp, int channel)
timestamp
- only get new information
if timestamp > than last call or timestamp == -1 .channel
- (1-6) which type/color of object to retrieve.public Vec2 getPosition(long timestamp)
timestamp
- only get new information
if timestamp > than last call or timestamp == -1.public Vec2 getPosition()
public void resetPosition(Vec2 posit)
position
- the new position.public double getSteerHeading(long timestamp)
timestamp
- only get new information
if timestamp > than last call or timestamp == -1.Simple.setSteerHeading(long, double)
public void resetSteerHeading(double heading)
heading
- the new heading in radians.Simple.getSteerHeading(long)
,
Simple.setSteerHeading(long, double)
public void setSteerHeading(long timestamp, double heading)
heading
- the heading in radians.timestamp
- only get new information
if timestamp > than last call or timestamp == -1.Simple.getSteerHeading(long)
public void setSpeed(long timestamp, double speed)
timestamp
- only get new information
if timestamp > than last call or timestamp == -1.speed
- the desired speed from 0 to 1.0, where 1.0 is the
base speed.Simple.setSteerHeading(long, double)
,
Simple.setBaseSpeed(double)
public void setBaseSpeed(double speed)
speed
- the desired speed from 0 to 1.0, where 1.0 is the
base speed.Simple.setSpeed(long, double)
public Vec2[] getOpponents(long timestamp)
timestamp
- only get new information if
timestamp > than last call or timestamp == -1 .public int getPlayerNumber(long timestamp)
timestamp
- only get new information if
timestamp > than last call or timestamp == -1 .public Vec2[] getTeammates(long timestamp)
timestamp
- only get new information if
timestamp > than last call or timestamp == -1 .public void setKinMaxRange(double range)
range
- the range in meters.public void setGripperHeight(long timestamp, double position)
public void multicast(int[] ids, Message m) throws CommunicationException
ids
- int[], the IDs of the agents to receive the message.m
- Message, the message to transmit.public void broadcast(Message m)
m
- Message, the message to be broadcast.public void unicast(int id, Message m) throws CommunicationException
id
- int, the ID of the agent to receive the message.m
- Message, the message to transmit.public CircularBufferEnumeration getReceiveChannel()
Transceiver c = new RobotComm(); Enumeration r = c.getReceiveChannel(); while (r.hasMoreElements()) System.out.println(r.nextElement());
public void setCommunicationMaxRange(double m)
r
- double, the maximum range.public void receive(Message m)
m
- the message.public boolean connected()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |