TwiceAsNice
2019-02-18
|
This is the Deformable Mirror Service Interface. More...
#include <Device.h>
Public Member Functions | |
DmDevice (const Nice::JointPtr &_config) | |
DmDevice (const unsigned int _totalActuators, const std::vector< unsigned int > &_blankActuators, const unsigned short int _voltageLimitMin, const unsigned short int _voltageLimitMax, const double _maxPiston, const double _maxPistonStep, const std::vector< double > &_nonliniearityVector, const std::vector< double > &_sensitivityVector, const std::vector< double > &_flatPatternVector, const std::vector< std::vector< double > > &_injectionMatrix) | |
constructor initialize the DM with following parameters More... | |
virtual | ~DmDevice () |
default destructor More... | |
virtual void | reset (Basda::DeviceAsync &=Basda::Device::s_async) |
reset the device More... | |
virtual void | version () |
version More... | |
virtual void | init (Basda::DeviceAsync &=Basda::Device::s_async) |
init the device More... | |
virtual void | deinit (Basda::DeviceAsync &=Basda::Device::s_async) |
deinit the device More... | |
virtual void | activate (DeviceAsync &=Basda::Device::s_async) |
activate the device More... | |
virtual void | deactivate (DeviceAsync &=Basda::Device::s_async) |
deactivate the device More... | |
virtual void | open (char *_devicePath)=0 |
Opens the DM device. More... | |
void | open (const Nice::Completion &_c) |
virtual void | open () |
open device More... | |
void | close (const Nice::Completion &_c) |
Closes an open DM device. More... | |
virtual void | close () |
close device More... | |
unsigned short int | getNodeID () |
Returns the Reflective Memory device node ID. More... | |
virtual unsigned short int | readNodeID ()=0 |
unsigned int | getBoardID () |
Returns the ID of the Reflective Memory board. More... | |
virtual unsigned int | readBoardID ()=0 |
unsigned int | getMemorySize () |
Returns the total amount of memory space available on the Reflective Memory device. More... | |
virtual unsigned int | readMemorySize ()=0 |
std::string | getDeviceName () |
Returns the Reflective Memory device name. More... | |
virtual std::string | readDeviceName ()=0 |
std::string | getDriverVersion () |
Returns the Reflective Memory device driver version. More... | |
virtual std::string | readDriverVersion ()=0 |
Nice::CompletionState | setNonlinearity (const std::vector< double > &_nonliniearityVector, Nice::PropertyFoo *) |
Set the weighting factor for the non-linearities. More... | |
void | setNonlinearity (const std::vector< double > &_nonliniearityVector) |
Set the weighting factor for the non-linearities. More... | |
std::vector< Ice::Double > | getNonlinearity () |
Returns the weighting factor for the non-linearities. More... | |
Nice::CompletionState | setSensitivity (const std::vector< double > &_sensitivityVector, Nice::PropertyFoo *) |
Set the vector of the different sensibilities of the single actuators. More... | |
void | setSensitivity (const std::vector< double > &_sensitivityVector) |
Set the vector of the different sensibilities of the single actuators. More... | |
std::vector< Ice::Double > | getSensitivity () |
Returns the vector of the different sensibilities of the single actuators. More... | |
Nice::CompletionState | setFlatPattern (const std::vector< double > &_flatPatternVector, Nice::PropertyFoo *) |
Set the flat pattern vector. More... | |
void | setFlatPattern (const std::vector< double > &_flatPattern) |
Set the flat pattern vector. More... | |
std::vector< Ice::Double > | getFlatPattern () |
Returns the flat pattern vector. More... | |
Nice::CompletionState | setInjection (const std::vector< std::vector< double > > &_injectionMatrix, Nice::PropertyFoo *) |
Set the injection matrix. More... | |
void | setInjection (const std::vector< std::vector< double > > &_injectionMatrix) |
Set the injection matrix. More... | |
std::vector< std::vector< double > > | getInjection () |
Returns the injection matrix. More... | |
Nice::CompletionState | setActuatorPositions (const std::vector< double > &_actuatorStrokesPercent, Nice::PropertyFoo *) |
Sends the position of each actuator to the Deformable Mirror. More... | |
virtual void | setActuatorPositions (const std::vector< double > &_actuatorStrokesPercent, const bool _pistonStep, const bool _addSensitivity, const bool _addNonLinearity, const bool _addFlatPattern) |
Sends the position of each actuator to the Deformable Mirror. More... | |
virtual void | applyStroke ()=0 |
virtual void | readStroke ()=0 |
void | readActuatorPositions (const Nice::Completion &_c) |
void | getActuatorPositions (std::vector< double > &_actuatorStrokesPercent) |
Nice::CompletionState | setModesAmplitude (const std::vector< double > &_modesAmplitude, Nice::PropertyFoo *) |
Compute the actuator positions based on amplitude vector and injection matrix and sends the position of each actuator to the Deformable Mirror. More... | |
void | setModesAmplitude (const std::vector< double > &_modesAmplitude, const bool _pistonStep, const bool _addSensitivity, const bool _addNonLinearity, const bool _addFlatPattern) |
Sends the position of each actuator to the Deformable Mirror. More... | |
bool | getLedStatus () |
Retrieves the current ON/OFF state of the Reflective Memory board's STATUS LED. More... | |
virtual bool | readLedStatus ()=0 |
Nice::CompletionState | setLedStatus (const bool &_ledStatus, Nice::PropertyFoo *) |
Sets the ON/OFF state of the Reflective Memory board's STATUS LED. More... | |
void | setLedStatus (const bool &_ledStatus) |
Sets the ON/OFF state of the Reflective Memory board's STATUS LED. More... | |
virtual void | writeLedStatus (const bool &_ledStatus)=0 |
![]() | |
Device (const Nice::JointPtr &_config) | |
constructor. This is an elementary (lazy) action which stores the name and gets configuration. More... | |
virtual | ~Device () |
destructor Does nothing More... | |
virtual void | setConfig (const Nice::JointPtr &_config) |
init with config tree ptr More... | |
Nice::JointPtr & | config () |
retrieve the property tree More... | |
std::string & | name () |
retrieve the name set at ctor time. More... | |
Device (const Nice::JointPtr &_config) | |
constructor. This is an elementary (lazy) action which stores the name and gets configuration. More... | |
virtual | ~Device () |
destructor Does nothing More... | |
virtual void | setConfig (const Nice::JointPtr &_config) |
init with config tree ptr More... | |
Nice::JointPtr & | config () |
retrieve the property tree More... | |
std::string & | name () |
retrieve the name set at ctor time. More... | |
Protected Attributes | |
Nice::U32 | m_lowestOffset |
std::vector< double > | m_actuatorStrokesPercent |
/** More... | |
std::vector< Nice::U16 > | m_actuatorStrokesVoltage |
This member holds voltage values of each actuators. More... | |
Nice::U16 | m_voltageLimitMin |
This member holds minimum voltage limit for actuators. More... | |
Nice::U16 | m_voltageLimitMean |
This member holds mean voltage limit for actuators. More... | |
Nice::U16 | m_voltageLimitMax |
This member holds maximum voltage limit for actuators. More... | |
double | m_actuatorStrokesMeanLast |
This member holds last mean actuator strokes. More... | |
Nice::U32 | m_totalActuators |
Member to store the total number of actuators inclusive blanks. More... | |
Nice::U32 | m_presentActuators |
Member to store the present number of actuators exclusive blanks. More... | |
std::vector< bool > | m_blankActuators |
List, which stores the blank actuators. More... | |
std::vector< double > | m_nonliniearityVector |
Member to store the weight vector for the non-linearities. More... | |
double | m_maxPiston |
Member to store the maximum value of the allowed piston. More... | |
double | m_maxPistonStep |
Member to store the maximum piston step between two successive commands. More... | |
std::vector< double > | m_sensitivityVector |
Member to store the sensitivity vector. More... | |
std::vector< double > | m_flatPatternVector |
Member to store the flat pattern. More... | |
std::vector< std::vector< double > > | m_injectionMatrix |
Member to store the injection matrix. More... | |
Nice::U32 | m_injectionModes |
Member to store the number of modes. More... | |
Nice::JointPtrVector | m_moduleNodes |
bool | m_connected |
Member variable indicates the status of the connection. More... | |
![]() | |
Nice::JointPtr | m_config |
Nice::JointPtr | m_cfg |
Nice::JointPtr | m_var |
std::string | m_name |
Private Member Functions | |
void | addSensitivity () |
The sensitivity of each actuator are add to the current actuator strokes. More... | |
void | addNonLinearity () |
The non-linearities of each actuator are add to the current actuator strokes. More... | |
void | addFlatPattern () |
The flat pattern are add to the current actuator strokes. More... | |
void | checkPiston (const bool _pistonStep) |
This method checks the piston and the maximum piston step of the Deformable Mirror. More... | |
void | convert2Voltage () |
This method convert the percental strokes of each actuators to the voltage values of each actuators. More... | |
void | convert2Percent (std::vector< double > &_actuatorStrokesPercent) |
This method convert the voltage values of each actuators to the percental strokes of each actuators. More... | |
double | mean () |
This method comnpute the mean value of m_actuatorStrokesPercent. More... | |
Private Attributes | |
::Nice::Mutex | m_mutex |
Mutex to avoid reading and writing at the same time. More... | |
Additional Inherited Members | |
![]() | |
static DeviceAsyncImpl | s_async |
This is the Deformable Mirror Service Interface.
This service contains all necessary logic and intelligence to control the Deformable Mirror (DM). It uses the Reflective Memory (RFM2G) as interface to the DM.
Basda::DmDevice::DmDevice | ( | const Nice::JointPtr & | _config | ) |
Basda::DmDevice::DmDevice | ( | const unsigned int | _totalActuators, |
const std::vector< unsigned int > & | _blankActuators, | ||
const unsigned short int | _voltageLimitMin, | ||
const unsigned short int | _voltageLimitMax, | ||
const double | _maxPiston, | ||
const double | _maxPistonStep, | ||
const std::vector< double > & | _nonliniearityVector, | ||
const std::vector< double > & | _sensitivityVector, | ||
const std::vector< double > & | _flatPatternVector, | ||
const std::vector< std::vector< double > > & | _injectionMatrix | ||
) |
constructor initialize the DM with following parameters
_totalActuators | the total number of actuators inclusive blanks |
_blankActuators | a vector with the IDs of the Blank actuators |
_voltageLimitMin | the minimum voltage limit |
_voltageLimitMax | the maximum voltage limit |
_maxPiston | the maximum value of the allowed piston |
_maxPistonStep | the maximum piston step between two successive commands |
_nonliniearityVector | weighting vector for the non-linearities |
_sensitivityVector | vector of the different sensibilities of the single actuators |
_flatPatternVector | vector contains the flat pattern |
_injectionMatrix | matrix contains the injection parameter |
|
virtual |
default destructor
- |
|
inlinevirtual |
activate the device
Implements Basda::Device.
|
private |
The flat pattern are add to the current actuator strokes.
This method change the private member m_actuatorStrokesPercent.
- |
|
private |
The non-linearities of each actuator are add to the current actuator strokes.
This method change the private member m_actuatorStrokesPercent.
- |
|
private |
The sensitivity of each actuator are add to the current actuator strokes.
This method change the private member m_actuatorStrokesPercent.
- |
|
pure virtual |
This method checks the piston and the maximum piston step of the Deformable Mirror.
Depends on the mode the piston of the Deformable Mirror is checked. In case the piston is to high the percental strokes of each actuators (m_actuatorStrokesPercent) are adjust to the maximal possible.
_pistonStep | see setActuatorPositions() |
void Basda::DmDevice::close | ( | const Nice::Completion & | _c | ) |
Closes an open DM device.
- |
|
inlinevirtual |
close device
Implements Basda::Device.
|
private |
This method convert the voltage values of each actuators to the percental strokes of each actuators.
_actuatorStrokesPercent | see getActuatorPositions() |
|
private |
This method convert the percental strokes of each actuators to the voltage values of each actuators.
This method change the private member m_actuatorStrokesVoltage.
- |
|
inlinevirtual |
deactivate the device
Implements Basda::Device.
|
inlinevirtual |
deinit the device
Implements Basda::Device.
void Basda::DmDevice::getActuatorPositions | ( | std::vector< double > & | _actuatorStrokesPercent | ) |
unsigned int Basda::DmDevice::getBoardID | ( | ) |
Returns the ID of the Reflective Memory board.
- |
Carma::Dm::closeDeviceException |
std::string Basda::DmDevice::getDeviceName | ( | ) |
Returns the Reflective Memory device name.
- |
Carma::Dm::closeDeviceException |
std::string Basda::DmDevice::getDriverVersion | ( | ) |
Returns the Reflective Memory device driver version.
- |
Carma::Dm::closeDeviceException |
std::vector< double > Basda::DmDevice::getFlatPattern | ( | ) |
Returns the flat pattern vector.
- |
std::vector< std::vector< double > > Basda::DmDevice::getInjection | ( | ) |
Returns the injection matrix.
- |
bool Basda::DmDevice::getLedStatus | ( | ) |
Retrieves the current ON/OFF state of the Reflective Memory board's STATUS LED.
- |
Carma::Dm::closeDeviceException |
unsigned int Basda::DmDevice::getMemorySize | ( | ) |
Returns the total amount of memory space available on the Reflective Memory device.
- |
Carma::Dm::closeDeviceException |
unsigned short int Basda::DmDevice::getNodeID | ( | ) |
Returns the Reflective Memory device node ID.
- |
Carma::Dm::closeDeviceException |
std::vector< double > Basda::DmDevice::getNonlinearity | ( | ) |
Returns the weighting factor for the non-linearities.
- |
std::vector< double > Basda::DmDevice::getSensitivity | ( | ) |
Returns the vector of the different sensibilities of the single actuators.
- |
|
virtual |
init the device
Implements Basda::Device.
|
private |
|
pure virtual |
Opens the DM device.
_devicePath | Path to special device file. Refer to your driver-specific manual for the format of DevicePath. |
Basda::Dm::closeDeviceException |
void Basda::DmDevice::open | ( | const Nice::Completion & | _c | ) |
|
inlinevirtual |
open device
Implements Basda::Device.
void Basda::DmDevice::readActuatorPositions | ( | const Nice::Completion & | _c | ) |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
inlinevirtual |
reset the device
Implements Basda::Device.
Nice::CompletionState Basda::DmDevice::setActuatorPositions | ( | const std::vector< double > & | _actuatorStrokesPercent, |
Nice::PropertyFoo * | |||
) |
Sends the position of each actuator to the Deformable Mirror.
The unit of the positions is percent and are in range of -1 .. +1.
_actuatorStrokesPercent | Pointer to where data is copied to Reflective Memory. Variable containing the current stroke values of all actuator. The values are in a range of -1 .. +1. The size of this vector depends on the amount of the Deformable Mirror actuator and have to be defined in the configuration file. |
|
virtual |
Sends the position of each actuator to the Deformable Mirror.
The unit of the positions is percent and are in range of -1 .. +1.
_actuatorStrokesPercent | Pointer to where data is copied to Reflective Memory. Variable containing the current stroke values of all actuator. The values are in a range of -1 .. +1. The size of this vector depends on the amount of the Deformable Mirror actuator and have to be defined in the configuration file. |
_pistonStep | The flag can be used to switch between the two modes:
|
_addSensitivity | The flag can be used to switch between the two modes:
|
_addNonLinearity | The flag can be used to switch between the two modes:
|
_addFlatPattern | The flag can be used to switch between the two modes:
|
Nice::CompletionState Basda::DmDevice::setFlatPattern | ( | const std::vector< double > & | _flatPatternVector, |
Nice::PropertyFoo * | |||
) |
Set the flat pattern vector.
_flatPattern | vector contains the flat pattern |
Basda::Dm::vectorSizeException |
void Basda::DmDevice::setFlatPattern | ( | const std::vector< double > & | _flatPattern | ) |
Set the flat pattern vector.
_flatPattern | vector contains the flat pattern |
Basda::Dm::vectorSizeException |
Nice::CompletionState Basda::DmDevice::setInjection | ( | const std::vector< std::vector< double > > & | _injectionMatrix, |
Nice::PropertyFoo * | |||
) |
Set the injection matrix.
_injectionMatrix | matrix contains the different modes for each actuator |
Basda::Dm::matrixSizeException |
void Basda::DmDevice::setInjection | ( | const std::vector< std::vector< double > > & | _injectionMatrix | ) |
Set the injection matrix.
_injectionMatrix | matrix contains the different modes for each actuator |
Basda::Dm::matrixSizeException |
Nice::CompletionState Basda::DmDevice::setLedStatus | ( | const bool & | _ledStatus, |
Nice::PropertyFoo * | |||
) |
Sets the ON/OFF state of the Reflective Memory board's STATUS LED.
Sets the ON/OFF state of the Reflective Memory board's STATUS LED.
_ledStatus | The state of the LED: true -> on, false -> off |
Basda::Dm::closeDeviceException |
Nice::CompletionState Basda::DmDevice::setModesAmplitude | ( | const std::vector< double > & | _modesAmplitude, |
Nice::PropertyFoo * | |||
) |
Compute the actuator positions based on amplitude vector and injection matrix and sends the position of each actuator to the Deformable Mirror.
_modesAmplitude | the amplitudes of the different modes |
Basda::Dm::closeDeviceException |
void Basda::DmDevice::setModesAmplitude | ( | const std::vector< double > & | _modesAmplitude, |
const bool | _pistonStep, | ||
const bool | _addSensitivity, | ||
const bool | _addNonLinearity, | ||
const bool | _addFlatPattern | ||
) |
Sends the position of each actuator to the Deformable Mirror.
The unit of the positions is percent and are in range of -1 .. +1.
_actuatorStrokesPercent | Pointer to where data is copied to Reflective Memory. Variable containing the current stroke values of all actuator. The values are in a range of -1 .. +1. The size of this vector depends on the amount of the Deformable Mirror actuator and have to be defined in the configuration file. |
_pistonStep | The flag can be used to switch between the two modes:
|
_addSensitivity | The flag can be used to switch between the two modes:
|
_addNonLinearity | The flag can be used to switch between the two modes:
|
_addFlatPattern | The flag can be used to switch between the two modes:
|
Nice::CompletionState Basda::DmDevice::setNonlinearity | ( | const std::vector< double > & | _nonliniearityVector, |
Nice::PropertyFoo * | |||
) |
Set the weighting factor for the non-linearities.
_nonliniearityVector | weighting vector for the non-linearities |
void Basda::DmDevice::setNonlinearity | ( | const std::vector< double > & | _nonliniearityVector | ) |
Set the weighting factor for the non-linearities.
_nonliniearityVector | weighting vector for the non-linearities |
Nice::CompletionState Basda::DmDevice::setSensitivity | ( | const std::vector< double > & | _sensitivityVector, |
Nice::PropertyFoo * | |||
) |
Set the vector of the different sensibilities of the single actuators.
_sensitivityVector | vector of the different sensibilities of the single actuators |
void Basda::DmDevice::setSensitivity | ( | const std::vector< double > & | _sensitivityVector | ) |
Set the vector of the different sensibilities of the single actuators.
_sensitivityVector | vector of the different sensibilities of the single actuators |
|
inlinevirtual |
version
Implements Basda::Device.
|
protected |
This member holds last mean actuator strokes.
This is necessary to know check the piston step distance.
|
protected |
/**
This member holds percental strokes of each actuators.
The size of this vector depends on the amount of the Deformable Mirror actuator and have to be defined in the configuration file.
|
protected |
This member holds voltage values of each actuators.
The size of this vector depends on the amount of the Deformable Mirror actuator and have to be defined in the configuration file.
|
protected |
List, which stores the blank actuators.
It have to be defined in the configuration file.
|
protected |
Member variable indicates the status of the connection.
true - connected; false - disconnected
|
protected |
Member to store the flat pattern.
It have to be defined in the configuration file.
|
protected |
Member to store the injection matrix.
It have to be defined in the configuration file.
|
protected |
Member to store the number of modes.
|
protected |
|
protected |
Member to store the maximum value of the allowed piston.
It have to be defined in the configuration file.
|
protected |
Member to store the maximum piston step between two successive commands.
It have to be defined in the configuration file.
|
protected |
|
private |
Mutex to avoid reading and writing at the same time.
|
protected |
Member to store the weight vector for the non-linearities.
It have to be defined in the configuration file.
|
protected |
Member to store the present number of actuators exclusive blanks.
It have to be defined in the configuration file.
|
protected |
Member to store the sensitivity vector.
It have to be defined in the configuration file.
|
protected |
Member to store the total number of actuators inclusive blanks.
It have to be defined in the configuration file.
|
protected |
This member holds maximum voltage limit for actuators.
The conversion from percental strokes to voltage values and voltage to percental strokes based on this value.
|
protected |
This member holds mean voltage limit for actuators.
The conversion from percental strokes to voltage values and voltage to percental strokes based on this value.
|
protected |
This member holds minimum voltage limit for actuators.
The conversion from percental strokes to voltage values and voltage to percental strokes based on this value.