Skip to content

Commit

Permalink
start the async thread when configuring the controller
Browse files Browse the repository at this point in the history
  • Loading branch information
saikishor committed Jun 12, 2024
1 parent 4474281 commit 52fb844
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions controller_interface/src/controller_interface_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,8 @@ return_type ControllerInterfaceBase::init(
node_->register_on_cleanup(
std::bind(&ControllerInterfaceBase::on_cleanup, this, std::placeholders::_1));

auto activate_callback = [this](const rclcpp_lifecycle::State & state)
{
if (is_async() && async_handler_)
{
async_handler_->start_async_update_thread();
}
return on_activate(state);
};
node_->register_on_activate(activate_callback);
node_->register_on_activate(
std::bind(&ControllerInterfaceBase::on_activate, this, std::placeholders::_1));

node_->register_on_deactivate(
std::bind(&ControllerInterfaceBase::on_deactivate, this, std::placeholders::_1));
Expand Down Expand Up @@ -102,6 +95,7 @@ const rclcpp_lifecycle::State & ControllerInterfaceBase::configure()
std::bind(&ControllerInterfaceBase::get_state, this),
std::bind(
&ControllerInterfaceBase::update, this, std::placeholders::_1, std::placeholders::_2));
async_handler_->start_async_update_thread();
}

return get_node()->configure();
Expand Down

0 comments on commit 52fb844

Please sign in to comment.