brbrain
Class AX12Register

java.lang.Object
  extended by brbrain.AXRegister
      extended by brbrain.AX12Register

public class AX12Register
extends AXRegister

Represents the Dynamixel AX-12 registers in a high-level way.

Copyright (C) 2008 Marsette A. Vona, III

Author:
Marsette (Marty) A. Vona, III

Field Summary
static AX12Register AX12_ALARM_LED
          bitmask of E_* constants to trigger the LED (RW)
static AX12Register AX12_ALARM_SHUTDOWN
          bitmask of E_* constants to trigger torque off (RW)
static AX12Register AX12_BAUD_RATE
          Dynamixel Baud Rate (RW), natural units [kbits/sec].
static AX12Register AX12_CCW_ANGLE_LIMIT
          counter-clockwise angle limit (RW), natural units [deg]
static AX12Register AX12_CCW_COMPLIANCE_MARGIN
          Counter-clockwise compliance margin (RW), natural units normalized to [0.0, 1.0].
static AX12Register AX12_CCW_COMPLIANCE_SLOPE
          Counter-clockwise compliance slope (RW), natural units normalized to [0.0, 1.0].
static AX12Register AX12_CW_ANGLE_LIMIT
          clockwise angle limit (RW), natural units [deg]
static AX12Register AX12_CW_COMPLIANCE_MARGIN
          Clockwise compliance margin (RW), natural units normalized to [0.0, 1.0].
static AX12Register AX12_CW_COMPLIANCE_SLOPE
          Clockwise compliance slope (RW), natural units normalized to [0.0, 1.0].
static AX12Register AX12_DOWN_CALIBRATION
          undocumented pot calibration (RO)
static AX12Register AX12_ERROR
          Virtual register containing the error status of the dynamixel (RO).
static AX12Register AX12_FIRMWARE_VERSION
          dynamixel firmware version (RO)
static AX12Register AX12_GOAL_POSITION
          Goal position (RW), natural units [deg].
static AX12Register AX12_HIGHEST_LIMIT_TEMPERATURE
          limit temp (RW), natural units [deg Celcius]
static AX12Register AX12_HIGHEST_LIMIT_VOLTAGE
          high limit voltage (RW), natural units [Volts]
static AX12Register AX12_ID
          dynamixel ID (RW)
static AX12Register AX12_LED
          direct LED control (RW), boolean, positive logic
static AX12Register AX12_LOCK
          Whether to restrict writing to registers AX12_TORQUE_ENABLE through AX12_TORQUE_LIMIT (RW), boolean.
static AX12Register AX12_LOWEST_LIMIT_VOLTAGE
          low limit voltage (RW), natural units [Volts]
static AX12Register AX12_MAX_TORQUE
          Maximum torque (RW), natural units normalized to [0.0, 1.0].
static AX12Register AX12_MODEL_NUMBER
          dynamixel model number (RO)
static AX12Register AX12_MOVING
          Whether the servo is currentl moving (RO), boolean
static AX12Register AX12_MOVING_SPEED
          Moving speed (RW), natural units [rev/min].
static AX12Register AX12_PRESENT_LOAD
          Current "load" (RO), natural units normalized to [0.0, 1.0].
static AX12Register AX12_PRESENT_POSITION
          Current position (RO), natural units [deg]
static AX12Register AX12_PRESENT_SPEED
          Current speed (RO), natural units [rev/min]
static AX12Register AX12_PRESENT_TEMPERATURE
          Current temperature (RO), natural units [degrees Celcius]
static AX12Register AX12_PRESENT_VOLTAGE
          Current voltage (RO), natural units [Volts]
static AX12Register AX12_PUNCH
          Initial current to apply after the position error has exceeded the compliance margin (RW), natural units normalized to [0.0, 1.0].
static AX12Register AX12_REGISTERED_INSTRUCTION
          Whether there is a registered instruction pending (RW), boolean
static AX12Register AX12_RETURN_DELAY_TIME
          Dynamixel return delay time (RW), natural units [usec].
static AX12Register AX12_STATUS_RETURN_LEVEL
          Dynamixel status return level (RW).
static AX12Register AX12_TORQUE_ENABLE
          enables torque generation (RW), boolean, positive logic
static AX12Register AX12_TORQUE_LIMIT
          See AX12_MAX_TORQUE
static AX12Register AX12_UP_CALIBRATION
          undocumented pot calibration (RO)
static java.lang.String DYNAMIXEL_TYPE
          the Dynamixel type identifier
static AXRegister FIRST_RAM_REGISTER
          first register in RAM
static AXRegister FIRST_REGISTER
          first register in RAM
static double MOVING_SPEED_TO_COUNTS_PER_MS
          Multiplication factor taking AX12_MOVING_SPEED raw value to position counts per millisecond.
protected static int nextOrdinal
          next register ordinal during class init
static float NOMINAL_BATTERY_VOLTAGE
          nominal battery voltage in Volts (8xNiMH) = (8x1.2V) = 9.6V
static int NUM_REGISTERS
          total number of registers
protected static AX12Register[] registers
          the array of AX12Registers, indexed by ordinal
private static java.lang.String svnid
           
 
Fields inherited from class brbrain.AXRegister
E_ANGLE_LIMIT, E_CHECKSUM, E_INPUT_VOLTAGE, E_INSTRUCTION, E_OVERHEATING, E_OVERLOAD, E_RANGE, max, MAX_DYNAMIXEL_ID, min, naturalUnitsLabel, naturalUnitsPerCount, ordinal, prettyName, RAM_START_ADDRESS, signMagnitude11Bit, startAddr, useNaturalUnitsByDefault, width, writeable
 
Constructor Summary
protected AX12Register(int ordinal, java.lang.String prettyName, int startAddr)
          read-only unsigned 1-byte reg, natural units are counts
protected AX12Register(int ordinal, java.lang.String prettyName, int startAddr, float naturalUnitsPerCount, java.lang.String naturalUnitsLabel, boolean useNaturalUnitsByDefault)
          read-only unsigned 1-byte reg
protected AX12Register(int ordinal, java.lang.String prettyName, int startAddr, int width)
          read-only unsigned reg, natural units are counts
protected AX12Register(int ordinal, java.lang.String prettyName, int startAddr, int width, boolean signMagnitude11Bit, float naturalUnitsPerCount, java.lang.String naturalUnitsLabel, boolean useNaturalUnitsByDefault)
          read-only reg with all options
protected AX12Register(int ordinal, java.lang.String prettyName, int startAddr, int width, float naturalUnitsPerCount, java.lang.String naturalUnitsLabel, boolean useNaturalUnitsByDefault)
          Read-only unsigned reg (be careful of confusion with AX12Register(int, String, int, int, int, String, boolean)).
protected AX12Register(int ordinal, java.lang.String prettyName, int startAddr, int min, int max)
          writeable unsigned 1-byte reg, natural units are coutns
protected AX12Register(int ordinal, java.lang.String prettyName, int startAddr, int min, int max, float naturalUnitsPerCount, java.lang.String naturalUnitsLabel, boolean useNaturalUnitsByDefault)
          writeable unsigned 1-byte reg
protected AX12Register(int ordinal, java.lang.String prettyName, int startAddr, int width, int min, int max)
          writeable unsigned reg, natural units are counts
protected AX12Register(int ordinal, java.lang.String prettyName, int startAddr, int width, int min, int max, boolean signMagnitude11Bit, float naturalUnitsPerCount, java.lang.String naturalUnitsLabel, boolean useNaturalUnitsByDefault)
          writeable reg with all options
protected AX12Register(int ordinal, java.lang.String prettyName, int startAddr, int width, int min, int max, float naturalUnitsPerCount, java.lang.String naturalUnitsLabel, boolean useNaturalUnitsByDefault)
          writeable unsigned reg
protected AX12Register(int ordinal, java.lang.String prettyName, int startAddr, int min, int max, java.lang.String naturalUnitsLabel, boolean useNaturalUnitsByDefault)
          writeable unsigned 1-byte reg, natural units are counts
 
Method Summary
static AX12Register[] getAllRegisters()
          covers getAllRegisters(AX12Register[], int), always conses
static AX12Register[] getAllRegisters(AX12Register[] regs)
          covers getAllRegisters(AX12Register[], int), starts at 0
static AX12Register[] getAllRegisters(AX12Register[] regs, int start)
          get a copy of the ordered array of AX12Registers
static float getCalibratedStiffness(int complianceSlope)
          Covers getCalibratedStiffness(int, float), uses NOMINAL_BATTERY_VOLTAGE.
static float getCalibratedStiffness(int complianceSlope, float voltage)
          Get the stiffness of an AX-12 actuator in units of kg*cm/deg.
protected  java.lang.String getDynamixelType()
          returns DYNAMIXEL_TYPE
static AXRegister getFirstRAMRegister()
          get the FIRST_RAM_REGISTER
static AXRegister getFirstRegister()
          get the FIRST_REGISTER
 int getNumRegisters()
          get the total number of AX12Registers
static AXRegister getRegister(int ordinal)
          get the AX12Register at the specified ordinal
 AXRegister getRelativeRegister(int offset)
          get the register with the given relative ordinal
static float interp(float abscissa, float valueAtLowEnd, float abscissaAtLowEnd, float valueAtHighEnd, float abscissaAtHighEnd)
          Linearly interpolate between the points (abscissaAtLowEnd, valueAtLowEnd) and (abscissaAtHighEnd, valueAtHighEnd).
 
Methods inherited from class brbrain.AXRegister
check, check, checkSpan, clamp, clamp, containsReadOnlyRegs, decode, dup, dup, encode, ensureCapacity, errorsToString, errorsToString, fromNaturalUnits, isBoolean, isRAM, nextRegister, prevRegister, span, span, span, span, toIdentifierString, toNaturalUnits, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DYNAMIXEL_TYPE

public static final java.lang.String DYNAMIXEL_TYPE
the Dynamixel type identifier

See Also:
Constant Field Values

NOMINAL_BATTERY_VOLTAGE

public static final float NOMINAL_BATTERY_VOLTAGE
nominal battery voltage in Volts (8xNiMH) = (8x1.2V) = 9.6V

See Also:
Constant Field Values

MOVING_SPEED_TO_COUNTS_PER_MS

public static final double MOVING_SPEED_TO_COUNTS_PER_MS

Multiplication factor taking AX12_MOVING_SPEED raw value to position counts per millisecond.

 Tested both @12.4V and @9.8V
 500->400 @ 20: 3s  (f = 100/(3000*20) = 100/60000 = 1/600)
 500->400 @ 10: 6s  (f = 100/(6000*10) = 100/60000 = 1/600)
 500->400 @  5: 11s (f = 100/(11000*5) = 100/55000 = 1/550)
 500->400 @  2: 25s (f = 100/(25000*2) = 100/50000 = 1/500)
 500->400 @  1: 49s (f = 100/(49000*1) = 100/49000 = 1/490)
 

See Also:
Constant Field Values

nextOrdinal

protected static int nextOrdinal
next register ordinal during class init


AX12_MODEL_NUMBER

public static final AX12Register AX12_MODEL_NUMBER
dynamixel model number (RO)


AX12_FIRMWARE_VERSION

public static final AX12Register AX12_FIRMWARE_VERSION
dynamixel firmware version (RO)


AX12_ID

public static final AX12Register AX12_ID
dynamixel ID (RW)


AX12_BAUD_RATE

public static final AX12Register AX12_BAUD_RATE

Dynamixel Baud Rate (RW), natural units [kbits/sec].

See table in dynamixel docs for standard rates.

Changing this will probably make the CM-5 firmware unhappy.


AX12_RETURN_DELAY_TIME

public static final AX12Register AX12_RETURN_DELAY_TIME

Dynamixel return delay time (RW), natural units [usec].

Changing this will probably make the CM-5 firmware unhappy.


AX12_CW_ANGLE_LIMIT

public static final AX12Register AX12_CW_ANGLE_LIMIT
clockwise angle limit (RW), natural units [deg]


AX12_CCW_ANGLE_LIMIT

public static final AX12Register AX12_CCW_ANGLE_LIMIT
counter-clockwise angle limit (RW), natural units [deg]


AX12_HIGHEST_LIMIT_TEMPERATURE

public static final AX12Register AX12_HIGHEST_LIMIT_TEMPERATURE
limit temp (RW), natural units [deg Celcius]


AX12_LOWEST_LIMIT_VOLTAGE

public static final AX12Register AX12_LOWEST_LIMIT_VOLTAGE
low limit voltage (RW), natural units [Volts]


AX12_HIGHEST_LIMIT_VOLTAGE

public static final AX12Register AX12_HIGHEST_LIMIT_VOLTAGE
high limit voltage (RW), natural units [Volts]


AX12_MAX_TORQUE

public static final AX12Register AX12_MAX_TORQUE

Maximum torque (RW), natural units normalized to [0.0, 1.0].

According to dynamixel manual, max torque 0 enables "Free Run" mode, whatever that is. Also note that the dynamixel appears to copy this value to AX12_TORQUE_LIMIT at boot and may not respect changes to it (or to AX12_TORQUE_LIMIT?) until the next boot.

It is unclear how the dynamixel measures "torque" and "load" (current sensing? or based only on servo error?), and calibration relating to physical units is TBD.


AX12_STATUS_RETURN_LEVEL

public static final AX12Register AX12_STATUS_RETURN_LEVEL

Dynamixel status return level (RW).

0 means no return packets, 1 means return packets only for READ_DATA, 2 means return packets always.

Changing this will probably make the CM-5 firmware unhappy.


AX12_ALARM_LED

public static final AX12Register AX12_ALARM_LED
bitmask of E_* constants to trigger the LED (RW)


AX12_ALARM_SHUTDOWN

public static final AX12Register AX12_ALARM_SHUTDOWN
bitmask of E_* constants to trigger torque off (RW)


AX12_DOWN_CALIBRATION

public static final AX12Register AX12_DOWN_CALIBRATION
undocumented pot calibration (RO)


AX12_UP_CALIBRATION

public static final AX12Register AX12_UP_CALIBRATION
undocumented pot calibration (RO)


AX12_TORQUE_ENABLE

public static final AX12Register AX12_TORQUE_ENABLE
enables torque generation (RW), boolean, positive logic


AX12_LED

public static final AX12Register AX12_LED
direct LED control (RW), boolean, positive logic


AX12_CW_COMPLIANCE_MARGIN

public static final AX12Register AX12_CW_COMPLIANCE_MARGIN

Clockwise compliance margin (RW), natural units normalized to [0.0, 1.0].

This is the angular slop allowed before current is applied.

Calibration relating to physical units is TBD.


AX12_CCW_COMPLIANCE_MARGIN

public static final AX12Register AX12_CCW_COMPLIANCE_MARGIN

Counter-clockwise compliance margin (RW), natural units normalized to [0.0, 1.0].

This is the angular slop allowed before current is applied.

Calibration relating to physical units is TBD.


AX12_CW_COMPLIANCE_SLOPE

public static final AX12Register AX12_CW_COMPLIANCE_SLOPE

Clockwise compliance slope (RW), natural units normalized to [0.0, 1.0].

This appears to be 1.0 minus the P-gain.

Actual calibration relating to physical units of rotational stiffness depends on operating voltage.

In an example, the dynamixel documentation states that only the integer part of the base-2 log of this value is significant.


AX12_CCW_COMPLIANCE_SLOPE

public static final AX12Register AX12_CCW_COMPLIANCE_SLOPE

Counter-clockwise compliance slope (RW), natural units normalized to [0.0, 1.0].

This appears to be 1.0 minus the P-gain.

Actual calibration relating to physical units of rotational stiffness depends on operating voltage.

In an example, the dynamixel documentation states that only the integer part of the base-2 log of this value is significant.


AX12_GOAL_POSITION

public static final AX12Register AX12_GOAL_POSITION

Goal position (RW), natural units [deg].

Servo is centered when goal position is at center of range.


AX12_MOVING_SPEED

public static final AX12Register AX12_MOVING_SPEED

Moving speed (RW), natural units [rev/min].

It appears that in position control mode this is effectively a(n unsigned) speed limit, with the limit disabled when this is set to zero.

Setting both AX12_CW_ANGLE_LIMIT and AX12_CCW_ANGLE_LIMIT to zero appears to switch the servo to velocity control mode, where the value of this register is the signed goal velocity.


AX12_TORQUE_LIMIT

public static final AX12Register AX12_TORQUE_LIMIT
See AX12_MAX_TORQUE


AX12_PRESENT_POSITION

public static final AX12Register AX12_PRESENT_POSITION
Current position (RO), natural units [deg]


AX12_PRESENT_SPEED

public static final AX12Register AX12_PRESENT_SPEED
Current speed (RO), natural units [rev/min]


AX12_PRESENT_LOAD

public static final AX12Register AX12_PRESENT_LOAD

Current "load" (RO), natural units normalized to [0.0, 1.0].

It is unclear whether "load" is the same as "torque" here.

Calibration to physical units is TBD.


AX12_PRESENT_VOLTAGE

public static final AX12Register AX12_PRESENT_VOLTAGE
Current voltage (RO), natural units [Volts]


AX12_PRESENT_TEMPERATURE

public static final AX12Register AX12_PRESENT_TEMPERATURE
Current temperature (RO), natural units [degrees Celcius]


AX12_REGISTERED_INSTRUCTION

public static final AX12Register AX12_REGISTERED_INSTRUCTION
Whether there is a registered instruction pending (RW), boolean


AX12_MOVING

public static final AX12Register AX12_MOVING
Whether the servo is currentl moving (RO), boolean


AX12_LOCK

public static final AX12Register AX12_LOCK

Whether to restrict writing to registers AX12_TORQUE_ENABLE through AX12_TORQUE_LIMIT (RW), boolean.

Once this is set it becomes immutable until power cycle.


AX12_PUNCH

public static final AX12Register AX12_PUNCH

Initial current to apply after the position error has exceeded the compliance margin (RW), natural units normalized to [0.0, 1.0].

Calibration to physical units TBD.


AX12_ERROR

public static final AX12Register AX12_ERROR

Virtual register containing the error status of the dynamixel (RO).

The error status is a bitfield of the E_* bits.


svnid

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

registers

protected static AX12Register[] registers
the array of AX12Registers, indexed by ordinal


NUM_REGISTERS

public static final int NUM_REGISTERS
total number of registers


FIRST_REGISTER

public static final AXRegister FIRST_REGISTER
first register in RAM


FIRST_RAM_REGISTER

public static final AXRegister FIRST_RAM_REGISTER
first register in RAM

Constructor Detail

AX12Register

protected AX12Register(int ordinal,
                       java.lang.String prettyName,
                       int startAddr,
                       int width,
                       int min,
                       int max,
                       boolean signMagnitude11Bit,
                       float naturalUnitsPerCount,
                       java.lang.String naturalUnitsLabel,
                       boolean useNaturalUnitsByDefault)
writeable reg with all options


AX12Register

protected AX12Register(int ordinal,
                       java.lang.String prettyName,
                       int startAddr,
                       int width,
                       boolean signMagnitude11Bit,
                       float naturalUnitsPerCount,
                       java.lang.String naturalUnitsLabel,
                       boolean useNaturalUnitsByDefault)
read-only reg with all options


AX12Register

protected AX12Register(int ordinal,
                       java.lang.String prettyName,
                       int startAddr,
                       int width,
                       int min,
                       int max,
                       float naturalUnitsPerCount,
                       java.lang.String naturalUnitsLabel,
                       boolean useNaturalUnitsByDefault)
writeable unsigned reg


AX12Register

protected AX12Register(int ordinal,
                       java.lang.String prettyName,
                       int startAddr,
                       int width,
                       int min,
                       int max)
writeable unsigned reg, natural units are counts


AX12Register

protected AX12Register(int ordinal,
                       java.lang.String prettyName,
                       int startAddr,
                       int min,
                       int max,
                       java.lang.String naturalUnitsLabel,
                       boolean useNaturalUnitsByDefault)
writeable unsigned 1-byte reg, natural units are counts


AX12Register

protected AX12Register(int ordinal,
                       java.lang.String prettyName,
                       int startAddr,
                       int width,
                       float naturalUnitsPerCount,
                       java.lang.String naturalUnitsLabel,
                       boolean useNaturalUnitsByDefault)

Read-only unsigned reg (be careful of confusion with AX12Register(int, String, int, int, int, String, boolean)).


AX12Register

protected AX12Register(int ordinal,
                       java.lang.String prettyName,
                       int startAddr,
                       int width)
read-only unsigned reg, natural units are counts


AX12Register

protected AX12Register(int ordinal,
                       java.lang.String prettyName,
                       int startAddr,
                       int min,
                       int max,
                       float naturalUnitsPerCount,
                       java.lang.String naturalUnitsLabel,
                       boolean useNaturalUnitsByDefault)
writeable unsigned 1-byte reg


AX12Register

protected AX12Register(int ordinal,
                       java.lang.String prettyName,
                       int startAddr,
                       int min,
                       int max)
writeable unsigned 1-byte reg, natural units are coutns


AX12Register

protected AX12Register(int ordinal,
                       java.lang.String prettyName,
                       int startAddr,
                       float naturalUnitsPerCount,
                       java.lang.String naturalUnitsLabel,
                       boolean useNaturalUnitsByDefault)
read-only unsigned 1-byte reg


AX12Register

protected AX12Register(int ordinal,
                       java.lang.String prettyName,
                       int startAddr)
read-only unsigned 1-byte reg, natural units are counts

Method Detail

getCalibratedStiffness

public static float getCalibratedStiffness(int complianceSlope,
                                           float voltage)

Get the stiffness of an AX-12 actuator in units of kg*cm/deg.

Calibrated by physical experiment.

Parameters:
complianceSlope - the compliance slope register value which determines the stiffness
voltage - the operating voltage of the servo or NaN to use NOMINAL_BATTERY_VOLTAGE

interp

public static float interp(float abscissa,
                           float valueAtLowEnd,
                           float abscissaAtLowEnd,
                           float valueAtHighEnd,
                           float abscissaAtHighEnd)

Linearly interpolate between the points (abscissaAtLowEnd, valueAtLowEnd) and (abscissaAtHighEnd, valueAtHighEnd).


getCalibratedStiffness

public static float getCalibratedStiffness(int complianceSlope)

Covers getCalibratedStiffness(int, float), uses NOMINAL_BATTERY_VOLTAGE.


getRelativeRegister

public AXRegister getRelativeRegister(int offset)
get the register with the given relative ordinal

Specified by:
getRelativeRegister in class AXRegister

getNumRegisters

public int getNumRegisters()
get the total number of AX12Registers

Specified by:
getNumRegisters in class AXRegister

getDynamixelType

protected java.lang.String getDynamixelType()
returns DYNAMIXEL_TYPE

Specified by:
getDynamixelType in class AXRegister

getFirstRegister

public static AXRegister getFirstRegister()
get the FIRST_REGISTER


getFirstRAMRegister

public static AXRegister getFirstRAMRegister()
get the FIRST_RAM_REGISTER


getRegister

public static AXRegister getRegister(int ordinal)
get the AX12Register at the specified ordinal


getAllRegisters

public static AX12Register[] getAllRegisters(AX12Register[] regs,
                                             int start)
get a copy of the ordered array of AX12Registers


getAllRegisters

public static AX12Register[] getAllRegisters(AX12Register[] regs)
covers getAllRegisters(AX12Register[], int), starts at 0


getAllRegisters

public static AX12Register[] getAllRegisters()
covers getAllRegisters(AX12Register[], int), always conses