Skip to content

Commit

Permalink
[ControllerInterface] Avoid warning about conversion from int64_t t…
Browse files Browse the repository at this point in the history
…o `unsigned int` (#1173)

Without this there is a warning. For what I found the best way is to do static cast.

```
ros2_control/controller_interface/src/controller_interface_base.cpp:88:67: warning: conversion from ‘int64_t’{aka ‘long int’} to ‘unsigned int’ may change value [-Wconversion]
88 |     update_rate_ = get_node()->get_parameter("update_rate").as_int();
```

(cherry picked from commit 2569b76)
  • Loading branch information
destogl authored and mergify[bot] committed Jul 20, 2024
1 parent 877920a commit 1f16796
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion controller_interface/src/controller_interface_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const rclcpp_lifecycle::State & ControllerInterfaceBase::configure()
// Other solution is to add check into the LifecycleNode if a transition is valid to trigger
if (get_state().id() == lifecycle_msgs::msg::State::PRIMARY_STATE_UNCONFIGURED)
{
update_rate_ = get_node()->get_parameter("update_rate").as_int();
update_rate_ = static_cast<unsigned int>(get_node()->get_parameter("update_rate").as_int());
is_async_ = get_node()->get_parameter("is_async").as_bool();
}

Expand Down

0 comments on commit 1f16796

Please sign in to comment.