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
-
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
-
-
SimpleN150Hard(int, int)
- Instantiate a SimpleN150Hard object.
-
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.
-
getPosition(long)
- Get the position of the robot in global coordinates.
-
getSteerHeading(long)
- Get the current heading of the steering motor (radians).
-
getTime()
- Gets time elapsed since the robot was instantiated.
-
getTurretHeading(long)
- Get the current heading of the turret motor.
-
quit()
- Quit the I/O thread.
-
resetPosition(Vec2)
- Reset the odometry of the robot in global coordinates.
-
resetSteerHeading(double)
- Reset the steering odometry of the robot in
global coordinates.
-
resetTurretHeading(double)
- Reset the turret odometry of the robot in global coordinates.
-
setBaseSpeed(double)
- Set the base speed for the robot (translation) in
meters per second.
-
setDisplayString(String)
- Set the String that is printed on the robot's display.
-
setObstacleMaxRange(double)
- Set the maximum range at which a sensor reading should be considered
an obstacle.
-
setSpeed(long, double)
- Set the desired speed for the robot (translation).
-
setSteerHeading(long, double)
- Set the desired heading for the steering motor.
-
setTurretHeading(long, double)
- Set the desired heading for the turret motor.
-
takeStep()
- Conducts periodic I/O with
the robot.
nomad150_hardware
protected Ndirect nomad150_hardware
DEBUG
protected static final boolean DEBUG
cycles
protected double cycles
run_time_sum
protected double run_time_sum
time_sum
protected double time_sum
keep_running
protected boolean keep_running
old_desired_heading
protected double old_desired_heading
old_desired_turret_heading
protected double old_desired_turret_heading
hard_command
protected int hard_command
old_hard_command
protected int old_hard_command
sonar_raw_data
protected int sonar_raw_data[]
last_Obstacles
protected Vec2 last_Obstacles[]
num_Obstacles
protected int num_Obstacles
obstacle_rangeInch
protected int obstacle_rangeInch
last_Position
protected Vec2 last_Position
last_SteerHeading
protected double last_SteerHeading
in_reverse
protected boolean in_reverse
desired_heading
protected double desired_heading
last_TurretHeading
protected double last_TurretHeading
desired_speed
protected double desired_speed
base_speed
protected double base_speed
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.
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.
quit
public void quit()
- Quit the I/O thread. Do this only when you are done with the
robot!
- Overrides:
- quit in class Simple
getTime
public long getTime()
- Gets time elapsed since the robot was instantiated. Unlike
simulation, this is real elapsed time.
- Overrides:
- getTime in class Simple
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
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
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
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
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
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
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
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
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
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
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
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
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