public class StateMachine extends Object implements org.lsst.ccs.framework.HasLifecycle, Events
PhysicalState and SoftwareState.
Subsystem components wishing to submit events to the state machine do so by calling one of
the event methods in this object. Each event is accompanied by a
Channel<EventReply> which the state machine uses to send event accept/reject notices back to the
submitter.
PhysicalState,
SoftwareState| Constructor and Description |
|---|
StateMachine()
Creates the state machine, event queue and scheduler.
|
| Modifier and Type | Method and Description |
|---|---|
void |
calibDone(Channel<EventReply> replyChan,
CalibDone calibResults)
Indicates that a Hall calibration operation has been successful.
|
void |
calibrate(Channel<EventReply> replyChan,
Calibrate calibParams)
Requests a Hall calibration.
|
void |
changeAxisEnable(Channel<EventReply> replyChan,
org.lsst.ccs.subsystem.motorplatform.bus.ChangeAxisEnable req)
Requests that the enable state of the given axis be changed.
|
void |
changeBrakeState(Channel<EventReply> replyChan,
Axis ax,
ChangeBrakeState.State newState)
Requests that the brake state on a given axis be changed.
|
void |
clearAllFaults(Channel<EventReply> replyChan,
org.lsst.ccs.subsystem.motorplatform.bus.ClearAllFaults req)
Requests that fault conditions be cleared for both axes.
|
void |
clearAxisFaults(Channel<EventReply> replyChan,
org.lsst.ccs.subsystem.motorplatform.bus.ClearAxisFaults req)
Requests that fault conditions be cleared for the given axis.
|
void |
closeShutter(Channel<EventReply> replyChan)
Requests that a closing of the shutter be started.
|
void |
contactLost(Channel<EventReply> replyChan)
Indicates that the subsystem can't communicate properly with the shutter PLC.
|
void |
disable(Channel<EventReply> replyChan)
Indicates that the shutter hardware protection is forbidding shutter operation.
|
void |
disableAllAxes(Channel<EventReply> replyChan,
org.lsst.ccs.subsystem.motorplatform.bus.DisableAllAxes req)
Requests that both axes be disabled.
|
void |
enable(Channel<EventReply> replyChan)
Indicates that the shutter hardware protection is is allowing shutter operation.
|
void |
enableAllAxes(Channel<EventReply> replyChan,
org.lsst.ccs.subsystem.motorplatform.bus.EnableAllAxes req)
Requests that both axes be enabled.
|
void |
error(Channel<EventReply> replyChan,
Error err)
Indicates that the shutter tried and failed to carry out a requested operation.
|
Actions |
getActions()
Gets the
Actions implementation being used by the state machine. |
void |
gotoCenter(Channel<EventReply> replyChan)
Requests that the shutter prepare for power-down by placing both blade sets in the center
position.
|
void |
gotoProd(Channel<EventReply> replyChan)
Requests that the shutter, if it's ready to do so, accept subsequent requests to take exposures.
|
void |
homeAxis(Channel<EventReply> replyChan,
org.lsst.ccs.subsystem.motorplatform.bus.HomeAxis req)
Requests that the shutter perform a homing operation for the given axis.
|
void |
ignored(Channel<EventReply> replyChan,
Ignored.Reason reason)
Indicates that the shutter PLC state machine has ignored an event sent to it.
|
void |
init()
Registers the shutter physical-state and software-state bundles and sets their initial values to
OTHER and SYNCHRONIZING, respectively. |
void |
motionDone(Channel<EventReply> replyChan,
MotionDonePLC profileData)
Indicates that a blade set has successfully completed a motion.
|
void |
moveAxisAbsolute(Channel<EventReply> replyChan,
org.lsst.ccs.subsystem.motorplatform.bus.MoveAxisAbsolute req)
Requests that the given axis be moved to a given absolute position.
|
void |
moveAxisRelative(Channel<EventReply> replyChan,
org.lsst.ccs.subsystem.motorplatform.bus.MoveAxisRelative req)
Requests that an axis change its position by a certain offset.
|
void |
openShutter(Channel<EventReply> replyChan)
Requests that an opening of the shutter be started.
|
void |
plcIsDisabled(Channel<EventReply> replyChan)
Indicates that shutter controller has sent a status message in which the reported state
is Enabled.
|
void |
plcIsEnabled(Channel<EventReply> replyChan)
Indicates that the shutter controller has sent a status message in which reported
state is Disabled.
|
void |
postStart()
Creates the actual state machine and starts the task that manages event submission.
|
void |
reset(Channel<EventReply> replyChan)
Requests that the shutter controller stop any motion in progress and
reset its state machine to one of its initial states.
|
void |
resync(Channel<EventReply> replyChan)
Triggers another attempt to synchronize states with the PLC.
|
void |
shutdown() |
void |
syncTimeout(Channel<EventReply> replyChan)
Indicates that after a reset the PLC has taken too long to reach one of
the designated after-reset states.
|
void |
takeExposure(Channel<EventReply> replyChan,
Duration exposureTime)
Requests that an exposure of the given duration be started.
|
void |
timer(Channel<EventReply> replyChan)
Indicates that an exposure in progress has run for its allotted time.
|
void |
toggleSafetyCheck(Channel<EventReply> replyChan)
Reverses the current setting of the PLC safety check flag, true->false, false->true.
|
public StateMachine()
public void init()
OTHER and SYNCHRONIZING, respectively.init in interface org.lsst.ccs.framework.HasLifecyclePhysicalStatepublic void postStart()
Actions used by the state
machine is for real or simulated hardware.postStart in interface org.lsst.ccs.framework.HasLifecyclepublic Actions getActions()
Actions implementation being used by the state machine.public void shutdown()
shutdown in interface org.lsst.ccs.framework.HasLifecyclepublic void contactLost(Channel<EventReply> replyChan) throws InterruptedException
EventscontactLost in interface EventsreplyChan - The channel used to deliver the event reply.InterruptedException - if inter-task communication is interrupted.public void plcIsEnabled(Channel<EventReply> replyChan) throws InterruptedException
Eventsenable()
and disable() event messages sent from the controller.plcIsEnabled in interface EventsreplyChan - The channel used to deliver the event reply.InterruptedException - if inter-task communication is interrupted.public void plcIsDisabled(Channel<EventReply> replyChan) throws InterruptedException
Eventsenable()
and disable() event messages sent from the controller.plcIsDisabled in interface EventsreplyChan - The channel used to deliver the event reply.InterruptedException - if inter-task communication is interrupted.public void resync(Channel<EventReply> replyChan) throws InterruptedException
Eventsresync in interface EventsreplyChan - The channel used to deliver the event reply.InterruptedException - if inter-task communication is interrupted.public void syncTimeout(Channel<EventReply> replyChan) throws InterruptedException
EventssyncTimeout in interface EventsreplyChan - The channel used to deliver the event reply.InterruptedException - if inter-task communication is interrupted.public void enable(Channel<EventReply> replyChan) throws InterruptedException
Eventsenable in interface EventsreplyChan - The channel used to deliver the event reply.InterruptedException - if inter-task communication is interrupted.public void disable(Channel<EventReply> replyChan) throws InterruptedException
Eventsdisable in interface EventsreplyChan - The channel used to deliver the event reply.InterruptedException - if inter-task communication is interrupted.public void motionDone(Channel<EventReply> replyChan, MotionDonePLC profileData) throws InterruptedException
EventsmotionDone in interface EventsreplyChan - The channel used to deliver the event reply.profileData - The motion profile.InterruptedException - if inter-task communication is interrupted.public void calibrate(Channel<EventReply> replyChan, Calibrate calibParams) throws InterruptedException
Eventscalibrate in interface EventsreplyChan - The channel used to deliver the event reply.calibParams - The calibration parameters. If null the event is rejected.InterruptedException - if inter-task communication is interrupted.public void toggleSafetyCheck(Channel<EventReply> replyChan) throws InterruptedException
EventstoggleSafetyCheck in interface EventsreplyChan - The channel used to deliver the event reply.InterruptedException - if inter-task communication is interrupted.public void calibDone(Channel<EventReply> replyChan, CalibDone calibResults) throws InterruptedException
EventscalibDone in interface EventsreplyChan - The channel used to deliver the event reply.calibResults - The results of the calibration.InterruptedException - if inter-task communication is interrupted.public void error(Channel<EventReply> replyChan, Error err) throws InterruptedException
Eventserror in interface EventsreplyChan - The channel used to deliver the event reply.err - The error message received from the shutter.InterruptedException - if inter-task communication is interrupted.public void reset(Channel<EventReply> replyChan) throws InterruptedException
Eventsreset in interface EventsreplyChan - The channel used to deliver the event reply.InterruptedException - if inter-task communication is interrupted.public void takeExposure(Channel<EventReply> replyChan, Duration exposureTime) throws InterruptedException
EventstakeExposure in interface EventsreplyChan - The channel used to deliver the event reply.exposureTime - The length of the exposure. If null or too short a duration the
event is rejected.InterruptedException - if inter-task communication is interrupted.public void openShutter(Channel<EventReply> replyChan) throws InterruptedException
EventsopenShutter in interface EventsreplyChan - The channel used to deliver the event reply.InterruptedException - if inter-task communication is interrupted.public void timer(Channel<EventReply> replyChan) throws InterruptedException
Eventstimer in interface EventsreplyChan - The channel used to deliver the event reply.InterruptedException - if inter-task communication is interrupted.public void closeShutter(Channel<EventReply> replyChan) throws InterruptedException
EventscloseShutter in interface EventsreplyChan - The channel used to deliver the event reply.InterruptedException - if inter-task communication is interrupted.public void ignored(Channel<EventReply> replyChan, Ignored.Reason reason) throws InterruptedException
Eventsignored in interface EventsreplyChan - The channel used to deliver the event reply.reason - The reason why the event was rejected.InterruptedException - if inter-task communication is interrupted.public void gotoProd(Channel<EventReply> replyChan) throws InterruptedException
EventsgotoProd in interface EventsreplyChan - The channel used to deliver the event reply.InterruptedException - if inter-task communication is interrupted.public void gotoCenter(Channel<EventReply> replyChan) throws InterruptedException
EventsgotoCenter in interface EventsreplyChan - The channel used to deliver the event reply.InterruptedException - if inter-task communication is interrupted.public void moveAxisAbsolute(Channel<EventReply> replyChan, org.lsst.ccs.subsystem.motorplatform.bus.MoveAxisAbsolute req) throws InterruptedException
EventsmoveAxisAbsolute in interface EventsreplyChan - The channel used to deliver the event reply.req - Contains the request parameters. If null then the event is rejected.InterruptedException - if inter-task communication is interrupted.public void moveAxisRelative(Channel<EventReply> replyChan, org.lsst.ccs.subsystem.motorplatform.bus.MoveAxisRelative req) throws InterruptedException
EventsmoveAxisRelative in interface EventsreplyChan - The channel used to deliver the event reply.req - Contains the request parameters. If null then event is rejected.InterruptedException - if inter-task communication is interrupted.public void clearAllFaults(Channel<EventReply> replyChan, org.lsst.ccs.subsystem.motorplatform.bus.ClearAllFaults req) throws InterruptedException
EventsclearAllFaults in interface EventsreplyChan - The channel used to deliver the event reply.req - Contains the request parameters. If null then the event is rejected.InterruptedException - if inter-task communication is interrupted.public void changeAxisEnable(Channel<EventReply> replyChan, org.lsst.ccs.subsystem.motorplatform.bus.ChangeAxisEnable req) throws InterruptedException
EventschangeAxisEnable in interface EventsreplyChan - The channel used to deliver the event reply.req - Contains the request parameters. If null then the event is rejected.InterruptedException - if inter-task communication is interrupted.public void changeBrakeState(Channel<EventReply> replyChan, Axis ax, ChangeBrakeState.State newState) throws InterruptedException
EventschangeBrakeState in interface EventsreplyChan - The channel used to deliver the event reply.ax - The PLC task axis to affect.newState - The desired brake state.InterruptedException - if inter-task communication is interrupted.public void clearAxisFaults(Channel<EventReply> replyChan, org.lsst.ccs.subsystem.motorplatform.bus.ClearAxisFaults req) throws InterruptedException
EventsclearAxisFaults in interface EventsreplyChan - The channel used to deliver the event reply.req - Contains the request parameters. If null then the event is rejected.InterruptedException - if inter-task communication is interrupted.public void enableAllAxes(Channel<EventReply> replyChan, org.lsst.ccs.subsystem.motorplatform.bus.EnableAllAxes req) throws InterruptedException
EventsenableAllAxes in interface EventsreplyChan - The channel used to deliver the event reply.req - Contains the request parameters. If null then event is rejected.InterruptedException - if inter-task communication is interrupted.public void disableAllAxes(Channel<EventReply> replyChan, org.lsst.ccs.subsystem.motorplatform.bus.DisableAllAxes req) throws InterruptedException
EventsdisableAllAxes in interface EventsreplyChan - The channel used to deliver the event reply.req - Contains the request parameters. If null then the event is rejected.InterruptedException - if inter-task communication is interrupted.public void homeAxis(Channel<EventReply> replyChan, org.lsst.ccs.subsystem.motorplatform.bus.HomeAxis req) throws InterruptedException
EventshomeAxis in interface EventsreplyChan - The channel used to deliver the event reply.req - Contains the request parameters. If null then the event is rejected.InterruptedException - if inter-task communication is interrupted.Copyright © 2022 LSST. All rights reserved.