qmi.instruments.adwin.goldii

Instrument driver for the Adwin Gold II. Inherits from Adwin_Base class in adwin.py

Classes

Adwin_GoldII(context, name, device_no)

Instrument driver for Adwin real-time microcontroller.

class qmi.instruments.adwin.goldii.Adwin_GoldII(context: QMI_Context, name: str, device_no: int)

Instrument driver for Adwin real-time microcontroller.

This driver is specific for the Adwin Gold 2.

check_ready() None

Raise an exception if the Adwin is not ready.

close() None

Close the connection to the instrument hardware and release associated resources.

When this method returns, the instrument must not be used again unless it is first re-opened by calling the open() method.

Subclasses can extend this method if they have specific resources to close. If they do, they should call super().close() as a last statement.

force_unlock() None

Forcefully unlock the remote object.

This unlocks the object, regardless of who owns the lock. This allows you to unlock an object if the locking proxy has been destroyed without unlocking.

Use this with care.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

classmethod get_category() str | None

Return the optional name of the category this object belongs to.

A category name is a free-form string that has no special significance. Its purpose is to distinguish between groups of RPC objects that fulfill similar roles.

get_data(data_idx: int, first_index: int, count: int) ndarray

Read values from a global Data array.

Parameters:
  • data_idx – Index into the global list of Data arrays (range 1 to MAX_DATA).

  • first_index – First index into the data array (>= 1).

  • count – Number of elements to read from the data array.

Returns:

1D Numpy array with data values. Element 0 of the returned array will correspond with first_index into the Adwin array.

get_data_length(data_idx: int) int

Return the length of the specified global Data array.

Parameters:

data_idx – Index into the global list of Data arrays (range 1 to MAX_DATA).

Returns:

Length of the data array (maximum valid array index).

get_fifo_filled(data_idx: int) int

Return the number of values waiting in the FIFO.

Parameters:

data_idx – Index into the global list of Data arrays (range 1 to MAX_DATA).

Returns:

Number of FIFO entries currently in use.

get_fifo_room(data_idx: int) int

Return the number of values that can be added to the FIFO without overflowing it.

Parameters:

data_idx – Index into the global list of Data arrays (range 1 to MAX_DATA).

Returns:

Number of empty FIFO entries available.

get_fpar(par_idx: int) float

Return the current value of the specified global parameter.

Parameters:

par_idx – Index into the global FPar array (range 1 to MAX_PAR).

Returns:

Value of the parameter.

get_fpar_block(par_first: int, par_count: int) ndarray

Return the current values of a block of global parameters.

Parameters:
  • par_first – First index into the global FPar array (range 1 to MAX_PAR).

  • par_count – Number of parameters to get.

Returns:

1D Numpy array with the parameter values.

get_full_data(data_idx: int) ndarray

Read all elements from a global DATA array.

Parameters:

data_idx – Index into the global list of Data arrays (range 1 to MAX_DATA).

Returns:

1D Numpy array with data values. Element 0 of the returned array will correspond with element 1 into the Adwin array.

get_name() str

Return the name of this object.

Returns:

name attribute.

get_par(par_idx: int) int

Return the current value of the specified global parameter.

Parameters:

par_idx – Index into the global Par array (range 1 to MAX_PAR).

Returns:

Value of the parameter.

get_par_block(par_first: int, par_count: int) ndarray

Return the current values of a block of global parameters.

Parameters:
  • par_first – First index into the global Par array (range 1 to MAX_PAR).

  • par_count – Number of parameters to get.

Returns:

1D Numpy array with the parameter values.

get_processor_type() str

Returns the ADwin processor type.

get_signals() list[SignalDescription]

Return a list of signals that can be published by this object.

Returns:

List consisting of qmi_signals attributes.

get_workload() int

Return average processor workload in percent since the last call.

is_locked() bool

Query if the remote object is locked.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

is_open() bool

Return True if the instrument is open (ready for interaction).

is_process_running(slot: int) bool

Return True if the specified Adwin process is currently running.

Parameters:

slot – Adwin process slot index (range 1 to MAX_PROCESS_NO).

load_process(bin_file: str) None

Load the specified Adwin process but do not start it yet.

Parameters:

bin_file – Path to binary file to load into the Adwin.

lock(timeout: float = 0.0, lock_token: str | None = None) bool

Lock the remote object. If timeout is given, try every 0.1s within the given timeout value. The remote object can be locked with an optional custom lock token by giving a string into lock_token keyword argument.

If successful, this proxy is the only proxy that can invoke RPC methods on the remote object; other proxies will receive an “object is locked” response. The return value indicates if the lock was granted; a denied lock means the object was already locked by another proxy.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

open() None

Connect to the instrument hardware.

When this method returns, the instrument must be ready for interaction via calls to instrument-specific methods.

Subclasses can extend this method to implement instrument-specific initialization. If they do, they should call super().open() as a last statement.

read_fifo(data_idx: int, count: int) ndarray

Read data from a global FIFO variable.

Parameters:
  • data_idx – Index into the global list of Data arrays (range 1 to MAX_DATA).

  • count – Number of values to read from the FIFO.

Returns:

1D Numpy array containing the FIFO elements.

reboot() None

Reboot the Adwin system, clear data and restart programs.

This function must be called after power-on before communication with the Adwin is possible. This function may be called again to perform a full reset.

This function boots the Adwin, removes all processes and data.

release_rpc_object() None

Give a warning if the instrument is removed while still open.

set_data(data_idx: int, first_index: int, value: ndarray | List[int] | List[float]) None

Write values to a global Data array.

Parameters:
  • data_idx – Index into the global list of Data arrays (range 1 to MAX_DATA).

  • first_index – First index into the Data array (>= 1).

  • value – List of values to write to the Data array.

set_file_to_data(data_idx: int, first_index: int, file_path: str) None

Upload the file at file_path to the specified array. This method is used to load binary programs into TiCo modules at ADwin runtime.

Parameters:
  • data_idx – Index into the global list of Data arrays (range 1 to MAX_DATA).

  • first_index – First index into the Data array (>= 1).

  • file_path – Path of the file to upload.

set_fpar(par_idx: int, value: float) None

Change the value of the specified global parameter.

Parameters:
  • par_idx – Index into the global FPar array (range 1 to MAX_PAR).

  • value – New value to write to the parameter.

set_par(par_idx: int, value: int) None

Change the value of the specified global parameter.

Parameters:
  • par_idx – Index into the global Par array (range 1 to MAX_PAR).

  • value – New value to write to the parameter (signed 32-bit integer).

start_process(slot: int) None

Start the specified Adwin process.

The process must already have been loaded by calling load_process().

Parameters:

slot – Adwin process slot index (range 1 to MAX_PROCESS_NO).

stop_process(slot: int) None

Stop the specified Adwin process.

Parameters:

slot – Adwin process slot index (range 1 to MAX_PROCESS_NO).

unlock(lock_token: str | None = None) bool

Unlock the remote object.

Without optional parameters, this is only allowed by the proxy that initially locked the object. By giving the lock token as an input parameter, the specific object locked by this token can be unlocked. The return value indicates if the unlocking was successful.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

wait_for_process(slot: int, timeout: float) None

Wait until the specified Adwin process has stopped.

Parameters:
  • slot – Adwin process slot index (range 1 to MAX_PROCESS_NO).

  • timeout – Maximum time to wait (seconds).

Raises:

QMI_TimeoutException – If the process does not stop before timeout occurs.

write_fifo(data_idx: int, value: ndarray | List[int] | List[float]) None

Write data to a global FIFO variable.

Parameters:
  • data_idx – Index into the global list of Data arrays (range 1 to MAX_DATA).

  • value – Array of values to write to the FIFO.