@@ -66,7 +66,7 @@ timer_base::timer_base(std::shared_ptr<posix_timer> parent, const YAML::Node& co
6666// ! Initialize timer
6767void timer_base::init (void ) {
6868 // add trigger device
69- robotkernel::add_device (shared_from_this ());
69+ robotkernel::add_device (shared_from_this_as<trigger> ());
7070
7171 string pdin_desc = " - double: interval\n " ;
7272 pdin = make_shared<robotkernel::triple_buffer>(
@@ -88,7 +88,7 @@ void timer_base::deinit(void) {
8888 pdin_inspect = nullptr ;
8989
9090 // register devices (trigger, process_data)
91- robotkernel::remove_device (shared_from_this ());
91+ robotkernel::remove_device (shared_from_this_as<trigger> ());
9292 robotkernel::remove_device (pdin);
9393
9494 pdin->reset_provider (prov);
@@ -282,15 +282,15 @@ void posix_timer::init() {
282282 std::function<void (const YAML::Node& timer_config)> create_timer = [&](const YAML::Node& timer_config) {
283283 if (timer_config[" mode" ]) {
284284 if (timer_config[" mode" ].as <string>() == string (" nanosleep" )) {
285- timers.push_back (std::make_shared<nanosleep>(shared_from_this (), timer_config));
285+ timers.push_back (std::make_shared<nanosleep>(shared_from_this_as<posix_timer> (), timer_config));
286286 } else if (timer_config[" mode" ].as <string>() == string (" timer" )) {
287- timers.push_back (std::make_shared<timer>(shared_from_this (), timer_config));
287+ timers.push_back (std::make_shared<timer>(shared_from_this_as<posix_timer> (), timer_config));
288288 } else if (timer_config[" mode" ].as <string>() == string (" busywait" )) {
289- timers.push_back (std::make_shared<busywait>(shared_from_this (), timer_config));
289+ timers.push_back (std::make_shared<busywait>(shared_from_this_as<posix_timer> (), timer_config));
290290 }
291291 } else {
292292 log (info, " mode not specified, assuming nanosleep mode!\n " );
293- timers.push_back (std::make_shared<nanosleep>(shared_from_this (), timer_config));
293+ timers.push_back (std::make_shared<nanosleep>(shared_from_this_as<posix_timer> (), timer_config));
294294 }
295295 };
296296
0 commit comments