org.lsst.ccs.subsystems.fcs
Class CarouselModule

java.lang.Object
  extended by java.util.Observable
      extended by org.lsst.ccs.framework.Module
          extended by org.lsst.ccs.subsystems.fcs.CarouselModule
All Implemented Interfaces:
Serializable, Observer, Carousel
Direct Known Subclasses:
SftCarouselModule

public class CarouselModule
extends org.lsst.ccs.framework.Module
implements Carousel

This is a representation of the hardware of the carousel. It receives commands from the FCSMAinModule and send back an anknowledge. It publishes data on the status bus. In engineering mode it can receive commands from the engineering console. It has a latch, an engine which are connected to real or simulated hardware.

Author:
virieux
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.lsst.ccs.framework.Module
org.lsst.ccs.framework.Module.ValueUpdate
 
Field Summary
static String publishedByCarouselOutputName
           
 
Fields inherited from class org.lsst.ccs.framework.Module
configMethods, log, name, nObserverThreads, registry, tickMillis
 
Constructor Summary
CarouselModule()
           
 
Method Summary
static double addAngle(double angle1, double angle2)
          Add 2 angles : an angle is a double which value is between -360 and +360
 void engageClampsContact()
          After a rotation, when the carousel is stopped the power contact can be engaged again.
 GenericLatch getBrake()
           
 Motor getCarouselMotor()
           
 Actuator getClampActuatorXminus()
           
 Actuator getClampActuatorXplus()
           
 FilterClampModule getClampXminus()
          This method returns the clampX- which is at standby position.
 FilterClampModule getClampXplus()
          This method returns the clampX+ which is at standby position.
 Filter getFilterAtStandby()
          This methods return the filter which is in the socketAtStandby at standby position.
 String getFilterInStandbyName()
           
 double getFilterPosition(Filter filter)
           
 int getNbSockets()
           
 double getPosition()
          The carousel position measures the rotation angle of the carousel within the fixed part of the camera.
 CarouselSocket getSocketAtStandby()
          This methods returns the socket at standby position or null if there is no socket at standby position.
 int getSocketNumber(Filter filter)
           
 CarouselSocket[] getSockets()
           
 double getStandbyPositionForFilter(Filter filter)
           
 ModuleState getState()
           
 StatusDataPublishedByCarousel getStatusData()
           
 String grabbeFilterAtStandby(Filter filter)
          This method has to be executed when a filter has just been moved on the carousel at standby position by the autochanger.
 String grabbeFilterAtStandby(Object filterName)
           
 void initModule()
           
 boolean isAbleToMove()
          The carousel can be locked by a break or prevented to move by the autochanger fliprail.
 boolean isLocked()
           
 boolean isOnStandby(Filter filter)
           
 boolean isReadyToGrabbeAFilterAtStandby()
          This method let us know if the carousel is ready to receive a filter at standby position : - the carousel must not rotate - an empty socketAtStandby is at standby position.
 boolean isRotating()
           
 String lock()
          Lock the carousel (or engage the break).
protected  String moveFilterToStandby(Filter filter)
          This method rotates the carousel to put the given filter in front of the autochanger (standby position).
 void printSockets()
          Print for every socket on carousel, the name of the filter it contains.
 void processUpdate(Observable source, org.lsst.ccs.framework.Module.ValueUpdate v)
          What to do when the Modules we observe send there new values : we notify our own observers
 String releaseClamps()
          This is a command that can be sent to the carousel.
 void releaseClampsContact()
          Before rotating the carousel we have to release the power contact between the moving part and the fixed part.
 void removeFilterFromCarousel(Filter filter)
           
 String rotate(double angle)
          Rotates carousel for an angle given as a parameter.
 void setBrake(GenericLatch latch)
           
 void setCarouselMotor(Motor engine)
           
 void setClampActuatorXminus(Actuator clampActuator)
           
 void setClampActuatorXplus(Actuator clampActuator)
           
 void setNbSockets(int nbSockets)
           
 void setSockets(CarouselSocket[] sockets)
           
 void setState(ModuleState state)
           
 String stop()
          Stop the carousel if it is rotating.
 void tick()
          What has to be done for each tick of the timer.
 String toString()
           
 void ungrabbeFilterAtStandby(Filter filter)
           
 String unlock()
          Unlock the carousel (or disengage the break)
 String unlockClamps()
           
 String unlockClamps(Filter filter)
           
 
Methods inherited from class org.lsst.ccs.framework.Module
change, checkHardware, dropConfigurationContext, getCheckedValueFromConfiguration, getContext, getModule, getName, getNObserverThreads, getObservables, getSubsystem, getTickMillis, init, listens, newConfigurationContext, notifyChange, notifyChangeWithoutPreliminaryChecks, publishData, publishData, publishData, publishData, register, register, sendToReply, sendToStatus, setBeanName, setContext, setName, setNObserverThreads, setObservables, setStateModularSubsystem, setStateModularSubsystem, setTickMillis, shutdownCommand, shutdownNow, start, startTicking, update
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

publishedByCarouselOutputName

public static String publishedByCarouselOutputName
Constructor Detail

CarouselModule

public CarouselModule()
Method Detail

getSockets

public CarouselSocket[] getSockets()

setSockets

public void setSockets(CarouselSocket[] sockets)

getPosition

public double getPosition()
Description copied from interface: Carousel
The carousel position measures the rotation angle of the carousel within the fixed part of the camera.

Specified by:
getPosition in interface Carousel
Returns:
The position of the carousel in degrees. Its values is greater or equal to 0 and less than 360.

getCarouselMotor

public Motor getCarouselMotor()

setCarouselMotor

public void setCarouselMotor(Motor engine)

getBrake

public GenericLatch getBrake()

setBrake

public void setBrake(GenericLatch latch)

getState

public ModuleState getState()

setState

public void setState(ModuleState state)

getNbSockets

public int getNbSockets()
Returns:
the nbSockets

setNbSockets

public void setNbSockets(int nbSockets)
Parameters:
nbSockets - the nbSockets to set

getClampActuatorXminus

public Actuator getClampActuatorXminus()
Returns:
the clampActuatorXminus

setClampActuatorXminus

public void setClampActuatorXminus(Actuator clampActuator)
Parameters:
clampActuatorXminus - the clampActuatorXminus to set

getClampActuatorXplus

public Actuator getClampActuatorXplus()
Returns:
the clampActuatorXminus

setClampActuatorXplus

public void setClampActuatorXplus(Actuator clampActuator)
Parameters:
clampActuatorXminus - the clampActuatorXminus to set

getClampXminus

public FilterClampModule getClampXminus()
This method returns the clampX- which is at standby position. It can returns null if there is no socketAtStandby halted at standby position.

Returns:

getClampXplus

public FilterClampModule getClampXplus()
This method returns the clampX+ which is at standby position. It can returns null if there is no socketAtStandby halted at standby position.

Returns:

initModule

public void initModule()
Overrides:
initModule in class org.lsst.ccs.framework.Module

getStatusData

public StatusDataPublishedByCarousel getStatusData()

toString

public String toString()
Overrides:
toString in class Object

processUpdate

public void processUpdate(Observable source,
                          org.lsst.ccs.framework.Module.ValueUpdate v)
What to do when the Modules we observe send there new values : we notify our own observers

Overrides:
processUpdate in class org.lsst.ccs.framework.Module

getSocketAtStandby

public CarouselSocket getSocketAtStandby()
Description copied from interface: Carousel
This methods returns the socket at standby position or null if there is no socket at standby position. If the carousel is rotating, it returns null.

Specified by:
getSocketAtStandby in interface Carousel
Returns:
the socket which is at standby position or null if there is no socket at standby position.

getFilterAtStandby

public Filter getFilterAtStandby()
This methods return the filter which is in the socketAtStandby at standby position. When there is no filter at standby position it returns null.

Returns:
filter at standby position or null if there is no filter at standby position.

getFilterInStandbyName

public String getFilterInStandbyName()

isReadyToGrabbeAFilterAtStandby

public boolean isReadyToGrabbeAFilterAtStandby()
                                        throws HardwareErrorDetectedException
This method let us know if the carousel is ready to receive a filter at standby position : - the carousel must not rotate - an empty socketAtStandby is at standby position.

Returns:
true if the position of the carousel matches the position when one of its sockets is at standby position and this socketAtStandby is empty. false
Throws:
HardwareErrorDetectedException

isRotating

public boolean isRotating()

isAbleToMove

public boolean isAbleToMove()
Description copied from interface: Carousel
The carousel can be locked by a break or prevented to move by the autochanger fliprail. The carousel is able to move if no piece of hardware (nor simulated hardware) prevents the carousel to move.

Specified by:
isAbleToMove in interface Carousel
Returns:
true if the carousel is able to move, false if not.

isLocked

public boolean isLocked()

stop

public String stop()
Description copied from interface: Carousel
Stop the carousel if it is rotating.

Specified by:
stop in interface Carousel
Returns:

lock

public String lock()
Description copied from interface: Carousel
Lock the carousel (or engage the break).

Specified by:
lock in interface Carousel
Returns:

unlock

public String unlock()
Description copied from interface: Carousel
Unlock the carousel (or disengage the break)

Specified by:
unlock in interface Carousel
Returns:

rotate

public String rotate(double angle)
              throws IllegalArgumentException,
                     org.lsst.ccs.bus.BadCommandException
Rotates carousel for an angle given as a parameter. This method can be launched by the user from the TestConsole. It checks the value of the rotation angle entered by the user, converts it in a double, and send the result of the method rotate(double angle).

Specified by:
rotate in interface Carousel
Parameters:
angleEntered - : rotation angle The rotation angle can be positive or negative. It must be a double and have a value between -360.0 and 360.0
Returns:
the result of the command rotate(double angle)
Throws:
IllegalArgumentException, - BadCommandException
IllegalArgumentException - if the angle given as parameter is not in the ranges of available values.
org.lsst.ccs.bus.BadCommandException - if the carousel is already rotating or is unable to move.

tick

public void tick()
What has to be done for each tick of the timer. We have to publish on the status bus.

Overrides:
tick in class org.lsst.ccs.framework.Module

removeFilterFromCarousel

public void removeFilterFromCarousel(Filter filter)
                              throws org.lsst.ccs.bus.BadCommandException,
                                     HardwareErrorDetectedException,
                                     org.lsst.ccs.bus.ErrorInCommandExecutionException
Throws:
org.lsst.ccs.bus.BadCommandException
HardwareErrorDetectedException
org.lsst.ccs.bus.ErrorInCommandExecutionException

getFilterPosition

public double getFilterPosition(Filter filter)

getStandbyPositionForFilter

public double getStandbyPositionForFilter(Filter filter)

getSocketNumber

public int getSocketNumber(Filter filter)
Parameters:
filter -
Returns:
the position of the filter in the sockets array I'm not sure this method is useful actually. Only used is FcsMainModule in method printFilters.

moveFilterToStandby

protected String moveFilterToStandby(Filter filter)
                              throws InterruptedException,
                                     org.lsst.ccs.bus.BadCommandException
This method rotates the carousel to put the given filter in front of the autochanger (standby position). This method can't be launched by the user from the console. It computes the shortest way for the carousel. So the running way can be positive or negative. This could be more complicated if the carousel was not able to rotate more than TBD turns in one way.

Throws:
org.lsst.ccs.bus.BadCommandException
InterruptedException

printSockets

public void printSockets()
Print for every socket on carousel, the name of the filter it contains.


grabbeFilterAtStandby

public String grabbeFilterAtStandby(Object filterName)
                             throws org.lsst.ccs.bus.BadCommandException,
                                    org.lsst.ccs.bus.ErrorInCommandExecutionException,
                                    HardwareErrorDetectedException
Throws:
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException
HardwareErrorDetectedException

grabbeFilterAtStandby

public String grabbeFilterAtStandby(Filter filter)
                             throws org.lsst.ccs.bus.BadCommandException,
                                    org.lsst.ccs.bus.ErrorInCommandExecutionException,
                                    HardwareErrorDetectedException
This method has to be executed when a filter has just been moved on the carousel at standby position by the autochanger. It updates the carousel socketAtStandby at standby or throw an exception. This method tests if the clamps are locked on a filter at standby position The clamps lock automaticaly, and the filter presence sensor tells us if the filter is here or not. If the clamps are locked on a filter at standby position, this method updates the socketAtStandby at standby position : it puts the filter on the socketAtStandby.

Parameters:
filter -
Returns:
Throws:
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException
HardwareErrorDetectedException

ungrabbeFilterAtStandby

public void ungrabbeFilterAtStandby(Filter filter)
                             throws org.lsst.ccs.bus.BadCommandException,
                                    org.lsst.ccs.bus.ErrorInCommandExecutionException,
                                    HardwareErrorDetectedException
Throws:
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException
HardwareErrorDetectedException

releaseClamps

public String releaseClamps()
                     throws org.lsst.ccs.bus.BadCommandException,
                            org.lsst.ccs.bus.ErrorInCommandExecutionException
Description copied from interface: Carousel
This is a command that can be sent to the carousel. It releases (unlock it) the clamps at standby position. (when a clamp is released, it can be locked automaticaly when a filter comes in the socket)

Specified by:
releaseClamps in interface Carousel
Returns:
Throws:
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException

unlockClamps

public String unlockClamps(Filter filter)
                    throws org.lsst.ccs.bus.BadCommandException,
                           org.lsst.ccs.bus.ErrorInCommandExecutionException,
                           HardwareErrorDetectedException
Specified by:
unlockClamps in interface Carousel
Throws:
org.lsst.ccs.bus.BadCommandException
org.lsst.ccs.bus.ErrorInCommandExecutionException
HardwareErrorDetectedException

unlockClamps

public String unlockClamps()
                    throws org.lsst.ccs.bus.BadCommandException,
                           HardwareErrorDetectedException,
                           org.lsst.ccs.bus.ErrorInCommandExecutionException
Throws:
org.lsst.ccs.bus.BadCommandException
HardwareErrorDetectedException
org.lsst.ccs.bus.ErrorInCommandExecutionException

isOnStandby

public boolean isOnStandby(Filter filter)

addAngle

public static double addAngle(double angle1,
                              double angle2)
Add 2 angles : an angle is a double which value is between -360 and +360

Parameters:
angle1 -
angle2 -
Returns:
result of the angles addition. Always > 0

releaseClampsContact

public void releaseClampsContact()
Description copied from interface: Carousel
Before rotating the carousel we have to release the power contact between the moving part and the fixed part.

Specified by:
releaseClampsContact in interface Carousel

engageClampsContact

public void engageClampsContact()
Description copied from interface: Carousel
After a rotation, when the carousel is stopped the power contact can be engaged again.

Specified by:
engageClampsContact in interface Carousel


Copyright © 2012 LSST. All Rights Reserved.