|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object JSci.instruments.PositionControlAdapter JSci.instruments.pi.Mercury
public abstract class Mercury
A mechanical device attached to a Mercury PI board.
Attention! The Mercury board forgets the position of the axes when it is reset or
is turned off. Do not turn off the Mercury while the motor is moving!
There is a lot of final
and protected
methods, because
this should be not be simply sub-classed by motor-specific classes, but it should be
included in them.
Field Summary | |
---|---|
protected static java.lang.String |
ACTIVITY_ACT_NEG_LIMIT
|
protected static java.lang.String |
ACTIVITY_ACT_POS_LIMIT
|
protected static java.lang.String |
ACTIVITY_AXIS_SETTLED
|
protected static java.lang.String |
ACTIVITY_IN_MOTION
|
protected static java.lang.String |
ACTIVITY_MAX_VELOCITY
|
protected static java.lang.String |
ACTIVITY_MOTOR_STATUS
|
protected static java.lang.String |
ACTIVITY_PHASING_INITD
|
protected static java.lang.String |
ACTIVITY_POSITION_CAPTURE
|
protected static java.lang.String |
ACTIVITY_PROFILE_MODE_0
|
protected static java.lang.String |
ACTIVITY_PROFILE_MODE_1
|
protected static java.lang.String |
ACTIVITY_PROFILE_MODE_2
|
protected static java.lang.String |
ACTIVITY_RESERVED
|
protected static java.lang.String |
ACTIVITY_TRACKING
|
static java.lang.String |
C136
The C-136.10 motor |
static java.lang.String |
C150PD
The C-150.PD motor |
protected static java.lang.String |
EVENT_BREAKPOINT1
|
protected static java.lang.String |
EVENT_BREAKPOINT2
|
protected static java.lang.String |
EVENT_CAPTURE_RECEIVED
|
protected static java.lang.String |
EVENT_COMMUNICATION_ERR
|
protected static java.lang.String |
EVENT_INSTRUCTION_ERR
|
protected static java.lang.String |
EVENT_MOTION_COMPLETE
|
protected static java.lang.String |
EVENT_MOTION_ERROR
|
protected static java.lang.String |
EVENT_NEG_LIMIT
|
protected static java.lang.String |
EVENT_POS_LIMIT
|
protected static java.lang.String |
EVENT_WRAP_AROUND
|
static java.lang.String |
M126PD
The M-126.PD motor |
static java.lang.String |
RAW
A generic motor driven by Mercury |
(package private) javax.swing.JFrame |
setLimitsDialog
|
protected static java.lang.String |
SIGNAL_AXIS_IN
|
protected static java.lang.String |
SIGNAL_AXIS_OUT
|
protected static java.lang.String |
SIGNAL_ENCODER_A
|
protected static java.lang.String |
SIGNAL_ENCODER_B
|
protected static java.lang.String |
SIGNAL_ENCODER_HOME
|
protected static java.lang.String |
SIGNAL_ENCODER_INDEX
|
protected static java.lang.String |
SIGNAL_HALL_A
|
protected static java.lang.String |
SIGNAL_HALL_B
|
protected static java.lang.String |
SIGNAL_HALL_C
|
protected static java.lang.String |
SIGNAL_MOTOR_OUTPUT
|
protected static java.lang.String |
SIGNAL_NEG_LIMIT
|
protected static java.lang.String |
SIGNAL_POS_LIMIT
|
protected static java.lang.String |
SIGNAL_STEP_OUTPUT
|
Fields inherited from class JSci.instruments.PositionControlAdapter |
---|
listenerList |
Constructor Summary | |
---|---|
protected |
Mercury(int p,
java.io.DataInput rfi,
java.io.DataOutput rfo,
int n)
Remember this class is abstract! |
Method Summary | |
---|---|
protected void |
clearErrors()
Clear errors |
protected javax.swing.JPanel |
createButtonControlPanel()
Create a JPanel with buttons for controlling the motor. ATTENZIONE! NON E' COMPLETO!!! |
static Mercury |
createMotorDevice(java.lang.String t,
int p,
java.io.DataInput rfi,
java.io.DataOutput rfo,
int n,
double gf)
Call this to build a driver for a given motor, instead of calling the constructor. |
static Mercury |
createMotorDevice(java.lang.String t,
int p,
int n)
Call this to build a driver for a given motor, instead of calling the constructor. |
static Mercury |
createMotorDevice(java.lang.String t,
int p,
int n,
double gf)
Call this to build a driver for a given motor, instead of calling the constructor. |
protected javax.swing.JPanel |
createPositionPanel(boolean monitor,
boolean vertical,
boolean inverted)
Create a JPanel with the controls of the position |
protected javax.swing.JPanel |
createVelocityPanel(boolean monitor)
Create a JPanel with the controls of the velocity |
double |
doGetPosition()
|
double |
doGetPositionError()
|
protected void |
findCenter()
move to the position between the two limit switches. |
protected java.util.Hashtable |
getActivityStatus()
get the status of activity. |
double |
getActualPosition()
get the actual position while the axis is moving. |
double |
getActualVelocity()
get the actual velocity while moving. |
protected boolean |
getBrake()
check if the brake is on or off. |
abstract java.awt.Component |
getControlComponent()
The motor can be controlled by a visual component, with buttons, sliders and so on. |
protected java.util.Hashtable |
getEventStatus()
get the status of event. |
double |
getMajorStep()
get the major step suggested for changing the position |
double |
getMaximum()
get the maximum value of position |
double |
getMaxVelocity()
get the maximum value of velocity |
double |
getMinimum()
get the minimum value of position |
double |
getMinorStep()
get the minor step suggested for changing the position |
protected boolean |
getMotorOn()
check if the motor is on or off. |
double |
getPosition()
get the position. |
double |
getPositionError()
get the error on the actual position. |
protected java.util.Hashtable |
getSignalStatus()
get the status of signal. |
java.lang.String |
getUnit()
get the unit in which the position is expressed |
double |
getVelocity()
get the velocity that should be reached when moving. |
double |
getVelocityStep()
get the step suggested for changing the velocity |
java.lang.String |
getVelocityUnit()
get the unit in which the velocity is expressed |
static void |
main(java.lang.String[] args)
Useful controls for the Mercury board. |
protected void |
setBrake(boolean b)
switch the brake on or off. |
void |
setLimits()
runs a graphical configuration of the limits. |
protected void |
setLimitSwitches(boolean b)
set the limit switch polarity. |
void |
setMaximum(double m)
set the maximum value of position. |
void |
setMinimum(double m)
set the minimum value of position. |
protected void |
setMotorOn(boolean b)
switch the motor on or off. |
void |
setPosition(double p)
move the device to the given position. |
void |
setVelocity(double v)
set the velocity the device will reach when moving. |
void |
sleep()
sleep until the axis has reached its position |
java.lang.String |
toString()
Report port number, device number and version |
Methods inherited from class JSci.instruments.PositionControlAdapter |
---|
addChangeListener, fireStateChanged, getChangeListeners, getListeners, removeChangeListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String EVENT_MOTION_COMPLETE
protected static final java.lang.String EVENT_WRAP_AROUND
protected static final java.lang.String EVENT_BREAKPOINT1
protected static final java.lang.String EVENT_CAPTURE_RECEIVED
protected static final java.lang.String EVENT_MOTION_ERROR
protected static final java.lang.String EVENT_POS_LIMIT
protected static final java.lang.String EVENT_NEG_LIMIT
protected static final java.lang.String EVENT_INSTRUCTION_ERR
protected static final java.lang.String EVENT_COMMUNICATION_ERR
protected static final java.lang.String EVENT_BREAKPOINT2
protected static final java.lang.String SIGNAL_ENCODER_A
protected static final java.lang.String SIGNAL_ENCODER_B
protected static final java.lang.String SIGNAL_ENCODER_INDEX
protected static final java.lang.String SIGNAL_ENCODER_HOME
protected static final java.lang.String SIGNAL_POS_LIMIT
protected static final java.lang.String SIGNAL_NEG_LIMIT
protected static final java.lang.String SIGNAL_AXIS_IN
protected static final java.lang.String SIGNAL_HALL_A
protected static final java.lang.String SIGNAL_HALL_B
protected static final java.lang.String SIGNAL_HALL_C
protected static final java.lang.String SIGNAL_AXIS_OUT
protected static final java.lang.String SIGNAL_STEP_OUTPUT
protected static final java.lang.String SIGNAL_MOTOR_OUTPUT
protected static final java.lang.String ACTIVITY_PHASING_INITD
protected static final java.lang.String ACTIVITY_MAX_VELOCITY
protected static final java.lang.String ACTIVITY_TRACKING
protected static final java.lang.String ACTIVITY_PROFILE_MODE_0
protected static final java.lang.String ACTIVITY_PROFILE_MODE_1
protected static final java.lang.String ACTIVITY_PROFILE_MODE_2
protected static final java.lang.String ACTIVITY_RESERVED
protected static final java.lang.String ACTIVITY_AXIS_SETTLED
protected static final java.lang.String ACTIVITY_MOTOR_STATUS
protected static final java.lang.String ACTIVITY_POSITION_CAPTURE
protected static final java.lang.String ACTIVITY_IN_MOTION
protected static final java.lang.String ACTIVITY_ACT_POS_LIMIT
protected static final java.lang.String ACTIVITY_ACT_NEG_LIMIT
public static final java.lang.String C150PD
public static final java.lang.String C136
public static final java.lang.String M126PD
public static final java.lang.String RAW
javax.swing.JFrame setLimitsDialog
Constructor Detail |
---|
protected Mercury(int p, java.io.DataInput rfi, java.io.DataOutput rfo, int n)
p
- the ttyS port number at which the Mercury is attachedrfi
- the input file connected to the port; something like
new RandomAccessFile("/dev/ttyS0","rw")rfo
- the output file connected to the port; something like
new RandomAccessFile("/dev/ttyS0","rw")n
- the number of the axisMethod Detail |
---|
protected final void setLimitSwitches(boolean b)
b
- the switch signals are high when out-of-limit?protected void findCenter()
public void setPosition(double p)
setPosition
in interface PositionControl
setPosition
in class PositionControlAdapter
p
- the position that we want to reach, in counts.
It is rounded to its nearest integer positionpublic double getPosition()
getPosition
in interface PositionControl
getPosition
in class PositionControlAdapter
public double doGetPosition()
public double getActualPosition()
getActualPosition
in interface PositionControl
getActualPosition
in class PositionControlAdapter
public double getMinimum()
getMinimum
in interface PositionControl
getMinimum
in class PositionControlAdapter
public double getMaximum()
getMaximum
in interface PositionControl
getMaximum
in class PositionControlAdapter
public void setMinimum(double m)
m
- the minimum positionpublic void setMaximum(double m)
m
- the maximum positionpublic java.lang.String getUnit()
getUnit
in interface PositionControl
getUnit
in class PositionControlAdapter
public double getMinorStep()
public double getMajorStep()
public double getPositionError()
public double doGetPositionError()
public void setVelocity(double v)
v
- the velocity in counts per cycle. It is rounded to its
nearest integer position.public double getVelocity()
public double getActualVelocity()
public double getMaxVelocity()
public double getVelocityStep()
public java.lang.String getVelocityUnit()
protected void clearErrors()
protected void setMotorOn(boolean b)
b
- do you want to switch the motor on?protected boolean getMotorOn()
protected void setBrake(boolean b)
b
- do you want to switch the brake on?protected boolean getBrake()
protected java.util.Hashtable getEventStatus()
protected java.util.Hashtable getSignalStatus()
protected java.util.Hashtable getActivityStatus()
public void sleep()
sleep
in interface PositionControl
sleep
in class PositionControlAdapter
protected javax.swing.JPanel createPositionPanel(boolean monitor, boolean vertical, boolean inverted)
monitor
- monitor the actual position every 0.1 s.vertical
- the direction of motion is verticalinverted
- invert the direction of motionprotected javax.swing.JPanel createVelocityPanel(boolean monitor)
monitor
- monitor the actual velocity every 0.1 s.protected javax.swing.JPanel createButtonControlPanel()
public abstract java.awt.Component getControlComponent()
getControlComponent
in interface Control
getControlComponent
in interface PositionControl
getControlComponent
in class PositionControlAdapter
public static Mercury createMotorDevice(java.lang.String t, int p, java.io.DataInput rfi, java.io.DataOutput rfo, int n, double gf)
t
- the type of motor connected to the board (see RAW,C150PD, C136, M126PD).p
- the number of the ttyS portrfi
- the input file connected to the portrfo
- the output file connected to the portn
- the number of the axisgf
- if there's a mechanical device such as a gear, gf is the ratio final motion/motor motion. gf=1 for RAW.public static Mercury createMotorDevice(java.lang.String t, int p, int n, double gf)
t
- the type of motor connected to the board (see RAW,C150PD, C136, M126PD).p
- the number of the ttyS portn
- the number of the axisgf
- if there's a mechanical device such as a gear, gf is the ratio final motion/motor motion. gf=1 for RAW.public static Mercury createMotorDevice(java.lang.String t, int p, int n)
t
- the type of motor connected to the board (see RAW,C150PD, C136, M126PD).p
- the number of the ttyS portn
- the number of the axispublic java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
java it.unimi.pi.Mercury {options} {commands}
public void setLimits()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |