EDU.gatech.cc.is.abstractrobot
Class MultiForageN150Hard

java.lang.Object
  |
  +--EDU.gatech.cc.is.abstractrobot.Simple
        |
        +--EDU.gatech.cc.is.abstractrobot.SimpleN150Hard
              |
              +--EDU.gatech.cc.is.abstractrobot.MultiForageN150Hard
Direct Known Subclasses:
MultiForageN150HardPassiveGrip

public class MultiForageN150Hard
extends SimpleN150Hard
implements MultiForageN150

MultiForageN150Hard implements MultiForageN150 for Nomad 150 hardware using the Ndirect class. You should see the specifications in MultiForageN150 and Ndirect class documentation for details.

To reduce I/O between the controller and the robot, a thread is set up to perform periodic I/O. The sensor data and motor commands are exchanged through MultiForageN150Hard class variables (globals).

Copyright (c)1997, 1998 Tucker Balch

See Also:
MultiForageN150, Ndirect, EDU.gatech.cc.is.Newton

Field Summary
protected  double gripper_finger
           
protected  double gripper_height
           
protected  int hard_command
           
protected  Newton newt
           
protected  NewtonTrans nt
           
protected  double old_gripper_finger
           
protected  double old_gripper_height
           
protected  int old_hard_command
           
protected  boolean trigger_mode
           
 
Fields inherited from class EDU.gatech.cc.is.abstractrobot.SimpleN150Hard
base_speed, cycles, DEBUG, desired_heading, desired_speed, hard_command, in_reverse, keep_running, last_Obstacles, last_Position, last_SteerHeading, last_TurretHeading, nomad150_hardware, num_Obstacles, obstacle_rangeInch, old_desired_heading, old_desired_turret_heading, old_hard_command, run_time_sum, sonar_raw_data, time_sum
 
Fields inherited from class EDU.gatech.cc.is.abstractrobot.Simple
dictionary, displayVectors, unique_id
 
Fields inherited from interface EDU.gatech.cc.is.abstractrobot.MultiForageN150
GRIPPER_CAPTURE_RADIUS, GRIPPER_POSITION, VISION_FOV_DEG, VISION_FOV_RAD, VISION_RANGE
 
Fields inherited from interface EDU.gatech.cc.is.abstractrobot.SimpleN150
MAX_STEER, MAX_TRANSLATION, MAX_TURRET, RADIUS, SONAR_RADIUS
 
Constructor Summary
MultiForageN150Hard(int serial_port, int baud)
          Instantiate a MultiForageN150Hard object.
 
Method Summary
 void broadcast(Message m)
          NOT IMPLEMENTED.
 boolean connected()
          NOT IMPLEMENTED.
 int getObjectInGripper(long timestamp)
          Get the kind of object in the gripper.
 Vec2[] getOpponents(long timestamp)
          NOT IMPLEMENTED.
 int getPlayerNumber(long timestamp)
          NOT IMPLEMENTED.
 CircularBufferEnumeration getReceiveChannel()
          NOT IMPLEMENTED.
 Vec2[] getTeammates(long timestamp)
          NOT IMPLEMENTED.
 Vec2[] getVisualObjects(long timestamp, int channel)
          Get an array of Vec2s that represent the locations of visually sensed objects egocentrically from center of the robot to the objects currently sensed by the vision system.
 void multicast(int[] ids, Message m)
          NOT IMPLEMENTED.
 void run()
          Body of the thread that conducts periodic I/O with the robot.
 void setCommunicationMaxRange(double r)
          NOT IMPLEMENTED.
 void setGripperFingers(long time_stamp, double position)
          Set the gripper "finger" position from 0 to 1, with 0 being closed and 1 being open.
 void setGripperHeight(long time_stamp, double position)
          Set the gripper height from 0 to 1, with 0 being down and 1 being up.
 void setKinMaxRange(double r)
          NOT IMPLEMENTED.
 void setVisionNoise(double mean, double stddev, long seed)
          this is a dummy implementation to keep compatibility with VisualSensorObject.
 void unicast(int id, Message m)
          NOT IMPLEMENTED.
 
Methods inherited from class EDU.gatech.cc.is.abstractrobot.SimpleN150Hard
getBackgroundColor, getForegroundColor, getObstacles, getPosition, getSteerHeading, getTime, getTurretHeading, quit, resetPosition, resetSteerHeading, resetTurretHeading, setBaseSpeed, setDisplayString, setObstacleMaxRange, setSpeed, setSteerHeading, setTurretHeading, takeStep
 
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

newt

protected Newton newt

nt

protected NewtonTrans nt

old_gripper_finger

protected double old_gripper_finger

old_gripper_height

protected double old_gripper_height

hard_command

protected int hard_command

old_hard_command

protected int old_hard_command

gripper_finger

protected double gripper_finger

trigger_mode

protected boolean trigger_mode

gripper_height

protected double gripper_height
Constructor Detail

MultiForageN150Hard

public MultiForageN150Hard(int serial_port,
                           int baud)
                    throws java.lang.Exception
Instantiate a MultiForageN150Hard object. You should only instantiate one of these per robot connected to your computer. Standard call is MultiForageN150Hard(1,38400);
Parameters:
serial_port - 1 = ttys0 (COM1), 2 = ttys1 (COM2) ...
baud - baud rate for communication.
Throws:
java.lang.Exception - If unable to configure the hardware.
Method Detail

run

public void run()
Body of the thread that conducts periodic I/O with the robot. It runs at most every MultiForageN150Hard.MIN_CYCLE_TIME milliseconds to gather sensor data from the robot, and issue movement commands.

getVisualObjects

public Vec2[] getVisualObjects(long timestamp,
                               int channel)
Get an array of Vec2s that represent the locations of visually sensed objects egocentrically from center of the robot to the objects currently sensed by the vision system.
Parameters:
timestamp - only get new information if timestamp > than last call or timestamp == -1 .
channel - (1-6) which type/color of object to retrieve.
Returns:
the sensed objects.

setVisionNoise

public void setVisionNoise(double mean,
                           double stddev,
                           long seed)
this is a dummy implementation to keep compatibility with VisualSensorObject. at this point, vision noise is not built into the class. for an example, see SimpleCyeSim.
Tags copied from interface: VisualObjectSensor
Parameters:
mean - this is the mean of the distribution. most cases this will be 0
stddev - this is the standard deviation of the noise (>= 0.0) if equal to 0, then noise will not affect the sensor
seed - this is the value used to seed the number generator, for repeatable pseudorandom noise.

getObjectInGripper

public int getObjectInGripper(long timestamp)
Get the kind of object in the gripper.
Parameters:
timestamp - only get new information if timestamp > than last call or timestamp == -1 .
Returns:
channel (0-5) which type/color of object `in the gripper, -1 otherwise.
See Also:
getVisualObjects(long, int)

setGripperFingers

public void setGripperFingers(long time_stamp,
                              double position)
Set the gripper "finger" position from 0 to 1, with 0 being closed and 1 being open. In simulation, any setting less than 1 means closed.
Parameters:
position - the desired position from 0 to 1.

setGripperHeight

public void setGripperHeight(long time_stamp,
                             double position)
Set the gripper height from 0 to 1, with 0 being down and 1 being up. In simulation this has no effect.
Parameters:
position - the desired position from 0 to 1.

getTeammates

public Vec2[] getTeammates(long timestamp)
NOT IMPLEMENTED. 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)
NOT IMPLEMENTED. 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)
NOT IMPLEMENTED. 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.
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)
NOT IMPLEMENTED. 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
NOT IMPLEMENTED. 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
NOT IMPLEMENTED. 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 CircularBufferEnumeration getReceiveChannel()
NOT IMPLEMENTED. 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();
 CircularBufferEnumeration r = c.getReceiveChannel();
 while (r.hasMoreElements())
      System.out.println(r.nextElement());
 
Returns:
the CircularBufferEnumeration.

setCommunicationMaxRange

public void setCommunicationMaxRange(double r)
NOT IMPLEMENTED. 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()
NOT IMPLEMENTED.