Class MotionController

java.lang.Object
  extended by MotionController

 class MotionController
extends java.lang.Object

The class MotionController contains methods to perform various operations upon the Galil Motion Controller Card. Most MotionController methods calls then invoke the native methods provided by the af2motioncontroller library, which communicates through the Galil API library to the Galil PCI card.


Field Summary
private static MotionController _instance
           
private  int AXIS_WAIT_PERIOD
          The polling period for axis motion complete
private  long AXIS_WAIT_TIMEOUT
          The axis movement wait timeout (2 mins)
(package private) static java.lang.String E_DMC_AXIS_NAME
           
(package private) static boolean ENCODER_SIMULATION
           
(package private) static java.lang.String F_DMC_AXIS_NAME
           
(package private) static java.lang.String G_DMC_AXIS_NAME
           
(package private) static java.lang.String H_DMC_AXIS_NAME
           
private  java.lang.String MAX_POSITION_LIMIT
           
private  java.lang.String MIN_POSITION_LIMIT
           
(package private) static java.lang.String S_DMC_AXIS_NAME
           
(package private) static java.lang.String W_DMC_AXIS_NAME
           
(package private) static java.lang.String X_DMC_AXIS_NAME
           
(package private) static java.lang.String Y_DMC_AXIS_NAME
           
(package private) static java.lang.String Z_DMC_AXIS_NAME
           
 
Constructor Summary
private MotionController()
          The MotionController's private constructor.
 
Method Summary
private  java.lang.String axisParameters(java.util.List axes, java.util.List parameters)
          Create an axis parameter list string
private  void close()
          Close communications with the DMC card
(package private)  void defineAuxiliaryEncoderPosition(MotionControllerAxis theAxis, long Position)
          Define the axis' auxiliary encoder position
(package private)  void defineEncoderPosition(MotionControllerAxis theAxis, long Position)
          Define the axis' encoder position
(package private)  void disablePositionLimits(MotionControllerAxis theAxis)
          Disable position limits
private  long DMCClose()
          Galil DMC18x0 native method to close comms with the motion controller
private  MotionControllerResult DMCCommand(java.lang.String Command)
          Galil DMC18x0 native method to send a command to the motion controller
private  long DMCGetAnalogInputFromDR(int DMCAnalogInputPort)
           
private  long DMCGetAxisAuxiliaryPositionFromDR(int DMCAxisNumber)
           
private  long DMCGetAxisMotorPositionFromDR(int DMCAxisNumber)
           
private  long DMCGetGeneralInputFromDR(int DMCGeneralInputPortBlock)
           
private  long DMCGetGeneralOutputFromDR(int DMCGeneralOutputPortBlock)
           
private  long DMCOpen()
          Galil DMC18x0 native method to open comms with the motion controller
private  long DMCRefreshDataRecord()
           
private  long DMCReset()
          Galil DMC18x0 native method to reset the motion controller
(package private)  void findEdge(MotionControllerAxis theAxis)
          Find the home switch edge of an axis
(package private)  void findEdge(MotionControllerAxis theAxis1, MotionControllerAxis theAxis2)
          Find the home switch edges of 2 axes
(package private)  void findIndex(MotionControllerAxis theAxis)
          Find the index pulse of an axis
(package private)  long getAcceleration(MotionControllerAxis theAxis)
          Get the acceleration of an axis
(package private)  double getADCReading(int theADCPort)
          Get the value of an a/d port
(package private)  long getAnalogInputFromDR(int DMCAnalogInputPort)
           
(package private)  long getAuxiliaryEncoderPosition(MotionControllerAxis theAxis)
          Get the auixiliary encoder position
(package private)  long getAxisAuxiliaryPositionFromDR(int DMCAxisNumber)
           
(package private)  long getAxisMotorPositionFromDR(int DMCAxisNumber)
           
(package private)  long getDeceleration(MotionControllerAxis theAxis)
          Get the deceleration of an axis
(package private)  int getDigitalInputs(int digitalInputBlockNumber)
          Get the state of a digital input block
(package private)  int getDigitalOutputs(int digitalOutputBlockNumber)
          Get the state of a digital output block
(package private)  long getGeneralInputFromDR(int DMCGeneralInputPortBlock)
           
(package private)  long getGeneralOutputFromDR(int DMCGeneralOutputPortBlock)
           
(package private)  MotionControllerResult getPosition()
          Get the positions of all of the main encoders
(package private)  long getPosition(MotionControllerAxis theAxis)
          Get the main encoder position of an axis
(package private)  long getPositionError(MotionControllerAxis theAxis)
          Get the position error of an axis
(package private)  MotionControllerResult getReferencePosition()
          Get the reference positions of all of the main encoders
(package private)  long getReferencePosition(MotionControllerAxis theAxis)
          Get the main encoder reference position of an axis
(package private)  long getSpeed(MotionControllerAxis theAxis)
          Get the speed of an axis
(package private)  void home(MotionControllerAxis theAxis)
          Find and define the home position of an axis
(package private)  void home(MotionControllerAxis theAxis1, MotionControllerAxis theAxis2)
          Find and define the home position of two axes
static MotionController instance()
          The instance class method
(package private)  boolean isDigitalInputPortHigh(int theInputPort)
          Get the condition of a digital input port
(package private)  boolean isDigitalOutputPortHigh(int theOutputPort)
          Get the condition of a digital output port
(package private)  boolean isInForwardLimit(MotionControllerAxis theAxis)
          Check the forward limit of an axis
(package private)  boolean isInHomeSwitch(MotionControllerAxis theAxis)
          Is the axis in it's home switch
(package private)  boolean isInReverseLimit(MotionControllerAxis theAxis)
          Check the reverse limit of an axis
(package private)  void jog(MotionControllerAxis theAxis, long Speed)
          Jog an axis
(package private)  void move(MotionControllerAxis theAxis, long Position)
          Move an axis to the required position
(package private)  void move(MotionControllerAxis theAxis1, MotionControllerAxis theAxis2, long Position1, long Position2)
          Move 2 axes to the required positions - this does not produce a linear motion
(package private)  void moveVector(MotionControllerAxis theAxis1, MotionControllerAxis theAxis2, long Position1, long Position2, long VectorSpeed, long VectorAcceleration)
          Move 2 axes in a linear motion
(package private)  void moveVector(MotionControllerAxis theAxis1, MotionControllerAxis theAxis2, MotionControllerAxis theAxis3, long Position1, long Position2, long Position3, long VectorSpeed, long VectorAcceleration)
          Move 3 axes in a linear motion
(package private)  void offset(MotionControllerAxis theAxis, long Offset)
          Offset an axis
(package private)  void offset(MotionControllerAxis theAxis1, MotionControllerAxis theAxis2, long Offset1, long Offset2)
          Offset 2 axes - this does not produce a linear motion
(package private)  void offsetVector(MotionControllerAxis theAxis1, MotionControllerAxis theAxis2, long Offset1, long Offset2, long VectorSpeed, long VectorAcceleration)
          Offset 2 axes in a linear motion
private  void open()
          Open communications with the DMC card
(package private)  void refreshDataRecord()
          Refresh the data record
private  void reset()
          Reset the DMC card
(package private)  MotionControllerResult sendCommand(java.lang.String Command)
          Send a command to the motion controller
(package private)  void setAcceleration(MotionControllerAxis theAxis, int Acceleration)
          Set the acceleration of an axis
(package private)  void setDeceleration(MotionControllerAxis theAxis, int Deceleration)
          Set the deceleration of an axis
(package private)  void setDigitalOutputPortHigh(int theDigitalOutputPort)
          Set a digital port output high
(package private)  void setDigitalOutputPortLow(int theDigitalOutputPort)
          Set a digital output port low
(package private)  void setDualLoop(MotionControllerAxis theAxis, boolean state)
          Set the axis to use the dual loop method
(package private)  void setErrorLimit(long errorLimit)
          Set the error limit on all axes
(package private)  void setMotorOff(MotionControllerAxis theAxis)
          Set an axis motor off
(package private)  void setMotorServoHere(MotionControllerAxis theAxis)
          Set an axis motor servoing
(package private)  void setMotorsOff()
          Set all of the motors to the off condition
(package private)  void setMotorsServoHere()
          Set all of the motors servoing
(package private)  void setPID(MotionControllerAxis theAxis, double ProportionalConstant, double Integrator, double DerivativeConstant)
          Set the gain (PID) parameters of an axis
(package private)  void setPositionLimits(MotionControllerAxis theAxis, long ReversePositionLimit, long ForwardPositionLimit)
          Set the reverse and forward position limits for an axis
(package private)  void setSmoothing(MotionControllerAxis theAxis, double Smoothing)
          Set the smoothing of an axis
(package private)  void setSpeed(MotionControllerAxis theAxis, int Speed)
          Set the speed of an axis
(package private)  void setTorqueLimit(MotionControllerAxis theAxis, double torque)
          Set the torque limit
(package private)  void stop()
          Stop motion on all axes
private  void test()
           
(package private)  void wait(MotionControllerAxis theAxis)
          Wait for an axis to complete it's motion
(package private)  void wait(MotionControllerAxis theAxis1, MotionControllerAxis theAxis2, MotionControllerAxis theAxis3)
          Wait for 3 axes to complete motion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENCODER_SIMULATION

static final boolean ENCODER_SIMULATION
See Also:
Constant Field Values

X_DMC_AXIS_NAME

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

Y_DMC_AXIS_NAME

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

Z_DMC_AXIS_NAME

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

W_DMC_AXIS_NAME

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

E_DMC_AXIS_NAME

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

F_DMC_AXIS_NAME

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

G_DMC_AXIS_NAME

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

H_DMC_AXIS_NAME

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

S_DMC_AXIS_NAME

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

AXIS_WAIT_PERIOD

private final int AXIS_WAIT_PERIOD
The polling period for axis motion complete

See Also:
Constant Field Values

AXIS_WAIT_TIMEOUT

private final long AXIS_WAIT_TIMEOUT
The axis movement wait timeout (2 mins)

See Also:
Constant Field Values

MIN_POSITION_LIMIT

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

MAX_POSITION_LIMIT

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

_instance

private static MotionController _instance
Constructor Detail

MotionController

private MotionController()
The MotionController's private constructor.

Method Detail

instance

public static MotionController instance()
The instance class method

Returns:
The single instance of the class

DMCCommand

private MotionControllerResult DMCCommand(java.lang.String Command)
Galil DMC18x0 native method to send a command to the motion controller

Parameters:
Command - Command to send to DMC
Returns:
Driver result code

DMCOpen

private long DMCOpen()
Galil DMC18x0 native method to open comms with the motion controller

Returns:
Driver result code

DMCClose

private long DMCClose()
Galil DMC18x0 native method to close comms with the motion controller

Returns:
Driver result code

DMCReset

private long DMCReset()
Galil DMC18x0 native method to reset the motion controller

Returns:
Driver result code

DMCRefreshDataRecord

private long DMCRefreshDataRecord()

DMCGetGeneralInputFromDR

private long DMCGetGeneralInputFromDR(int DMCGeneralInputPortBlock)

DMCGetGeneralOutputFromDR

private long DMCGetGeneralOutputFromDR(int DMCGeneralOutputPortBlock)

DMCGetAnalogInputFromDR

private long DMCGetAnalogInputFromDR(int DMCAnalogInputPort)

DMCGetAxisMotorPositionFromDR

private long DMCGetAxisMotorPositionFromDR(int DMCAxisNumber)

DMCGetAxisAuxiliaryPositionFromDR

private long DMCGetAxisAuxiliaryPositionFromDR(int DMCAxisNumber)

open

private void open()
Open communications with the DMC card


close

private void close()
Close communications with the DMC card


reset

private void reset()
Reset the DMC card


sendCommand

MotionControllerResult sendCommand(java.lang.String Command)
Send a command to the motion controller

Parameters:
Command - The command to send
Returns:
Result of the command to the motion controller

setDigitalOutputPortHigh

void setDigitalOutputPortHigh(int theDigitalOutputPort)
Set a digital port output high

Parameters:
theDigitalOutputPort - The number of the digital output port

setDigitalOutputPortLow

void setDigitalOutputPortLow(int theDigitalOutputPort)
Set a digital output port low

Parameters:
theDigitalOutputPort - The number of the digital output port

isDigitalInputPortHigh

boolean isDigitalInputPortHigh(int theInputPort)
Get the condition of a digital input port

Parameters:
theInputPort - The number of the input port
Returns:
Boolean to indicate whether the input port is high

isDigitalOutputPortHigh

boolean isDigitalOutputPortHigh(int theOutputPort)
Get the condition of a digital output port

Parameters:
theOutputPort - The number of the output port
Returns:
Boolean to indicate whether the output port is high

getDigitalInputs

int getDigitalInputs(int digitalInputBlockNumber)
Get the state of a digital input block

Parameters:
digitalInputBlockNumber - The input block number
Returns:
The bytewise state of the input block

getDigitalOutputs

int getDigitalOutputs(int digitalOutputBlockNumber)
Get the state of a digital output block

Parameters:
digitalOutputBlockNumber - The output block number
Returns:
The bytewise state of the output block

getADCReading

double getADCReading(int theADCPort)
Get the value of an a/d port

Parameters:
theADCPort - The number of the a/d port
Returns:
The voltage on the a/d port (-10.0 to +10.0)

setPID

void setPID(MotionControllerAxis theAxis,
            double ProportionalConstant,
            double Integrator,
            double DerivativeConstant)
Set the gain (PID) parameters of an axis

Parameters:
theAxis - The axis
ProportionalConstant - The proportional constant P
Integrator - The integrator I
DerivativeConstant - Thye derivative constant D

setAcceleration

void setAcceleration(MotionControllerAxis theAxis,
                     int Acceleration)
Set the acceleration of an axis

Parameters:
theAxis - The axis
Acceleration - The required acceleration

setDeceleration

void setDeceleration(MotionControllerAxis theAxis,
                     int Deceleration)
Set the deceleration of an axis

Parameters:
theAxis - The axis
Deceleration - The required deceleration

setSmoothing

void setSmoothing(MotionControllerAxis theAxis,
                  double Smoothing)
Set the smoothing of an axis

Parameters:
theAxis - The axis
Smoothing - The required smoothing factor (0=maximum smoothing, 1=no smoothing)

setSpeed

void setSpeed(MotionControllerAxis theAxis,
              int Speed)
Set the speed of an axis

Parameters:
theAxis - The axis
Speed - The required speed

setPositionLimits

void setPositionLimits(MotionControllerAxis theAxis,
                       long ReversePositionLimit,
                       long ForwardPositionLimit)
Set the reverse and forward position limits for an axis

Parameters:
theAxis - The axis
ReversePositionLimit - The reverse position limit
ForwardPositionLimit - The forward position limit

disablePositionLimits

void disablePositionLimits(MotionControllerAxis theAxis)
Disable position limits

Parameters:
theAxis - The axis

setErrorLimit

void setErrorLimit(long errorLimit)
Set the error limit on all axes

Parameters:
errorLimit - The error limit in encoder counts

setMotorsOff

void setMotorsOff()
Set all of the motors to the off condition


setMotorOff

void setMotorOff(MotionControllerAxis theAxis)
Set an axis motor off

Parameters:
theAxis - The axis

setTorqueLimit

void setTorqueLimit(MotionControllerAxis theAxis,
                    double torque)
Set the torque limit

Parameters:
theAxis - The axis
torque - The torque limit

setMotorsServoHere

void setMotorsServoHere()
Set all of the motors servoing


setMotorServoHere

void setMotorServoHere(MotionControllerAxis theAxis)
Set an axis motor servoing

Parameters:
theAxis - The axis

setDualLoop

void setDualLoop(MotionControllerAxis theAxis,
                 boolean state)
Set the axis to use the dual loop method

Parameters:
theAxis - MotionControllerAxis
state - boolean

defineEncoderPosition

void defineEncoderPosition(MotionControllerAxis theAxis,
                           long Position)
Define the axis' encoder position

Parameters:
theAxis - The axis
Position - The position the axis is to be defined at

defineAuxiliaryEncoderPosition

void defineAuxiliaryEncoderPosition(MotionControllerAxis theAxis,
                                    long Position)
Define the axis' auxiliary encoder position

Parameters:
theAxis - The axis
Position - The position the axis is to be defined at

home

void home(MotionControllerAxis theAxis)
Find and define the home position of an axis

Parameters:
theAxis - The axis to be homed

home

void home(MotionControllerAxis theAxis1,
          MotionControllerAxis theAxis2)
Find and define the home position of two axes

Parameters:
theAxis1 - The first axis to be homed
theAxis2 - The second axis to be homed

jog

void jog(MotionControllerAxis theAxis,
         long Speed)
Jog an axis

Parameters:
theAxis - The axis
Speed - The jogging speed

move

void move(MotionControllerAxis theAxis,
          long Position)
Move an axis to the required position

Parameters:
theAxis - The axis to be moved
Position - The position to which the axis is to be moved

move

void move(MotionControllerAxis theAxis1,
          MotionControllerAxis theAxis2,
          long Position1,
          long Position2)
Move 2 axes to the required positions - this does not produce a linear motion

Parameters:
theAxis1 - Axis 1 to be moved
theAxis2 - Axis 2 to be moved
Position1 - The demand position for axis 1
Position2 - The demand position for axis 1

offset

void offset(MotionControllerAxis theAxis,
            long Offset)
Offset an axis

Parameters:
theAxis - The axis to be offset
Offset - The offset

offset

void offset(MotionControllerAxis theAxis1,
            MotionControllerAxis theAxis2,
            long Offset1,
            long Offset2)
Offset 2 axes - this does not produce a linear motion

Parameters:
theAxis1 - The first axis
theAxis2 - The second axis
Offset1 - The first axis offset
Offset2 - The second axis offset

moveVector

void moveVector(MotionControllerAxis theAxis1,
                MotionControllerAxis theAxis2,
                long Position1,
                long Position2,
                long VectorSpeed,
                long VectorAcceleration)
Move 2 axes in a linear motion

Parameters:
theAxis1 - The first axis
theAxis2 - The second axis
Position1 - The first axis position
Position2 - The second axis position
VectorSpeed - The speed of the linear motion
VectorAcceleration - The acceleration of the linear motion

moveVector

void moveVector(MotionControllerAxis theAxis1,
                MotionControllerAxis theAxis2,
                MotionControllerAxis theAxis3,
                long Position1,
                long Position2,
                long Position3,
                long VectorSpeed,
                long VectorAcceleration)
Move 3 axes in a linear motion

Parameters:
theAxis1 - The first axis
theAxis2 - The second axis
theAxis3 - The third axis
Position1 - The first axis position
Position2 - The second axis position
Position3 - The third axis position
VectorSpeed - The speed of the linear motion
VectorAcceleration - The acceleration of the linear motion

offsetVector

void offsetVector(MotionControllerAxis theAxis1,
                  MotionControllerAxis theAxis2,
                  long Offset1,
                  long Offset2,
                  long VectorSpeed,
                  long VectorAcceleration)
Offset 2 axes in a linear motion

Parameters:
theAxis1 - The first axis
theAxis2 - The second axis
Offset1 - The first axis offset
Offset2 - The second axis offset
VectorSpeed - The speed of the linear motion
VectorAcceleration - The acceleration of the linear motion

getPosition

long getPosition(MotionControllerAxis theAxis)
Get the main encoder position of an axis

Parameters:
theAxis - The axis
Returns:
The main encoder position

getPosition

MotionControllerResult getPosition()
Get the positions of all of the main encoders

Returns:
The motion controller result

getReferencePosition

long getReferencePosition(MotionControllerAxis theAxis)
Get the main encoder reference position of an axis

Parameters:
theAxis - The axis
Returns:
The main encoder reference position

getReferencePosition

MotionControllerResult getReferencePosition()
Get the reference positions of all of the main encoders

Returns:
The motion controller result

getPositionError

long getPositionError(MotionControllerAxis theAxis)
Get the position error of an axis

Parameters:
theAxis - The axis
Returns:
The position error

getAuxiliaryEncoderPosition

long getAuxiliaryEncoderPosition(MotionControllerAxis theAxis)
Get the auixiliary encoder position

Parameters:
theAxis - The axis
Returns:
The auxiliary encoder position

getAcceleration

long getAcceleration(MotionControllerAxis theAxis)
Get the acceleration of an axis

Parameters:
theAxis - The axis
Returns:
The current acceleration of the axis

getDeceleration

long getDeceleration(MotionControllerAxis theAxis)
Get the deceleration of an axis

Parameters:
theAxis - The axis
Returns:
The current deceleration of the axis

getSpeed

long getSpeed(MotionControllerAxis theAxis)
Get the speed of an axis

Parameters:
theAxis - The axis
Returns:
The current speed of the axis

findIndex

void findIndex(MotionControllerAxis theAxis)
Find the index pulse of an axis

Parameters:
theAxis - The axis

findEdge

void findEdge(MotionControllerAxis theAxis)
Find the home switch edge of an axis

Parameters:
theAxis - The axis

findEdge

void findEdge(MotionControllerAxis theAxis1,
              MotionControllerAxis theAxis2)
Find the home switch edges of 2 axes

Parameters:
theAxis1 - The axis 1
theAxis2 - The axis 2

wait

void wait(MotionControllerAxis theAxis)
Wait for an axis to complete it's motion

Parameters:
theAxis - The axis

wait

void wait(MotionControllerAxis theAxis1,
          MotionControllerAxis theAxis2,
          MotionControllerAxis theAxis3)
Wait for 3 axes to complete motion

Parameters:
theAxis1 - Axis 1
theAxis2 - Axis 2
theAxis3 - Axis 3

stop

void stop()
Stop motion on all axes


isInHomeSwitch

boolean isInHomeSwitch(MotionControllerAxis theAxis)
Is the axis in it's home switch

Parameters:
theAxis - The axis
Returns:
Boolean to indicate whether the axis is in it's home switch

isInForwardLimit

boolean isInForwardLimit(MotionControllerAxis theAxis)
Check the forward limit of an axis

Parameters:
theAxis - The axis
Returns:
Boolean to indicate if the axis is in the forward limit

isInReverseLimit

boolean isInReverseLimit(MotionControllerAxis theAxis)
Check the reverse limit of an axis

Parameters:
theAxis - The axis
Returns:
Boolean to indicate if the axis is in the reverse limit

refreshDataRecord

void refreshDataRecord()
Refresh the data record


getGeneralInputFromDR

long getGeneralInputFromDR(int DMCGeneralInputPortBlock)

getGeneralOutputFromDR

long getGeneralOutputFromDR(int DMCGeneralOutputPortBlock)

getAnalogInputFromDR

long getAnalogInputFromDR(int DMCAnalogInputPort)

getAxisMotorPositionFromDR

long getAxisMotorPositionFromDR(int DMCAxisNumber)

getAxisAuxiliaryPositionFromDR

long getAxisAuxiliaryPositionFromDR(int DMCAxisNumber)

axisParameters

private java.lang.String axisParameters(java.util.List axes,
                                        java.util.List parameters)
Create an axis parameter list string

Parameters:
axes - A list of axes
parameters - A list of parameters
Returns:
The list of comma separated parameters for the axis parameters

test

private void test()