mcx::watchdog::Module

mcx::watchdog::Module

Inherits from mcx::container::Module

Public Functions

Name
Module() =delete
Module(utils::SystemMode system_mode, WatchdogType type, const char * device)
virtual ~Module() override
Default destructor.

Protected Functions

Name
virtual 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.
virtual bool initPhase1_() override
User-defined callback to register parameters in the tree.
virtual bool initPhase2_() override
User-defined callback after the parameter tree is ready.
virtual bool startOp_() override
User-defined callback before entering Operation mode.
virtual bool stopOp_() override
User-defined callback before to stop Operation mode.
virtual bool iterateOp_(const container::TaskTime & system_time, container::UserTime * user_time) override
User-defined callback which is called during Operation mode.

Additional inherited members

Public Types inherited from mcx::container::Module

Name
enum class ModuleStates { NOT_INITIALIZED, PHASE_0, PHASE0, PHASE0_1, PHASE1, PHASE1_2, PHASE2, PHASE2_OP, OP, OP_PHASE2, PHASE2_NOT_INIT}
enum class ModuleErrors { NO_ERROR, NO_CALLBACK_DEFINED, CALLBACK_FAILED, WRONG_STATE}
enum class ModuleEvents { EMPTY, STOP, START, PAUSE, ACK}

Public Functions inherited from mcx::container::Module

Name
Module & operator=(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.
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.
bool initPhase1()
Executes initialization of the parameter tree phase.
bool initPhase2()
Initialization, which require parameter tree to be complete and loaded.
bool startOp()
Final initialization before entering Operation mode.
bool stopOp()
Stops Operation mode, switches back to PHASE2.
bool iterate(const TaskTime & task_time, UserTime * user_time)
Iterates an execution cycle of the module.
void setName(const char * name)
Sets the name of the module.
const char * getName() const
Returns the name of the module.
void setDtMicroSec(uint64_t micro_sec)
Sets a cycle time of module and its submodules in microseconds.
uint64_t getDtMicroSec() const
Returns a cycle time as an integer in microseconds.
void setDtSec(double sec)
Sets a cycle time of module and its submodules in seconds.
double getDtSec() const
ModuleStates getState() const
Returns an actual state.
void setEvent(ModuleEvents event)
Command an event.
ModuleErrors getError() const
Returns active error code.

Protected Functions inherited from mcx::container::Module

Name
virtual bool iteratePreOp_(const TaskTime & system_time, UserTime * user_time)
User-defined callback which is called during Phase 2.
void createSubmodule(Module * module, const char * name)
Creates and registers submodule.
template <typename T >
void
createSubmodules(utils::span< T > module_array, const char * basename)
Creates and registers an array of submodules.
void setType(const char * name)
Sets a type of the module.
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.
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.
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.
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.
parameter_server::SubHandle subscribe(const char * path)
Helper function to subscribe for the parameter’s update.
parameter_server::ReqHandle request(const char * path)
Helper function to request a parameter’s value.
parameter_server::PubHandle publish(const char * path)
Helper function to update parameter’s value.
parameter_server::Parameter * getParameterRoot()
Returns the root of the parameter tree.
parameter_server::Parameter * getLocalBranch()
Returns the root of the local branch.

Friends inherited from mcx::container::Module

Name
class Task

Public Functions Documentation

function Module

Module() =delete

function Module

Module(
    utils::SystemMode system_mode,
    WatchdogType type,
    const char * device
)

function ~Module

virtual ~Module() override

Default destructor.

Reimplements: mcx::container::Module::~Module

Protected Functions Documentation

function create_

virtual 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.

Parameters:

  • name - unique name.
  • parameter_server - pointer to the root.
  • dt_micro_s - cycle time in microseconds.

See: Module::create

Reimplements: mcx::container::Module::create_

function initPhase1_

virtual bool initPhase1_() override

User-defined callback to register parameters in the tree.

See: Module::initPhase1

Return: user callback should return true on success, otherwise the state machine won’t progress.

Reimplements: mcx::container::Module::initPhase1_

function initPhase2_

virtual bool initPhase2_() override

User-defined callback after the parameter tree is ready.

See: Module::initPhase2

Return: user callback should return true on success, otherwise the state machine won’t progress.

Reimplements: mcx::container::Module::initPhase2_

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

function startOp_

virtual bool startOp_() override

User-defined callback before entering Operation mode.

See: Module::startOp

Return: user callback should return true on success, otherwise the state machine won’t progress.

Reimplements: mcx::container::Module::startOp_

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.

function stopOp_

virtual bool stopOp_() override

User-defined callback before to stop Operation mode.

See: Module::stopOp

Return: user callback should return true on success, otherwise the state machine won’t progress.

Reimplements: mcx::container::Module::stopOp_

function iterateOp_

virtual bool iterateOp_(
    const container::TaskTime & system_time,
    container::UserTime * user_time
) override

User-defined callback which is called during Operation mode.

See: Module::iterate

Return: user callback should return true on success, otherwise the state machine won’t progress.

Reimplements: mcx::container::Module::iterateOp_


Updated on 2022-04-05 at 16:21:27 +0200