Motorcortex Core  version: 2.7.6
mcx::drive::Diagnostics Class Reference
Inheritance diagram for mcx::drive::Diagnostics:
Collaboration diagram for mcx::drive::Diagnostics:

Public Member Functions

 Diagnostics (unsigned int number_of_axis=1, unsigned int number_of_diagnostic_codes=3)
 
- Public Member Functions inherited from mcx::container::Module
 Module ()
 Default constructor.
 
virtual ~Module ()=default
 Default destructor.
 
 Module (const Module &orig)=delete
 Copy constructors are deleted.
 
Moduleoperator= (const Module &)=delete
 Copy constructors are deleted.
 
void create (const char *name, parameter_server::Parameter *parameter_server, uint64_t dt_micro_s=0)
 Executes 'Create' phase of initialization. More...
 
void create (const char *name, parameter_server::Parameter *parameter_server, uint64_t dt_micro_s, parameter_server::UserGroup owner_group, uint32_t permissions=parameter_server::default_permissions)
 Extended interface with access permissions. More...
 
bool initPhase1 ()
 Executes initialization of the parameter tree phase. More...
 
bool initPhase2 ()
 Initialization, which require parameter tree to be complete and loaded. More...
 
bool startOp ()
 Final initialization before entering Operation mode. More...
 
bool stopOp ()
 Stops Operation mode, switches back to PHASE2. More...
 
bool iterate (const TaskTime &task_time, UserTime *user_time)
 Iterates an execution cycle of the module. More...
 
void setName (const char *name)
 Sets the name of the module. More...
 
const char * getName () const
 Returns the name of the module. More...
 
void setDtMicroSec (uint64_t micro_sec)
 Sets a cycle time of module and its submodules in microseconds. More...
 
uint64_t getDtMicroSec () const
 Returns a cycle time as an integer in microseconds. More...
 
void setDtSec (double sec)
 Sets a cycle time of module and its submodules in seconds. More...
 
double getDtSec () const
 
ModuleStates getState () const
 Returns an actual state. More...
 
void setEvent (ModuleEvents event)
 Command an event. More...
 
ModuleErrors getError () const
 Returns active error code. More...
 

Protected Member Functions

void create_ (const char *name, parameter_server::Parameter *parameter_server, uint64_t dt_micro_s) override
 User-defined callback, which is executed during 'Create' phase. More...
 
bool initPhase1_ () override
 User-defined callback to register parameters in the tree. More...
 
bool initPhase2_ () override
 User-defined callback after the parameter tree is ready. More...
 
bool startOp_ () override
 User-defined callback before entering Operation mode. More...
 
bool stopOp_ () override
 User-defined callback before to stop Operation mode. More...
 
bool iterateOp_ (const container::TaskTime &system_time, container::UserTime *user_time) override
 User-defined callback which is called during Operation mode. More...
 
- Protected Member Functions inherited from mcx::container::Module
virtual bool iteratePreOp_ (const TaskTime &system_time, UserTime *user_time)
 User-defined callback which is called during Phase 2. More...
 
void createSubmodule (Module *module, const char *name)
 Creates and registers submodule. More...
 
template<typename T >
void createSubmodules (utils::span< T > module_array, const char *basename)
 Creates and registers an array of submodules. More...
 
void setType (const char *name)
 Sets a type of the module. More...
 
template<size_t buffer_size = parameter_server::DEFAULT_INPUT_BUFFER_LENGTH>
parameter_server::ParamHandle addParameter (const char *id, parameter_server::ParameterType param_type, char *str_ptr, size_t length)
 Helper function to register C-string member variable in the parameter tree. More...
 
template<typename T , size_t buffer_size = parameter_server::DEFAULT_INPUT_BUFFER_LENGTH, add_visitable::EnableIfNotVisitable< T > = true>
parameter_server::ParamHandle addParameter (const char *id, parameter_server::ParameterType param_type, T *value_ptr, size_t length=1, parameter_server::Unit param_unit=parameter_server::Unit::undefined)
 Helper function to register member variable of in the parameter tree. More...
 
template<typename T , size_t buffer_size = parameter_server::DEFAULT_INPUT_BUFFER_LENGTH, add_visitable::EnableIfVisitable< T > = true>
parameter_server::GroupHandle addParameter (const char *id, parameter_server::ParameterType param_type, T *value_ptr, size_t length=1, parameter_server::Unit param_unit=parameter_server::Unit::undefined)
 Helper function to register visitable PODs in the parameter tree. More...
 
template<typename T , size_t buffer_size = parameter_server::DEFAULT_INPUT_BUFFER_LENGTH>
parameter_server::ParamHandle addParameter (const char *id, parameter_server::ParameterType param_type, parameter_server::DataType data_type, T *value_ptr, size_t length=1, parameter_server::Unit param_unit=parameter_server::Unit::undefined)
 Helper function to register types, which cannot be deduced. More...
 
parameter_server::SubHandle subscribe (const char *path)
 Helper function to subscribe for the parameter's update. More...
 
parameter_server::ReqHandle request (const char *path)
 Helper function to request a parameter's value. More...
 
parameter_server::PubHandle publish (const char *path)
 Helper function to update parameter's value. More...
 
parameter_server::ParametergetParameterRoot ()
 Returns the root of the parameter tree. More...
 
parameter_server::ParametergetLocalBranch ()
 Returns the root of the local branch. More...
 

Additional Inherited Members

- Public Types inherited from mcx::container::Module
enum  ModuleStates {
  NOT_INITIALIZED = 0, PHASE_0 = 1, PHASE0 = 2, PHASE0_1 = 3,
  PHASE1 = 4, PHASE1_2 = 5, PHASE2 = 6, PHASE2_OP = 7,
  OP = 8, OP_PHASE2 = 9, PHASE2_NOT_INIT = 10
}
 
enum  ModuleErrors { NO_ERROR = 0, NO_CALLBACK_DEFINED = 1, CALLBACK_FAILED = 2, WRONG_STATE = 3 }
 
enum  ModuleEvents {
  EMPTY = -1, STOP = 0, START = 1, PAUSE = 2,
  ACK = 0xFF
}
 

Member Function Documentation

◆ create_()

void mcx::drive::Diagnostics::create_ ( const char *  name,
parameter_server::Parameter parameter_server,
uint64_t  dt_micro_s 
)
overrideprotectedvirtual

User-defined callback, which is executed during 'Create' phase.

Parameters
name- unique name.
parameter_server- pointer to the root.
dt_micro_s- cycle time in microseconds.
See also
Module::create

Implements mcx::container::Module.

◆ initPhase1_()

bool mcx::drive::Diagnostics::initPhase1_ ( )
overrideprotectedvirtual

User-defined callback to register parameters in the tree.

Returns
user callback should return true on success, otherwise the state machine won't progress.
See also
Module::initPhase1

Implements mcx::container::Module.

◆ initPhase2_()

bool mcx::drive::Diagnostics::initPhase2_ ( )
overrideprotectedvirtual

User-defined callback after the parameter tree is ready.

This callback could be used for additional initialization. During initPhase2_ tree structure is complete, initial values are NOT loaded.

Returns
user callback should return true on success, otherwise the state machine won't progress.
See also
Module::initPhase2

Implements mcx::container::Module.

◆ iterateOp_()

bool mcx::drive::Diagnostics::iterateOp_ ( const container::TaskTime system_time,
container::UserTime user_time 
)
overrideprotectedvirtual

User-defined callback which is called during Operation mode.

Returns
user callback should return true on success, otherwise the state machine won't progress.
See also
Module::iterate

Implements mcx::container::Module.

◆ startOp_()

bool mcx::drive::Diagnostics::startOp_ ( )
overrideprotectedvirtual

User-defined callback before entering Operation mode.

During startOp_ callback user can safely access initialized parameter tree. startOp_ operation is part of the first iterateOp_ cycle, that is why it should be relatively short. Otherwise fist cycle time will be violated.

Returns
user callback should return true on success, otherwise the state machine won't progress.
See also
Module::startOp

Implements mcx::container::Module.

◆ stopOp_()

bool mcx::drive::Diagnostics::stopOp_ ( )
overrideprotectedvirtual

User-defined callback before to stop Operation mode.

Returns
user callback should return true on success, otherwise the state machine won't progress.
See also
Module::stopOp

Implements mcx::container::Module.


The documentation for this class was generated from the following files: