Skip to content

Commit df4c612

Browse files
author
Tony Najjar
authored
Merge branch 'ros2-master' into galactic-devel
2 parents d56f70d + 630a22e commit df4c612

11 files changed

+428
-383
lines changed

teb_local_planner/include/teb_local_planner/homotopy_class_planner.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class HomotopyClassPlanner : public PlannerInterface
125125
* @param visualization Shared pointer to the TebVisualization class (optional)
126126
* @param via_points Container storing via-points (optional)
127127
*/
128-
HomotopyClassPlanner(nav2_util::LifecycleNode::SharedPtr node, const TebConfig& cfg, ObstContainer* obstacles = NULL, RobotFootprintModelPtr robot_model = std::make_shared<PointRobotFootprint>(),
128+
HomotopyClassPlanner(nav2_util::LifecycleNode::SharedPtr node, const TebConfig& cfg, ObstContainer* obstacles = NULL,
129129
TebVisualizationPtr visualization = TebVisualizationPtr(), const ViaPointContainer* via_points = NULL);
130130

131131
/**
@@ -138,16 +138,12 @@ class HomotopyClassPlanner : public PlannerInterface
138138
* @param node Shared pointer for rclcpp::Node
139139
* @param cfg Const reference to the TebConfig class for internal parameters
140140
* @param obstacles Container storing all relevant obstacles (see Obstacle)
141-
* @param robot_model Shared pointer to the robot shape model used for optimization (optional)
142141
* @param visualization Shared pointer to the TebVisualization class (optional)
143142
* @param via_points Container storing via-points (optional)
144143
*/
145-
void initialize(nav2_util::LifecycleNode::SharedPtr node, const TebConfig& cfg, ObstContainer* obstacles = NULL, RobotFootprintModelPtr robot_model = std::make_shared<PointRobotFootprint>(),
144+
void initialize(nav2_util::LifecycleNode::SharedPtr node, const TebConfig& cfg, ObstContainer* obstacles = NULL,
146145
TebVisualizationPtr visualization = TebVisualizationPtr(), const ViaPointContainer* via_points = NULL);
147146

148-
149-
void updateRobotModel(RobotFootprintModelPtr robot_model );
150-
151147
/** @name Plan a trajectory */
152148
//@{
153149

teb_local_planner/include/teb_local_planner/homotopy_class_planner.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ EquivalenceClassPtr HomotopyClassPlanner::calculateEquivalenceClass(BidirIter pa
6565
template<typename BidirIter, typename Fun>
6666
TebOptimalPlannerPtr HomotopyClassPlanner::addAndInitNewTeb(BidirIter path_start, BidirIter path_end, Fun fun_position, double start_orientation, double goal_orientation, const geometry_msgs::msg::Twist* start_velocity, bool free_goal_vel)
6767
{
68-
TebOptimalPlannerPtr candidate = TebOptimalPlannerPtr( new TebOptimalPlanner(node_, *cfg_, obstacles_, robot_model_));
68+
TebOptimalPlannerPtr candidate = TebOptimalPlannerPtr( new TebOptimalPlanner(node_, *cfg_, obstacles_));
6969

7070
candidate->teb().initTrajectoryToGoal(path_start, path_end, fun_position, cfg_->robot.max_vel_x, cfg_->robot.max_vel_theta,
7171
cfg_->robot.acc_lim_x, cfg_->robot.acc_lim_theta, start_orientation, goal_orientation, cfg_->trajectory.min_samples,

teb_local_planner/include/teb_local_planner/optimal_planner.h

+2-8
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,10 @@ class TebOptimalPlanner : public PlannerInterface
125125
* @brief Construct and initialize the TEB optimal planner.
126126
* @param cfg Const reference to the TebConfig class for internal parameters
127127
* @param obstacles Container storing all relevant obstacles (see Obstacle)
128-
* @param robot_model Shared pointer to the robot shape model used for optimization (optional)
129128
* @param visual Shared pointer to the TebVisualization class (optional)
130129
* @param via_points Container storing via-points (optional)
131130
*/
132-
TebOptimalPlanner(nav2_util::LifecycleNode::SharedPtr node, const TebConfig& cfg, ObstContainer* obstacles = NULL, RobotFootprintModelPtr robot_model = std::make_shared<PointRobotFootprint>(),
131+
TebOptimalPlanner(nav2_util::LifecycleNode::SharedPtr node, const TebConfig& cfg, ObstContainer* obstacles = NULL,
133132
TebVisualizationPtr visual = TebVisualizationPtr(), const ViaPointContainer* via_points = NULL);
134133

135134
/**
@@ -146,14 +145,9 @@ class TebOptimalPlanner : public PlannerInterface
146145
* @param visual Shared pointer to the TebVisualization class (optional)
147146
* @param via_points Container storing via-points (optional)
148147
*/
149-
void initialize(nav2_util::LifecycleNode::SharedPtr node, const TebConfig& cfg, ObstContainer* obstacles = NULL, RobotFootprintModelPtr robot_model = std::make_shared<PointRobotFootprint>(),
148+
void initialize(nav2_util::LifecycleNode::SharedPtr node, const TebConfig& cfg, ObstContainer* obstacles = NULL,
150149
TebVisualizationPtr visual = TebVisualizationPtr(), const ViaPointContainer* via_points = NULL);
151150

152-
/**
153-
* @param robot_model Shared pointer to the robot shape model used for optimization (optional)
154-
*/
155-
void updateRobotModel(RobotFootprintModelPtr robot_model );
156-
157151
/** @name Plan a trajectory */
158152
//@{
159153

teb_local_planner/include/teb_local_planner/planner_interface.h

-4
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,6 @@ class PlannerInterface
173173
}
174174

175175
virtual void setVisualization(const TebVisualizationPtr & visualization) = 0;
176-
177-
virtual void updateRobotModel(RobotFootprintModelPtr robot_model)
178-
{
179-
}
180176

181177
/**
182178
* @brief Check whether the planned trajectory is feasible or not.

teb_local_planner/include/teb_local_planner/pose_se2.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
#include <tf2/convert.h>
5050
#include <tf2/utils.h>
51-
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
51+
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
5252

5353
namespace teb_local_planner
5454
{

teb_local_planner/include/teb_local_planner/teb_config.h

+13-4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
#include <Eigen/Core>
4646
#include <Eigen/StdVector>
4747
#include <nav_2d_utils/parameters.hpp>
48+
#include "teb_local_planner/robot_footprint_model.h"
49+
#include <nav2_costmap_2d/footprint.hpp>
4850

4951
// Definitions
5052
#define USE_ANALYTIC_JACOBI // if available for a specific edge, use analytic jacobi
@@ -64,6 +66,13 @@ class TebConfig
6466
std::string map_frame; //!< Global planning frame
6567
std::string node_name; //!< node name used for parameter event callback
6668

69+
RobotFootprintModelPtr robot_model;
70+
std::string model_name;
71+
double radius;
72+
std::vector<double> line_start, line_end;
73+
double front_offset, front_radius, rear_offset, rear_radius;
74+
std::string footprint_string;
75+
6776
//! Trajectory related parameters
6877
struct Trajectory
6978
{
@@ -393,11 +402,11 @@ class TebConfig
393402
void loadRosParamFromNodeHandle(const nav2_util::LifecycleNode::SharedPtr nh, const std::string name);
394403

395404
/**
396-
* @brief Paremeter event callback
397-
* @param event The ParameterEvent
405+
* @brief Callback executed when a paramter change is detected
406+
* @param parameters list of changed parameters
398407
*/
399-
void on_parameter_event_callback(
400-
const rcl_interfaces::msg::ParameterEvent::SharedPtr event);
408+
rcl_interfaces::msg::SetParametersResult
409+
dynamicParametersCallback(std::vector<rclcpp::Parameter> parameters);
401410

402411
/**
403412
* @brief Check parameters and print warnings in case of discrepancies

teb_local_planner/include/teb_local_planner/teb_local_planner_ros.h

+6-9
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
#include <nav2_util/lifecycle_node.hpp>
7272
#include <nav2_costmap_2d/costmap_2d_ros.hpp>
7373
#include <nav_2d_utils/parameters.hpp>
74+
#include "rcl_interfaces/msg/set_parameters_result.hpp"
7475
// dynamic reconfigure
7576
//#include "teb_local_planner/TebLocalPlannerReconfigureConfig.h>
7677
//#include <dynamic_reconfigure/server.h>
@@ -110,8 +111,8 @@ class TebLocalPlannerROS : public nav2_core::Controller
110111
void configure(
111112
const rclcpp_lifecycle::LifecycleNode::WeakPtr & parent,
112113
std::string name,
113-
const std::shared_ptr<tf2_ros::Buffer> & tf,
114-
const std::shared_ptr<nav2_costmap_2d::Costmap2DROS> & costmap_ros) override;
114+
std::shared_ptr<tf2_ros::Buffer> tf,
115+
std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros) override;
115116
void activate() override;
116117
void deactivate() override;
117118
void cleanup() override;
@@ -406,18 +407,14 @@ class TebLocalPlannerROS : public nav2_core::Controller
406407
std::vector<geometry_msgs::msg::Point> footprint_spec_; //!< Store the footprint of the robot
407408
double robot_inscribed_radius_; //!< The radius of the inscribed circle of the robot (collision possible)
408409
double robot_circumscribed_radius; //!< The radius of the circumscribed circle of the robot
409-
410-
std::string global_frame_; //!< The frame in which the controller will run
411-
std::string robot_base_frame_; //!< Used as the base frame id of the robot
412410

413411
// flags
414412
bool initialized_; //!< Keeps track about the correct initialization of this class
415413
std::string name_; //!< Name of plugin ID
416414

417-
// Subscription for parameter change
418-
rclcpp::AsyncParametersClient::SharedPtr parameters_client_;
419-
rclcpp::Subscription<rcl_interfaces::msg::ParameterEvent>::SharedPtr parameter_event_sub_;
420-
415+
protected:
416+
// Dynamic parameters handler
417+
rclcpp::node_interfaces::OnSetParametersCallbackHandle::SharedPtr dyn_params_handler;
421418
public:
422419
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
423420
};

teb_local_planner/src/homotopy_class_planner.cpp

+6-12
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,23 @@ HomotopyClassPlanner::HomotopyClassPlanner() : cfg_(NULL), obstacles_(NULL), via
4747
{
4848
}
4949

50-
HomotopyClassPlanner::HomotopyClassPlanner(nav2_util::LifecycleNode::SharedPtr node, const TebConfig& cfg, ObstContainer* obstacles, RobotFootprintModelPtr robot_model,
50+
HomotopyClassPlanner::HomotopyClassPlanner(nav2_util::LifecycleNode::SharedPtr node, const TebConfig& cfg, ObstContainer* obstacles,
5151
TebVisualizationPtr visual, const ViaPointContainer* via_points) : initial_plan_(NULL)
5252
{
53-
initialize(node, cfg, obstacles, robot_model, visual, via_points);
53+
initialize(node, cfg, obstacles, visual, via_points);
5454
}
5555

5656
HomotopyClassPlanner::~HomotopyClassPlanner()
5757
{
5858
}
5959

60-
void HomotopyClassPlanner::initialize(nav2_util::LifecycleNode::SharedPtr node, const TebConfig& cfg, ObstContainer* obstacles, RobotFootprintModelPtr robot_model,
60+
void HomotopyClassPlanner::initialize(nav2_util::LifecycleNode::SharedPtr node, const TebConfig& cfg, ObstContainer* obstacles,
6161
TebVisualizationPtr visual, const ViaPointContainer* via_points)
6262
{
6363
node_ = node;
6464
cfg_ = &cfg;
6565
obstacles_ = obstacles;
6666
via_points_ = via_points;
67-
robot_model_ = robot_model;
6867

6968
if (cfg_->hcp.simple_exploration)
7069
graph_search_ = std::shared_ptr<GraphSearchInterface>(new lrKeyPointGraph(*cfg_, this));
@@ -82,11 +81,6 @@ void HomotopyClassPlanner::initialize(nav2_util::LifecycleNode::SharedPtr node,
8281
setVisualization(visual);
8382
}
8483

85-
void HomotopyClassPlanner::updateRobotModel(RobotFootprintModelPtr robot_model )
86-
{
87-
robot_model_ = robot_model;
88-
}
89-
9084
void HomotopyClassPlanner::setVisualization(const TebVisualizationPtr& visualization)
9185
{
9286
visualization_ = visualization;
@@ -171,7 +165,7 @@ void HomotopyClassPlanner::visualize()
171165
visualization_->publishLocalPlanAndPoses(best_teb->teb());
172166

173167
if (best_teb->teb().sizePoses() > 0) //TODO maybe store current pose (start) within plan method as class field.
174-
visualization_->publishRobotFootprintModel(best_teb->teb().Pose(0), *robot_model_);
168+
visualization_->publishRobotFootprintModel(best_teb->teb().Pose(0), *cfg_->robot_model);
175169

176170
// feedback message
177171
if (cfg_->trajectory.publish_feedback)
@@ -372,7 +366,7 @@ TebOptimalPlannerPtr HomotopyClassPlanner::addAndInitNewTeb(const PoseSE2& start
372366
{
373367
if(tebs_.size() >= cfg_->hcp.max_number_classes)
374368
return TebOptimalPlannerPtr();
375-
TebOptimalPlannerPtr candidate = TebOptimalPlannerPtr( new TebOptimalPlanner(node_, *cfg_, obstacles_, robot_model_, visualization_));
369+
TebOptimalPlannerPtr candidate = TebOptimalPlannerPtr( new TebOptimalPlanner(node_, *cfg_, obstacles_, visualization_));
376370

377371
candidate->teb().initTrajectoryToGoal(start, goal, 0, cfg_->robot.max_vel_x, cfg_->trajectory.min_samples, cfg_->trajectory.allow_init_with_backwards_motion);
378372

@@ -427,7 +421,7 @@ TebOptimalPlannerPtr HomotopyClassPlanner::addAndInitNewTeb(const std::vector<ge
427421
{
428422
if(tebs_.size() >= cfg_->hcp.max_number_classes)
429423
return TebOptimalPlannerPtr();
430-
TebOptimalPlannerPtr candidate = TebOptimalPlannerPtr( new TebOptimalPlanner(node_, *cfg_, obstacles_, robot_model_, visualization_));
424+
TebOptimalPlannerPtr candidate = TebOptimalPlannerPtr( new TebOptimalPlanner(node_, *cfg_, obstacles_, visualization_));
431425

432426
candidate->teb().initTrajectoryToGoal(initial_plan, cfg_->robot.max_vel_x, cfg_->robot.max_vel_theta,
433427
cfg_->trajectory.global_plan_overwrite_orientation, cfg_->trajectory.min_samples, cfg_->trajectory.allow_init_with_backwards_motion);

0 commit comments

Comments
 (0)