Implementation of a meta instrument to control single-axis positioner stages.
More...
|
| enum class | DirectionType { Forward
, Backward
} |
| | Type to determine the direction of the positioner stage's movements. More...
|
| |
| using | ParamsType = PositionerStageParams |
| | Type of the parameter class belonging to this Object type. Declare this alias in every derived class with the respective parameter class accompanying the derived Object. "
|
| |
| using | ConfigType = PositionerStageConfigurator |
| | Type of the configurator class belonging to this Object type. Declare this alias in every derived class with the respective configurator class accompanying the derived Object.
|
| |
| using | InstrumentDataType = PositionerStageData |
| | Type of the data class belonging to this InstrumentBase type. Declare this alias in every derived class with the respective data class accompanying the derived InstrumentBase.
|
| |
|
Redefined to use this instrument with DynExpInstr::gRPCInstrument.
|
| using | InitTaskType = PositionerStageTasks::InitTask |
| | Defines a task for initializing an instrument within an instrument inheritance hierarchy. Each instrument (indirectly) derived from class InstrumentBase must be accompanied by an initialization task class derived from InitTaskBase. Even if the task does not do anything, at least it has to call InitTaskBase::InitFuncImpl() of the derived instrument's initialization task class.
|
| |
| using | ExitTaskType = PositionerStageTasks::ExitTask |
| | Defines a task for deinitializing an instrument within an instrument inheritance hierarchy. Each instrument (indirectly) derived from class InstrumentBase must be accompanied by a deinitialization task class derived from ExitTaskBase. Even if the task does not do anything, at least it has to call ExitTaskBase::ExitFuncImpl() of the derived instrument's deinitialization task class.
|
| |
| using | UpdateTaskType = PositionerStageTasks::UpdateTask |
| | Defines a task for updating an instrument within an instrument inheritance hierarchy. Each instrument (indirectly) derived from class InstrumentBase must be accompanied by an update task class derived from UpdateTaskBase. Even if the task does not do anything, at least it has to call UpdateTaskBase::UpdateFuncImpl() of the derived instrument's update task class.
|
| |
| enum class | TaskHandlingContinuationType { Continue
, Terminate
, Defer
} |
| | Indicates how an instrument should proceed after handling a task. More...
|
| |
| using | ParamsType = InstrumentParamsBase |
| | Type of the parameter class belonging to this Object type. Declare this alias in every derived class with the respective parameter class accompanying the derived Object. "
|
| |
| using | ConfigType = InstrumentConfiguratorBase |
| | Type of the configurator class belonging to this Object type. Declare this alias in every derived class with the respective configurator class accompanying the derived Object.
|
| |
| using | InstrumentDataType = InstrumentDataBase |
| | Type of the data class belonging to this InstrumentBase type. Declare this alias in every derived class with the respective data class accompanying the derived InstrumentBase.
|
| |
| using | InstrumentDataTypeSyncPtrType = Util::SynchronizedPointer< InstrumentDataType > |
| | Alias for the return type of InstrumentBase::GetInstrumentData(). Data class instances wrapped into Util::SynchronizedPointer can be accessed in a thread-safe way.
|
| |
| using | InstrumentDataTypeSyncPtrConstType = Util::SynchronizedPointer< const InstrumentDataType > |
| | Alias for the return type of InstrumentBase::GetInstrumentData() const. Data class instances wrapped into Util::SynchronizedPointer can be accessed in a thread-safe way.
|
| |
| using | InitTaskType = InitTaskBase |
| | Defines a task for initializing an instrument within an instrument inheritance hierarchy. Each instrument (indirectly) derived from class InstrumentBase must be accompanied by an initialization task class derived from InitTaskBase. Even if the task does not do anything, at least it has to call InitTaskBase::InitFuncImpl() of the derived instrument's initialization task class.
|
| |
| using | ExitTaskType = ExitTaskBase |
| | Defines a task for deinitializing an instrument within an instrument inheritance hierarchy. Each instrument (indirectly) derived from class InstrumentBase must be accompanied by a deinitialization task class derived from ExitTaskBase. Even if the task does not do anything, at least it has to call ExitTaskBase::ExitFuncImpl() of the derived instrument's deinitialization task class.
|
| |
| using | UpdateTaskType = UpdateTaskBase |
| | Defines a task for updating an instrument within an instrument inheritance hierarchy. Each instrument (indirectly) derived from class InstrumentBase must be accompanied by an update task class derived from UpdateTaskBase. Even if the task does not do anything, at least it has to call UpdateTaskBase::UpdateFuncImpl() of the derived instrument's update task class.
|
| |
| using | InstrumentDataGetterType = Util::CallableMemberWrapper< InstrumentBase, InstrumentDataTypeSyncPtrType(InstrumentBase::*)(const std::chrono::milliseconds)> |
| | Invoking an instance of this alias is supposed to call InstrumentBase::GetInstrumentData() of the instance the Util::CallableMemberWrapper has been constructed with.
|
| |
| using | ParamsType = RunnableObjectParams |
| | Type of the parameter class belonging to this Object type. Declare this alias in every derived class with the respective parameter class accompanying the derived Object. "
|
| |
| using | ConfigType = RunnableObjectConfigurator |
| | Type of the configurator class belonging to this Object type. Declare this alias in every derived class with the respective configurator class accompanying the derived Object.
|
| |
| using | ParamsType = ParamsBase |
| | Type of the parameter class belonging to this Object type. Declare this alias in every derived class with the respective parameter class accompanying the derived Object.
|
| |
| using | ParamsTypeSyncPtrType = Util::SynchronizedPointer< ParamsType > |
| | Alias for the return type of Object::GetParams(). Parameters wrapped into Util::SynchronizedPointer can be accessed in a thread-safe way.
|
| |
| using | ParamsConstTypeSyncPtrType = Util::SynchronizedPointer< const ParamsType > |
| | Alias for the return type of Object::GetParams() const. Parameters wrapped into Util::SynchronizedPointer can be accessed in a thread-safe way.
|
| |
| using | ConfigType = ConfiguratorBase |
| | Type of the configurator class belonging to this Object type. Declare this alias in every derived class with the respective configurator class accompanying the derived Object.
|
| |
| using | ParamsGetterType = Util::CallableMemberWrapper< Object, decltype(&Object::GetParams)> |
| | Invoking an instance of this alias is supposed to call Object::GetParams() of the instance the Util::CallableMemberWrapper has been constructed with.
|
| |
|
| | PositionerStage (const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType &&Params) |
| | Constructs an instrument instance.
|
| |
| virtual | ~PositionerStage ()=0 |
| |
| virtual std::string | GetName () const override |
| | Returns the name of this Object type.
|
| |
| virtual std::string | GetCategory () const override |
| | Returns the category of this Object type.
|
| |
| virtual std::chrono::milliseconds | GetTaskQueueDelay () const override |
| | Specifies in which time intervals the instrument's task queue runs to handle pending tasks.
|
| |
|
Override by derived classes to provide information about the instrument.
|
| virtual PositionerStageData::PositionType | GetMinPosition () const noexcept=0 |
| | Returns the minimal position the stage can move to in nm if the stage supports SI units, in step units otherwise.
|
| |
| virtual PositionerStageData::PositionType | GetMaxPosition () const noexcept=0 |
| | Returns the maximal position the stage can move to in nm if the stage supports SI units, in step units otherwise.
|
| |
| virtual PositionerStageData::PositionType | GetResolution () const noexcept=0 |
| | Returns the stage's position resolution (precision) in nm if the stage supports SI units, in step units otherwise.
|
| |
| virtual PositionerStageData::PositionType | GetMinVelocity () const noexcept=0 |
| | Returns the minimal velocity the stage can move with in nm/s if the stage supports SI units, in steps/s otherwise.
|
| |
| virtual PositionerStageData::PositionType | GetMaxVelocity () const noexcept=0 |
| | Returns the maximal velocity the stage can move with in nm/s if the stage supports SI units, in steps/s otherwise.
|
| |
| virtual PositionerStageData::PositionType | GetDefaultVelocity () const noexcept=0 |
| | Returns the stage's default velocity in nm/s if the stage supports SI units, in steps/s otherwise.
|
| |
| virtual double | GetStepNanoMeterRatio () const noexcept |
| | Determines the conversion factor in between internal PositionerStageData::PositionType position and velocities and the units the underlying hardware expects.
|
| |
| virtual bool | IsUsingSIUnits () const noexcept |
| | Determines whether the underlying hardware expects SI units for positions and velocities or arbitrary units.
|
| |
|
Override by derived classes to insert tasks into the instrument's task queue. Logical const-ness: const member functions to allow modules inserting tasks into the instrument's task queue.
|
| virtual void | SetHome () const |
| | Stores the positioner's home position. Also refer to MoveToHome().
|
| |
| virtual void | Reference (DirectionType Direction=DirectionType::Forward, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const |
| | References the positioner such that it finds its zero position or end stop.
|
| |
| virtual void | Calibrate (DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const |
| | Calibrates the positioner. The meaning of such a calibration is solely specified by the hardware manufacturer of the respective positioner type.
|
| |
| virtual void | SetVelocity (const PositionerStageData::PositionType Velocity) const =0 |
| | Sets the positioner's velocity in its native units. Do divide units of PositionerStageData::Velocity by GetStepNanoMeterRatio() to obtain native units. Also refer to IsUsingSIUnits().
|
| |
| virtual void | MoveToHome (DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const |
| | Moves the positioner to its stored home position. Also refer to SetHome().
|
| |
| virtual void | MoveAbsolute (const PositionerStageData::PositionType Steps, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0 |
| | Moves the positioner to an absolute position in its native units. Do divide units of PositionerStageData::Position by GetStepNanoMeterRatio() to obtain native units. Also refer to IsUsingSIUnits().
|
| |
| virtual void | MoveRelative (const PositionerStageData::PositionType Steps, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0 |
| | Moves the positioner to a position relative to its current position. The position offset Steps has to be specified in native units. Do divide units of PositionerStageData::Position by GetStepNanoMeterRatio() to obtain native units. Also refer to IsUsingSIUnits().
|
| |
| virtual void | StopMotion () const =0 |
| | Stops any motion or position stabilization of the positioner immediately.
|
| |
| | InstrumentBase (const std::thread::id OwnerThreadID, ParamsBasePtrType &&Params) |
| | Constructs an instrument instance.
|
| |
| virtual | ~InstrumentBase ()=0 |
| |
| template<typename DerivedInstrT , typename... TaskFuncArgTs, typename... ArgTs> |
| ExceptionContainer | AsSyncTask (void(DerivedInstrT::*TaskFunc)(TaskFuncArgTs...) const, ArgTs &&...Args) const |
| | Calls a (derived) instrument's function which inserts a task into the instrument's task queue synchronously. This means that AsSyncTask() blocks until the task has been executed or aborted. This is achieved by passing a callback function to the task which in turn sets a flag after the task execution. The thread calling AsSyncTask() blocks (via std::this_thread::yield()) until this flag is set.
|
| |
| InstrumentDataTypeSyncPtrType | GetInstrumentData (const std::chrono::milliseconds Timeout=GetInstrumentDataTimeoutDefault) |
| | Locks the mutex of the instrument data class instance InstrumentData assigned to this InstrumentBase instance and returns a pointer to the locked InstrumentData. Instrument data should not be locked by having called this function while subsequently calling a derived instrument's method which also makes use of the instrument's data by locking it. If this happens (e.g. in a module thread), the instrument data's mutex is locked recursively. In principle, this does no harm since Util::ISynchronizedPointerLockable supports that. But, it is not considered good practice.
|
| |
| InstrumentDataTypeSyncPtrConstType | GetInstrumentData (const std::chrono::milliseconds Timeout=GetInstrumentDataTimeoutDefault) const |
| | Locks the mutex of the instrument data class instance InstrumentData assigned to this InstrumentBase instance and returns a pointer to the locked InstrumentData. Instrument data should not be locked by having called this function while subsequently calling a derived instrument's method which also makes use of the instrument's data by locking it. If this happens (e.g. in a module thread), the instrument data's mutex is locked recursively. In principle, this does no harm since Util::ISynchronizedPointerLockable supports that. But, it is not considered good practice.
|
| |
| void | UpdateData () const |
| | Enqueues an update task (instance of class UpdateTaskBase).
|
| |
| void | EnqueueArriveAtLatchTask (std::latch &Latch) const |
| | Enqueues a task which arrives at a latch when executed (instance of class ArriveAtLatchTask).
|
| |
| bool | IsInitialized () const |
| | Getter for Initialized.
|
| |
| | RunnableObject (const std::thread::id OwnerThreadID, ParamsBasePtrType &&Params) |
| | Constructs an Object instance.
|
| |
| virtual | ~RunnableObject ()=0 |
| |
| void | SetPaused (bool Pause, std::string Description="") |
| | Pauses or resumes a RunnableObject instance. Its thread stays running, but the instance does not perform any action while it is paused.
|
| |
| bool | IsRunning () const noexcept |
| | Returns Running.
|
| |
| bool | IsPaused () const noexcept |
| | Returns Paused.
|
| |
| bool | IsExiting () const noexcept |
| | Returns ShouldExit.
|
| |
| auto | GetStartupType () const noexcept |
| | Returns Startup.
|
| |
| auto | GetReasonWhyPaused () const |
| | Returns ReasonWhyPaused.
|
| |
| bool | Run (QWidget *ParentWidget=nullptr) |
| | Starts the RunnableObject instance's thread and ensures that all Object instances linked to this instance via ObjectLink parameters are in a ready state. Calls RunChild() which is to be overridden by derived classes to start a thread and to pass this thread back by calling StoreThread().
|
| |
| bool | RunIfRunAutomatic () |
| | Calls Run() if RunnableObjectParams::Startup is set to RunnableObjectParams::Automatic.
|
| |
| bool | RunIfRunOnCreation () |
| | Calls Run() if RunnableObjectParams::Startup is set to RunnableObjectParams::OnCreation.
|
| |
| void | Terminate (bool Force=false, const std::chrono::milliseconds Timeout=TerminateTimeoutDefault) |
| | Notifies the RunnableObject instance's thread to terminate and waits until it has ended. Calls TerminateImpl().
|
| |
| | INonCopyable (const INonCopyable &)=delete |
| |
| INonCopyable & | operator= (const INonCopyable &)=delete |
| |
| ItemIDType | GetID () const noexcept |
| | Returns the ID of this Object instance. Thread-safe since ID is const.
|
| |
| std::string | GetCategoryAndName () const |
| | Builds a string from an Object's category and name to allow the user to identify an Object's type.
|
| |
| void | EnsureReadyState (bool IsAutomaticStartup) |
| | Ensures that this Object instance is ready by possibly starting its worker thread or by opening connections to hardware devices.
|
| |
| void | CheckLinkedObjectStates () const |
| | Checks whether Object instances this instance uses are in a ready state. Override CheckLinkedObjectStatesChild() to implement this behavior.
|
| |
| void | Reset () |
| | Resets this Object instance (including all its derived classes) by calling ResetImpl(). A reset implies that the derived classes reload all their parameters from Params and that all LinkedObjectWrapper instances owned by this Object instance become invalidated.
|
| |
| void | BlockIfUnused (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) |
| | Blocks this Object instance setting Object::IsBlocked to true. Refer to Object::IsBlocked for the consequences.
|
| |
| ParamsConstTypeSyncPtrType | GetParams (const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) const |
| | Locks the mutex of the parameter class instance Params assigned to this Object instance and returns a pointer to the locked Params.
|
| |
| ParamsTypeSyncPtrType | GetParams (const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) |
| | Locks the mutex of the parameter class instance Params assigned to this Object instance and returns a pointer to the locked Params.
|
| |
| auto | GetObjectName (const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) const |
| | Returns the name of this Object instance.
|
| |
| bool | IsSharedUsageEnabled (const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) const |
| | Returns whether shared usage has been enabled for this Object instance. Refer to ParamsBase::UsageType.
|
| |
| void | SetWarning (std::string Description, int ErrorCode) const |
| | Setter for Object::Warning. Sets the warning by a description and an error code.
|
| |
| void | SetWarning (const Util::Exception &e) const |
| | Setter for Object::Warning. Sets the warning by retrieving the warning data from an exception e.
|
| |
| void | ClearWarning () const |
| | Resets Object::Warning.
|
| |
| auto | GetWarning () const |
| | Returns Object::Warning in a thread-safe way by copying its internal data.
|
| |
| std::exception_ptr | GetException (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) const |
| | Returns a pointer to the exception which has caused this Object instance to fail.
|
| |
| bool | IsReady () const |
| | Returns wheter this Object instance is ready (e.g. it is running or connected to a hardware device) and not blocked (refer to Object::IsBlocked).
|
| |
| auto | GetUseCount (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) const |
| | Counts the registered useres in a thread-safe way.
|
| |
| bool | IsUnused (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) const |
| | Returns whether this Object instance is used by other instances.
|
| |
| auto | GetUserIDs (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) const |
| | Returns a list of the IDs of the registered users in a thread-safe way.
|
| |
| auto | GetUserNamesString (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) const |
| | Builds a string describing which users are registered containing their object names, categories and type names in a thread-safe way.
|
| |
Implementation of a meta instrument to control single-axis positioner stages.
Definition at line 154 of file Stage.h.