22 #include <core/plugin.h> 24 #include "driver_thread.h" 25 #include "sensor_thread.h" 26 #include "act_thread.h" 48 std::set<std::string> configs;
49 std::set<std::string> ignored_configs;
51 std::string prefix =
"/dynamixel/";
54 #if __cplusplus >= 201103L 55 std::unique_ptr<Configuration::ValueIterator> i(config->
search(prefix.c_str()));
57 std::auto_ptr<Configuration::ValueIterator> i(config->
search(prefix.c_str()));
60 std::string cfg_name = std::string(i->
path()).substr(prefix.length());
61 cfg_name = cfg_name.substr(0, cfg_name.find(
"/"));
63 if ( (configs.find(cfg_name) == configs.end()) &&
64 (ignored_configs.find(cfg_name) == ignored_configs.end()) ) {
66 std::string cfg_prefix = prefix + cfg_name +
"/";
70 active = config->
get_bool((cfg_prefix +
"active").c_str());
78 thread_list.push_back(drv_thread);
79 configs.insert(cfg_name);
82 ignored_configs.insert(cfg_name);
85 for (ThreadList::iterator i = thread_list.begin();
86 i != thread_list.end(); ++i) {
96 if ( thread_list.empty() ) {
99 throw Exception(
"No active servo configs, aborting");
102 thread_list.push_back(sensor_thread);
103 thread_list.push_back(act_thread);
107 PLUGIN_DESCRIPTION(
"Robotis Dynamixel servo driver plugin")
Driver thread for Robotis dynamixel servos.
Fawkes library namespace.
virtual bool get_bool(const char *path)=0
Get value from configuration which is of type bool.
void add_driver_thread(DynamixelDriverThread *drv_thread)
Add a driver thread to wake in ACT hook.
void add_driver_thread(DynamixelDriverThread *drv_thread)
Add a driver thread to wake in SENSOR_ACQUIRE hook.
virtual ValueIterator * search(const char *path)=0
Iterator with search results.
virtual bool next()=0
Check if there is another element and advance to this if possible.
Robotis dynamixel servo sensor thread.
Base class for exceptions in Fawkes.
Driver plugin for Robotis dynamixel servos.
Robotis dynamixel servo act thread.
virtual const char * path() const =0
Path of value.
DynamixelPlugin(Configuration *config)
Constructor.
Interface for configuration handling.