![]() |
Scanframe Modular Application 0.1.0
|
Pure virtual class for implementation of motion controllers. More...
#include <Controller.h>
Classes | |
| struct | Parameters |
| Arguments for when creating a controller implementation. More... | |
| class | Axis |
| Interface class to access Axis properties and functions. More... | |
Public Types | |
| enum | EStatus : int { csError = -1 , csUninitialized = 0 , csInitialized , csUnhomed , csHoming , csReady } |
| States the controller can have. More... | |
| typedef Value::flt_type | value_type |
| Use the floating point type of the Value class. | |
Public Member Functions | |
| Controller (const Parameters &) | |
| Constructor for passing general structure for derived classes. | |
| virtual | ~Controller () |
| Virtual destructor for derived classes. | |
| void | destroy () |
| Must be called from a derived class in the destructor before anything. | |
| bool | initialize () |
| Initializes the hardware for operation and starts the thread when doInitialize returns true. | |
| bool | uninitialize () |
| Un-initializes the hardware. | |
| const ControllerListener::emitter_type & | getEventEmitter () const |
| Attaches the event handler for events. | |
| bool | storeSettings (bool rd) |
| Reads or writes the non exported parameters/settings to profile. | |
| bool | homeAxes (bool skip) |
| Start homing procedure and returns true when successfully started. When skip has been passed the implementation tries to skip homing. | |
| bool | setJoystick (EJoystickCmd jsc) |
| Enables or disables the joystick mode of the controller. | |
| EJoystickCmd | getJoystick () const |
| Returns the joystick state. Off=0, Stop=1 and On=2. | |
| EAxisLocation | getJoystickAxis () const |
| Returns the current selected axis on the joystick control. This does not mean it is enabled. | |
| bool | setJoystickAxis (EAxisLocation axis_loc) |
| Sets the selected axis for the joystick enabled or not. | |
| EAxisLocation | getPopAxis () const |
| Returns the current selected axis on the pop event source. | |
| bool | setPopAxis (EAxisLocation al) |
| Sets the selected axis for the pop event source. | |
| bool | setTriggerEnable (bool enable) |
| Sets the trigger enable. | |
| bool | getTriggerEnable () const |
| Gets the trigger enable status. | |
| value_type | setTriggerFreq (value_type freq) |
| Sets the trigger internal frequency generator and returns the clipped or rounded value. | |
| value_type | getTriggerFreq () const |
| Returns the trigger internal frequency generator. | |
| bool | setMovePos (EMovePosCmd mpc) |
| Executes a passed move position command. | |
| EMovePosCmd | getMovePos () const |
| Returns the current active position command. When moving position the command returned will eventually become mcSTOP. | |
| bool | setMoveVel (EMoveVelCmd mvc) |
| Executes a passed move velocity command. | |
| EMoveVelCmd | getMoveVel () const |
| Returns the current active velocity command. | |
| bool | setMoveCon (EMoveConCmd mcc) |
| Executes a passed move continuous command. | |
| EMoveConCmd | getMoveCon () const |
| Returns the current active velocity command. | |
| Axis & | getAxis (int axis_loc) |
| Gets a reference to the axis at the specified location. | |
| const Axis & | getAxis (int axis_loc) const |
| Gets a const reference to the axis at the specified location. | |
| Axis & | getPhysicalAxis (int axis_num) |
| Returns the physical axis location of the passed axis number. | |
| virtual void | addPropertyPages (PropertySheetDialog *sheet) |
| Adds controller specific property pages to the passed sheet. | |
| bool | getCurrent (EAxisValueType avt, AxesCoord &ac) const |
| Gets the current axes values. | |
| bool | setCurrent (EAxisValueType avt, const AxesCoord &coord) |
| Sets the current axes values. | |
| bool | getTarget (EAxisValueType avt, AxesCoord &coord) const |
| Gets the target set for this axis. | |
| bool | setTarget (EAxisValueType avt, const AxesCoord &coord) |
| Set the target value type. | |
| bool | setTarget (const AxesCoord &pos, const AxesCoord &vel, const AxesCoord &acc, bool linear) |
| Set the target. | |
| bool | setMode (EAxisMode am, const AxesCoord &ac, EAxisMode am_def=amDISABLED) |
| Sets the mode according the in the coord specified axes. | |
| bool | setTriggerAxis (EAxisLocation al) |
| Sets the axis which pulses are used to derive the trigger pulses. | |
| EAxisLocation | getTriggerAxis () const |
| Gets the current selected trigger axis. | |
| value_type | getTriggerDensity () const |
| Gets the density of measurements in radians or meters depending on selected axis. | |
| bool | setTriggerDensity (value_type td) |
| Sets the density of measurements in rads or m depending on selected axis. | |
| bool | setTriggerMode (bool intern) |
| Sets Trigger mode. | |
| bool | getTriggerMode () const |
| Gets the trigger mode. | |
| bool | setChuckJaw (EChuckJaw cj) |
| Sets chuck-jaw state. | |
| EChuckJaw | getChuckJaw () const |
| Gets chuck-jaw state. | |
| bool | isMovePosCompleted () const |
| Returns true if the last position move is completed. | |
| bool | isMoveVelCompleted () const |
| Returns true if the velocity move is completed. | |
| bool | isMoveConCompleted () const |
| Returns true if the contineous move is completed. | |
| bool | isMoving () const |
| Function testing for movement of position and velocity mode. When there is an abort state of-any-of the motion groups the axis is considered as not moving. | |
| bool | setPosition (EAxisLocation al, value_type value) |
| Sets the current position of single axis. | |
| bool | setPosition (const AxesCoord &ac) |
| Sets the current position of all axis. | |
| AxesCoord & | normalize (AxesCoord &pos) const |
| normalize the passed position for all unlimited rotation axes. Uses accuracy to find the actual position to normalize. The passed value is also returned. | |
| AxesCoord | normalized (const AxesCoord &dist) const |
| normalize the passed position for all unlimited rotation axes. Uses accuracy to find the actual position to normalize. The passed value is also returned. | |
| AxisLocations | getRadialUnlimited () const |
| Gets a bitmap set of radial unlimited axis locations. | |
| virtual void | openDebugger () |
| Opens a debugger dialog for the motion controller if any. | |
| bool | isReady () const |
| Returns true if the current status is READY. | |
| const char * | getStatusName () const |
| Gets the current status as a name. | |
| unsigned | getAxisCount () const |
| Gets the amount real implemented axes. | |
| std::string | getLastErrorText () const |
| Gets the last error if there is one. | |
| bool | getParamInfo (IdType id, ParamInfo &info) const |
| Retrieve information about the passed param id. | |
| bool | getParam (IdType id, Value &value) const |
| Returns the value of the specified parameter id. When the ID does not exist it returns false. | |
| bool | setParam (IdType id, const Value &value, bool skip_event) |
| Sets an interface parameter and notifies hooked user when skip_event is false. | |
| bool | setGetParam (IdType id, Value &value, bool skip_event) |
| Sets and immediately gets the same value again clipped or not. When skip event is true the callParamHook is not called. | |
| virtual bool | handleParam (IdType id, ParamInfo *info, const Value *setval, Value *getval)=0 |
| This function must be overridden to handle the interface parameters. When info in non-null the parameter info must be filled in. When the set or get value is non-null the value is set and/or retrieved. | |
| virtual IdType | getParamId (EParam param, int axis=std::numeric_limits< int >::max()) const=0 |
| Gets the ID of the parameter for the specified gate. Value std::numeric_limits<int>::max() tells the implementation to ignore the parameter. | |
| virtual bool | enumParamIds (IdList &ids) const=0 |
| Enumerate interface parameters ids. | |
| void | setParamHook (NotifyProc proc, void *data) |
| Sets a procedure hook for the interface implementation to be called when the value changes as a result of the implementation itself. | |
| void | setResultHook (NotifyProc proc, void *data) |
| Sets a procedure hook for the interface implementation to be called when there ias data result has data. | |
| virtual IdType | getResultId (EResult result, int axis=std::numeric_limits< int >::max()) const=0 |
| Gets the ID of the result for the specified gate. Value std::numeric_limits<int>::max() tells the implementation to ignore the result. | |
| virtual bool | enumResultIds (IdList &ids) const=0 |
| Enumerate interface results ids. | |
| bool | getResultInfo (IdType id, ResultInfo &info) const |
| Retrieve information about the passed result id. | |
| virtual bool | handleResult (IdType id, ResultInfo *info, BufferInfo *buf_info)=0 |
| This function must be overridden to handle the interface results. | |
| bool | getResultBuffer (IdType id, BufferInfo &buf_info) |
| Gets the result buffer associated with the result ID passed in the result hook at the time of the call. | |
| bool | getAccuracy (AxesCoord &accuracy) const |
| Gets the accuracy of positions of the implementation for a coords compare. | |
| bool | getResolution (AxesCoord &resolution) const |
| Gets the resolution on all axis for the implementation. | |
| bool | getMinMax (EAxisMinMax amm, AxesCoord &coord) const |
| Gets the current axes extremes. | |
| bool | setOffset (const AxesCoord &coord) |
| Sets the position offset for all position related parameters of all axes. | |
| bool | getOffset (AxesCoord &coord) const |
| Returns the current offset for all axes. | |
| std::string | getProfilePath () const |
| Returns the configuration profile path of this implementation. | |
Static Public Member Functions | |
| static const char * | getAxisName (int axis_loc) |
| Gets the name of the axis. | |
| static const char * | getAxisDescription (int axis_loc) |
| Gets the description of the axis. | |
| static const char * | getStatusName (EStatus status) |
| Gets the status name of the current status. | |
Protected Member Functions | |
| virtual bool | doInitialize (bool)=0 |
| Initialization function which must be overridden by a derived class. Should check the hardware configuration. | |
| virtual bool | doSetPosition (EAxisLocation al, value_type) |
| Can be overridden by a derived class. Sets the current position. | |
| virtual bool | doHomeAxes (bool skip) |
| Does the real execution of the home function and must be overridden. When skip has been passed the implementation tries to skip homing. | |
| void | setLastErrorText (const char *text) |
| Derived classes can set the error text for the function. | |
| void | setStatus (EStatus status) |
| Used by derived classes to set the controllers status. | |
| EStatus | getStatus () const |
| Gets the status value. | |
| void | callParamHook (IdType id) |
| Calls the hooked function if it exists. Passing the set data pointer and the ID of the effected parameter. | |
| void | callResultHook (IdType id) |
| Calls the hooked function if it exists. Passing the set data pointer and the ID of the effected result. | |
| void | sendPopEvent () |
| Sends a POP event to the hooked event handlers. Is to be called by the implementation to signal that a new rotation has begun. | |
Pure virtual class for implementation of motion controllers.
Use the floating point type of the Value class.
| enum sf::gmi::Controller::EStatus : int |
| sf::gmi::Controller::Controller | ( | const Parameters & | ) |
Constructor for passing general structure for derived classes.
|
virtual |
Virtual destructor for derived classes.
|
virtual |
Adds controller specific property pages to the passed sheet.
|
protected |
Calls the hooked function if it exists. Passing the set data pointer and the ID of the effected parameter.
|
protected |
Calls the hooked function if it exists. Passing the set data pointer and the ID of the effected result.
| void sf::gmi::Controller::destroy | ( | ) |
Must be called from a derived class in the destructor before anything.
|
protectedvirtual |
Does the real execution of the home function and must be overridden. When skip has been passed the implementation tries to skip homing.
|
protectedpure virtual |
Initialization function which must be overridden by a derived class. Should check the hardware configuration.
|
protectedvirtual |
Can be overridden by a derived class. Sets the current position.
|
pure virtual |
Enumerate interface parameters ids.
|
pure virtual |
Enumerate interface results ids.
| bool sf::gmi::Controller::getAccuracy | ( | AxesCoord & | accuracy | ) | const |
Gets the accuracy of positions of the implementation for a coords compare.
| Axis & sf::gmi::Controller::getAxis | ( | int | axis_loc | ) |
Gets a reference to the axis at the specified location.
| const Axis & sf::gmi::Controller::getAxis | ( | int | axis_loc | ) | const |
Gets a const reference to the axis at the specified location.
| unsigned sf::gmi::Controller::getAxisCount | ( | ) | const |
Gets the amount real implemented axes.
|
static |
Gets the description of the axis.
|
static |
Gets the name of the axis.
| EChuckJaw sf::gmi::Controller::getChuckJaw | ( | ) | const |
Gets chuck-jaw state.
| bool sf::gmi::Controller::getCurrent | ( | EAxisValueType | avt, |
| AxesCoord & | ac ) const |
Gets the current axes values.
| avt | Axis value type. |
| ac | Axes coordinate containing the values. |
| const ControllerListener::emitter_type & sf::gmi::Controller::getEventEmitter | ( | ) | const |
Attaches the event handler for events.
| EJoystickCmd sf::gmi::Controller::getJoystick | ( | ) | const |
Returns the joystick state. Off=0, Stop=1 and On=2.
Returns the current selected axis on the joystick control. This does not mean it is enabled.
| std::string sf::gmi::Controller::getLastErrorText | ( | ) | const |
Gets the last error if there is one.
| bool sf::gmi::Controller::getMinMax | ( | EAxisMinMax | amm, |
| AxesCoord & | coord ) const |
Gets the current axes extremes.
| EMoveConCmd sf::gmi::Controller::getMoveCon | ( | ) | const |
Returns the current active velocity command.
| EMovePosCmd sf::gmi::Controller::getMovePos | ( | ) | const |
Returns the current active position command. When moving position the command returned will eventually become mcSTOP.
| EMoveVelCmd sf::gmi::Controller::getMoveVel | ( | ) | const |
Returns the current active velocity command.
| bool sf::gmi::Controller::getOffset | ( | AxesCoord & | coord | ) | const |
Returns the current offset for all axes.
| bool sf::gmi::Controller::getParam | ( | IdType | id, |
| Value & | value ) const |
Returns the value of the specified parameter id. When the ID does not exist it returns false.
|
pure virtual |
Gets the ID of the parameter for the specified gate. Value std::numeric_limits<int>::max() tells the implementation to ignore the parameter.
| bool sf::gmi::Controller::getParamInfo | ( | IdType | id, |
| ParamInfo & | info ) const |
Retrieve information about the passed param id.
| Axis & sf::gmi::Controller::getPhysicalAxis | ( | int | axis_num | ) |
Returns the physical axis location of the passed axis number.
| EAxisLocation sf::gmi::Controller::getPopAxis | ( | ) | const |
Returns the current selected axis on the pop event source.
| std::string sf::gmi::Controller::getProfilePath | ( | ) | const |
Returns the configuration profile path of this implementation.
Gets a bitmap set of radial unlimited axis locations.
| bool sf::gmi::Controller::getResolution | ( | AxesCoord & | resolution | ) | const |
Gets the resolution on all axis for the implementation.
| bool sf::gmi::Controller::getResultBuffer | ( | IdType | id, |
| BufferInfo & | buf_info ) |
Gets the result buffer associated with the result ID passed in the result hook at the time of the call.
|
pure virtual |
Gets the ID of the result for the specified gate. Value std::numeric_limits<int>::max() tells the implementation to ignore the result.
| bool sf::gmi::Controller::getResultInfo | ( | IdType | id, |
| ResultInfo & | info ) const |
Retrieve information about the passed result id.
|
protected |
Gets the status value.
| const char * sf::gmi::Controller::getStatusName | ( | ) | const |
Gets the current status as a name.
|
static |
Gets the status name of the current status.
| bool sf::gmi::Controller::getTarget | ( | EAxisValueType | avt, |
| AxesCoord & | coord ) const |
Gets the target set for this axis.
| avt | Axis value type. |
| coord | Axes coordinate containing the values. |
Gets the current selected trigger axis.
Gets the density of measurements in radians or meters depending on selected axis.
| bool sf::gmi::Controller::getTriggerEnable | ( | ) | const |
Gets the trigger enable status.
Returns the trigger internal frequency generator.
| bool sf::gmi::Controller::getTriggerMode | ( | ) | const |
Gets the trigger mode.
|
pure virtual |
This function must be overridden to handle the interface parameters. When info in non-null the parameter info must be filled in. When the set or get value is non-null the value is set and/or retrieved.
|
pure virtual |
This function must be overridden to handle the interface results.
| bool sf::gmi::Controller::homeAxes | ( | bool | skip | ) |
Start homing procedure and returns true when successfully started. When skip has been passed the implementation tries to skip homing.
| bool sf::gmi::Controller::initialize | ( | ) |
Initializes the hardware for operation and starts the thread when doInitialize returns true.
| bool sf::gmi::Controller::isMoveConCompleted | ( | ) | const |
Returns true if the contineous move is completed.
| bool sf::gmi::Controller::isMovePosCompleted | ( | ) | const |
Returns true if the last position move is completed.
| bool sf::gmi::Controller::isMoveVelCompleted | ( | ) | const |
Returns true if the velocity move is completed.
| bool sf::gmi::Controller::isMoving | ( | ) | const |
Function testing for movement of position and velocity mode. When there is an abort state of-any-of the motion groups the axis is considered as not moving.
|
inline |
Returns true if the current status is READY.
| AxesCoord & sf::gmi::Controller::normalize | ( | AxesCoord & | pos | ) | const |
normalize the passed position for all unlimited rotation axes. Uses accuracy to find the actual position to normalize. The passed value is also returned.
| pos | Axes coordinate to modify. |
| AxesCoord sf::gmi::Controller::normalized | ( | const AxesCoord & | dist | ) | const |
normalize the passed position for all unlimited rotation axes. Uses accuracy to find the actual position to normalize. The passed value is also returned.
| dist | Axes distance coordinate to normalize. |
|
inlinevirtual |
Opens a debugger dialog for the motion controller if any.
|
protected |
Sends a POP event to the hooked event handlers. Is to be called by the implementation to signal that a new rotation has begun.
| bool sf::gmi::Controller::setChuckJaw | ( | EChuckJaw | cj | ) |
Sets chuck-jaw state.
| bool sf::gmi::Controller::setCurrent | ( | EAxisValueType | avt, |
| const AxesCoord & | coord ) |
Sets the current axes values.
| avt | Axis value type. |
| coord | Axes coordinate containing the values. |
| bool sf::gmi::Controller::setGetParam | ( | IdType | id, |
| Value & | value, | ||
| bool | skip_event ) |
Sets and immediately gets the same value again clipped or not. When skip event is true the callParamHook is not called.
| bool sf::gmi::Controller::setJoystick | ( | EJoystickCmd | jsc | ) |
Enables or disables the joystick mode of the controller.
| bool sf::gmi::Controller::setJoystickAxis | ( | EAxisLocation | axis_loc | ) |
Sets the selected axis for the joystick enabled or not.
|
protected |
Derived classes can set the error text for the function.
| bool sf::gmi::Controller::setMode | ( | EAxisMode | am, |
| const AxesCoord & | ac, | ||
| EAxisMode | am_def = amDISABLED ) |
Sets the mode according the in the coord specified axes.
| am | Axis mode. |
| ac | |
| am_def | Default value for the axes when not specified. |
| bool sf::gmi::Controller::setMoveCon | ( | EMoveConCmd | mcc | ) |
Executes a passed move continuous command.
| bool sf::gmi::Controller::setMovePos | ( | EMovePosCmd | mpc | ) |
Executes a passed move position command.
| bool sf::gmi::Controller::setMoveVel | ( | EMoveVelCmd | mvc | ) |
Executes a passed move velocity command.
| bool sf::gmi::Controller::setOffset | ( | const AxesCoord & | coord | ) |
Sets the position offset for all position related parameters of all axes.
| bool sf::gmi::Controller::setParam | ( | IdType | id, |
| const Value & | value, | ||
| bool | skip_event ) |
Sets an interface parameter and notifies hooked user when skip_event is false.
| void sf::gmi::Controller::setParamHook | ( | NotifyProc | proc, |
| void * | data ) |
Sets a procedure hook for the interface implementation to be called when the value changes as a result of the implementation itself.
| bool sf::gmi::Controller::setPopAxis | ( | EAxisLocation | al | ) |
Sets the selected axis for the pop event source.
| bool sf::gmi::Controller::setPosition | ( | const AxesCoord & | ac | ) |
Sets the current position of all axis.
| bool sf::gmi::Controller::setPosition | ( | EAxisLocation | al, |
| value_type | value ) |
Sets the current position of single axis.
| void sf::gmi::Controller::setResultHook | ( | NotifyProc | proc, |
| void * | data ) |
Sets a procedure hook for the interface implementation to be called when there ias data result has data.
|
protected |
Used by derived classes to set the controllers status.
| bool sf::gmi::Controller::setTarget | ( | const AxesCoord & | pos, |
| const AxesCoord & | vel, | ||
| const AxesCoord & | acc, | ||
| bool | linear ) |
Set the target.
| pos | Axes positions. |
| vel | Axes velocities. |
| acc | Axes accelerations. |
| linear |
| bool sf::gmi::Controller::setTarget | ( | EAxisValueType | avt, |
| const AxesCoord & | coord ) |
Set the target value type.
| avt | Axis value type. |
| coord | Axes coordinate containing the values. |
| bool sf::gmi::Controller::setTriggerAxis | ( | EAxisLocation | al | ) |
Sets the axis which pulses are used to derive the trigger pulses.
| bool sf::gmi::Controller::setTriggerDensity | ( | value_type | td | ) |
Sets the density of measurements in rads or m depending on selected axis.
| bool sf::gmi::Controller::setTriggerEnable | ( | bool | enable | ) |
Sets the trigger enable.
Sets the trigger internal frequency generator and returns the clipped or rounded value.
| bool sf::gmi::Controller::setTriggerMode | ( | bool | intern | ) |
Sets Trigger mode.
| bool sf::gmi::Controller::storeSettings | ( | bool | rd | ) |
Reads or writes the non exported parameters/settings to profile.
| rd | When true settings are read. |
| bool sf::gmi::Controller::uninitialize | ( | ) |
Un-initializes the hardware.