All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class EDU.gatech.cc.is.abstractrobot.SimpleN150Hard

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

public class SimpleN150Hard
extends Simple
implements SimpleN150, HardObject
SimpleN150Hard 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.2 $
Author:
Tucker Balch
See Also:
SimpleN150, Ndirect

Variable Index

 o base_speed
 o cycles
 o DEBUG
 o desired_heading
 o desired_speed
 o hard_command
 o in_reverse
 o keep_running
 o last_Obstacles
 o last_Position
 o last_SteerHeading
 o last_TurretHeading
 o nomad150_hardware
 o num_Obstacles
 o obstacle_rangeInch
 o old_desired_heading
 o old_desired_turret_heading
 o old_hard_command
 o run_time_sum
 o sonar_raw_data
 o time_sum

Constructor Index

 o SimpleN150Hard(int, int)
Instantiate a SimpleN150Hard object.

Method Index

 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 getPosition(long)
Get the position of the robot in global coordinates.
 o getSteerHeading(long)
Get the current heading of the steering motor (radians).
 o getTime()
Gets time elapsed since the robot was instantiated.
 o getTurretHeading(long)
Get the current heading of the turret motor.
 o quit()
Quit the I/O thread.
 o resetPosition(Vec2)
Reset the odometry of the robot in global coordinates.
 o resetSteerHeading(double)
Reset the steering odometry of the robot in global coordinates.
 o resetTurretHeading(double)
Reset the turret odometry of the robot in global coordinates.
 o setBaseSpeed(double)
Set the base speed for the robot (translation) in meters per second.
 o setDisplayString(String)
Set the String that is printed on the robot's display.
 o setObstacleMaxRange(double)
Set the maximum range at which a sensor reading should be considered an obstacle.
 o setSpeed(long, double)
Set the desired speed for the robot (translation).
 o setSteerHeading(long, double)
Set the desired heading for the steering motor.
 o setTurretHeading(long, double)
Set the desired heading for the turret motor.
 o takeStep()
Conducts periodic I/O with the robot.

Variables

 o nomad150_hardware
 protected Ndirect nomad150_hardware
 o DEBUG
 protected static final boolean DEBUG
 o cycles
 protected double cycles
 o run_time_sum
 protected double run_time_sum
 o time_sum
 protected double time_sum
 o keep_running
 protected boolean keep_running
 o old_desired_heading
 protected double old_desired_heading
 o old_desired_turret_heading
 protected double old_desired_turret_heading
 o hard_command
 protected int hard_command
 o old_hard_command
 protected int old_hard_command
 o sonar_raw_data
 protected int sonar_raw_data[]
 o last_Obstacles
 protected Vec2 last_Obstacles[]
 o num_Obstacles
 protected int num_Obstacles
 o obstacle_rangeInch
 protected int obstacle_rangeInch
 o last_Position
 protected Vec2 last_Position
 o last_SteerHeading
 protected double last_SteerHeading
 o in_reverse
 protected boolean in_reverse
 o desired_heading
 protected double desired_heading
 o last_TurretHeading
 protected double last_TurretHeading
 o desired_speed
 protected double desired_speed
 o base_speed
 protected double base_speed

Constructors

 o SimpleN150Hard
 public SimpleN150Hard(int serial_port,
                       int baud) throws Exception
Instantiate a SimpleN150Hard object. You should only instantiate one of these per robot connected to your computer. Standard call is SimpleN150Hard(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()
Conducts 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.

 o quit
 public void quit()
Quit the I/O thread. Do this only when you are done with the robot!

Overrides:
quit in class Simple
 o getTime
 public long getTime()
Gets time elapsed since the robot was instantiated. Unlike simulation, this is real elapsed time.

Overrides:
getTime in class Simple
 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 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 resetPosition
 public void resetPosition(Vec2 p)
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)
Get the current heading of the steering motor (radians).

Parameters:
timestamp - only get new information if timestamp > than last call or timestamp == -1 .
Returns:
the heading in radians.
Overrides:
getSteerHeading in class Simple
See Also:
resetSteerHeading, setSteerHeading
 o resetSteerHeading
 public void resetSteerHeading(double heading)
Reset the steering odometry of the robot in global coordinates. This might be done when reliable sensor information provides a very good estimate of the robot's heading, or you are starting the robot at a known heading other than 0. Do this only if you are certain you're right! It is also a good idea not to be moving when you do this.

Parameters:
heading - the new heading in radians.
Overrides:
resetSteerHeading in class Simple
See Also:
getSteerHeading, setSteerHeading
 o setSteerHeading
 public void setSteerHeading(long timestamp,
                             double heading)
Set the desired heading for the steering motor. If the turn is greater than 90 degrees we set the turn to be less than that and move in reverse.

Parameters:
heading - the heading in radians.
Overrides:
setSteerHeading in class Simple
See Also:
getSteerHeading, resetSteerHeading
 o getTurretHeading
 public double getTurretHeading(long timestamp)
Get the current heading of the turret motor.

Parameters:
timestamp - only get new information if timestamp > than last call or timestamp == -1 .
Returns:
the turret heading in radians.
See Also:
setTurretHeading, resetTurretHeading
 o resetTurretHeading
 public void resetTurretHeading(double heading)
Reset the turret odometry of the robot in global coordinates. This might be done when reliable sensor information provides a very good estimate of the robot's turret heading. Do this only if you are certain you're right! It is also a good idea not to be moving when you do this.

Parameters:
heading - the new turret heading in radians.
See Also:
getTurretHeading, setTurretHeading
 o setTurretHeading
 public void setTurretHeading(long timestamp,
                              double heading)
Set the desired heading for the turret motor. We assume the turret is not symmetric, so there is no reverse trick as in the steering motor.

Parameters:
heading - the heading in radians.
See Also:
getTurretHeading, resetTurretHeading
 o setSpeed
 public void setSpeed(long timestamp,
                      double speed)
Set the desired speed for the robot (translation). The speed must be between 0.0 and 1.0; where 0.0 is stopped and 1.0 is "full blast". It will be clipped to whichever limit it exceeds. The actual commanded speed is zero until the steering motor is close to the desired heading. Use setBaseSpeed to adjust the top speed.

Parameters:
timestamp - only get new information if timestamp > than last call
speed - the desired speed from 0 to 1.0, where 1.0 is the base speed.
Overrides:
setSpeed in class Simple
See Also:
setSteerHeading, setBaseSpeed
 o setBaseSpeed
 public void setBaseSpeed(double speed)
Set the base speed for the robot (translation) in meters per second. Base speed is how fast the robot will move when setSpeed(1.0) is called. The speed must be between 0 and MAX_TRANSLATION. It will be clipped to whichever limit it exceeds.

Parameters:
speed - the desired speed from 0 to 1.0, where 1.0 is the base speed.
Overrides:
setBaseSpeed in class Simple
See Also:
setSpeed
 o setDisplayString
 public void setDisplayString(String s)
Set the String that is printed on the robot's display. For real robots, this appears printed on the console.

Parameters:
s - String, the text to display.
Overrides:
setDisplayString in class Simple

All Packages  Class Hierarchy  This Package  Previous  Next  Index