From 5054265271a139648cd190a8ec7f7b3b586158ef Mon Sep 17 00:00:00 2001 From: Wiktor Bajor Date: Sat, 21 Dec 2024 12:49:43 +0100 Subject: [PATCH] Resovle all coments --- .../force_torque_sensor.hpp | 19 +++++++++---------- .../semantic_components/pose_sensor.hpp | 2 -- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/controller_interface/include/semantic_components/force_torque_sensor.hpp b/controller_interface/include/semantic_components/force_torque_sensor.hpp index 69a637b7ba..c898f31ee1 100644 --- a/controller_interface/include/semantic_components/force_torque_sensor.hpp +++ b/controller_interface/include/semantic_components/force_torque_sensor.hpp @@ -25,7 +25,7 @@ namespace { -using double_limits = std::numeric_limits; +constexpr std::size_t FORCES_SIZE = 3; } namespace semantic_components @@ -44,7 +44,7 @@ class ForceTorqueSensor : public SemanticComponentInterface get_forces() const { - std::array forces{ - {double_limits::quiet_NaN(), double_limits::quiet_NaN(), double_limits::quiet_NaN()}}; + std::array forces; + forces.fill(std::numeric_limits::quiet_NaN()); size_t interface_counter{0}; for (auto i = 0u; i < forces.size(); ++i) { @@ -114,16 +114,17 @@ class ForceTorqueSensor : public SemanticComponentInterface get_torques() const { - std::array torques{ - {double_limits::quiet_NaN(), double_limits::quiet_NaN(), double_limits::quiet_NaN()}}; + std::array torques; + torques.fill(std::numeric_limits::quiet_NaN()); + // find out how many force interfaces are being used // torque interfaces will be found from the next index onward auto torque_interface_counter = static_cast( - std::count(existing_axes_.begin(), existing_axes_.begin() + forces_size_, true)); + std::count(existing_axes_.begin(), existing_axes_.begin() + FORCES_SIZE, true)); for (auto i = 0u; i < torques.size(); ++i) { - if (existing_axes_[i + forces_size_]) + if (existing_axes_[i + FORCES_SIZE]) { torques[i] = state_interfaces_[torque_interface_counter].get().get_value(); ++torque_interface_counter; @@ -158,8 +159,6 @@ class ForceTorqueSensor : public SemanticComponentInterface existing_axes_; - const std::size_t forces_size_{3}; - const std::size_t torque_size_{3}; }; } // namespace semantic_components diff --git a/controller_interface/include/semantic_components/pose_sensor.hpp b/controller_interface/include/semantic_components/pose_sensor.hpp index 589600be16..098fb04278 100644 --- a/controller_interface/include/semantic_components/pose_sensor.hpp +++ b/controller_interface/include/semantic_components/pose_sensor.hpp @@ -91,8 +91,6 @@ class PoseSensor : public SemanticComponentInterface return true; } - -protected: }; } // namespace semantic_components