39 #ifndef TEB_LOCAL_PLANNER_ROS_H_ 40 #define TEB_LOCAL_PLANNER_ROS_H_ 58 #include <nav_msgs/Path.h> 59 #include <nav_msgs/Odometry.h> 60 #include <geometry_msgs/PoseStamped.h> 61 #include <visualization_msgs/MarkerArray.h> 62 #include <visualization_msgs/Marker.h> 63 #include <costmap_converter/ObstacleMsg.h> 76 #include <teb_local_planner/TebLocalPlannerReconfigureConfig.h> 77 #include <dynamic_reconfigure/server.h> 80 #include <boost/bind.hpp> 81 #include <boost/shared_ptr.hpp> 119 bool setPlan(
const std::vector<geometry_msgs::PoseStamped>& orig_global_plan);
217 void updateViaPointsContainer(
const std::vector<geometry_msgs::PoseStamped>& transformed_plan,
double min_separation);
234 void customObstacleCB(
const costmap_converter::ObstacleArrayMsg::ConstPtr& obst_msg);
258 std::vector<geometry_msgs::PoseStamped>& global_plan,
double dist_behind_robot=1);
279 const std::string& global_frame,
double max_plan_length, std::vector<geometry_msgs::PoseStamped>& transformed_plan,
298 int current_goal_idx,
const tf::StampedTransform& tf_plan_to_global,
int moving_average_length=3)
const;
315 void saturateVelocity(
double& vx,
double& vy,
double& omega,
double max_vel_x,
double max_vel_y,
316 double max_vel_theta,
double max_vel_x_backwards)
const;
344 void validateFootprints(
double opt_inscribed_radius,
double costmap_inscribed_radius,
double min_obst_dist);
347 void configureBackupModes(std::vector<geometry_msgs::PoseStamped>& transformed_plan,
int& goal_idx);
405 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
410 #endif // TEB_LOCAL_PLANNER_ROS_H_ boost::shared_ptr< dynamic_reconfigure::Server< TebLocalPlannerReconfigureConfig > > dynamic_recfg_
Dynamic reconfigure server to allow config modifications at runtime.
bool isGoalReached()
Check if the goal pose has been achieved.
TebVisualizationPtr visualization_
Instance of the visualization class (local/global plan, obstacles, ...)
TebLocalPlannerROS()
Default constructor of the teb plugin.
boost::mutex via_point_mutex_
Mutex that locks the via_points container (multi-threaded)
costmap_converter::ObstacleArrayMsg custom_obstacle_msg_
Copy of the most recent obstacle message.
PoseSE2 robot_goal_
Store current robot goal.
void initialize(std::string name, tf::TransformListener *tf, costmap_2d::Costmap2DROS *costmap_ros)
Initializes the teb plugin.
bool initialized_
Keeps track about the correct initialization of this class.
double robot_circumscribed_radius
The radius of the circumscribed circle of the robot.
void updateViaPointsContainer(const std::vector< geometry_msgs::PoseStamped > &transformed_plan, double min_separation)
Update internal via-point container based on the current reference plan.
bool pruneGlobalPlan(const tf::TransformListener &tf, const tf::Stamped< tf::Pose > &global_pose, std::vector< geometry_msgs::PoseStamped > &global_plan, double dist_behind_robot=1)
Prune global plan such that already passed poses are cut off.
Config class for the teb_local_planner and its components.
boost::shared_ptr< base_local_planner::CostmapModel > costmap_model_
bool custom_via_points_active_
Keep track whether valid via-points have been received from via_points_sub_.
void customViaPointsCB(const nav_msgs::Path::ConstPtr &via_points_msg)
Callback for custom via-points.
pluginlib::ClassLoader< costmap_converter::BaseCostmapToPolygons > costmap_converter_loader_
Load costmap converter plugins at runtime.
bool transformGlobalPlan(const tf::TransformListener &tf, const std::vector< geometry_msgs::PoseStamped > &global_plan, const tf::Stamped< tf::Pose > &global_pose, const costmap_2d::Costmap2D &costmap, const std::string &global_frame, double max_plan_length, std::vector< geometry_msgs::PoseStamped > &transformed_plan, int *current_goal_idx=NULL, tf::StampedTransform *tf_plan_to_global=NULL) const
Transforms the global plan of the robot from the planner frame to the local frame (modified)...
std::vector< geometry_msgs::Point > footprint_spec_
Store the footprint of the robot.
int no_infeasible_plans_
Store how many times in a row the planner failed to find a feasible plan.
static RobotFootprintModelPtr getRobotFootprintFromParamServer(const ros::NodeHandle &nh)
Get the current robot footprint/contour model.
FailureDetector failure_detector_
Detect if the robot got stucked.
bool goal_reached_
store whether the goal is reached or not
std::vector< Eigen::Vector2d, Eigen::aligned_allocator< Eigen::Vector2d > > Point2dContainer
Abbrev. for a container storing 2d points.
ros::Time time_last_infeasible_plan_
Store at which time stamp the last infeasible plan was detected.
ros::Subscriber custom_obst_sub_
Subscriber for custom obstacles received via a ObstacleMsg.
void updateObstacleContainerWithCostmapConverter()
Update internal obstacle vector based on polygons provided by a costmap_converter plugin...
bool computeVelocityCommands(geometry_msgs::Twist &cmd_vel)
Given the current position, orientation, and velocity of the robot, compute velocity commands to send...
boost::mutex custom_obst_mutex_
Mutex that locks the obstacle array (multi-threaded)
std::vector< geometry_msgs::PoseStamped > global_plan_
Store the current global plan.
void updateObstacleContainerWithCustomObstacles()
Update internal obstacle vector based on custom messages received via subscriber. ...
RotType
Symbols for left/none/right rotations.
costmap_2d::Costmap2DROS * costmap_ros_
Pointer to the costmap ros wrapper, received from the navigation stack.
tf::TransformListener * tf_
pointer to Transform Listener
RotType last_preferred_rotdir_
Store recent preferred turning direction.
~TebLocalPlannerROS()
Destructor of the plugin.
double estimateLocalGoalOrientation(const std::vector< geometry_msgs::PoseStamped > &global_plan, const tf::Stamped< tf::Pose > &local_goal, int current_goal_idx, const tf::StampedTransform &tf_plan_to_global, int moving_average_length=3) const
Estimate the orientation of a pose from the global_plan that is treated as a local goal for the local...
std::vector< ObstaclePtr > ObstContainer
Abbrev. for containers storing multiple obstacles.
TebConfig cfg_
Config class that stores and manages all related parameters.
static Point2dContainer makeFootprintFromXMLRPC(XmlRpc::XmlRpcValue &footprint_xmlrpc, const std::string &full_param_name)
Set the footprint from the given XmlRpcValue.
geometry_msgs::Twist last_cmd_
Store the last control command generated in computeVelocityCommands()
static Eigen::Vector2d tfPoseToEigenVector2dTransRot(const tf::Pose &tf_vel)
Transform a tf::Pose type into a Eigen::Vector2d containing the translational and angular velocities...
static double getNumberFromXMLRPC(XmlRpc::XmlRpcValue &value, const std::string &full_param_name)
Get a number from the given XmlRpcValue.
This class implements a pose in the domain SE2: The pose consist of the position x and y and an orie...
void configureBackupModes(std::vector< geometry_msgs::PoseStamped > &transformed_plan, int &goal_idx)
PoseSE2 robot_pose_
Store current robot pose.
base_local_planner::OdometryHelperRos odom_helper_
Provides an interface to receive the current velocity from the robot.
void saturateVelocity(double &vx, double &vy, double &omega, double max_vel_x, double max_vel_y, double max_vel_theta, double max_vel_x_backwards) const
Saturate the translational and angular velocity to given limits.
costmap_2d::Costmap2D * costmap_
Pointer to the 2d costmap (obtained from the costmap ros wrapper)
Implements the actual abstract navigation stack routines of the teb_local_planner plugin...
This class implements methods in order to detect if the robot got stucked or is oscillating.
void customObstacleCB(const costmap_converter::ObstacleArrayMsg::ConstPtr &obst_msg)
Callback for custom obstacles that are not obtained from the costmap.
std::string robot_base_frame_
Used as the base frame id of the robot.
void validateFootprints(double opt_inscribed_radius, double costmap_inscribed_radius, double min_obst_dist)
Validate current parameter values of the footprint for optimization, obstacle distance and the costma...
ros::Subscriber via_points_sub_
Subscriber for custom via-points received via a Path msg.
void updateObstacleContainerWithCostmap()
Update internal obstacle vector based on occupied costmap cells.
double robot_inscribed_radius_
The radius of the inscribed circle of the robot (collision possible)
boost::shared_ptr< costmap_converter::BaseCostmapToPolygons > costmap_converter_
Store the current costmap_converter.
PlannerInterfacePtr planner_
Instance of the underlying optimal planner class.
std::string global_frame_
The frame in which the controller will run.
double convertTransRotVelToSteeringAngle(double v, double omega, double wheelbase, double min_turning_radius=0) const
Convert translational and rotational velocities to a steering angle of a carlike robot.
ros::Time time_last_oscillation_
Store at which time stamp the last oscillation was detected.
ObstContainer obstacles_
Obstacle vector that should be considered during local trajectory optimization.
bool setPlan(const std::vector< geometry_msgs::PoseStamped > &orig_global_plan)
Set the plan that the teb local planner is following.
ViaPointContainer via_points_
Container of via-points that should be considered during local trajectory optimization.
geometry_msgs::Twist robot_vel_
Store current robot translational and angular velocity (vx, vy, omega)
std::vector< Eigen::Vector2d, Eigen::aligned_allocator< Eigen::Vector2d > > ViaPointContainer
Typedef for a container storing via-points.
void reconfigureCB(TebLocalPlannerReconfigureConfig &config, uint32_t level)
Callback for the dynamic_reconfigure node.