All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class EDU.gatech.cc.is.abstractrobot.SocSmallSim

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

public class SocSmallSim
extends Simple
implements SocSmall, SimulatedObject
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

Version:
$Revision: 1.7 $
Author:
Tucker Balch
See Also:
SocSmall

Variable Index

 o DEBUG

Constructor Index

 o SocSmallSim()
Instantiate a SocSmallSim object.

Method Index

 o broadcast(Message)
 o canKick(long)
 o clearTrail()
Clear the trail.
 o connected()
 o draw(Graphics, int, int, double, double, double, double)
Draw the robot.
 o draw(Vec2, Graphics, int, int, double, double, double, double)
Draw the robot in a specific spot.
 o drawID(Graphics, int, int, double, double, double, double)
Draw the robot's ID.
 o drawState(Graphics, int, int, double, double, double, double)
Draw the robot's state.
 o drawTrail(Graphics, int, int, double, double, double, double)
Draw the robot's Trail.
 o getBall(long)
 o getCenter(Vec2)
 o getClosestPoint(Vec2)
 o getJustScored(long)
Get an integer that indicates whether a scoring event just occured.
 o getObstacles(long)
Get an array of Vec2s that point egocentrically from the center of the robot to the obstacles currently sensed by the bumpers and sonars.
 o getOpponents(long)
Get an array of Vec2s that point egocentrically from the center of the robot to the Opponents currently sensed by the robot.
 o getOpponentsGoal(long)
 o getOurGoal(long)
 o getPlayerNumber(long)
Return an int represting the player's ID on the team.
 o getPosition()
Get the position of the robot in global coordinates.
 o getPosition(long)
Get the position of the robot in global coordinates.
 o getReceiveChannel()
 o getSteerHeading(long)
 o getTeammates(long)
Get an array of Vec2s that point egocentrically from the center of the robot to the teammates currently sensed by the robot.
 o getTime()
Gets time elapsed since the robot was instantiated.
 o getVisionClass()
 o init(double, double, double, double, Color, Color, int, int, long)
Initialize a SocSmallSim object.
 o isObstacle()
 o isPickupable()
 o isPushable()
 o kick(long)
 o multicast(int[], Message)
 o pickUp(SimulatedObject)
 o push(Vec2, Vec2)
 o putDown(Vec2)
 o quit()
Clean up.
 o receive(Message)
 o resetPosition(Vec2)
Reset the odometry of the robot in global coordinates.
 o resetSteerHeading(double)
 o setBaseSpeed(double)
 o setCommunicationMaxRange(double)
 o setDisplayString(String)
Set the String that is printed on the robot's display.
 o setKinMaxRange(double)
Set the maximum range at which a sensor reading should be considered kin.
 o setObstacleMaxRange(double)
Set the maximum range at which a sensor reading should be considered an obstacle.
 o setSpeed(long, double)
 o setSteerHeading(long, double)
 o setTrailLength(int)
Set the length of the trail (in movement steps).
 o setVisionClass(int)
 o takeStep(long, SimulatedObject[])
Take a simulated step;
 o unicast(int, Message)

Variables

 o DEBUG
 public static final boolean DEBUG

Constructors

 o SocSmallSim
 public SocSmallSim()
Instantiate a SocSmallSim object. Be sure to also call init with proper values.

See Also:
init

Methods

 o init
 public void init(double xp,
                  double yp,
                  double tp,
                  double ignore,
                  Color f,
                  Color b,
                  int v,
                  int i,
                  long s)
Initialize a SocSmallSim object. Some of the parameters are ignored because soccer robots have specific starting places and headings.

Parameters:
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!).
 o takeStep
 public void takeStep(long time_increment,
                      SimulatedObject all_objs[])
Take a simulated step;

 o isObstacle
 public boolean isObstacle()
 o isPushable
 public boolean isPushable()
 o isPickupable
 public boolean isPickupable()
 o getClosestPoint
 public Vec2 getClosestPoint(Vec2 from)
 o getCenter
 public Vec2 getCenter(Vec2 from)
 o push
 public void push(Vec2 d,
                  Vec2 v)
 o pickUp
 public void pickUp(SimulatedObject o)
 o putDown
 public void putDown(Vec2 p)
 o setVisionClass
 public void setVisionClass(int v)
 o getVisionClass
 public int getVisionClass()
 o draw
 public void draw(Vec2 pos,
                  Graphics g,
                  int w,
                  int h,
                  double t,
                  double b,
                  double l,
                  double r)
Draw the robot in a specific spot.

 o drawTrail
 public void drawTrail(Graphics g,
                       int w,
                       int h,
                       double t,
                       double b,
                       double l,
                       double r)
Draw the robot's Trail.

 o setDisplayString
 public void setDisplayString(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.

Parameters:
s - String, the text to display.
Overrides:
setDisplayString in class Simple
 o drawState
 public void drawState(Graphics g,
                       int w,
                       int h,
                       double t,
                       double b,
                       double l,
                       double r)
Draw the robot's state.

 o setTrailLength
 public void setTrailLength(int l)
Set the length of the trail (in movement steps).

Parameters:
l - int, the length of the trail.
 o clearTrail
 public void clearTrail()
Clear the trail.

 o drawID
 public void drawID(Graphics g,
                    int w,
                    int h,
                    double t,
                    double b,
                    double l,
                    double r)
Draw the robot's ID.

 o draw
 public void draw(Graphics g,
                  int w,
                  int h,
                  double t,
                  double b,
                  double l,
                  double r)
Draw the robot.

 o quit
 public void quit()
Clean up.

Overrides:
quit in class Simple
 o 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
 o 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.
 o 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.
 o getBall
 public Vec2 getBall(long timestamp)
 o getJustScored
 public int getJustScored(long timestamp)
Get an integer that indicates whether a scoring event just occured.

Parameters:
timestamp - only get new information if timestamp > than last call or timestamp == -1.
Returns:
1 if team just scored, -1 if scored against, 0 otherwise.
 o getOurGoal
 public Vec2 getOurGoal(long timestamp)
 o getOpponentsGoal
 public Vec2 getOpponentsGoal(long timestamp)
 o 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.
 o canKick
 public boolean canKick(long timestamp)
 o kick
 public void kick(long timestamp)
 o 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.

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

Parameters:
range - the range in meters.
Overrides:
setObstacleMaxRange in class Simple
 o getPosition
 public Vec2 getPosition(long timestamp)
Get the position of the robot in global coordinates.

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

Returns:
the position.
See Also:
resetPosition
 o 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!

Parameters:
position - the new position.
Overrides:
resetPosition in class Simple
See Also:
getPosition
 o getSteerHeading
 public double getSteerHeading(long timestamp)
Overrides:
getSteerHeading in class Simple
 o resetSteerHeading
 public void resetSteerHeading(double heading)
Overrides:
resetSteerHeading in class Simple
 o setSteerHeading
 public void setSteerHeading(long timestamp,
                             double heading)
Overrides:
setSteerHeading in class Simple
 o setSpeed
 public void setSpeed(long timestamp,
                      double speed)
Overrides:
setSpeed in class Simple
See Also:
setSpeed
 o setBaseSpeed
 public void setBaseSpeed(double speed)
Overrides:
setBaseSpeed in class Simple
See Also:
setBaseSpeed
 o multicast
 public void multicast(int ids[],
                       Message m) throws CommunicationException
 o broadcast
 public void broadcast(Message m)
 o unicast
 public void unicast(int id,
                     Message m) throws CommunicationException
 o getReceiveChannel
 public Enumeration getReceiveChannel()
 o setCommunicationMaxRange
 public void setCommunicationMaxRange(double m)
 o receive
 public void receive(Message m)
 o connected
 public boolean connected()

All Packages  Class Hierarchy  This Package  Previous  Next  Index