Main PyMoDAQ class to drive actuators |
|
|
|
|
Built-in mutable sequence. |
8.1.5. The DAQ_Move Class
This documentation highlights the useful entry and output points that you may use in your applications.
- class pymodaq.control_modules.daq_move.DAQ_Move(parent=None, title='DAQ Move', ui_identifier=None, **kwargs)[source]
Main PyMoDAQ class to drive actuators
Qt object and generic UI to drive actuators.
- init_signal
This signal is emitted when the chosen actuator is correctly initialized
- Type:
- move_done_signal
This signal is emitted when the chosen actuator finished its action. It gives the actuator’s name and current value
- Type:
pyqtSignal,DataActuator]
- bounds_signal
This signal is emitted when the actuator reached defined limited boundaries.
- Type:
See also
ControlModule,ParameterManager- Attributes:
actuatorstr: the selected actuator’s type
initialized_statebool: status of the actuator’s initialization (init or not)
move_done_boolbool: status of the actuator’s status (done or not)
Methods
Get the current actuator value via the "get_actuator_value" command send to the hardware
get_continuous_actuator_value([get_value])Start the continuous getting of the actuator's value
grab()move(move_command)Generic method to trigger the correct action on the actuator
move_abs(value[, send_to_tcpip])Move the connected hardware to the absolute value
move_home([send_to_tcpip])Move the connected actuator to its home value (if any)
move_rel(rel_value[, send_to_tcpip])Move the connected hardware to the relative value
quit_fun()Programmatic quitting of the current instance of DAQ_Move
Stop any motion
thread_status(status)Get back info (using the ThreadCommand object) from the hardware
- get_actuator_value()[source]
Get the current actuator value via the “get_actuator_value” command send to the hardware
Returns nothing but the move_done_signal will be send once the action is done
- get_continuous_actuator_value(get_value=True)[source]
Start the continuous getting of the actuator’s value
- Parameters:
get_value (
bool) – if True start the timer to periodically fetch the actuator’s value, else stop it
Notes
The current timer period is set by the refresh value ‘refresh_timeout’ in the actuator main settings.
- init_hardware_ui(do_init=True)
Programmatic entry to simulate a click on the user interface init button
- Parameters:
do_init (
bool) – if True initialize the selected hardware else deinitialize it
Notes
This method should be preferred to
init_hardware()
- move(move_command)[source]
Generic method to trigger the correct action on the actuator
- Parameters:
move_command (
MoveCommand) – MoveCommand with move_type attribute either: * ‘abs’: performs an absolute action * ‘rel’: performs a relative action * ‘home’: find the actuator’s home
See also
move_abs(),move_rel(),move_home(),utility_classes.MoveCommand
- move_abs(value, send_to_tcpip=False)[source]
Move the connected hardware to the absolute value
Returns nothing but the move_done_signal will be send once the action is done
- Parameters:
value (
Union[DataActuator,Number]) – The value the actuator should reachsend_to_tcpip (
bool) – if True, this position is send through the TCP/IP communication canal
- move_home(send_to_tcpip=False)[source]
Move the connected actuator to its home value (if any)
- Parameters:
send_to_tcpip (
bool) – if True, this position is send through the TCP/IP communication canal
- move_rel(rel_value, send_to_tcpip=False)[source]
Move the connected hardware to the relative value
Returns nothing but the move_done_signal will be send once the action is done
- quit_fun()[source]
Programmatic quitting of the current instance of DAQ_Move
Des-init the actuator then close the UI parent widget
- thread_status(status)[source]
Get back info (using the ThreadCommand object) from the hardware
And re-emit this ThreadCommand using the custom_sig signal if it should be used in a higher level module
Commands valid for all control modules are defined in the parent class, here are described only the specific ones
- Parameters:
status (
ThreadCommand) –Possible values are:
ini_stage: obtains info from the initialization
get_actuator_value: update the UI current value
move_done: update the UI current value and emits the move_done signal
outofbounds: emits the bounds_signal signal with a True argument
set_allowed_values: used to change the behaviour of the spinbox controlling absolute values (see
daq_move_ui.set_abs_spinbox_properties()stop: stop the motion
8.1.6. The DAQ_Move UI class
This object is the User Interface of the DAQ_Viewer, allowing easy access to all of the DAQ_Viewer functionnalities in a generic interface.
8.1.7. The DAQ_Move Plugin Class
This object is the base class from which all actuator plugins should inherit. It exposes a few methods, attributes and signal that could be useful to understand.
- class pymodaq.control_modules.move_utility_classes.DAQ_Move_base(parent=None, params_state=None, **kwargs)[source]
The base class to be inherited by all actuator modules
This base class implements all necessary parameters and methods for the plugin to communicate with its parent (the DAQ_Move module)
- Parameters:
- move_done_signal
signal represented by a float. Is emitted each time the hardware reached the target position within the epsilon precision (see comon_parameters variable)
- Type:
- controller
the object representing the hardware in the plugin. Used to access hardware functionality
- Type:
- settings
- instance representing the hardware settings defined from the params attribute. Modifications on the GUI settings
will be transferred to this attribute. It stores at all times the current state of the hardware/plugin settings
- Type:
Parameter
- params
Its definition on the class level enable the automatic update of the GUI settings when changing plugins (even in managers mode creation). To be populated on the plugin level as the base class does’t represents a real hardware
- Type:
Listofdict usedtocreate a Parameter object.
- is_multiaxes
class level attribute. Defines if the plugin controller controls multiple axes. If True, one has to define a Master instance of this plugin and slave instances of this plugin (all sharing the same controller_ID parameter)
- Type:
- current_value
stores the current position after each call to the get_actuator_value in the plugin
- Type:
DataActuator
- target_value
stores the target position the controller should reach within epsilon
- Type:
DataActuator
- Attributes:
axis_index_keyGet the current index or key correspondingto the current axis
axis_nameGet/Set the current axis using its string identifier
axis_namesGet/Set the names of all axes controlled by this instrument plugin
axis_unitGet/set the unit of the currently chosen axis
axis_unitsGet/Set the units for each axis of the controller
axis_valueGet the current value selected from the current axis
controller_unitsGet/Set the units of the currently chosen axis of the controller
- current_position
- current_value
epsilonGet/Set the epsilon of the currently chosen axis
epsilonsGet/Set the epsilon for each axis of the controller
is_masterGet the controller master/slave status
ispollingGet/Set the polling status
- target_position
- target_value
Methods
Implement the condition for exiting the polling mechanism and specifying that the target value has been reached
check_bound(position)Check if the current position is within the software bounds
commit_settings(param)to subclass to transfer parameters to hardware
emit_status(status)Emit the status_sig signal with the given status ThreadCommand back to the main GUI.
emit_value(pos)Convenience method to emit the current actuator value back to the UI
Get the current position from the hardware with scaling conversion.
To be subclassed, in order to init specific attributes needed by the real implementation
ini_stage([controller])Actuator communication initialization
ini_stage_init([old_controller, ...])Manage the Master/Slave controller issue
move_done([position])Poll the current moving.
send_param_status(param, changes)Send changes value updates to the gui to update consequently the User Interface
Set the scaled positions in case of relative moves
Set the current position from the parameter and hardware with scaling conversion.
stop_motion(value)Stop the actuator and emit move_done signal.
update_settings(settings_parameter_dict)Receive the settings_parameter signal from the param_tree_changed method and make hardware updates of modified values.
Implement a user defined condition for exiting the polling mechanism and specifying that the target value has been reached (on top of the existing epsilon mechanism)
check_target_reached
close
commit_common_settings
get_actuator_value
move_abs
move_done_signal
move_home
move_rel
- absolute_difference_condition_to_reach_target()[source]
Implement the condition for exiting the polling mechanism and specifying that the target value has been reached
- Returns:
bool
- Return type:
See also
- check_bound(position)[source]
Check if the current position is within the software bounds
Return the new position eventually coerced within the bounds
- Return type:
- emit_status(status)[source]
Emit the status_sig signal with the given status ThreadCommand back to the main GUI.
- get_position_with_scaling(pos)[source]
Get the current position from the hardware with scaling conversion.
- Return type:
- ini_attributes()[source]
To be subclassed, in order to init specific attributes needed by the real implementation
- ini_stage_init(old_controller=None, new_controller=None, slave_controller=None)[source]
Manage the Master/Slave controller issue
First initialize the status dictionary Then check whether this stage is controlled by a multiaxe controller (to be defined for each plugin)
if it is a multiaxes controller then: * if it is Master: init the controller here * if it is Slave: use an already initialized controller (defined in the preset of the dashboard)
- Parameters:
old_controller (
Optional[TypeVar(HardwareController)]) – The particular object that allow the communication with the hardware, in general a python wrapper around the hardware library. In case of Slave this one comes from a previously initialized pluginnew_controller (
Optional[TypeVar(HardwareController)]) – The particular object that allow the communication with the hardware, in general a python wrapper around the hardware library. In case of Master it is the new instance of your plugin controller
- Return type:
- move_done(position=None)[source]
- Emit a move done signal transmitting the float position to hardware.The position argument is just there to match some signature of child classes.
Arguments
Type
Description
position
float
The position argument is just there to match some signature of child classes
- poll_moving()[source]
Poll the current moving. In case of timeout emit the raise timeout Thread command.
See also
DAQ_utils.ThreadCommand,move_done
- send_param_status(param, changes)[source]
Send changes value updates to the gui to update consequently the User Interface
The message passing is made via the ThreadCommand “update_settings”.
- set_position_relative_with_scaling(pos)[source]
Set the scaled positions in case of relative moves
- Return type:
- set_position_with_scaling(pos)[source]
Set the current position from the parameter and hardware with scaling conversion.
- Return type:
- abstractmethod stop_motion(value)[source]
Stop the actuator and emit move_done signal.
- Return type:
- update_settings(settings_parameter_dict)[source]
Receive the settings_parameter signal from the param_tree_changed method and make hardware updates of modified values.
- user_condition_to_reach_target()[source]
Implement a user defined condition for exiting the polling mechanism and specifying that the target value has been reached (on top of the existing epsilon mechanism)
Should be reimplemented in plugins to implement other conditions
- Returns:
bool
- Return type:
- property axis_index_key: int | str
Get the current index or key correspondingto the current axis
In case axis_names is a list, return the index wihtin the list In case axis_names is a dict, return the key of the dict self.axis_name
- property axis_names: List | Dict
Get/Set the names of all axes controlled by this instrument plugin
- Return type:
Listofstringordictionary mapping namestointegers
- property axis_unit: str
Get/set the unit of the currently chosen axis
Will update the printed controller unit in the UI
New in 4.4.0
- property axis_units: List[str] | Dict[str, str]
Get/Set the units for each axis of the controller
New in 4.4.0
- property axis_value: int
Get the current value selected from the current axis
In case axis_names is a list, return the element of the list: self.axis_name In case axis_names is a dict, return the value of the dict self.axis_names[self.axis_name]
- property controller_units
Get/Set the units of the currently chosen axis of the controller
Deprecated with pymodaq >= 4.4.0
The property controller_units is deprecated please use the axis_unit property
- property epsilons: List[float] | Dict[str, float]
Get/Set the epsilon for each axis of the controller
New in 4.4.0
- property ispolling
Get/Set the polling status