EDU.gatech.cc.is.nomad150
Class Ndirect

java.lang.Object
  |
  +--EDU.gatech.cc.is.nomad150.Ndirect

public class Ndirect
extends java.lang.Object

Introduction
Provides an interface to the Nomadics Technologies control library for a Nomad 150 robot. It provides a slightly higher-level interface than the C library functions provided by Nomadics. See the Nomadic's Language Reference Manual for details.

Two demonstration/debugging applications are also provided: Nomad150TestTriangle and Nomad150TestSensors. Nomad150TestTriangle drives the robot around in a 5 foot triange, while Nomad150TestSensors prints out detected sensor values. See documentation for them by clicking on the appropriate link below.

See Also:
Nomad150TestTriangle, Nomad150TestSensors

Field Summary
static int MV_AC
          A control law for mv().
static int MV_IGNORE
          A control law for mv().
static int MV_LP
          A control law for mv().
static int MV_PR
          A control law for mv().
static int MV_PWM_HIGH_0
           
static int MV_PWM_HIGH_1
           
static int MV_PWM_HIGH_2
           
static int MV_PWM_HIGH_3
           
static int MV_PWM_LOW_0
           
static int MV_PWM_LOW_1
           
static int MV_PWM_LOW_2
           
static int MV_PWM_LOW_3
           
static int MV_SP
          A control law for mv().
static int MV_VM
          A control law for mv().
static int SERVO_CCW_TIME
          Time in microseconds for full CCW rotation of servo.
static int SERVO_CW_TIME
          Time in microseconds for full CW rotation of servo.
static int SERVO_TIME
          Time in microseconds for servo pulse.
 
Constructor Summary
Ndirect(int serial_port, int baud)
          Instantiate a nomad150.Ndirect object.
 
Method Summary
 int da(int th, int tu)
          Defines the robot's steering and turret angles.
 int dp(int x, int y)
          Defines the position of the robot.
protected  void finalize()
          Dispose of a nomad150.Ndirect object.
 long get_bp()
          Reads the bumpers.
 int get_rc()
          Gets an update of the sonar, X, Y, turret and steering data.
 int get_rv()
          Gets an update of the robot's translation, turret and steering velocities.
 int get_sn(int[] readings)
          Reads the sonars.
 int get_steering()
          Get the robot's steering heading, call get_rc() or mv() first to ensure this data is current.
 int get_turret()
          Get the robot's turret heading, call get_rc() or mv() first to ensure this data is current.
 int get_vsteering()
          Get the robot's steering velocity, call get_rv() or mv() first to ensure this data is current.
 int get_vtranslation()
          Get the robot's translational velocity, call get_rv() or mv() first to ensure this data is current.
 int get_vturret()
          Get the robot's turret velocity, call get_rv() or mv() first to ensure this data is current.
 int get_x()
          Get the robot's X coordinate, call get_rc() or mv() first to ensure this data is current.
 int get_y()
          Get the robot's Y coordinate, call get_rc() or mv() first to ensure this data is current.
 int gs()
          Reads all the sensor data from the robot.
 int mv(int t_mode, int t_mv, int s_mode, int s_mv, int r_mode, int r_mv)
          Move the robot: translation, turret and steering all at once.
 int sn_off()
          Turns off the sonar range sensors
 int sn_on()
          Turns on the sonar range sensors.
 int sn_on(int delay)
          Turns on the sonar range sensors.
 int st()
          Stop the robot: translation, turret and steering all at once.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MV_IGNORE

public static final int MV_IGNORE
A control law for mv().
See Also:
mv(int, int, int, int, int, int)

MV_VM

public static final int MV_VM
A control law for mv().
See Also:
mv(int, int, int, int, int, int)

MV_PR

public static final int MV_PR
A control law for mv().
See Also:
mv(int, int, int, int, int, int)

MV_LP

public static final int MV_LP
A control law for mv().
See Also:
mv(int, int, int, int, int, int)

MV_AC

public static final int MV_AC
A control law for mv().
See Also:
mv(int, int, int, int, int, int)

MV_SP

public static final int MV_SP
A control law for mv().
See Also:
mv(int, int, int, int, int, int)

SERVO_TIME

public static final int SERVO_TIME
Time in microseconds for servo pulse.

SERVO_CW_TIME

public static final int SERVO_CW_TIME
Time in microseconds for full CW rotation of servo.

SERVO_CCW_TIME

public static final int SERVO_CCW_TIME
Time in microseconds for full CCW rotation of servo.

MV_PWM_LOW_0

public static final int MV_PWM_LOW_0

MV_PWM_HIGH_0

public static final int MV_PWM_HIGH_0

MV_PWM_LOW_1

public static final int MV_PWM_LOW_1

MV_PWM_HIGH_1

public static final int MV_PWM_HIGH_1

MV_PWM_LOW_2

public static final int MV_PWM_LOW_2

MV_PWM_HIGH_2

public static final int MV_PWM_HIGH_2

MV_PWM_LOW_3

public static final int MV_PWM_LOW_3

MV_PWM_HIGH_3

public static final int MV_PWM_HIGH_3
Constructor Detail

Ndirect

public Ndirect(int serial_port,
               int baud)
        throws java.lang.Exception
Instantiate a nomad150.Ndirect object. You should only instantiate one of these per robot connected to your computer. Configures the robot with default values with calls to zr(), ac(), conf_sn() conf_tm(). Standard call is Ndirect(1,38400);
Parameters:
serial_port - 1 = ttys0 (COM1), 2 = ttys1 (COM2) ...
baud - baud rate for communication.
Throws:
java.lang.Exception - If unable to make native code resident.
Method Detail

finalize

protected void finalize()
                 throws java.lang.Exception,
                        java.lang.Throwable
Dispose of a nomad150.Ndirect object. You should never call this, the garbage collector calls it.
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Exception - If unable to release code resources.
java.lang.Throwable - If super.finalize() throws it.

da

public int da(int th,
              int tu)
Defines the robot's steering and turret angles.
Parameters:
th - steering orientation.
tu - turret orientation.
Returns:
0 on success 1 otherwise.

dp

public int dp(int x,
              int y)
Defines the position of the robot.
Parameters:
x - the X coordinate.
y - the Y coordinate.
Returns:
0 on success 1 otherwise.

mv

public int mv(int t_mode,
              int t_mv,
              int s_mode,
              int s_mv,
              int r_mode,
              int r_mv)
Move the robot: translation, turret and steering all at once. The arguments are passed directly to Nomadics mv(). The control law for each axis must be MV_VM, MV_PR, MV_IGNORE, MV_LP, MV_SP or MV_AC. See Nomadic's Language Reference Manual for details.
Parameters:
t_mode - control law for translation.
t_mv - motion value for translation.
s_mode - control law for steering.
s_mv - motion value for steering.
r_mode - control law for turret.
r_mv - motion value for turret.
Returns:
0 on success 1 otherwise.

st

public int st()
Stop the robot: translation, turret and steering all at once.
Returns:
0 on success 1 otherwise.

sn_on

public int sn_on(int delay)
Turns on the sonar range sensors. Calls Nomadics conf_sn with a standard sonar firing order.
Parameters:
delay - The time between sonar firing in milliseconds. The minimum is 60.
Returns:
0 on success 1 otherwise.

sn_on

public int sn_on()
Turns on the sonar range sensors. Calls Nomadics conf_sn with a standard sonar firing order. Calls sn_on(60)
Returns:
0 on success 1 otherwise.

sn_off

public int sn_off()
Turns off the sonar range sensors
Returns:
0 on success 1 otherwise.

get_sn

public int get_sn(int[] readings)
Reads the sonars. The readings are in inches from the sonar "skin." The sonars are arranged in 22.5 degree increments CCW from 0 to 15. The data is refreshed either by a move command or a call to get_rc().
Parameters:
readings - The sonar readings will be read into this array. It must contain at least 16 elemements.
Returns:
0 on success 1 otherwise.
See Also:
get_rc()

gs

public int gs()
Reads all the sensor data from the robot.
Returns:
0 on success 1 otherwise.
See Also:
get_rc()

get_bp

public long get_bp()
Reads the bumpers. The data is refreshed either by a move command or a call to get_rc().
Returns:
the bumper data.
See Also:
get_rc()

get_rc

public int get_rc()
Gets an update of the sonar, X, Y, turret and steering data. This method does not actually return this data, you have to call one of the various accessor functions to get it.
Returns:
0 on success 1 otherwise.
See Also:
get_x(), get_y(), get_steering(), get_turret()

get_x

public int get_x()
Get the robot's X coordinate, call get_rc() or mv() first to ensure this data is current.
Returns:
the X coordinate in tenths of an inch.
See Also:
get_rc()

get_y

public int get_y()
Get the robot's Y coordinate, call get_rc() or mv() first to ensure this data is current.
Returns:
the Y coordinate in tenths of an inch.
See Also:
get_rc()

get_steering

public int get_steering()
Get the robot's steering heading, call get_rc() or mv() first to ensure this data is current.
Returns:
the steering heading in tenths of a degree.
See Also:
get_rc()

get_turret

public int get_turret()
Get the robot's turret heading, call get_rc() or mv() first to ensure this data is current.
Returns:
the turret heading in tenths of a degree.
See Also:
get_rc()

get_rv

public int get_rv()
Gets an update of the robot's translation, turret and steering velocities. This method does not actually return this data, you have to call the various accessor functions to get it.
Returns:
0 on success 1 otherwise.
See Also:
get_vtranslation(), get_vsteering(), get_vturret()

get_vtranslation

public int get_vtranslation()
Get the robot's translational velocity, call get_rv() or mv() first to ensure this data is current.
Returns:
the translational velocity in tenths of an inch/s.
See Also:
get_rv()

get_vturret

public int get_vturret()
Get the robot's turret velocity, call get_rv() or mv() first to ensure this data is current.
Returns:
the turret velocity in tenths of a degree/s.
See Also:
get_rv()

get_vsteering

public int get_vsteering()
Get the robot's steering velocity, call get_rv() or mv() first to ensure this data is current.
Returns:
the steering velocity in tenths of a degree/s.
See Also:
get_rv()