#include <mc_control/MCController.h>
#include <mc_rtc/version.h>
Go to the source code of this file.
◆ CONTROLLER_CHECK_VERSION
#define CONTROLLER_CHECK_VERSION |
( |
|
NAME | ) |
|
Value: if(mc_rtc::MC_RTC_VERSION != mc_rtc::version()) \
mc_rtc::log::error(
"{} was compiled with {} but mc_rtc is currently at version {}, you might experience subtle " \
"issues and should recompile your code", \
NAME, mc_rtc::MC_RTC_VERSION, mc_rtc::version()); \
}
Set of macros to assist with the writing of an MCController A simple compile-time versus run-time version checking macro
If you are not relying on CONTROLLER_CONSTRUCTOR or SIMPLE_CONTROLLER_CONSTRUCTOR you should use this in your MC_RTC_CONTROLLER implementation
◆ CONTROLLER_CONSTRUCTOR
#define CONTROLLER_CONSTRUCTOR |
( |
|
NAME, |
|
|
|
TYPE |
|
) |
| |
Value: extern "C" \
{ \
CONTROLLER_MODULE_API void MC_RTC_CONTROLLER(std::vector<std::string> & names) \
{ \
CONTROLLER_CHECK_VERSION(NAME) \
names = {NAME}; \
} \
{ \
delete ptr; \
} \
CONTROLLER_MODULE_API unsigned int create_args_required() \
{ \
return 4; \
} \
const double & dt, \
{ \
return new TYPE(robot, dt, conf); \
} \
}
Provides a handle to construct the controller with Json config
◆ MULTI_CONTROLLERS_CONSTRUCTOR
#define MULTI_CONTROLLERS_CONSTRUCTOR |
( |
|
NAME0, |
|
|
|
NEWCTL0, |
|
|
|
NAME1, |
|
|
|
NEWCTL1 |
|
) |
| |
Value: extern "C" \
{ \
CONTROLLER_MODULE_API void MC_RTC_CONTROLLER(std::vector<std::string> & names) \
{ \
CONTROLLER_CHECK_VERSION(NAME0) \
names = {NAME0, NAME1}; \
} \
\
{ \
delete ptr; \
} \
CONTROLLER_MODULE_API unsigned int create_args_required() \
{ \
return 4; \
} \
const std::string & name, \
const double & dt, \
{ \
if(name == NAME0) { return new NEWCTL0; } \
return new NEWCTL1; \
} \
}
Provides all functions except create
◆ SIMPLE_CONTROLLER_CONSTRUCTOR
#define SIMPLE_CONTROLLER_CONSTRUCTOR |
( |
|
NAME, |
|
|
|
TYPE |
|
) |
| |
Value: extern "C" \
{ \
CONTROLLER_MODULE_API void MC_RTC_CONTROLLER(std::vector<std::string> & names) \
{ \
CONTROLLER_CHECK_VERSION(NAME) \
names = {NAME}; \
} \
{ \
delete ptr; \
} \
CONTROLLER_MODULE_API unsigned int create_args_required() \
{ \
return 4; \
} \
const double & dt, \
{ \
return new TYPE(robot, dt); \
} \
}
Provides a handle to construct a generic controller