Skip to content

Commit

Permalink
Use std::fill
Browse files Browse the repository at this point in the history
Co-authored-by: Sai Kishor Kothakota <saisastra3@gmail.com>
  • Loading branch information
christophfroehlich and saikishor authored Sep 6, 2023
1 parent 457f931 commit f8cf432
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions example_10/hardware/rrbot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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!");

Expand Down

0 comments on commit f8cf432

Please sign in to comment.