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

Variable Index

 o last_opponents
 o last_teammates
 o rec_positions
Channel for recieving other robot positions.
 o t
The transceiver used to communicate with the rest of the robots.

Constructor Index

 o CommN150Hard(int, int, String, int)
Instantiate a CommN150Hard object.

Method Index

 o broadcast(Message)
Broadcast a message to all teammates, except self.
 o connected()
Check to see if the transceiver is connected to the server.
 o getOpponents(long)
Get an array of Vec2s that represent the locations of opponents.
 o getPlayerNumber(long)
Get the robot's player number, between 0 and the number of robots on the team.
 o getReceiveChannel()
Get an enumeration of the incoming messages.
 o getTeammates(long)
Get an array of Vec2s that represent the locations of teammates (Kin).
 o multicast(int[], Message)
Transmit a message to specific teammates.
 o setCommunicationMaxRange(double)
Set the maximum range at which communication can occur.
 o setKinMaxRange(double)
NOT IMPLEMENTED Set the maximum range at which kin may be sensed.
 o takeStep()
Conduct periodic I/O with the robot.
 o unicast(int, Message)
Transmit a message to just one teammate.

Variables

 o t
 protected TransceiverHard t
The transceiver used to communicate with the rest of the robots.

 o rec_positions
 protected Enumeration rec_positions
Channel for recieving other robot positions.

 o last_teammates
 protected Vec2 last_teammates[]
 o last_opponents
 protected Vec2 last_opponents[]

Constructors

 o 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.

Methods

 o 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
 o 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
 o 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
 o 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.
 o 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.
 o broadcast
 public void broadcast(Message m)
Broadcast a message to all teammates, except self.

Parameters:
m - Message, the message to be broadcast.
 o 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.
 o 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.
 o 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.
 o 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.
 o connected
 public boolean connected()
Check to see if the transceiver is connected to the server.


All Packages  Class Hierarchy  This Package  Previous  Next  Index