Skip to content

Commit

Permalink
fix: Create ParamListener and get params on configure IMUSensorBroadc…
Browse files Browse the repository at this point in the history
…aster
  • Loading branch information
YueErro authored and YueErro committed Oct 10, 2023
1 parent f62fc3a commit d095f86
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions imu_sensor_broadcaster/src/imu_sensor_broadcaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
namespace imu_sensor_broadcaster
{
controller_interface::CallbackReturn IMUSensorBroadcaster::on_init()
{
return CallbackReturn::SUCCESS;
}

controller_interface::CallbackReturn IMUSensorBroadcaster::on_configure(
const rclcpp_lifecycle::State & /*previous_state*/)
{
try
{
Expand All @@ -33,18 +39,10 @@ controller_interface::CallbackReturn IMUSensorBroadcaster::on_init()
catch (const std::exception & e)
{
RCLCPP_ERROR(
get_node()->get_logger(), "Exception thrown during init stage with message: %s \n", e.what());
get_node()->get_logger(), "Exception thrown during configure stage with message: %s \n", e.what());
return CallbackReturn::ERROR;
}

return CallbackReturn::SUCCESS;
}

controller_interface::CallbackReturn IMUSensorBroadcaster::on_configure(
const rclcpp_lifecycle::State & /*previous_state*/)
{
params_ = param_listener_->get_params();

imu_sensor_ = std::make_unique<semantic_components::IMUSensor>(
semantic_components::IMUSensor(params_.sensor_name));
try
Expand Down

0 comments on commit d095f86

Please sign in to comment.