Class AbstractPlannerExecution

Inheritance Relationships

Base Type

Class Documentation

class AbstractPlannerExecution : public mbf_abstract_nav::AbstractExecutionBase

The AbstractPlannerExecution class loads and binds the global planner plugin. It contains a thread running the plugin in a cycle to plan and re-plan. An internal state is saved and will be pulled by the server, which controls the global planner execution. Due to a state change it wakes up all threads connected to the condition variable.

Public Types

enum PlanningState

Internal states.

Values:

enumerator INITIALIZED

Planner initialized.

enumerator STARTED

Planner started.

enumerator PLANNING

Executing the plugin.

enumerator FOUND_PLAN

Found a valid plan.

enumerator MAX_RETRIES

Exceeded the maximum number of retries without a valid command.

enumerator PAT_EXCEEDED

Exceeded the patience time without a valid command.

enumerator NO_PLAN_FOUND

No plan has been found (MAX_RETRIES and PAT_EXCEEDED are 0).

enumerator CANCELED

The planner has been canceled.

enumerator STOPPED

The planner has been stopped.

enumerator INTERNAL_ERROR

An internal error occurred.

typedef std::shared_ptr<AbstractPlannerExecution> Ptr

shared pointer type to the planner execution.

Public Functions

AbstractPlannerExecution(const std::string &name, const mbf_abstract_core::AbstractPlanner::Ptr &planner_ptr, const mbf_utility::RobotInformation::ConstPtr &robot_info, const rclcpp::Node::SharedPtr &node_handle)

Constructor.

Parameters:
  • name – Name of this execution

  • planner_ptr – Pointer to the planner

  • robot_info – Current robot state

  • config – Initial configuration for this execution

virtual ~AbstractPlannerExecution()

Destructor.

std::vector<geometry_msgs::msg::PoseStamped> getPlan() const

Returns a new plan, if one is available.

rclcpp::Time getLastValidPlanTime() const

Returns the last time a valid plan was available.

Returns:

time, the last valid plan was available.

bool isPatienceExceeded() const

Checks whether the patience was exceeded.

Returns:

true, if the patience duration was exceeded.

PlanningState getState() const

Returns the current internal state.

Returns:

the current internal state

inline double getFrequency() const

Gets planning frequency.

double getCost() const

Gets computed costs.

Returns:

The costs of the computed path

virtual bool cancel()

Cancel the planner execution. This calls the cancel method of the planner plugin. This could be useful if the computation takes too much time, or if we are aborting the navigation.

Returns:

true, if the planner plugin tries / tried to cancel the planning step.

void setNewGoal(const geometry_msgs::msg::PoseStamped &goal, double tolerance)

Sets a new goal pose for the planner execution.

Parameters:
  • goal – the new goal pose

  • tolerance – tolerance to the goal for the planning

void setNewStart(const geometry_msgs::msg::PoseStamped &start)

Sets a new start pose for the planner execution.

Parameters:

start – new start pose

void setNewStartAndGoal(const geometry_msgs::msg::PoseStamped &start, const geometry_msgs::msg::PoseStamped &goal, double tolerance)

Sets a new star and goal pose for the planner execution.

Parameters:
  • start – new start pose

  • goal – new goal pose

  • tolerance – tolerance to the new goal for the planning

bool start(const geometry_msgs::msg::PoseStamped &start, const geometry_msgs::msg::PoseStamped &goal, double tolerance)

Starts the planner execution thread with the given parameters.

Parameters:
  • start – start pose for the planning

  • goal – goal pose for the planning

  • tolerance – tolerance to the goal pose for the planning

Returns:

true, if the planner thread has been started, false if the thread is already running.

rcl_interfaces::msg::SetParametersResult reconfigure(std::vector<rclcpp::Parameter> parameters)

Is called by the server thread to reconfigure the controller execution, if a user uses dynamic reconfigure to reconfigure the current state.

Parameters:

parameters – Vector parameters that are being reconfigured.

Protected Functions

virtual void run()

The main run method, a thread will execute this method. It contains the main planner execution loop.

void handle_thread_interrupted()

Helper method for cleaning up the state when the planner thread was interrupted.

Protected Attributes

mbf_abstract_core::AbstractPlanner::Ptr planner_

the local planer to calculate the robot trajectory

std::string plugin_name_

the name of the loaded planner plugin