Function husarion_ugv_hardware_interfaces::OperationWithAttempts
Defined in File utils.hpp
Function Documentation
-
bool husarion_ugv_hardware_interfaces::OperationWithAttempts(const std::function<void()> operation, const unsigned max_attempts, const std::function<void()> on_error =
[]() {}) Attempts to run operation for max_attempts number of times. operation can throw std::runtime_error, which is caught, and on_error function is executed (for example deinitialization or some other cleanup in case of failure)
- Returns:
true if the operation was successfully executed, false if it wasn’t successfully executed and the number of attempts exceeded the maximum allowed or on_error function threw std::runtime_error