Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Some properties are known in advance and will not change at run-time. Examples are positionUnits, or resolutionBest. These properties are implemented as regular (non-Dependent) properties, and are given default values directly in the properties block. In some cases, it may make sense to allow these properties to be optionally constructor-initialized, eg if their value depends on a firmware version which can vary from device to device. For the MP285, the positionUnits falls into this "set-it-and-forget-it" category.
  • Some properties do change at runtime, and involve read-only queries to the hardware. An example is positionAbsoluteRaw. These properties are implemented as Dependent properties, with get-methods that send the appropriate query commands to the hardware.
  • Some properties not only change at runtime, but can be set to new values, as well as queried. An example of such a property is velocity, implemented as a Dependent property with both a set-method and a get-method. The set-method sends the appropriate set-command (and value-to-be-set) to the hardware to set the value on the device.

...

At the current time, the abstract properties required for ScanImage operation are:

  1. nonblockingMoveCompletedDetectionStrategy
  2. positionAbsoluteRaw (get only)
  3. isMoving (get only)
  4. positionDeviceUnits (get only)
  5. resolution (get only)
  • accelerationRaw, for example, does not apply to the MP285. To make MP285 a concrete class, {{accelerationRaw]} must be defined somewhere in a properties block; however, for the MP285, the property doesn't do anything (its get-method always returns NaN, and there is no set-method).

Your device may similarly "omit" inapplicable properties. Note however that the ScanImage application will expect certain properties to be preset and working. See #Minimal LSC Implementation for ScanImage belowIn the case where you want to do the least possible to get ScanImage up and running, the other properties can be "left blank" (eg implemented with empty values).

  • The MP285 has two "resolutionModes", 'fine' and 'coarse'. Each mode has its own velocity setting, so that the resolutionMode is queried when setting/getting the velocity property. The details related to resolutionMode are specific to MP285 and may not apply to your device; however they do illustrate the general pattern of having more than one mode.
  • The MP285 is a serial port device, and the MP285 class subclasses from LSCSerial. To implement its send/receive commands, it uses the LSCSerial property , which holds an hRS232 object. This object adds some convenience functionality to the MATLAB serial object. See the documentation for Dabsdabs.Devices.Interfacesinterfaces.RS232DeviceBasic for details.

...

LSC has a number of other methods with Hook in their names, such as moveCompleteHook, interruptMoveHook, etc. Concrete subclasses are encouraged to override these methods whenever possible. The default implementation of interruptMoveHook, for example, simply throws an error indicating that move-interruption is not supported. LSC subclasses representing stages that can be interrupted during moves should implement an override for this method to enable such interruption.

Minimal LSC Implementation for ScanImage

At the current time, the abstract properties required for ScanImage operation are:

  1. nonblockingMoveCompletedDetectionStrategy
  2. positionAbsoluteRaw (get only)
  3. isMoving (get only)
  4. positionDeviceUnits (get only)
  5. resolution (get only)

In the case where you want to do the least possible to get ScanImage up and running, the other properties can be "left blank" (eg implemented with empty values).

Testing

When your subclass is complete, it is critical to test its operation with real hardware in a "safe" setting before live use. Implementing an LSC subclass involves a fair amount of complexity and some amount of testing/debugging time will likely be necessary to ensure reliable operation. Using an LSC without proper testing could lead to wild stage moves and damage to your rig.