EDU.gatech.cc.is.abstractrobot
Class RescueVanSim

java.lang.Object
  |
  +--EDU.gatech.cc.is.abstractrobot.Simple
        |
        +--EDU.gatech.cc.is.abstractrobot.RescueVanSim

public class RescueVanSim
extends Simple
implements SimulatedObject, RescueVan

RescueVanSim implements RescueVanSim for simulation. Also includes code implementing communication, gripper and vision.

Copyright (c)1998 Tucker Balch

See Also:
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

position

protected Vec2 position

steer

protected Vec2 steer

foreground

protected java.awt.Color foreground

background

protected java.awt.Color background

left

protected double left

right

protected double right

top

protected double top

bottom

protected double bottom

DEBUG

public static final boolean DEBUG

base_speed

protected double base_speed
Constructor Detail

RescueVanSim

public RescueVanSim()
Instantiate a RescueVanSim object. Be sure to also call init with proper values.
See Also:
init(double, double, double, double, java.awt.Color, java.awt.Color, int, int, long)
Method Detail

init

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)
Initialize a RescueVanSim object.
Specified by:
init in interface SimulatedObject
Tags copied from interface: SimulatedObject
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 void takeStep(long time_increment,
                     SimulatedObject[] all_objs)
Description copied from interface: SimulatedObject
Take a simulated step.
Specified by:
takeStep in interface SimulatedObject
Tags copied from interface: SimulatedObject
Parameters:
time_increment - how much time has elapsed since the last call.
all_objects - the other objects in the simulation.

getNumObjectsCarrying

public int getNumObjectsCarrying(long timestamp)
Report how many things are loaded in the van.
Tags copied from interface: MultiCarry
Parameters:
timestamp - only get new information if timestamp > than last call or timestamp == -1.
Returns:
number of objects.

pickup

public boolean pickup(long timestamp)
Description copied from interface: MultiCarry
Pick up the closest pickupable object. Will fail if no object in range, or if full capacity.
Tags copied from interface: MultiCarry
Parameters:
timestamp - only get new information if timestamp > than last call or timestamp == -1.
Returns:
true if success, false otherwise.

drop

public void drop(long timestamp)
Drop something out of the van in Last-In-First-Out (LIFO) order.
Tags copied from interface: MultiCarry
Parameters:
timestamp - only get new information if timestamp > than last call or timestamp == -1.
position - the desired position from 0 to 1.
Returns:
true if success, false otherwise.

isObstacle

public boolean isObstacle()
Description copied from interface: SimulatedObject
true if the object should be considered an obstacle, false otherwise.
Specified by:
isObstacle in interface SimulatedObject
Tags copied from interface: SimulatedObject
Returns:
true if the object should be considered an obstacle, false otherwise.

isPushable

public boolean isPushable()
Description copied from interface: SimulatedObject
true if the object is pushable false otherwise.
Specified by:
isPushable in interface SimulatedObject
Tags copied from interface: SimulatedObject
Returns:
true if the object is pushable, false otherwise.

isPickupable

public boolean isPickupable()
Description copied from interface: SimulatedObject
true if the object can be picked up, false otherwise.
Specified by:
isPickupable in interface SimulatedObject
Tags copied from interface: SimulatedObject
Returns:
true if the object can be picked up, false otherwise.

getClosestPoint

public Vec2 getClosestPoint(Vec2 from)
Description copied from interface: SimulatedObject
Find the closest point on the object from a particular location. This is useful for obstacle avoidance and so on.
Specified by:
getClosestPoint in interface SimulatedObject
Tags copied from interface: SimulatedObject
Parameters:
from - the place from which the point is determined.
Returns:
the closest point.

checkCollision

public boolean checkCollision(Circle2 c)
determine if the object is intersecting with a specified circle. This is useful for obstacle avoidance and so on.
Specified by:
checkCollision in interface SimulatedObject
Parameters:
c - the circle which may be intersecting the current object.
Returns:
true if collision detected.

checkCollision

public boolean checkCollision(Polygon2 p)
determine if the object is intersecting with a specified polygon. This is useful for obstacle avoidance and so on.
Specified by:
checkCollision in interface SimulatedObject
Parameters:
p - the polygon which may be intersecting the current object.
Returns:
true if collision detected.

getCenter

public Vec2 getCenter(Vec2 from)
Description copied from interface: SimulatedObject
Find the center point of the object from a particular location.
Specified by:
getCenter in interface SimulatedObject
Tags copied from interface: SimulatedObject
Parameters:
from - the place from which the point is determined.
Returns:
the center point.

push

public void push(Vec2 d,
                 Vec2 v)
Description copied from interface: SimulatedObject
Try to push the object.
Specified by:
push in interface SimulatedObject
Tags copied from interface: SimulatedObject
Parameters:
d - the direction and distance of the push.
v - the velocity of the push.

pickUp

public void pickUp(SimulatedObject o)
Description copied from interface: SimulatedObject
Try to pick up the object.
Specified by:
pickUp in interface SimulatedObject
Tags copied from interface: SimulatedObject
Parameters:
o - the object picking it up - this is used for drawing purposes.

putDown

public void putDown(Vec2 p)
Description copied from interface: SimulatedObject
Try to put down the object.
Specified by:
putDown in interface SimulatedObject
Tags copied from interface: SimulatedObject
Parameters:
p - the location of deposit.

setVisionClass

public void setVisionClass(int v)
Description copied from interface: SimulatedObject
Change the way the object is perceived by vision hardware. This can be used to make old targets invisible (a simulation hack.... sorry).
Specified by:
setVisionClass in interface SimulatedObject
Tags copied from interface: SimulatedObject
Parameters:
v - the new vision class.

getVisionClass

public int getVisionClass()
Description copied from interface: SimulatedObject
Return the vision class of the object.
Specified by:
getVisionClass in interface SimulatedObject
Tags copied from interface: SimulatedObject
Parameters:
v - the new vision class.

getForegroundColor

public java.awt.Color getForegroundColor()
Description copied from interface: SimpleInterface
Gets the foreground color of the robot.
Overrides:
getForegroundColor in class Simple

getBackgroundColor

public java.awt.Color getBackgroundColor()
Description copied from interface: SimpleInterface
Gets the background color of the robot.
Overrides:
getBackgroundColor in class Simple

drawID

public void drawID(java.awt.Graphics g,
                   int w,
                   int h,
                   double t,
                   double b,
                   double l,
                   double r)
Draw the robot's ID.
Specified by:
drawID in interface SimulatedObject
Tags copied from interface: SimulatedObject
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 void drawTrail(java.awt.Graphics g,
                      int w,
                      int h,
                      double t,
                      double b,
                      double l,
                      double r)
Draw the robot's Trail.
Specified by:
drawTrail in interface SimulatedObject
Tags copied from interface: SimulatedObject
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.

setDisplayString

public void setDisplayString(java.lang.String s)
Set the String that is printed on the robot's display. For simulated robots, this appears printed below the agent when view "Robot State" is selected.
Overrides:
setDisplayString in class Simple
Parameters:
s - String, the text to display.

drawState

public void drawState(java.awt.Graphics g,
                      int w,
                      int h,
                      double t,
                      double b,
                      double l,
                      double r)
Draw the robot's state.
Specified by:
drawState in interface SimulatedObject
Tags copied from interface: SimulatedObject
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 void setTrailLength(int l)
Set the length of the trail (in movement steps).
Specified by:
setTrailLength in interface SimulatedObject
Parameters:
l - int, the length of the trail.

clearTrail

public void clearTrail()
Clear the trail.
Specified by:
clearTrail in interface SimulatedObject

draw

public 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.
Specified by:
draw in interface SimulatedObject
Tags copied from interface: SimulatedObject
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.

drawIcon

public void drawIcon(java.awt.Graphics g,
                     int w,
                     int h,
                     double t,
                     double b,
                     double l,
                     double r)
Draw the robot as an icon.
Specified by:
drawIcon in interface SimulatedObject
Tags copied from interface: SimulatedObject
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 void draw(java.awt.Graphics g,
                 int w,
                 int h,
                 double t,
                 double b,
                 double l,
                 double r)
Draw the robot.
Specified by:
draw in interface SimulatedObject
Tags copied from interface: SimulatedObject
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.

quit

public void quit()
Clean up.
Specified by:
quit in interface SimulatedObject
Overrides:
quit in class Simple

getTime

public long getTime()
Gets time elapsed since the robot was instantiated. Since this is simulation, it may not match real elapsed time.
Overrides:
getTime in class Simple

getObstacles

public 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.
Overrides:
getObstacles in class Simple
Parameters:
timestamp - only get new information if timestamp > than last call or timestamp == -1 .
Returns:
the sensed obstacles.

setObstacleMaxRange

public void setObstacleMaxRange(double range)
Set the maximum range at which a sensor reading should be considered an obstacle. Beyond this range, the readings are ignored. The default range on startup is 1 meter.
Overrides:
setObstacleMaxRange in class Simple
Parameters:
range - the range in meters.

getVisualObjects

public 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.
Parameters:
timestamp - only get new information if timestamp > than last call or timestamp == -1 .
channel - (1-6) which type/color of object to retrieve.
Returns:
the sensed objects.

setVisionNoise

public void setVisionNoise(double mean,
                           double stddev,
                           long seed)
this is a dummy implementation to keep compatibility with VisualSensorObject. at this point, vision noise is not built into the class. for an example, see SimpleCyeSim.
Tags copied from interface: VisualObjectSensor
Parameters:
mean - this is the mean of the distribution. most cases this will be 0
stddev - this is the standard deviation of the noise (>= 0.0) if equal to 0, then noise will not affect the sensor
seed - this is the value used to seed the number generator, for repeatable pseudorandom noise.

getVisualSizes

public 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.
Parameters:
timestamp - only get new information if timestamp > than last call or timestamp == -1 .
channel - (1-6) which type/color of object to retrieve.
Returns:
the sizes of the sensed objects.

getVisualAxes

public double[] getVisualAxes(long timestamp,
                              int channel)
NOT IMPLEMENTED: Get an array of doubles that represent the major axis orientation of the visually sensed objects. 0 and PI are horizontal, PI/2 is vertical.
Parameters:
timestamp - only get new information if timestamp > than last call or timestamp == -1 .
channel - (1-6) which type/color of object to retrieve.
Returns:
the major axes of the sensed objects.

getPosition

public Vec2 getPosition(long timestamp)
Get the position of the robot in global coordinates.
Overrides:
getPosition in class Simple
Parameters:
timestamp - only get new information if timestamp > than last call or timestamp == -1.
Returns:
the position.

getPosition

public Vec2 getPosition()
Get the position of the robot in global coordinates.
Specified by:
getPosition in interface SimulatedObject
Returns:
the position.

resetPosition

public void resetPosition(Vec2 posit)
Reset the odometry of the robot in global coordinates. This might be done when reliable sensor information provides a very good estimate of the robot's location, or if you are starting the robot in a known location other than (0,0). Do this only if you are certain you're right!
Overrides:
resetPosition in class Simple
Parameters:
position - the new position.

getSteerHeading

public double getSteerHeading(long timestamp)
Description copied from interface: SimpleInterface
Get the current heading of the steering motor.
Overrides:
getSteerHeading in class Simple
Tags copied from interface: SimpleInterface
Parameters:
timestamp - only get new information if timestamp > than last call or timestamp == -1.
Returns:
the heading in radians.
See Also:
Simple.setSteerHeading(long, double)

resetSteerHeading

public void resetSteerHeading(double heading)
Description copied from interface: SimpleInterface
Reset the steering odometry of the robot in global coordinates. This might be done when reliable sensor information provides a very good estimate of the robot's heading. Do this only if you are certain you're right!
Overrides:
resetSteerHeading in class Simple
Tags copied from interface: SimpleInterface
Parameters:
heading - the new heading in radians.
See Also:
Simple.getSteerHeading(long), Simple.setSteerHeading(long, double)

setSteerHeading

public void setSteerHeading(long timestamp,
                            double heading)
Description copied from interface: SimpleInterface
Set the desired heading for the steering motor.
Overrides:
setSteerHeading in class Simple
Tags copied from interface: SimpleInterface
Parameters:
heading - the heading in radians.
timestamp - only get new information if timestamp > than last call or timestamp == -1.
See Also:
Simple.getSteerHeading(long)

setSpeed

public void setSpeed(long timestamp,
                     double speed)
Description copied from interface: SimpleInterface
Set the desired speed for the robot (translation). The speed must be between 0 and 1; where 0 is stopped and 1.0 is "full blast". It will be clipped to whichever limit it exceeds. Also, underlying software will keep the actual speed at zero until the steering motor is close to the desired heading. Use setBaseSpeed to adjust the top speed.
Overrides:
setSpeed in class Simple
Tags copied from interface: SimpleInterface
Parameters:
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.
See Also:
Simple.setSteerHeading(long, double), Simple.setBaseSpeed(double)

setBaseSpeed

public void setBaseSpeed(double speed)
Description copied from interface: SimpleInterface
Set the base speed for the robot (translation) in meters per second. Base speed is how fast the robot will move when setSpeed(1.0) is called. The speed must be between 0 and MAX_TRANSLATION. It will be clipped to whichever limit it exceeds.
Overrides:
setBaseSpeed in class Simple
Tags copied from interface: SimpleInterface
Parameters:
speed - the desired speed from 0 to 1.0, where 1.0 is the base speed.
See Also:
Simple.setSpeed(long, double)

getOpponents

public 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
Parameters:
timestamp - only get new information if timestamp > than last call or timestamp == -1 .
Returns:
the sensed Opponents.

getPlayerNumber

public int getPlayerNumber(long timestamp)
Return an int represting the player's ID on the team. This value may not be valid if the simulation has not been "set up" yet. Do not use it during initialization.
Parameters:
timestamp - only get new information if timestamp > than last call or timestamp == -1 .
Returns:
the number.

getTeammates

public 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.
Parameters:
timestamp - only get new information if timestamp > than last call or timestamp == -1 .
Returns:
the sensed teammates.

setKinMaxRange

public void setKinMaxRange(double range)
Set the maximum range at which a sensor reading should be considered kin. Beyond this range, the readings are ignored. Also used by opponent sensor. The default range on startup is 1 meter.
Parameters:
range - the range in meters.

setGripperHeight

public void setGripperHeight(long timestamp,
                             double position)
NOT IMPLEMENTED

multicast

public void multicast(int[] ids,
                      Message m)
               throws CommunicationException
Description copied from interface: Transceiver
Transmit a message to specific teammates. Transmission to self is allowed.
Tags copied from interface: Transceiver
Parameters:
ids - int[], the IDs of the agents to receive the message.
m - Message, the message to transmit.
Throws:
CommunicationException - if one of the receiving agents does not exist.

broadcast

public void broadcast(Message m)
Description copied from interface: Transceiver
Broadcast a message to all teammates, except self.
Tags copied from interface: Transceiver
Parameters:
m - Message, the message to be broadcast.

unicast

public void unicast(int id,
                    Message m)
             throws CommunicationException
Description copied from interface: Transceiver
Transmit a message to just one teammate. Transmission to self is allowed.
Tags copied from interface: Transceiver
Parameters:
id - int, the ID of the agent to receive the message.
m - Message, the message to transmit.
Throws:
CommunicationException - if the receiving agent does not exist.

getReceiveChannel

public CircularBufferEnumeration getReceiveChannel()
Description copied from interface: Transceiver
Get an enumeration of the incoming messages. The messages are automatically buffered by the implementation. Unless the implementation guarantees it, you cannot count on all messages being delivered. Example, to print all incoming messages:
 Transceiver c = new RobotComm();
 Enumeration r = c.getReceiveChannel();
 while (r.hasMoreElements())
 	System.out.println(r.nextElement());
 
Tags copied from interface: Transceiver
Returns:
the Enumeration.

setCommunicationMaxRange

public void setCommunicationMaxRange(double m)
Description copied from interface: Transceiver
Set the maximum range at which communication can occur. In simulation, this corresponds to a simulation of physical limits, on mobile robots it corresponds to a signal strength setting.
Tags copied from interface: Transceiver
Parameters:
r - double, the maximum range.

receive

public void receive(Message m)
Description copied from interface: SimulatedObject
Receive a message. This is principally for robot to robot communication. Most objects can safely ignore this.
Specified by:
receive in interface SimulatedObject
Tags copied from interface: SimulatedObject
Parameters:
m - the message.

connected

public boolean connected()
Description copied from interface: Transceiver
Check to see if the transceiver is connected to the server.