Skip to content

Commit

Permalink
Fix cpplint and uncrustify (ros-navigation#4341)
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Wake <michael.wake@aosgrp.com.au>
  • Loading branch information
aosmw committed Oct 4, 2024
1 parent 523193a commit 2958f47
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion nav2_controller/src/controller_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ void ControllerServer::updateGlobalPath()
std::shared_ptr<Action::Result> result = std::make_shared<Action::Result>();
result->error_code = Action::Result::INVALID_CONTROLLER;
result->error_msg = "Terminating action, invalid controller " +
goal->controller_id +" requested.";
goal->controller_id + " requested.";
RCLCPP_INFO(get_logger(), result->error_msg.c_str());
action_server_->terminate_current(result);
return;
Expand Down
21 changes: 11 additions & 10 deletions nav2_util/include/nav2_util/simple_action_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,22 +575,23 @@ class SimpleActionServer
* This allows for ActionT::Result messages that do not contain
* an error_code or error_msg such as test_msgs::action::Fibonacci
*/
template <typename T, typename = void>
template<typename T, typename = void>
struct has_error_msg : std::false_type {};
template <typename T>
struct has_error_msg<T, std::void_t<decltype(T::error_msg)>> : std::true_type {};
template <typename T, typename = void>
template<typename T>
struct has_error_msg<T, std::void_t<decltype(T::error_msg)>>: std::true_type {};
template<typename T, typename = void>
struct has_error_code : std::false_type {};
template <typename T>
struct has_error_code<T, std::void_t<decltype(T::error_code)>> : std::true_type {};
template<typename T>
struct has_error_code<T, std::void_t<decltype(T::error_code)>>: std::true_type {};

template <typename T>
std::string get_error_details_if_available(const T& result)
template<typename T>
std::string get_error_details_if_available(const T & result)
{
if constexpr (has_error_code<typename ActionT::Result>::value &&
has_error_msg<typename ActionT::Result>::value) {
has_error_msg<typename ActionT::Result>::value)
{
return " error_code:" + std::to_string(result->error_code) +
", error_msg:'" + result->error_msg + "'.";
", error_msg:'" + result->error_msg + "'.";
} else if constexpr (has_error_code<typename ActionT::Result>::value) {
return " error_code:" + std::to_string(result->error_code) + ".";
} else {
Expand Down

0 comments on commit 2958f47

Please sign in to comment.