All Packages Class Hierarchy This Package Previous Next Index
Class EDU.gatech.cc.is.abstractrobot.CommN150Hard
java.lang.Object
|
+----EDU.gatech.cc.is.abstractrobot.Simple
|
+----EDU.gatech.cc.is.abstractrobot.SimpleN150Hard
|
+----EDU.gatech.cc.is.abstractrobot.CommN150Hard
- public class CommN150Hard
- extends SimpleN150Hard
- implements CommN150, HardObject
CommN150Hard implements SimpleN150 for
Nomad 150 hardware using the Ndirect class.
You should see the specifications in SimpleN150
and Ndirect class documentation for details.
Copyright
(c)1998 Tucker Balch
- Version:
- $Revision: 1.1 $
- Author:
- Tucker Balch
- See Also:
- CommN150, Ndirect
-
last_opponents
-
-
last_teammates
-
-
rec_positions
- Channel for recieving other robot positions.
-
t
- The transceiver used to communicate with the rest of the robots.
-
CommN150Hard(int, int, String, int)
- Instantiate a CommN150Hard object.
-
broadcast(Message)
- Broadcast a message to all teammates, except self.
-
connected()
- Check to see if the transceiver is connected to the server.
-
getOpponents(long)
- Get an array of Vec2s that represent the
locations of opponents.
-
getPlayerNumber(long)
- Get the robot's player number, between 0
and the number of robots on the team.
-
getReceiveChannel()
- Get an enumeration of the incoming messages.
-
getTeammates(long)
- Get an array of Vec2s that represent the locations of
teammates (Kin).
-
multicast(int[], Message)
- Transmit a message to specific teammates.
-
setCommunicationMaxRange(double)
- Set the maximum range at which communication can occur.
-
setKinMaxRange(double)
- NOT IMPLEMENTED
Set the maximum range at which kin may be sensed.
-
takeStep()
- Conduct periodic I/O with the robot.
-
unicast(int, Message)
- Transmit a message to just one teammate.
t
protected TransceiverHard t
- The transceiver used to communicate with the rest of the robots.
rec_positions
protected Enumeration rec_positions
- Channel for recieving other robot positions.
last_teammates
protected Vec2 last_teammates[]
last_opponents
protected Vec2 last_opponents[]
CommN150Hard
public CommN150Hard(int serial_port,
int baud,
String server,
int id) throws Exception
- Instantiate a CommN150Hard object. You should only
instantiate one of these per robot connected to your
computer. Standard call is CommN150Hard(1,38400);
- Parameters:
- serial_port - 1 = ttys0 (COM1), 2 = ttys1 (COM2) ...
- baud - baud rate for communication.
- Throws: Exception
- If unable to configure the hardware.
takeStep
public void takeStep()
- Conduct periodic I/O with the robot. It runs at most every
SimpleN150Hard.MIN_CYCLE_TIME milliseconds to gather sensor
data from the robot, and issue movement commands.
- Overrides:
- takeStep in class SimpleN150Hard
getTeammates
public Vec2[] getTeammates(long timestamp)
- Get an array of Vec2s that represent the locations of
teammates (Kin).
- Parameters:
- timestamp - only get new information if
timestamp > than last call or timestamp == -1.
- Returns:
- the sensed teammates.
- See Also:
- Vec2
getOpponents
public Vec2[] getOpponents(long timestamp)
- Get an array of Vec2s that represent the
locations of opponents.
- Parameters:
- timestamp - only get new information if
timestamp > than last call or timestamp == -1.
- Returns:
- the sensed opponents.
- See Also:
- Vec2
getPlayerNumber
public int getPlayerNumber(long timestamp)
- Get the robot's player number, between 0
and the number of robots on the team.
Don't confuse this with getID which returns a unique number
for the object in the simulation as a whole, not on its individual
team. On real hardware however, getID == PlayerNumber.
- Parameters:
- timestamp - only get new information if
timestamp > than last call or timestamp == -1.
- Returns:
- the player number.
setKinMaxRange
public void setKinMaxRange(double r)
- NOT IMPLEMENTED
Set the maximum range at which kin may be sensed. Primarily
for use in simulation.
- Parameters:
- r - double, the maximum range.
broadcast
public void broadcast(Message m)
- Broadcast a message to all teammates, except self.
- Parameters:
- m - Message, the message to be broadcast.
unicast
public void unicast(int id,
Message m) throws CommunicationException
- Transmit a message to just one teammate. Transmission to
self is allowed.
- 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.
multicast
public void multicast(int ids[],
Message m) throws CommunicationException
- Transmit a message to specific teammates. Transmission to
self is allowed.
- 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.
getReceiveChannel
public Enumeration getReceiveChannel()
- 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());
- Returns:
- the Enumeration.
setCommunicationMaxRange
public void setCommunicationMaxRange(double r)
- 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.
- Parameters:
- r - double, the maximum range.
connected
public boolean connected()
- Check to see if the transceiver is connected to the server.
All Packages Class Hierarchy This Package Previous Next Index