11 auto InstrParams = DynExp::dynamic_Params_cast<SmarAct>(Instance.
ParamsGetter());
14 InstrData->Channel = InstrParams->Channel;
15 Instance.
LockObject(InstrParams->HardwareAdapter, InstrData->HardwareAdapter);
30 InstrData->HardwareAdapter->StopMotion(InstrData->GetChannel());
46 bool UpdateError =
false;
50 InstrData->SetCurrentPosition(InstrData->HardwareAdapter->GetCurrentPosition(InstrData->GetChannel()));
51 InstrData->SetVelocity(InstrData->HardwareAdapter->GetVelocity(InstrData->GetChannel()));
52 InstrData->SmarActChannelStatus.Set(InstrData->HardwareAdapter->GetChannelState(InstrData->GetChannel()));
59 if (InstrData->NumFailedStatusUpdateAttempts++ >= 3)
64 InstrData->NumFailedStatusUpdateAttempts = 0;
81 InstrData->SetHomePosition(InstrData->GetCurrentPosition());
90 InstrData->HardwareAdapter->Reference(InstrData->GetChannel());
91 InstrData->GetSmarActChannelStatus().Set(InstrData->HardwareAdapter->GetChannelState(InstrData->GetChannel()));
100 InstrData->HardwareAdapter->Calibrate(InstrData->GetChannel());
101 InstrData->GetSmarActChannelStatus().Set(InstrData->HardwareAdapter->GetChannelState(InstrData->GetChannel()));
110 InstrData->HardwareAdapter->SetVelocity(InstrData->GetChannel(), Velocity);
119 InstrData->HardwareAdapter->MoveAbsolute(InstrData->GetChannel(), InstrData->GetHomePosition());
120 InstrData->GetSmarActChannelStatus().Set(InstrData->HardwareAdapter->GetChannelState(InstrData->GetChannel()));
129 InstrData->HardwareAdapter->MoveAbsolute(InstrData->GetChannel(), Position);
130 InstrData->GetSmarActChannelStatus().Set(InstrData->HardwareAdapter->GetChannelState(InstrData->GetChannel()));
139 InstrData->HardwareAdapter->MoveRelative(InstrData->GetChannel(), Position);
140 InstrData->GetSmarActChannelStatus().Set(InstrData->HardwareAdapter->GetChannelState(InstrData->GetChannel()));
149 InstrData->HardwareAdapter->StopMotion(InstrData->GetChannel());
157 SmarActChannelStatus.Set(0);
158 NumFailedStatusUpdateAttempts = 0;
171 auto InstrData = DynExp::dynamic_InstrumentData_cast<SmarAct>(
GetInstrumentData());
174 InstrData->HardwareAdapter->StopMotion(InstrData->GetChannel());
Implementation of an instrument to control a single positioner stage connected to the SmarAct MCS2.
Implementation of a meta instrument to control single-axis positioner stages.
void ResetImpl(dispatch_tag< PositionerStageData >) override final
Refer to DynExp::InstrumentDataBase::Reset(). Using tag dispatch mechanism to ensure that ResetImpl()...
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
void ExitFuncImpl(dispatch_tag< PositionerStageTasks::ExitTask >, DynExp::InstrumentInstance &Instance) override final
Deinitializes the respective instrument within the instrument inheritance hierarchy....
void InitFuncImpl(dispatch_tag< PositionerStageTasks::InitTask >, DynExp::InstrumentInstance &Instance) override final
Initializes the respective instrument within the instrument inheritance hierarchy....
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
void UpdateFuncImpl(dispatch_tag< PositionerStageTasks::UpdateTask >, DynExp::InstrumentInstance &Instance) override final
Updates the respective instrument within the instrument inheritance hierarchy. Call UpdateFuncImpl() ...
virtual void OnErrorChild() const override
Derived classes can perform critical shutdown actions after an error has occurred....
SmarAct(const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType &&Params)
void ResetImpl(dispatch_tag< PositionerStage >) override final
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
Refer to DynExp::ParamsBase::dispatch_tag.
Refer to DynExp::ParamsBase::dispatch_tag.
InstrumentDataTypeSyncPtrType GetInstrumentData(const std::chrono::milliseconds Timeout=GetInstrumentDataTimeoutDefault)
Locks the mutex of the instrument data class instance InstrumentData assigned to this InstrumentBase ...
Refer to ParamsBase::dispatch_tag.
Defines data for a thread belonging to a InstrumentBase instance. Refer to RunnableInstance.
const InstrumentBase::InstrumentDataGetterType InstrumentDataGetter
Getter for instrument's data. Refer to InstrumentBase::InstrumentDataGetterType.
Refer to ParamsBase::dispatch_tag.
const Object::ParamsGetterType ParamsGetter
Invoke to obtain the parameters (derived from ParamsBase) of Owner.
void UnlockObject(LinkedObjectWrapperContainer< ObjectT > &ObjectWrapperContainer)
Unlocks an Object instance stored in the LinkedObjectWrapperContainer ObjectWrapperContainer....
void LockObject(const ParamsBase::Param< ObjectLink< ObjectT >> &LinkParam, LinkedObjectWrapperContainer< ObjectT > &ObjectWrapperContainer, std::chrono::milliseconds Timeout=ObjectLinkBase::LockObjectTimeoutDefault)
Locks an Object instance referenced by a parameter LinkParam of type ParamsBase::Param< ObjectLink< O...
const auto & GetOwner() const noexcept
Returns Owner.
Defines the return type of task functions.
Refer to DynExp::ParamsBase::dispatch_tag.
Thrown when an operation timed out before it could be completed, especially used for locking shared d...
DynExp's instrument namespace contains the implementation of DynExp instruments which extend DynExp's...
std::unique_ptr< ParamsBase > ParamsBasePtrType
Alias for a pointer to the parameter system base class ParamsBase.
Accumulates include statements to provide a precompiled header.