|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectikayaki.squid.Handler
public class Handler
Offers an interface for controlling the sample handler.
Field Summary | |
---|---|
private int |
ACCELERATION
Value between 0 and 127 default 5. |
private SynchronousQueue<String> |
answerQueue
Synchronous queue for waiting result message from handler |
private int |
AXIAL_AF_POSITION
Axial AF demag position in steps, must be divisible by 10. |
private int |
BACKGROUND_POSITION
Position in steps, must be divisible by 10. |
private int |
currentMotor
Currently selected motor to send the commands to. |
private int |
currentPosition
The position where the handler is currently, or where it is heading right now. |
private int |
currentRotation
Angles are between 0 (0) and 2000 (360). |
private int |
currentVelocity
Last set velocity. |
private int |
DECELERATION
Value between 0 and 127 default 10. |
private int |
estimatedPositionEnd
|
private int |
estimatedPositionStart
Starting point at start of movement |
private long |
estimatedPositionStartTime
Time in milliseconds when we started movement |
private int |
estimatedRotationEnd
|
private int |
estimatedRotationStart
|
private long |
estimatedRotationStartTime
|
private int |
HANDLER_ROTATION
|
private int |
MEASUREMENT_POSITION
Position in steps, must be divisible by 10. |
private int |
MEASUREMENT_VELOCITY
Speed in measurement, should be small. |
private int |
POLL_TIMEOUT
timeout how long we wait answer from Squid-system, debugging to prevent lock-ups if communication fails. |
private int |
ROTATION_ACCELERATION
Value between 0 and 127. |
private int |
ROTATION_DECELERATION
Value between 0 and 127. |
private int |
ROTATION_VELOCITY
Value between 50 and 8500, but should be small |
private int |
SAMPLE_LOAD_POSITION
Value between 1 and 16,777,215. |
protected SerialIO |
serialIO
COM port for communication. |
private int |
TRANSVERSE_YAF_POSITION
AF demag position for transverse. |
private boolean |
waitingForMessage
Only one at time can be waiting for answer, works like semaphore for commanding handler |
private int |
VELOCITY
Value between 50 and 12 000. |
private LastExecutor |
workQueue
Executes the commands to the handler one at a time. |
Constructor Summary | |
---|---|
protected |
Handler()
Creates a new handler interface. |
Method Summary | |
---|---|
private void |
fireMovementStopped()
Stops calculating estimated current position |
private void |
fireRotationStopped()
Stops calculating estimated current position |
int |
getEstimatedPosition()
Returns an estimation that where handler is right now. |
int |
getEstimatedRotation()
Used for graphics of squid, estimates from speed and starting time where handler is. |
int |
getPosition()
Returns the position where the handler is currently, or where it is heading right now. |
int |
getRotation()
Returns the handler's current rotation, or where it is rotating to right now. |
protected void |
go()
Send handler on move (G). |
boolean |
isMoving()
Tells whether handler is moving right now. |
boolean |
isOK()
Checks if the serial communication channel is open. |
boolean |
isRotating()
Tells whether handler is rotating right now. |
void |
join()
Waits that all commands sent to the Handler have been executed. |
protected void |
moveSteps(int steps,
int velocity)
Commands the holder to move to the specified number of steps. |
void |
moveToBackground()
Commands the holder to move to background position. |
void |
moveToDegausserY()
Commands the holder to move to degauss Y (and X) position. |
void |
moveToDegausserZ()
Commands the holder to move to degauss Z position. |
void |
moveToLeftLimit()
Commands the holder to go to left limit. |
void |
moveToMeasurement()
Commands the holder to move to measure position. |
protected void |
moveToPosition(int position)
Moves the handler to an absolute position. |
void |
moveToRightLimit()
Commands the holder to go to right limit. |
void |
moveToSampleLoad()
Commands the holder to move to sample load position. |
protected void |
performSlew()
Slew the motor up to maximum speed and continue until reaching a hard limit switch or receiving a quit (Q) command. |
void |
rotateTo(int rotationAngle)
Rotates the handler to the specified angle. |
protected void |
seekHome()
Commands the holder to seek home position and rotation. |
protected void |
selectMovement()
Selects the movement motor to recieve all commands. |
protected void |
selectRotation()
Selects the rotation motor to recieve all commands. |
void |
serialIOEvent(SerialIOEvent event)
Propagates serial port message event. |
protected void |
setAcceleration(int acceleration)
Sends message to handler to set acceleration (Aa). |
protected void |
setDeceleration(int deceleration)
Sends message to handler to set deceleration (Dd). |
protected void |
setMotorNegative()
Set the motor direction of movement to negative. (-). |
protected void |
setMotorPositive()
Set the motor direction of movement to positive. (+). |
protected void |
setOnline()
Sends message to handler go online (@0). |
protected void |
setPosition(int position)
Sets the position that we start heading to. |
protected void |
setRotation(int rotationSteps)
Sets the rotation that we start heading to. |
protected void |
setUp()
Starts up the handler and seeks the home position. |
protected void |
setVelocity(int velocity)
Sends message to handler to set maximum velocity (Mv). |
protected void |
slewToLimit(boolean toRight)
|
protected void |
stopExecution()
This command stops execution of the internal program if it is used in the program. |
protected char |
takeMessage()
take the device for any waiting messages such as errors or end of move |
protected void |
updateSettings()
Checks which settings have changed and updates the handler interface. |
protected void |
waitForMessage()
Wait for handler to be idle. |
protected String |
verify(char registry)
Gives result for wanted registery. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private SynchronousQueue<String> answerQueue
private LastExecutor workQueue
private final int POLL_TIMEOUT
protected SerialIO serialIO
private int ACCELERATION
private int DECELERATION
private int VELOCITY
private int MEASUREMENT_VELOCITY
private int SAMPLE_LOAD_POSITION
private int TRANSVERSE_YAF_POSITION
private int AXIAL_AF_POSITION
private int BACKGROUND_POSITION
private int MEASUREMENT_POSITION
private int ROTATION_VELOCITY
private int ROTATION_ACCELERATION
private int ROTATION_DECELERATION
private int HANDLER_ROTATION
private int currentMotor
private int currentPosition
private int currentRotation
private int currentVelocity
private int estimatedPositionStart
private long estimatedPositionStartTime
private int estimatedPositionEnd
private int estimatedRotationStart
private long estimatedRotationStartTime
private int estimatedRotationEnd
private boolean waitingForMessage
Constructor Detail |
---|
protected Handler() throws SerialIOException
SerialIOException
Method Detail |
---|
protected void setUp() throws SerialIOException
SerialIOException
protected void updateSettings()
public boolean isMoving()
public boolean isRotating()
public int getPosition()
public int getRotation()
protected void setPosition(int position)
protected void setRotation(int rotationSteps)
private void fireMovementStopped()
private void fireRotationStopped()
public int getEstimatedPosition()
public int getEstimatedRotation()
public boolean isOK()
protected void seekHome() throws SerialIOException
SerialIOException
public void moveToSampleLoad()
public void moveToDegausserZ()
public void moveToDegausserY()
public void moveToMeasurement()
public void moveToBackground()
public void moveToLeftLimit()
public void moveToRightLimit()
protected void moveToPosition(int position) throws SerialIOException
position
- the position to move to, relative to home. If equal to Integer.MIN_VALUE, will go to left limit.
If equal to Integer.MAX_VALUE, will go to right limit.
SerialIOException
protected void moveSteps(int steps, int velocity) throws SerialIOException
steps
- the number of steps to move to.
IllegalArgumentException
- if steps is not in range -16777215 to 16777215.
SerialIOException
protected void slewToLimit(boolean toRight) throws SerialIOException
SerialIOException
public void rotateTo(int rotationAngle)
rotationAngle
- the angle in degrees to rotate the handler to.public void join() throws InterruptedException
InterruptedException
- if another thread has interrupted the current thread. The interrupted status of the
current thread is cleared when this exception is thrown.protected void setOnline() throws SerialIOException
SerialIOException
protected void selectMovement() throws SerialIOException
SerialIOException
protected void selectRotation() throws SerialIOException
SerialIOException
protected void setAcceleration(int acceleration) throws SerialIOException
acceleration
- Acceleration is a number from 0 to 127
IllegalArgumentException
- if the parameter is not in range.
SerialIOException
protected void setDeceleration(int deceleration) throws SerialIOException
deceleration
- Deceleration is a number from 0 to 127
IllegalArgumentException
- if the parameter is not in range.
SerialIOException
protected void setVelocity(int velocity) throws SerialIOException
velocity
- Velocity range is 50 to 8,500
IllegalArgumentException
- if the parameter is not in range.
SerialIOException
protected void stopExecution() throws SerialIOException
SerialIOException
protected void performSlew() throws SerialIOException
SerialIOException
protected void setMotorPositive() throws SerialIOException
SerialIOException
protected void setMotorNegative() throws SerialIOException
SerialIOException
protected void go() throws SerialIOException
SerialIOException
protected void waitForMessage() throws SerialIOException
SerialIOException
protected String verify(char registry) throws SerialIOException
registry
- A Acceleration SerialIOException
protected char takeMessage() throws SerialIOException
SerialIOException
public void serialIOEvent(SerialIOEvent event)
SerialIOListener
serialIOEvent
in interface SerialIOListener
event
- the event that happened.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |