_images/Bug72.jpg

IFocuserV4 Interface

class Focuser

Bases: ASCOM.DeviceInterface

ASCOM Standard IFocuser V4 Interface

Methods

Focuser.Action(ActionName: str, ActionParameters)

Added in version 2: Recommended over (now) deprecated CommandBlind(), CommandBool(), and CommandString() as more flexible extension mechanic.

Invoke the specified device-specific custom action

Parameters:
  • ActionName (str) – A name from SupportedActions that represents the action to be carried out.

  • ActionParameters (str) – List of required arguments or empty string if none are required.

Returns:

Action response. The meaning of returned strings is set by the driver author. See notes below.

Return type:

string

Raises:

Important

Note

  • Action names must be case insensitive, so for example SelectWheel, selectwheel and SELECTWHEEL all refer to the same action.

  • An example of a string response: Suppose filter wheels start to appear with automatic wheel changers; new actions could be QueryWheels and SelectWheel. The former returning a formatted list of wheel names and the second taking a wheel name and making the change, returning appropriate values to indicate success or failure.

Focuser.CommandBlind(Command: str, Raw: bool)

Added in version 2: Member added as part of common interface elements.

Deprecated since version 4: Use the more flexible Action() and SupportedActions mechanic. See Notes below.

Transmit an arbitrary string to the device and does not wait for a response.

Parameters:
  • Command (str) – The literal command string to be transmitted.

  • Raw (bool) – If True, command is transmitted ‘as-is’. If False, then protocol framing characters may be added prior to transmission.

Returns:

Nothing

Raises:
  • MethodNotImplementedException – If the method is not implemented

  • NotConnectedException – If the device is not connected

  • DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes communication errors.

Attention

Deprecated, may result in MethodNotImplementedException

Note

The CommandXXX methods are a historic mechanic that provides clients with direct and unimpeded access to change device hardware configuration. While highly enabling for clients, this mechanic is inherently risky because clients can fundamentally change hardware operation without the driver being aware that a change is taking / has taken place.

The newer Action and SupportedActions mechanic provides discrete, named, functions that can deliver any functionality required.They do need driver authors to make provision for them within the driver, but this approach is much lower risk than using the CommandXXX methods because it enables the driver to resolve conflicts between standard device interface commands and extended commandsprovided as Actions.The driver is always aware of what is happening and can adapt more effectively to client needs.

Focuser.CommandBool(Command: str, Raw: bool)

Added in version 2: Member added as part of common interface elements.

Deprecated since version 4: Use the more flexible Action() and SupportedActions mechanic. See Notes below.

Transmit an arbitrary string to the device and wait for a boolean response.

Parameters:
  • Command (str) – The literal command string to be transmitted.

  • Raw (bool) – If True, command is transmitted ‘as-is’. If False, then protocol framing characters may be added prior to transmission.

Returns:

True/False response from the command

Return type:

boolean

Raises:
  • MethodNotImplementedException – If the method is not implemented

  • NotConnectedException – If the device is not connected

  • DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes communication errors.

Attention

Deprecated, may result in MethodNotImplementedException

Note

The CommandXXX methods are a historic mechanic that provides clients with direct and unimpeded access to change device hardware configuration. While highly enabling for clients, this mechanic is inherently risky because clients can fundamentally change hardware operation without the driver being aware that a change is taking / has taken place.

The newer Action and SupportedActions mechanic provides discrete, named, functions that can deliver any functionality required.They do need driver authors to make provision for them within the driver, but this approach is much lower risk than using the CommandXXX methods because it enables the driver to resolve conflicts between standard device interface commands and extended commandsprovided as Actions.The driver is always aware of what is happening and can adapt more effectively to client needs.

Focuser.CommandString(Command: str, Raw: bool)

Added in version 2: Member added as part of common interface elements.

Deprecated since version 4: Use the more flexible Action() and SupportedActions mechanic. See Notes below.

Transmit an arbitrary string to the device and wait for a string response.

Parameters:
  • Command (str) – The literal command string to be transmitted.

  • Raw (bool) – If True, command is transmitted ‘as-is’. If False, then protocol framing characters may be added prior to transmission.

Returns:

String response from the command

Return type:

string

Raises:
  • MethodNotImplementedException – If the method is not implemented

  • NotConnectedException – If the device is not connected

  • DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes communication errors.

Attention

Deprecated, may result in MethodNotImplementedException

Note

The CommandXXX methods are a historic mechanic that provides clients with direct and unimpeded access to change device hardware configuration. While highly enabling for clients, this mechanic is inherently risky because clients can fundamentally change hardware operation without the driver being aware that a change is taking / has taken place.

The newer Action and SupportedActions mechanic provides discrete, named, functions that can deliver any functionality required.They do need driver authors to make provision for them within the driver, but this approach is much lower risk than using the CommandXXX methods because it enables the driver to resolve conflicts between standard device interface commands and extended commandsprovided as Actions.The driver is always aware of what is happening and can adapt more effectively to client needs.

async Focuser.Connect()

Added in version 4: Preferred asynchronous connection mechanic. See Important section below.

Connect to the device asynchronously. Use this to connect to a device rather than setting Connected to True.

Returns:

Nothing

Raises:

DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes communication errors.

Important

  • Non-Blocking. On return, Connecting must be True unless already connected. Connection has successfully completed when Connecting becomes (or is) False.

  • This is a mandatory method and must not throw a MethodNotConnectedException.

  • Use this to connect to a device rather than setting Link to True.

async Focuser.Disconnect()

Added in version 4: Preferred asynchronous connection mechanic. See Important section below.

Disconnect from the device asynchronously. Use this to disconnect from a device rather than setting Connected to False.

Returns:

Nothing

Raises:

DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes communication errors.

Important

  • Non-Blocking. On return, Connecting must be True unless already disconnected. Disconnect has successfully completed when Connecting becomes (or is) False.

  • This is a mandatory method and must not throw a MethodNotImplementedException.

  • Use this to disconnect from a device rather than setting Connected to False.

Focuser.Halt()

Immediately stop any focuser motion due to a previous Move() call.

Raises:
  • MethodNotImplementedException – The focuser cannot be programmatically halted.

  • NotConnectedException – If the device is not connected

  • DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes communication errors.

Note

  • This method must be short-lived; it is defined as synchronous in this specification.

  • Some focusers may not support this function, in which case a MethodNotImplemented exception must be raised.

  • Recommendation: Host software should call this method upon initialization and, if it fails, disable the Halt button in the user interface.

async Focuser.Move(Position: int)

Changed in version 3: Exception conditions - See Historical Notes below

Starts moving the focuser by the specified amount or to the specified position depending on the value of the Absolute property.

Non-blocking: Returns immediately after successfully starting the focus change with IsMoving = True. See Notes.

See Notes for details on absolute versus relative focusers

Parameters:

Position (int) – Step distance or absolute position, depending on the value of the Absolute property. See notes.

Raises:
  • InvalidValueException – If Position would result in a movement beyond MaxStep or otherwise out of range for the focuser.

  • InvalidOperationExceptionIFocuserV2 and earlier only Raised if ~Focuser.TempComp is True and a Move() is attempted. This restriction was removed in IFocuserV3, but you must be prepared to catch this for older focusers (2018). See the historical info below.

  • NotConnectedException – If the device is not connected

  • DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes communication errors.

Attention

Must be implemented.

Note

  • Asynchronous (non-blocking): The method returns as soon as the focus change operation has been successfully started, with the IsMoving property = True. After the requested position is successfully reached and motion stops, the IsMoving property becomes False.

  • If the Absolute property is True, then this is an absolute positioning focuser. The Move() method must cause the focuser to move to an exact step position, and the Position parameter of the Move() method must be an integer between 0 and MaxStep.

  • If the Absolute property is False, then this is a relative positioning focuser. The Move() method must cause the focuser to move in a relative direction. The Position parameter of the Move() method is actually a step distance and is an integer between minus MaxIncrement and plus MaxIncrement.

Recommendation

There is no common agreement among optical engineers as to the meaning of positive versus negative motion of a focuser. It is recommended, therefore, that a focuser have reversal setting that may be used to accommodate applications that are hard-wired to assume one or the other direction. In addition, it is recommended that auto-focus applications provide a reversal option as well.

Historical Notes

Prior to Platform 6.4, the interface specification mandated that drivers must throw an InvalidOperationException if a move was attempted when TempComp was True, even if the focuserwas able to execute the move safely without disrupting temperature compensation.

Following discussion on ASCOM-Talk in January 2018, the Focuser interface specification has been revised to IFocuserV3, removing the requrement to throw an InvalidOperationException. IFocuserV3 compliant drivers are expected to execute Move requests when temperature compensation is active and to hide any specific actions required by the hardware from the client. For example this could be achieved by disabling temperature compensation, m oving the focuser and re-enablingtemperature compensation or simply by moving t he focuser with compensation enabled if the hardware supports this.

Conform will continue to pass IFocuserV2 drivers that throw InvalidOperationException. However, Conform will now fail IFocuserV3 and later drivers that throw InvalidOperationException, in line with this revised specification… _Focuser.SetupDialog:

Focuser.SetupDialog()

Launches a configuration dialogue box for the driver. The call will not return until the user clicks OK or cancels manually.

Please note that this method is only valid for COM drivers. Alpaca devices should provide configuration through the Alpaca HTML endpoints and should not implement a SetupDialog endpoint.

Returns:

Nothing

Raises:

DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes communication errors.

Attention

Must be implemented, must not throw a MethodNotImplementedException

Note

  • Blocking It is permissible that the configuration dialog is modal, and for the driver not to respond to other calls while this dialog is open.

Properties

property Focuser.Absolute: boolean

Changed in version 4: Writing to change connection state superseded by asynchronous Connect(), Disconnect(), and Connecting.

Returns:

The focuser does absolute positioning. See the details in the documentation for the Move() method.

Return type:

boolean

Raises:
  • NotConnectedException – If the device is not connected

  • DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes communication errors.

Attention

Must be implemented.

Note

True means the focuser is capable of absolute position; that is, being commanded to a specific step location. False means this is a relative positioning focuser. See the details in the documentation for the Move() method.

property Focuser.Connected: boolean

Added in version 2: Supersedes Link(). See Historical Note below

Changed in version 4: Writing to change connection state superseded by asynchronous Connect(), Disconnect(), and Connecting.

(Read/Write) Retrieve or set the connected state of the device. Writing is deprecated, use the newer Connect() and Disconnect() methods, and the newer Connecting property. See remarks below.

Set True to connect to the device hardware. Set False to disconnect from the device hardware. You can also read the property to check whether it is connected. This reports the current hardware state. See Notes below.

Returns:

True if connected to the hardware, else false.

Return type:

boolean

Raises:

DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes communication errors.

Important

Property-write deprecated as of FocuserV4. Starting with Platform 7 and the interface revisions contained therein, writing to Connected is discouraged. To connect and disconnect, use the newer Connect() and Disconnect() methods.

Attention

Must be implemented

Note

  • Do not use a NotConnectedException here, that exception is for use in other methods that require a connection in order to succeed.

  • The Connected property sets and reports the state of connection to the device hardware. For a hub this means that Connected will be True when the first driver connects and will only be set to False when all drivers have disconnected. A second driver may find that Connected is already True and setting Connected to False does not report Connected as False. This is not an error because the physical state is that the hardware connection is still True.

  • Multiple calls setting Connected to True or False must not cause an error.

Historical Note

In previous versions of this specification the property Link was used to both set and retrieve the connected state, similar to the Connected property in other devices. This Connected property is not implemented in Version 1 drivers; these use the Link property and will raise a PropertyNotImplementedException exception for this property. Version 2 drivers must implement both Connected and Link. Applications should check that InterfaceVersion returns 2 or more before using Connected.

property Focuser.Connecting: Boolean

Added in version 4: Preferred asynchronous connection mechanic. See Notes below.

Returns:

Returns True while the device is undertaking an asynchronous connect or disconnect operation.

Return type:

boolean

Raises:

DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes communication errors.

Attention

Must be implemented, must not throw a class:PropertyNotImplementedException

Note

  • This is the correct property for determing when the non-blocking methods Connect() or Disconnect() have completed. Completion is when Connecting becomes False after calling either of these methods.

property Focuser.Description: String

Added in version 2: Member added.

Returns:

Description of the device such as manufacturer and model number. Any ASCII characters may be used.

Return type:

string

Raises:
  • NotConnectedException – If the device is not connected

  • DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes communication errors.

Attention

Must be implemented, must not throw a PropertyNotImplementedException

Note

  • This describes the device, not the driver. See the DriverInfo property for information on the ASCOM driver.

  • The description length must be a maximum of 64 characters so that it can be used in FITS image headers, which are limited to 80 characters including the header name.

property Focuser.DeviceState: List[StateValue]

Added in version 4: To allow reduction of status polling

Returns:

List of StateValue objects representing the operational properties of this device. See What is the “read all” feature and what are its rules?.

Return type:

List

This device must return the following operational properties if they are known:
property Focuser.DriverInfo: String

Added in version 2: Member added.

Returns:

Descriptive and version information about the ASCOM driver

Return type:

string

Raises:

DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes communication errors.

Attention

Must be implemented, must not throw a PropertyNotImplementedException

Note

This string may contain line endings and may be hundreds to thousands of characters long.It is intended to display detailed information on the ASCOM driver, including version and copyright data. See the Description property for information on the device itself.To get the driver version in a parse-able string, use the DriverVersion property.

property Focuser.DriverVersion: String

Added in version 2: Member added.

Returns:

String containing only the major and minor version of the driver.

Return type:

string

Raises:

DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes communication errors.

Attention

Must be implemented, must not throw a PropertyNotImplementedException

Note

  • This must be in the form “n.n”. It should not to be confused with the InterfaceVersion property, which is the version of this specification supported by the driver.

  • On systems with a comma as the decimal point you may need to make accommodations to parse the value.

property Focuser.InterfaceVersion: Short

Added in version 2: Member added.

Returns:

ASCOM Device interface definition version that this device supports. Should return 4 for this interface version.

Return type:

short

Raises:

DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes communication errors.

Attention

Must be implemented, must not throw a PropertyNotImplementedException

Note

  • This is a single “short” integer indicating the version of this specific ASCOM universal interface definition. For IFocuserV4, this must be 4. It should not to be confused with the DriverVersion property, which is the major.minor version of the driver for this device.

  • Clients can detect legacy V1 drivers by trying to read this property. If the driver raises an error, it is a V1 driver. V1 did not specify this property. A driver may also return a value of 1.In other words, a raised error or a return value of 1 indicates that the driver is a V1 driver.

property Focuser.IsMoving: boolean
Returns:

The focuser is currently moving to a new position

Return type:

boolean

Raises:
  • NotConnectedException – If the device is not connected

  • DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes communication errors.

Attention

Must be implmented.

Note

This is the correct property to use to determine successful completion of a (non-blocking) Move() request. IsMoving must be True upon returning from a Move() call (unless the focuser is already at the requested position), and must remain True until successful completion, at which time IsMoving will become False.

property Focuser.MaxIncrement: integer
Returns:

Maximum number of steps allowed in one Move() operation.

Return type:

integer

Raises:
  • NotConnectedException – If the device is not connected

  • DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes hardware or communication errors.

Attention

Must be implemented, must not throw a PropertyNotImplementedException.

Note

For most focusers this is the same as the MaxStep property. This is normally used to limit the increment display in the host software.

property Focuser.MaxStep: integer
Returns:

Maximum step position permitted.

Return type:

integer

Raises:
  • NotConnectedException – If the device is not connected

  • DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes hardware or communication errors.

Note

The focuser can step between 0 and MaxStep. If an attempt is made to move the focuser beyond these limits, it will automatically stop at the limit.

property Focuser.Name: String

Added in version 2: Member added.

Returns:

The short name of the driver, for display purposes.

Return type:

string

Raises:

DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes communication errors.

Attention

Must be implemented, must not throw a PropertyNotImplementedException

Note

The Description property is used to return info about the device rather than the driver.

property Focuser.Position: integer
Returns:

Current focuser position, in steps.

Return type:

integer

Raises:
  • PropertyNotImplementedException – The device is a relative focuser (Absolute is False)

  • NotConnectedException – If the device is not connected

  • DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes hardware or communication errors.

Attention

Applications must not use this as a way to determine if a (non-blocking) Move() has completed. The Position may transit through the requested position before finally settling. Use the IsMoving property.

Note

  • Valid only for absolute positioning focusers (see the Absolute property).

property Focuser.StepSize: float
Returns:

Step size (microns) for the focuser.

Return type:

float

Raises:
  • PropertyNotImplementedException – If the focuser does not intrinsically know what the step size is.

  • NotConnectedException – If the device is not connected

  • DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes hardware or communication errors.

property Focuser.SupportedActions: COM: ArrayList of String elements, Alpaca: Array of String

Added in version 2: Recommended over (now) deprecated CommandBlind(), CommandBool(), and CommandString() as more flexible extension mechanic.

Returns the list of custom action names supported by this driver, to be used with Action(),

Returns:

The list of custom action names supported by this driver

Return type:

COM: ArrayList of String elements, Alpaca: Array of String

Raises:

DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes communication errors.

Attention

Must be implemented, must not throw a PropertyNotImplementedException

Note

  • This method, combined with Action(), is the supported mechanic for adding non-standard functionality.

  • SupportedActions is a “discovery” mechanism that enables clients to know which Actions a device supports without having to exercise the Actions themselves. This mechanism is necessary because there could be people / equipment safety issues if actions are called unexpectedly or out of a defined process sequence. It follows from this that SupportedActions must return names that match the spelling of custom action names exactly, without additional descriptive text. However, returned names may use any casing because the ActionName parameter of Action() is case insensitive.

property Focuser.TempComp: boolean

(read/write) Set or indicate the state of the focuser’s temp compensation, else always False.

Raises:
  • PropertyNotImplementedException – On writing to TempComp, if TempCompAvailable is False, indicating that this focuser does not have temperature compensation. In that case reading TempComp will always return False.

  • NotConnectedException – If the device is not connected

  • DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes hardware or communication errors.

Note

  • TempComp Read must be implemented and must not throw a PropertyNotImplementedException.

  • Setting TempComp to True puts the focuser into temperature tracking mode; setting it to False will turn off temperature tracking.

  • If TempCompAvailable is False this property must always return False.

Historical Note

  • Prior to Platform 6.4, the interface specification mandated that drivers must throw an InvalidOperationException if a move was attempted when TempComp was True, even if the focuser was able to execute the move safely without disrupting temperature compensation.

  • Following discussion on ASCOM-Talk in January 2018, the Focuser interface specification has been revised to IFocuserV3, removing the requirement to throw the InvalidOperationException exception. IFocuserV3 compliant drivers are expected to execute Move requests when temperature compensation is active and to hide any specific actions required by the hardware from the client. For example this could be achieved by disabling temperature compensation, moving the focuser and re-enabling temperature compensation or simply by moving the focuser with compensation enabled if the hardware supports this.

  • Conform will continue to pass IFocuserV2 drivers that throw InvalidOperationException exceptions. However, Conform will now fail IFocuserV3 drivers that throw InvalidOperationException exceptions, in line with this revised specification.

property Focuser.TempCompAvailable: boolean

If focuser has temperature compensation available.

Raises:
  • NotConnectedException – If the device is not connected

  • DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes hardware or communication errors.

Attention

Must be implemented, must not throw a PropertyNotImplementedException

Note

Will be true only if the focuser’s temperature compensation can be turned on and off via the TempComp property.

property Focuser.Temperature: float

Current ambient temperature (deg. C) as measured by the focuser.

Raises:
  • PropertyNotImplementedException – The temperature is not available for this device.

  • NotConnectedException – If the device is not connected

  • DriverException – An error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself. Includes hardware or communication errors.

Historical Note

Historically (prior to 2019) no units were specified for this property. You should assume this this is in degrees Celsius but old devices may supply temperature in other units. By now (2022) however devices should be providing degrees celsius.