ohmm
Class OHMMDrive

java.lang.Object
  extended by ohmm.OHMM
      extended by ohmm.OHMMDrive
Direct Known Subclasses:
OHMMSite

public class OHMMDrive
extends OHMM

OHMM high level processor lib with extensions for the drive module.

Author:
Marsette A. Vona

Nested Class Summary
 class OHMMDrive.AllStateDrive
          state data structure for OHMM.allState(ohmm.OHMM.AllState)
 class OHMMDrive.DriveState
          state data structure for driveState(ohmm.OHMMDrive.DriveState)
 
Nested classes/interfaces inherited from class ohmm.OHMM
OHMM.AllState, OHMM.AnalogChannel, OHMM.ArmState, OHMM.AXReg, OHMM.AXState, OHMM.BatState, OHMM.DigitalPin, OHMM.MotState, OHMM.OHMMState, OHMM.SenseState, OHMM.TaskState
 
Field Summary
static int DRIVE_CFG_INDEX_B
          float index for driveGetCfg(float[])
static int DRIVE_CFG_INDEX_MA
          float index for driveGetCfg(float[])
static int DRIVE_CFG_INDEX_MS
          float index for driveGetCfg(float[])
static int DRIVE_CFG_INDEX_R
          float index for driveGetCfg(float[])
static int DRIVE_CFG_INDEX_TOL
          float index for driveGetCfg(float[])
static int DRIVE_CFG_LEN
          max cfg floats for driveGetCfg(float[])
static int DRIVE_ERR_ODOM
          status flag for OHMM.status(int[])
static int DRIVE_ERR_TIMEOUT
          status flag for OHMM.status(int[])
static int STATUS_INDEX_ARM
          status index for OHMM.status(int[])
static int STATUS_INDEX_DRIVE
          status index for OHMM.status(int[])
static int STATUS_LEN
          num bytes for OHMM.status(int[]), see getStatusLength()
private static java.lang.String svnid
           
static Version VERSION
          Version info for the OHMM hlp library.
 
Fields inherited from class ohmm.OHMM
ARM_ACTIVE, ARM_AT_GOAL, ARM_ELBOW, ARM_ERR_AX, ARM_FREEZE_CAL, ARM_GRIPPER, ARM_SHOULDER, ARM_WRIST, avgRecvWait, avgSendWait, AX_ERR_ANGLE_LIMIT, AX_ERR_CHECKSUM, AX_ERR_INSTRUCTION, AX_ERR_OVERHEATING, AX_ERR_OVERLOAD, AX_ERR_RANGE, AX_ERR_TIMEOUT, AX_ERR_TRANSACTION, AX_ERR_VOLTAGE, AX_ID_BCAST, bytesReceived, bytesSent, CMD_NAME_MAX, codes, commandDelay, debug, DEF_COMMAND_DELAY, DEF_PROCESS_INIT_WAIT, DEF_RECV_POLL_TIME, DEF_TIMEOUT_FILE, DEF_TIMEOUT_PROXY, DEF_TIMEOUT_RXTX, DF2, DF4, errorHandler, flushBuf, flushNext, HLP_ERR_RECV, HLP_ERR_SEND, INIT_DELAY, INITIAL_FLUSH_BUF_LEN, istream, LCD_WIDTH, LEFT, maxRecvWait, maxSendWait, minRecvWait, minSendWait, MOT_ERR_ENC_L, MOT_ERR_ENC_R, MOT_ERR_VEL_L, MOT_ERR_VEL_R, NUM_INIT_ZEROS, numTimeouts, OHMM_SITE_CLASS, OHMM_SITE_CLASS_PROP, ostream, PID_FPF, recvPollTime, recvTimedOut, RIGHT, RXTX_BAUDRATE, RXTX_OPEN_TIMEOUT_MS, RXTX_PORT_OWNER_NAME, rxtxSerialPort, SCAL_N, STATUS_INDEX_BAT, STATUS_INDEX_HLP, STATUS_INDEX_MOT, STATUS_INDEX_TASK, TASK_ERR_COLLISION, TASK_ERR_MEM, timeout, totalRecvWait, totalSendWait, USAGE
 
Constructor Summary
OHMMDrive()
          Calls superclass constructor.
OHMMDrive(double initWait, java.lang.String[] cmd)
          Calls superclass constructor.
OHMMDrive(ErrorHandler eh)
          Calls superclass constructor.
OHMMDrive(ErrorHandler eh, double initWait, java.lang.String[] cmd)
          Calls superclass constructor.
OHMMDrive(ErrorHandler eh, java.io.File p)
          Calls superclass constructor.
OHMMDrive(ErrorHandler eh, java.lang.String p)
          Calls superclass constructor.
OHMMDrive(ErrorHandler eh, java.lang.String[] cmd)
          Calls superclass constructor.
OHMMDrive(java.io.File p)
          Calls superclass constructor.
OHMMDrive(java.lang.String p)
          Calls superclass constructor.
OHMMDrive(java.lang.String[] cmd)
          Calls superclass constructor.
 
Method Summary
 boolean driveArc(float l, float d)
          Runs monitor command "da".
 boolean driveArcDeg(float l, float d)
          Runs monitor command "dad".
static java.lang.String driveCfgToString(float[] cfg)
          Convert drive config to a human readable message.
static java.lang.StringBuilder driveCfgToString(float[] cfg, java.lang.StringBuilder sb)
          helper for driveCfgToString(float[])
 float[] driveGetCfg()
          covers driveGetCfg(float[]), always conses
 float[] driveGetCfg(float[] cfg)
          Runs monitor command "dgcfg".
 float[] driveGetPose()
          calls driveGetPose(float[]), always conses
 float[] driveGetPose(float[] xyt)
          Runs monitor command "dgp".
 int driveGetQueue()
          Runs monitor command "dgq".
 float[] driveGetVL()
          calls driveGetVL(float[]), always conses
 float[] driveGetVL(float[] vl)
          Runs monitor command "dgvl".
 float[] driveGetVW()
          calls driveGetVW(float[]), always conses
 float[] driveGetVW(float[] vw)
          Runs monitor command "dgvw".
 boolean driveOrientationServo(float t)
          Runs monitor command "dos".
 void drivePause()
          Runs monitor command "dp".
 void driveReinit()
          Runs monitor command "dri".
 void driveResetPose()
          Runs monitor command "drp".
 void driveSetBaseline(float b)
          Runs monitor command "dsbl".
 void driveSetMaxAccel(float a)
          Runs monitor command "dsma".
 boolean driveSetMaxSpeed(float s)
          Runs monitor command "dsms".
 void driveSetPosDGain(float g)
          Runs the monitor command "dsdg".
 void driveSetPose(float x, float y, float t)
          Runs monitor command "dsp".
 void driveSetPosIGain(float g)
          Runs the monitor command "dsig".
 void driveSetPosPGain(float g)
          Runs the monitor command "dspg".
 void driveSetTol(float t)
          Runs monitor command "dstol".
 boolean driveSetVL(float v, float l)
          Runs monitor command "dsvl".
 boolean driveSetVW(float v, float w)
          Runs monitor command "dsvw".
 void driveSetWheelRadius(float r)
          Runs monitor command "dswr".
 OHMMDrive.DriveState driveState()
          covers driveState(DriveState), always conses
 OHMMDrive.DriveState driveState(OHMMDrive.DriveState state)
          Runs monitor command "drvst".
 void driveStop()
          Runs monitor command "dst".
 boolean driveStraight(float d)
          Runs monitor command "df".
 boolean driveTurn(float d)
          Runs monitor command "dt".
 boolean driveTurnDeg(float d)
          Runs monitor command "dtd".
 void driveUnPause()
          Runs monitor command "dup".
 java.lang.String getHLPVersion()
          get a human-readable string giving the OHMM hlp library version
 int getStatusIndexArm()
          Get module OHMM.status(int[]) byte index.
 int getStatusIndexDrive()
          Get module OHMM.status(int[]) byte index.
 int getStatusLength()
          Get number of bytes expected from llp for OHMM.status(int[]).
 OHMM.AllState makeAllState()
          Factory method to cons an OHMM.AllState.
 java.lang.StringBuilder statusToString(int[] status, java.lang.StringBuilder sb)
          helper for OHMM.statusToString(int[])
 
Methods inherited from class ohmm.OHMM
allState, allState, armActive, armAtGoal, armCal, armEnable, armFreezeAllCal, armGetAllCal, armGetAllCal, armGetAllJoints, armGetAllJoints, armGetAllJointsDeg, armGetAllJointsDeg, armGetAllJointsRad, armGetAllJointsRad, armGetCal, armGetGripper, armGetJoint, armGetJointDeg, armGetJointRad, armGetLoads, armGetLoads, armGetNumAXErrors, armGetTemps, armGetTemps, armHome, armReinit, armSetAllCal, armSetAllJoints, armSetAllJointsDeg, armSetAllJointsRad, armSetCal, armSetGripper, armSetJoint, armSetJointDeg, armSetJointRad, armState, armState, axAction, axErrToString, axESTOP, axGetLoad, axGetNumOverflows, axGetNumRetries, axGetNumTimeouts, axGetPos, axGetPosDeg, axGetPosRad, axGetTemp, axGetVolts, axPing, axRead, axRead, axRead16, axRead16, axRegSetGoal, axRegSetGoalDeg, axRegSetGoalRad, axRegWrite, axRegWrite, axRegWrite11, axRegWrite11, axReinit, axSetAngleLimits, axSetGoal, axSetGoalDeg, axSetGoalImpl, axSetGoalImpl, axSetGoalRad, axState, axState, axTorqueEnable, axWrite, axWrite, axWrite11, axWrite11, axWriteImpl, batMillivolts, batState, batState, close, dbg, drainReceiveBuffer, dumpStats, dumpStats, echo, echo, echo, echoFix, estop, fmt2, fmt4, freeRam, getBytesReceived, getBytesSent, getCmdCode, getCommandDelay, getCurrentTime, getDebug, getErrorHandler, getMonitorVersion, getNumTimeouts, getOHMMClass, getRecvPollTime, getStatusIndexBat, getStatusIndexHLP, getStatusIndexMot, getStatusIndexTask, getTimeout, init, init, lcdAlert, lcdMsg, lcdMsgClr, lcdSysMsg, lcdSysMsgClr, listPorts, listPorts, makeOHMM, makeOHMM, motFree, motGetErrors, motGetGainCmd, motGetPos, motGetPos, motGetPosCounts, motGetPosCounts, motGetVel, motGetVel, motGetVelCmd, motGetVelCmd, motKick, motReinit, motSetDiffVelIGain, motSetVelCmd, motSetVelDGain, motSetVelIGain, motSetVelPGain, motState, motState, noResponseDelay, ohmmState, ohmmState, printUsage, recvBoolean, recvByte, recvByte, recvChar, recvFix, recvFloat, recvInt, recvString, recvString, resetStats, send, send, send, send, send, send, send, send, send, send, send, send, send, send, send, send, sendCmdCode, sendCmdCode, sendFix, sendFix, sendFlush, sendZeros, senseConfigAnalog, senseConfigAnalog, senseConfigAnalogIR, senseConfigAnalogIR, senseConfigAnalogLUT, senseConfigAnalogLUT, senseConfigDigital, senseConfigDigital, senseReadAnalog, senseReadAnalog, senseReadDigital, senseReadDigital, senseReinit, senseState, senseState, setCommandDelay, setDebug, setErrorHandler, setRecvPollTime, setTimeout, shtdn, sleep, status, status, statusToString, taskState, taskState, ticks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

svnid

private static final java.lang.String svnid
See Also:
Constant Field Values

VERSION

public static final Version VERSION

Version info for the OHMM hlp library.

getHLPVersion() is a convenience; OHMM.getMonitorVersion() asks the firmware for its version, which may differ.


STATUS_LEN

public static final int STATUS_LEN
num bytes for OHMM.status(int[]), see getStatusLength()

See Also:
Constant Field Values

STATUS_INDEX_DRIVE

public static final int STATUS_INDEX_DRIVE
status index for OHMM.status(int[])

See Also:
Constant Field Values

STATUS_INDEX_ARM

public static final int STATUS_INDEX_ARM
status index for OHMM.status(int[])

See Also:
Constant Field Values

DRIVE_ERR_ODOM

public static final int DRIVE_ERR_ODOM
status flag for OHMM.status(int[])

See Also:
Constant Field Values

DRIVE_ERR_TIMEOUT

public static final int DRIVE_ERR_TIMEOUT
status flag for OHMM.status(int[])

See Also:
Constant Field Values

DRIVE_CFG_LEN

public static final int DRIVE_CFG_LEN
max cfg floats for driveGetCfg(float[])

See Also:
Constant Field Values

DRIVE_CFG_INDEX_R

public static final int DRIVE_CFG_INDEX_R
float index for driveGetCfg(float[])

See Also:
Constant Field Values

DRIVE_CFG_INDEX_B

public static final int DRIVE_CFG_INDEX_B
float index for driveGetCfg(float[])

See Also:
Constant Field Values

DRIVE_CFG_INDEX_MS

public static final int DRIVE_CFG_INDEX_MS
float index for driveGetCfg(float[])

See Also:
Constant Field Values

DRIVE_CFG_INDEX_MA

public static final int DRIVE_CFG_INDEX_MA
float index for driveGetCfg(float[])

See Also:
Constant Field Values

DRIVE_CFG_INDEX_TOL

public static final int DRIVE_CFG_INDEX_TOL
float index for driveGetCfg(float[])

See Also:
Constant Field Values
Constructor Detail

OHMMDrive

public OHMMDrive(ErrorHandler eh,
                 java.io.File p)
Calls superclass constructor.


OHMMDrive

public OHMMDrive(java.io.File p)
Calls superclass constructor.


OHMMDrive

public OHMMDrive(ErrorHandler eh,
                 java.lang.String p)
Calls superclass constructor.


OHMMDrive

public OHMMDrive(java.lang.String p)
Calls superclass constructor.


OHMMDrive

public OHMMDrive(ErrorHandler eh,
                 double initWait,
                 java.lang.String[] cmd)
Calls superclass constructor.


OHMMDrive

public OHMMDrive(ErrorHandler eh,
                 java.lang.String[] cmd)
Calls superclass constructor.


OHMMDrive

public OHMMDrive(double initWait,
                 java.lang.String[] cmd)
Calls superclass constructor.


OHMMDrive

public OHMMDrive(java.lang.String[] cmd)
Calls superclass constructor.


OHMMDrive

public OHMMDrive(ErrorHandler eh)
Calls superclass constructor.


OHMMDrive

public OHMMDrive()
Calls superclass constructor.

Method Detail

getHLPVersion

public java.lang.String getHLPVersion()
get a human-readable string giving the OHMM hlp library version

This impl reports both the base OHMM class version as well as the version of OHMMDrive.

Overrides:
getHLPVersion in class OHMM

getStatusLength

public int getStatusLength()

Get number of bytes expected from llp for OHMM.status(int[]).

Subclasses may override this.

Overrides:
getStatusLength in class OHMM

getStatusIndexDrive

public int getStatusIndexDrive()

Get module OHMM.status(int[]) byte index.

Subclasses may override this.


getStatusIndexArm

public int getStatusIndexArm()

Get module OHMM.status(int[]) byte index.

Subclasses may override this.

Overrides:
getStatusIndexArm in class OHMM

statusToString

public java.lang.StringBuilder statusToString(int[] status,
                                              java.lang.StringBuilder sb)
helper for OHMM.statusToString(int[])

Overrides:
statusToString in class OHMM

makeAllState

public OHMM.AllState makeAllState()

Factory method to cons an OHMM.AllState.

May be overridden by subclasses that also need to subclass OHMM.AllState.

Overrides:
makeAllState in class OHMM

driveReinit

public void driveReinit()
Runs monitor command "dri".


driveGetVW

public float[] driveGetVW(float[] vw)
Runs monitor command "dgvw".

Parameters:
vw - velocities are returned here, or cons if null
Returns:
vw

driveGetVW

public float[] driveGetVW()
calls driveGetVW(float[]), always conses


driveGetVL

public float[] driveGetVL(float[] vl)
Runs monitor command "dgvl".

Parameters:
vl - velocities are returned here, or cons if null
Returns:
vl

driveGetVL

public float[] driveGetVL()
calls driveGetVL(float[]), always conses


driveSetVW

public boolean driveSetVW(float v,
                          float w)
Runs monitor command "dsvw".

Parameters:
v - forward velocity in mm/s
w - rotational velocity in rad/s, CCW positive

driveSetVL

public boolean driveSetVL(float v,
                          float l)
Runs monitor command "dsvl".

Parameters:
v - forward velocity in mm/s or turn velocity in rad/s for turn in place
l - turn radius in mm, CCW positive

driveGetPose

public float[] driveGetPose(float[] xyt)
Runs monitor command "dgp".

Parameters:
xyt - pose is returned here, or cons if null
Returns:
xyt

Units correspond to args to driveSetPose(float, float, float).


driveGetPose

public float[] driveGetPose()
calls driveGetPose(float[]), always conses


driveSetPose

public void driveSetPose(float x,
                         float y,
                         float t)
Runs monitor command "dsp".

Parameters:
x - pose x in mm
y - pose y in mm
t - pose theta in rad CCW positive

driveResetPose

public void driveResetPose()
Runs monitor command "drp".


driveStraight

public boolean driveStraight(float d)
Runs monitor command "df".

Parameters:
d - distance to travel in mm, positive forward
Returns:
true unless the drive queue was full

driveTurn

public boolean driveTurn(float d)
Runs monitor command "dt".

Parameters:
d - amount of turn in radians, CCW positive
Returns:
true unless the drive queue was full

driveTurnDeg

public boolean driveTurnDeg(float d)
Runs monitor command "dtd".

Parameters:
d - amount of turn in degrees, CCW positive
Returns:
true unless the drive queue was full

driveArc

public boolean driveArc(float l,
                        float d)
Runs monitor command "da".

Parameters:
l - signed arc radius in mm
d - signed drive distance in mm, or turn angle in rad for turn in place
Returns:
true unless the drive queue was full

driveArcDeg

public boolean driveArcDeg(float l,
                           float d)
Runs monitor command "dad".

Parameters:
l - signed arc radius in mm
d - signed drive distance in mm, or turn angle in degrees for turn in place
Returns:
true unless the drive queue was full

driveOrientationServo

public boolean driveOrientationServo(float t)
Runs monitor command "dos".

Parameters:
t - global goal orientation in rad or NaN to disable orientation servo
Returns:
false if t not NaN and not at orientation goal

driveGetQueue

public int driveGetQueue()
Runs monitor command "dgq".

Returns:
num queued drive segments, plus 1 if a drive is ongoing

drivePause

public void drivePause()
Runs monitor command "dp".


driveUnPause

public void driveUnPause()
Runs monitor command "dup".


driveStop

public void driveStop()
Runs monitor command "dst".


driveSetPosPGain

public void driveSetPosPGain(float g)
Runs the monitor command "dspg".

Parameters:
g - the gain

driveSetPosIGain

public void driveSetPosIGain(float g)
Runs the monitor command "dsig".

Parameters:
g - the gain

driveSetPosDGain

public void driveSetPosDGain(float g)
Runs the monitor command "dsdg".

Parameters:
g - the gain

driveGetCfg

public float[] driveGetCfg(float[] cfg)
Runs monitor command "dgcfg".

Parameters:
cfg - up to DRIVE_CFG_LEN floats of config is returned here, or null to cons
Returns:
cfg Returned floats are indexed by DRIVE_CFG_INDEX_*.

driveGetCfg

public float[] driveGetCfg()
covers driveGetCfg(float[]), always conses


driveCfgToString

public static java.lang.String driveCfgToString(float[] cfg)
Convert drive config to a human readable message.

Parameters:
cfg - up to DRIVE_CFG_LEN bytes
Returns:
a corresponding message

driveCfgToString

public static java.lang.StringBuilder driveCfgToString(float[] cfg,
                                                       java.lang.StringBuilder sb)
helper for driveCfgToString(float[])


driveSetWheelRadius

public void driveSetWheelRadius(float r)
Runs monitor command "dswr".

Parameters:
r - nonnegative wheel radius in mm

driveSetBaseline

public void driveSetBaseline(float b)
Runs monitor command "dsbl".

Parameters:
b - nonnegative baseline between wheels in mm

driveSetMaxSpeed

public boolean driveSetMaxSpeed(float s)
Runs monitor command "dsms".

Parameters:
s - positive maximum speed in mm/sec
Returns:
true unless clamping occurs

driveSetMaxAccel

public void driveSetMaxAccel(float a)
Runs monitor command "dsma".

Parameters:
a - positive max acceleration in mm/sec/sec, or Float.POSITIVE_INFINITY to skip acceleration

driveSetTol

public void driveSetTol(float t)
Runs monitor command "dstol".

Parameters:
t - tolerance in mm

driveState

public OHMMDrive.DriveState driveState(OHMMDrive.DriveState state)
Runs monitor command "drvst".

Parameters:
state - the state is returned here, or null to cons
Returns:
state

driveState

public OHMMDrive.DriveState driveState()
covers driveState(DriveState), always conses