|
|||||||||
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
Defines the basic capabilites all robot classes should provide. A simple robot can detect obstacles, its position, and turn and move. The intention is for this class to be extended for several types of physical robots (e.g. Nomad 150s, Hummers, Dennings, etc.). Having a superclass for all of them allows us to potentially use the same control system for each and the same rendering and simulation system.
Frames of reference
We use a standard cartesian coordinate system in
meters and radians. Pretend you are looking down
on the robot: +x
goes out to your right (East), +y goes up (North).
When the robot is initialized, it is facing the +x direction.
Headings are given in radians, with East=0, North=PI/2 and so on CCW
around to 2*PI.
Some methods return "egocentric" vectors.
An egocentric vector is given relative to the center of
the robot in the same heading reference frame as global coordinates.
An object one meter east of the robot is at (1,0) egocentrically.
Sensors
The Simple robot can sense it's location and obstacles.
Timestamps
Many of the sensor and motor command
methods (e.g. get* and set*) require a timestamp as a parameter.
This is to help reduce the amount of I/O to the physical robot.
If the timestamp is less than or equal to the value sent on the
last call to one of these methods, old data is returned.
If the timestamp is -1 or greater than the last timestamp, the
robot is queried, and new data is returned. The idea is
that during each control cycle the higher level software will
increment the timestamp and use it for all calls to these methods.
Copyright
(c)1997, 1998 Tucker Balch
Field Summary | |
protected static TBDictionary |
dictionary
The robot's dictionary object. |
EDU.cmu.cs.coral.abstractrobot.DisplayVectors |
displayVectors
This object draws vectors. |
protected int |
unique_id
The robot's unique id. |
Constructor Summary | |
Simple()
Instantiate a Simple robot. |
|
Simple(int id)
Instantiate a Simple robot with constant values. |
Method Summary | |
abstract java.awt.Color |
getBackgroundColor()
Gets the background color of the robot. |
TBDictionary |
getDictionary()
Gets the TBDictionary holding parameters defined using the "dictionary" keyword in the dsc file. |
abstract java.awt.Color |
getForegroundColor()
Gets the foreground color of the robot. |
int |
getID()
Get the unique ID of the robot. |
int |
getID(long timestamp)
Get the unique ID of the robot (>=0). |
abstract 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 robot's sensors |
abstract Vec2 |
getPosition(long timestamp)
Get the position of the robot in global coordinates. |
abstract double |
getSteerHeading(long timestamp)
Get the current heading of the steering motor. |
abstract long |
getTime()
Gets time elapsed since the robot was instantiated. |
abstract void |
quit()
Quit the robot and release any resources it has reserved. |
abstract void |
resetPosition(Vec2 position)
Reset the odometry of the robot in global coordinates. |
abstract void |
resetSteerHeading(double heading)
Reset the steering odometry of the robot in global coordinates. |
abstract void |
setBaseSpeed(double speed)
Set the base speed for the robot (translation) in meters per second. |
void |
setDictionary(TBDictionary tbd)
Sets the TBDictionary for the robots. |
abstract void |
setDisplayString(java.lang.String s)
Set the String that is printed on the robot's display. |
void |
setID(int id)
Set the unique ID of the robot. |
abstract void |
setObstacleMaxRange(double range)
Set the maximum range at which a sensor reading should be considered an obstacle. |
abstract void |
setSpeed(long timestamp,
double speed)
Set the desired speed for the robot (translation). |
abstract void |
setSteerHeading(long timestamp,
double heading)
Set the desired heading for the steering motor. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected int unique_id
protected static TBDictionary dictionary
public EDU.cmu.cs.coral.abstractrobot.DisplayVectors displayVectors
Constructor Detail |
public Simple()
public Simple(int id)
id
- the unique_idMethod Detail |
public abstract void quit()
public abstract long getTime()
public abstract Vec2[] getObstacles(long timestamp)
timestamp
- only get new information
if timestamp > than last call or == -1.public abstract void setObstacleMaxRange(double range)
range
- the range in meters.public abstract Vec2 getPosition(long timestamp)
timestamp
- only get new information
if timestamp > than last call or timestamp == -1.public void setID(int id)
set
- the robot's ID.public int getID(long timestamp)
timestamp
- only get new information
if timestamp > than last call or timestamp == -1.public int getID()
public abstract void resetPosition(Vec2 position)
position
- the new position.getPosition(long)
public abstract double getSteerHeading(long timestamp)
timestamp
- only get new information
if timestamp > than last call or timestamp == -1.setSteerHeading(long, double)
public abstract void resetSteerHeading(double heading)
heading
- the new heading in radians.getSteerHeading(long)
,
setSteerHeading(long, double)
public abstract void setSteerHeading(long timestamp, double heading)
heading
- the heading in radians.timestamp
- only get new information
if timestamp > than last call or timestamp == -1.getSteerHeading(long)
public abstract 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.setSteerHeading(long, double)
,
setBaseSpeed(double)
public abstract void setDisplayString(java.lang.String s)
s
- String, the text to display.public abstract void setBaseSpeed(double speed)
speed
- the desired speed from 0 to 1.0, where 1.0 is the
base speed.setSpeed(long, double)
public TBDictionary getDictionary()
public void setDictionary(TBDictionary tbd)
tbd
- the dictionary to set it topublic abstract java.awt.Color getForegroundColor()
public abstract java.awt.Color getBackgroundColor()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |