Skip to content

Commit

Permalink
clang format
Browse files Browse the repository at this point in the history
  • Loading branch information
corot committed Nov 21, 2023
1 parent bab973b commit 41327ae
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 61 deletions.
38 changes: 13 additions & 25 deletions mbf_abstract_nav/include/mbf_abstract_nav/controller_action.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,54 +52,42 @@
namespace mbf_abstract_nav
{

class ControllerAction :
public AbstractActionBase<mbf_msgs::ExePathAction, AbstractControllerExecution>
class ControllerAction : public AbstractActionBase<mbf_msgs::ExePathAction, AbstractControllerExecution>
{
public:

public:
typedef boost::shared_ptr<ControllerAction> Ptr;

ControllerAction(const std::string &name,
const mbf_utility::RobotInformation &robot_info);
ControllerAction(const std::string& name, const mbf_utility::RobotInformation& robot_info);

/**
* @brief Start controller action.
* Override abstract action version to allow updating current plan without stopping execution.
* @param goal_handle Reference to the goal handle received on action execution callback.
* @param execution_ptr Pointer to the execution descriptor.
*/
void start(
GoalHandle &goal_handle,
typename AbstractControllerExecution::Ptr execution_ptr
);
void start(GoalHandle& goal_handle, typename AbstractControllerExecution::Ptr execution_ptr);

void runImpl(GoalHandle &goal_handle, AbstractControllerExecution& execution);
void runImpl(GoalHandle& goal_handle, AbstractControllerExecution& execution);

protected:
void publishExePathFeedback(
GoalHandle &goal_handle,
uint32_t outcome, const std::string &message,
const geometry_msgs::TwistStamped &current_twist);
void publishExePathFeedback(GoalHandle& goal_handle, uint32_t outcome, const std::string& message,
const geometry_msgs::TwistStamped& current_twist);

/**
* @brief Utility method to fill the ExePath action result in a single line
* @param outcome ExePath action outcome
* @param message ExePath action message
* @param result The action result to fill
*/
void fillExePathResult(
uint32_t outcome, const std::string &message,
mbf_msgs::ExePathResult &result);
void fillExePathResult(uint32_t outcome, const std::string& message, mbf_msgs::ExePathResult& result);

boost::mutex goal_mtx_; ///< lock goal handle for updating it while running
geometry_msgs::PoseStamped robot_pose_; ///< Current robot pose
geometry_msgs::PoseStamped goal_pose_; ///< Current goal pose
boost::mutex goal_mtx_; ///< lock goal handle for updating it while running
geometry_msgs::PoseStamped robot_pose_; ///< Current robot pose
geometry_msgs::PoseStamped goal_pose_; ///< Current goal pose

//! Publish the current goal pose (the last pose of the path we are following)
ros::Publisher goal_pub_;
};
}


} // namespace mbf_abstract_nav

#endif //MBF_ABSTRACT_NAV__CONTROLLER_ACTION_H_
#endif // MBF_ABSTRACT_NAV__CONTROLLER_ACTION_H_
27 changes: 10 additions & 17 deletions mbf_abstract_nav/include/mbf_abstract_nav/planner_action.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,43 +49,36 @@
#include "mbf_abstract_nav/abstract_action_base.hpp"
#include "mbf_abstract_nav/abstract_planner_execution.h"


namespace mbf_abstract_nav{

namespace mbf_abstract_nav
{

class PlannerAction : public AbstractActionBase<mbf_msgs::GetPathAction, AbstractPlannerExecution>
{
public:

public:
typedef boost::shared_ptr<PlannerAction> Ptr;

PlannerAction(
const std::string &name,
const mbf_utility::RobotInformation &robot_info
);

void runImpl(GoalHandle &goal_handle, AbstractPlannerExecution &execution);
PlannerAction(const std::string& name, const mbf_utility::RobotInformation& robot_info);

protected:
void runImpl(GoalHandle& goal_handle, AbstractPlannerExecution& execution);

protected:
/**
* @brief Transforms a plan to the global frame (global_frame_) coord system.
* @param plan Input plan to be transformed.
* @param global_plan Output plan, which is then transformed to the global frame.
* @return true, if the transformation succeeded, false otherwise
*/
bool transformPlanToGlobalFrame(const std::vector<geometry_msgs::PoseStamped>& plan,
std::vector<geometry_msgs::PoseStamped>& global_plan);

private:
bool transformPlanToGlobalFrame(const std::vector<geometry_msgs::PoseStamped>& plan,
std::vector<geometry_msgs::PoseStamped>& global_plan);

private:
//! Publisher to publish the current goal pose, which is used for path planning
ros::Publisher goal_pub_;

//! Path sequence counter
unsigned int path_seq_count_;
};

} /* mbf_abstract_nav */
} // namespace mbf_abstract_nav

#endif /* MBF_ABSTRACT_NAV__PLANNER_ACTION_H_ */
20 changes: 10 additions & 10 deletions mbf_abstract_nav/src/abstract_controller_execution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ namespace mbf_abstract_nav
const double AbstractControllerExecution::DEFAULT_CONTROLLER_FREQUENCY = 100.0; // 100 Hz

AbstractControllerExecution::AbstractControllerExecution(
const std::string &name,
const mbf_abstract_core::AbstractController::Ptr &controller_ptr,
const mbf_utility::RobotInformation &robot_info,
const ros::Publisher &vel_pub,
const MoveBaseFlexConfig &config) :
AbstractExecutionBase(name, robot_info),
controller_(controller_ptr),
state_(INITIALIZED), moving_(false), max_retries_(0), patience_(0), vel_pub_(vel_pub),
loop_rate_(DEFAULT_CONTROLLER_FREQUENCY)
const std::string& name, const mbf_abstract_core::AbstractController::Ptr& controller_ptr,
const mbf_utility::RobotInformation& robot_info, const ros::Publisher& vel_pub, const MoveBaseFlexConfig& config)
: AbstractExecutionBase(name, robot_info)
, controller_(controller_ptr)
, state_(INITIALIZED)
, moving_(false)
, max_retries_(0)
, patience_(0)
, vel_pub_(vel_pub)
, loop_rate_(DEFAULT_CONTROLLER_FREQUENCY)
{
ros::NodeHandle nh;
ros::NodeHandle private_nh("~");

// non-dynamically reconfigurable parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@
namespace mbf_costmap_nav
{

CostmapControllerExecution::CostmapControllerExecution(
const std::string &controller_name,
const mbf_costmap_core::CostmapController::Ptr &controller_ptr,
const mbf_utility::RobotInformation &robot_info,
const ros::Publisher &vel_pub,
const CostmapWrapper::Ptr &costmap_ptr,
const MoveBaseFlexConfig &config)
: AbstractControllerExecution(controller_name, controller_ptr, robot_info, vel_pub, toAbstract(config)),
costmap_ptr_(costmap_ptr)
CostmapControllerExecution::CostmapControllerExecution(const std::string& controller_name,
const mbf_costmap_core::CostmapController::Ptr& controller_ptr,
const mbf_utility::RobotInformation& robot_info,
const ros::Publisher& vel_pub,
const CostmapWrapper::Ptr& costmap_ptr,
const MoveBaseFlexConfig& config)
: AbstractControllerExecution(controller_name, controller_ptr, robot_info, vel_pub, toAbstract(config))
, costmap_ptr_(costmap_ptr)
{
ros::NodeHandle private_nh("~");
private_nh.param("controller_lock_costmap", lock_costmap_, true);
Expand Down

0 comments on commit 41327ae

Please sign in to comment.