From f8cf4320e10e88098b86f3aec4d75755dbdb8b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Fr=C3=B6hlich?= Date: Wed, 6 Sep 2023 16:50:09 +0200 Subject: [PATCH] Use std::fill Co-authored-by: Sai Kishor Kothakota --- example_10/hardware/rrbot.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/example_10/hardware/rrbot.cpp b/example_10/hardware/rrbot.cpp index 02799e8c4..d8e9bd84a 100644 --- a/example_10/hardware/rrbot.cpp +++ b/example_10/hardware/rrbot.cpp @@ -128,19 +128,10 @@ hardware_interface::CallbackReturn RRBotSystemWithGPIOHardware::on_configure( // END: This part here is for exemplary purposes - Please do not copy to your production code // reset values always when configuring hardware - for (uint i = 0; i < hw_states_.size(); i++) - { - hw_states_[i] = 0; - hw_commands_[i] = 0; - } - for (uint i = 0; i < hw_gpio_in_.size(); i++) - { - hw_gpio_in_[i] = 0; - } - for (uint i = 0; i < hw_gpio_out_.size(); i++) - { - hw_gpio_out_[i] = 0; - } + std::fill(hw_states_.begin(), hw_states_.end(), 0); + std::fill(hw_commands_.begin(), hw_commands_.end(), 0); + std::fill(hw_gpio_in_.begin(), hw_gpio_in_.end(), 0); + std::fill(hw_gpio_out_.begin(), hw_gpio_out_.end(), 0); RCLCPP_INFO(rclcpp::get_logger("RRBotSystemWithGPIOHardware"), "Successfully configured!");