-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcomponent.hpp
More file actions
45 lines (39 loc) · 1.35 KB
/
Copy pathcomponent.hpp
File metadata and controls
45 lines (39 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef COMPONENT_HPP
#define COMPONENT_HPP
#include <rtcf_examples/ExampleConfig.h>
#include <rtcf/macros.hpp>
OROCOS_HEADERS_BEGIN
#include <rtt/RTT.hpp>
OROCOS_HEADERS_END
#include <rtcf/rt_dynamic_reconfigure.hpp>
#include <rtcf/rtcf_extension.hpp>
class ParameterHandling : public RTT::TaskContext, public RtcfExtension {
public:
ParameterHandling(std::string const& name);
bool configureHook();
bool startHook();
void updateHook();
void stopHook();
void cleanupHook();
private:
// This class is necessary overhead for using dynamic reconfigure
// The reason therefore is that, the package::NameConfig-struct does always contain a string, which is definitely
// not real-time safe. Thus, we do this in the non real-time part.
struct ExampleParameters {
using ConfigType = rtcf_examples::ExampleConfig;
// list all fields of the .cfg-file
int int_param;
double double_param;
bool bool_param;
int size;
ExampleParameters(const ConfigType& config) :
int_param(config.int_param),
double_param(config.double_param),
bool_param(config.bool_param),
size(config.size) {}
ExampleParameters() {}
};
// this prepares the dynamic reconfigure server
RTDynamicReconfigure<ExampleParameters> dynamic_config;
};
#endif