Skip to content

Conversation

@habartakh
Copy link

When building the package ros2_control_demo_example_12, the following warning is generated:

 /ros2_ws/src/ros-controls/ros2_control_demos/example_12/controllers/src/passthrough_controller.cpp:145:39: warning: ignoring return value of ‘bool hardware_interface::LoanedCommandInterface::set_value(const T&, unsigned int) [with T = double]’, declared with attribute ‘nodiscard’ [-Wunused-result]
  145 |       command_interfaces_[i].set_value(reference_interfaces_[i]);
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~

This was fixed by explicitly ignoring the return value of the set_value function.

Copy link
Member

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we use this return value here, for exemplary purposes? For example, giving a warning if false? Using RCLCPP_INFO_EXPRESSION maybe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants