|
|||||||||
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.SocSmallSim
Implements SocSmall for simulation. You should see the specifications in SocSmall for details on how to use these methods.
Copyright (c)1997, 1998 Tucker Balch
SocSmall
Field Summary | |
static boolean |
DEBUG
|
Fields inherited from class EDU.gatech.cc.is.abstractrobot.Simple |
dictionary,
displayVectors,
unique_id |
Fields inherited from interface EDU.gatech.cc.is.abstractrobot.SocSmall |
KICKER_SPEED,
KICKER_SPOT_RADIUS,
MAX_STEER,
MAX_TRANSLATION,
RADIUS |
Constructor Summary | |
SocSmallSim()
Instantiate a SocSmallSim object. |
Method Summary | |
void |
broadcast(Message m)
Broadcast a message to all teammates, except self. |
boolean |
canKick(long timestamp)
Reveals whether or not the ball is in a position to be kicked. |
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 object 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. |
java.awt.Color |
getBackgroundColor()
Gets the background color of the robot. |
Vec2 |
getBall(long timestamp)
Get a Vec2 that points to the ball. |
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 |
getJustScored(long timestamp)
Get an integer that indicates whether a scoring event just occured. |
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. |
Vec2 |
getOpponentsGoal(long timestamp)
Get a Vec2 that points to the opponent's goal. |
Vec2 |
getOurGoal(long timestamp)
Get a Vec2 that points to the team's goal. |
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. |
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 SocSmallSim 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 |
kick(long timestamp)
If the ball can be kicked, kick it. |
void |
multicast(int[] ids,
Message m)
Transmit a message to specific teammates. |
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 |
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 |
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 |
public static final boolean DEBUG
Constructor Detail |
public SocSmallSim()
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)
xp
- if negative, it means this robot is on the west team,
east team otherwise.yp
- ignored.tp
- ignored.ignore
- ignored.f
- color 1 for the robot.b
- color 2 for the robot.v
- vision class of the robot (usually 1 or 2 depending
on whether on west team or east team).i
- unique simulation id (NOT the same as player number!).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 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 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 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 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 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[] getOpponents(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 Vec2 getBall(long timestamp)
timestamp
- only get new information
if timestamp > than last call or timestamp == -1.Vec2
public int getJustScored(long timestamp)
timestamp
- only get new information
if timestamp > than last call or timestamp == -1.public Vec2 getOurGoal(long timestamp)
timestamp
- only get new information
if timestamp > than last call or timestamp == -1.Vec2
public Vec2 getOpponentsGoal(long timestamp)
timestamp
- only get new information
if timestamp > than last call or timestamp == -1.Vec2
public int getPlayerNumber(long timestamp)
timestamp
- only get new information if
timestamp > than last call or timestamp == -1 .public boolean canKick(long timestamp)
timestamp
- only get new information
if timestamp > than last call or timestamp == -1.public void kick(long timestamp)
timestamp
- not used, but retained for compatibility.public Vec2[] getObstacles(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 setObstacleMaxRange(double range)
range
- the range in meters.public Vec2 getPosition(long timestamp)
timestamp
- only get new information
if timestamp > than last call or timestamp == -1.Simple.resetPosition(EDU.gatech.cc.is.util.Vec2)
public Vec2 getPosition()
Simple.resetPosition(EDU.gatech.cc.is.util.Vec2)
public void resetPosition(Vec2 posit)
position
- the new position.Simple.getPosition(long)
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)
setSpeed(long, double)
public void setBaseSpeed(double speed)
setBaseSpeed(double)
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 |