org.lsst.ccs.subsystems.fcs
Class CarouselSocket
java.lang.Object
java.util.Observable
org.lsst.ccs.framework.Module
org.lsst.ccs.subsystems.fcs.common.MobileItemModule
org.lsst.ccs.subsystems.fcs.CarouselSocket
- All Implemented Interfaces:
- Serializable, Observer, org.lsst.ccs.framework.Configurable
- Direct Known Subclasses:
- SimuCarouselSocket
public class CarouselSocket
- extends MobileItemModule
This is a socket on the carousel : there is 5 sockets on a carousel.
When a filter is on the carousel, it is attached at a socket.
A socket has a clamp on each side :
- clampX- (clampXminus)
- clampX+ (clampXplus)
clampX+ and clampX- are the same except for the method isLocked()
See FilterClampXminusModule and FilterClampXplusModule
The main job of this class CarouselSocket is to synchronize the actions on the 2 clamps.
The state of the CarouselSocket is the state of the clamps when both clamps state are
identical.
To synchonize an action (updateSateWithSensor, unlock or release) on both clamps, we use a CyclicBarrier :
we start 2 threads and they wait for each other action completion with a CyclicBarrier.
During an action on both clamps, we want to lock the CarouselSocket so no other thread can
try to access this object before the completion of action. We do that with a Lock and Condition.
(see java.util.concurrent).
CarouselSocket extends MobileItemModule because we want to lock or release the clamps when the carousel is at standby position
and we want to wait until the action is completed. We know if the action is completed in reading the clamps sensors.
So we use the general mechanism provided by the MobileItemModule.
- Author:
- virieux
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from class org.lsst.ccs.framework.Module |
org.lsst.ccs.framework.Module.ValueUpdate |
| Nested classes/interfaces inherited from interface org.lsst.ccs.framework.Configurable |
org.lsst.ccs.framework.Configurable.Environment |
| Fields inherited from class org.lsst.ccs.framework.Module |
environment, log, name, nObserverThreads, registry, tickMillis |
| Methods inherited from class org.lsst.ccs.framework.Module |
alias, change, checkHardware, dropConfigurationContext, getAvailableCommands, getCheckedValueFromConfiguration, getChildren, getContext, getModule, getName, getNObserverThreads, getObservables, getSubsystem, getTickMillis, init, initModule, listens, newConfigurationContext, notifyChange, notifyChangeWithoutPreliminaryChecks, processUpdate, publishData, publishData, publishData, publishData, publishData, publishData, publishData, register, register, removeLogPanicState, sendToReply, sendToStatus, setBeanName, setContext, setEnvironment, setHandlerLevel, setLogLevel, setName, setNObserverThreads, setObservables, setStateModularSubsystem, setStateModularSubsystem, setTickMillis, shutdownCommand, start, startTicking, tick, update |
CarouselSocket
public CarouselSocket()
CarouselSocket
public CarouselSocket(double position)
- This constructor is for tests.
- Parameters:
position -
getBridge
public BridgeToHardware getBridge()
setBridge
public void setBridge(BridgeToHardware bridge)
getClampXminus
public FilterClampModule getClampXminus()
setClampXminus
public void setClampXminus(FilterClampModule clampXminus)
getClampXplus
public FilterClampModule getClampXplus()
setClampXplus
public void setClampXplus(FilterClampModule clampXplus)
getPosition
public double getPosition()
setPosition
public void setPosition(double position)
getFilter
public Filter getFilter()
setFilter
protected void setFilter(Filter filter)
getStandbyPosition
public double getStandbyPosition()
setStandbyPosition
public void setStandbyPosition(double standbyPosition)
getClampsState
public FcsEnumerations.FilterClampState getClampsState()
updateClampsStateWithSensorsFromSDO
@Deprecated
public void updateClampsStateWithSensorsFromSDO()
throws HardwareException
- Deprecated.
- This method updates the state of the 2 clamps in reading the values sent by the sensors.
The values of the sensors are read clamp by clamp with read SDO commands.
- Throws:
HardwareError
HardwareException
updateClampsStateWithSensors
public void updateClampsStateWithSensors(CanOpenProxy.PDOStorage pdoStorage)
throws HardwareException
- Throws:
HardwareException
updateClampsStateWithSensors
public void updateClampsStateWithSensors()
throws HardwareException,
org.lsst.ccs.bus.BadCommandException
- Throws:
HardwareException
org.lsst.ccs.bus.BadCommandException
isEmpty
public boolean isEmpty()
throws HardwareException
- Throws:
HardwareException
isClampedOnFilter
public boolean isClampedOnFilter()
isUnclampedOnFilter
public boolean isUnclampedOnFilter()
isUnclampedEmpty
public boolean isUnclampedEmpty()
isReadyToClamp
public boolean isReadyToClamp()
releaseClamps
public String releaseClamps()
throws org.lsst.ccs.bus.BadCommandException,
org.lsst.ccs.bus.ErrorInCommandExecutionException,
HardwareException
- Releases the 2 clamps of the socket.
- Throws:
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException
HardwareError
HardwareException
releaseClampsWithThreadSleep
@Deprecated
public String releaseClampsWithThreadSleep()
throws org.lsst.ccs.bus.BadCommandException,
org.lsst.ccs.bus.ErrorInCommandExecutionException,
HardwareException
- Deprecated.
- Releases the 2 clamps of the socket.
- Throws:
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException
HardwareError
HardwareException
unlockClamps
public String unlockClamps()
throws HardwareException,
org.lsst.ccs.bus.BadCommandException,
org.lsst.ccs.bus.ErrorInCommandExecutionException
- This method unclamp the 2 clamps at standby position.
It turn ON the actuators and wait for the end of the unlocking task.
The unlock is completed when the clamps sensors notice that the clamps are UNLOCKED.
So this method reads the sensors with the method updateClampsStateWithSensors until the clamps are UNLOCKED or the
duration of the task is greater than the timeout (timeoutUnlock)
To read the sensors at a regular time schedule we use the ScheduledThreadPoolExecutor (scheduler.scheduleAtFixedRate)
from the java.util.concurrent package.
- Parameters:
bridge - actuatorXminus - actuatorXplus -
- Returns:
- a message for the end user
- Throws:
HardwareError
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException
HardwareException
unlockClampsWithThreadSleep
@Deprecated
public String unlockClampsWithThreadSleep()
throws org.lsst.ccs.bus.BadCommandException,
org.lsst.ccs.bus.ErrorInCommandExecutionException,
HardwareException
- Deprecated.
- Unlock the 2 clamps in the old way : we unlock the clamp one by one,
so the reading of the clamps sensors is not optimized.
- Parameters:
actuatorXminus - actuatorXplus -
- Throws:
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException
HardwareException
removeFilter
public void removeFilter()
throws org.lsst.ccs.bus.BadCommandException
- Software removing
- Throws:
org.lsst.ccs.bus.BadCommandException
putFilterOnSocket
public void putFilterOnSocket(Filter filter)
toString
public String toString()
- Overrides:
toString in class Object
isActionCompleted
public boolean isActionCompleted(FcsEnumerations.MobileItemAction action)
- Specified by:
isActionCompleted in class MobileItemModule
updateStateWithSensorsToCheckIfActionIsCompleted
public void updateStateWithSensorsToCheckIfActionIsCompleted()
throws Exception
- Specified by:
updateStateWithSensorsToCheckIfActionIsCompleted in class MobileItemModule
- Throws:
Exception
startAction
public void startAction(FcsEnumerations.MobileItemAction action)
throws org.lsst.ccs.bus.BadCommandException,
org.lsst.ccs.bus.ErrorInCommandExecutionException,
HardwareException
- Specified by:
startAction in class MobileItemModule
- Throws:
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException
HardwareException
postAction
public void postAction(FcsEnumerations.MobileItemAction action)
throws org.lsst.ccs.bus.BadCommandException,
org.lsst.ccs.bus.ErrorInCommandExecutionException,
HardwareException
- Specified by:
postAction in class MobileItemModule
- Throws:
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException
HardwareException
Copyright © 2013 LSST. All Rights Reserved.