visualization.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2016,
6  * TU Dortmund - Institute of Control Theory and Systems Engineering.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of the institute nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  * Author: Christoph Rösmann
37  *********************************************************************/
38 
39 #ifndef VISUALIZATION_H_
40 #define VISUALIZATION_H_
41 
42 
43 
44 // teb stuff
48 
49 // ros stuff
50 #include <ros/publisher.h>
52 
53 // boost
54 #include <boost/graph/adjacency_list.hpp>
55 #include <boost/graph/graph_traits.hpp>
56 
57 // std
58 #include <iterator>
59 
60 // messages
61 #include <nav_msgs/Path.h>
62 #include <geometry_msgs/PoseStamped.h>
63 #include <geometry_msgs/PoseArray.h>
64 #include <std_msgs/ColorRGBA.h>
65 #include <tf/transform_datatypes.h>
66 #include <nav_msgs/Odometry.h>
67 #include <nav_msgs/Path.h>
68 #include <visualization_msgs/Marker.h>
69 
70 namespace teb_local_planner
71 {
72 
73 class TebOptimalPlanner;
74 
75 
81 {
82 public:
83 
89 
96 
104  void initialize(ros::NodeHandle& nh, const TebConfig& cfg);
105 
106 
109 
114  void publishGlobalPlan(const std::vector<geometry_msgs::PoseStamped>& global_plan) const;
115 
120  void publishLocalPlan(const std::vector<geometry_msgs::PoseStamped>& local_plan) const;
121 
129  void publishLocalPlanAndPoses(const TimedElasticBand& teb) const;
130 
139  void publishRobotFootprintModel(const PoseSE2& current_pose, const BaseRobotFootprintModel& robot_model, const std::string& ns = "RobotFootprintModel",
140  const std_msgs::ColorRGBA& color = toColorMsg(0.5, 0.0, 0.8, 0.0));
141 
148  void publishInfeasibleRobotPose(const PoseSE2& current_pose, const BaseRobotFootprintModel& robot_model);
149 
155  void publishObstacles(const ObstContainer& obstacles) const;
156 
161  void publishViaPoints(const std::vector< Eigen::Vector2d, Eigen::aligned_allocator<Eigen::Vector2d> >& via_points, const std::string& ns = "ViaPoints") const;
162 
171  template <typename GraphType>
172  void publishGraph(const GraphType& graph, const std::string& ns_prefix = "Graph");
173 
199  template <typename BidirIter>
200  void publishPathContainer(BidirIter first, BidirIter last, const std::string& ns = "PathContainer");
201 
208  void publishTebContainer(const std::vector< boost::shared_ptr<TebOptimalPlanner> >& teb_planner, const std::string& ns = "TebContainer");
209 
220  void publishFeedbackMessage(const std::vector< boost::shared_ptr<TebOptimalPlanner> >& teb_planners, unsigned int selected_trajectory_idx, const ObstContainer& obstacles);
221 
231  void publishFeedbackMessage(const TebOptimalPlanner& teb_planner, const ObstContainer& obstacles);
232 
234 
243  static std_msgs::ColorRGBA toColorMsg(double a, double r, double g, double b);
244 
245 protected:
246 
251  bool printErrorWhenNotInitialized() const;
252 
258 
259  const TebConfig* cfg_;
260 
262 
263 
264 public:
265  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
266 };
267 
270 
273 
274 
275 } // namespace teb_local_planner
276 
277 
278 // Include template method implementations / definitions
280 
281 #endif /* VISUALIZATION_H_ */
void publishViaPoints(const std::vector< Eigen::Vector2d, Eigen::aligned_allocator< Eigen::Vector2d > > &via_points, const std::string &ns="ViaPoints") const
Publish via-points to the ros topic ../../teb_markers.
const TebConfig * cfg_
Config class that stores and manages all related parameters.
void initialize(ros::NodeHandle &nh, const TebConfig &cfg)
Initializes the class and registers topics.
ros::Publisher feedback_pub_
Publisher for the feedback message for analysis and debug purposes.
void publishLocalPlan(const std::vector< geometry_msgs::PoseStamped > &local_plan) const
Publish a given local plan to the ros topic ../../local_plan.
void publishPathContainer(BidirIter first, BidirIter last, const std::string &ns="PathContainer")
Publish multiple 2D paths (each path given as a point sequence) from a container class.
ros::Publisher teb_poses_pub_
Publisher for the trajectory pose sequence.
static std_msgs::ColorRGBA toColorMsg(double a, double r, double g, double b)
Helper function to generate a color message from single values.
Config class for the teb_local_planner and its components.
Definition: teb_config.h:61
Class that defines a trajectory modeled as an elastic band with augmented tempoarl information...
Abstract class that defines the interface for robot footprint/contour models.
bool printErrorWhenNotInitialized() const
Small helper function that checks if initialize() has been called and prints an error message if not...
boost::shared_ptr< const TebVisualization > TebVisualizationConstPtr
Abbrev. for shared instances of the TebVisualization (read-only)
void publishRobotFootprintModel(const PoseSE2 &current_pose, const BaseRobotFootprintModel &robot_model, const std::string &ns="RobotFootprintModel", const std_msgs::ColorRGBA &color=toColorMsg(0.5, 0.0, 0.8, 0.0))
Publish the visualization of the robot model.
void publishGlobalPlan(const std::vector< geometry_msgs::PoseStamped > &global_plan) const
Publish a given global plan to the ros topic ../../global_plan.
void publishLocalPlanAndPoses(const TimedElasticBand &teb) const
Publish Timed_Elastic_Band related stuff (local plan, pose sequence).
void publishObstacles(const ObstContainer &obstacles) const
Publish obstacle positions to the ros topic ../../teb_markers.
void publishTebContainer(const std::vector< boost::shared_ptr< TebOptimalPlanner > > &teb_planner, const std::string &ns="TebContainer")
Publish multiple Tebs from a container class (publish as marker message).
void publishGraph(const GraphType &graph, const std::string &ns_prefix="Graph")
Publish a boost::adjacency_list (boost&#39;s graph datatype) via markers.
boost::shared_ptr< TebVisualization > TebVisualizationPtr
Abbrev. for shared instances of the TebVisualization.
std::vector< ObstaclePtr > ObstContainer
Abbrev. for containers storing multiple obstacles.
Definition: obstacles.h:297
ros::Publisher teb_marker_pub_
Publisher for visualization markers.
This class implements a pose in the domain SE2: The pose consist of the position x and y and an orie...
Definition: pose_se2.h:57
TebVisualization()
Default constructor.
ros::Publisher global_plan_pub_
Publisher for the global plan.
This class optimizes an internal Timed Elastic Band trajectory using the g2o-framework.
void publishInfeasibleRobotPose(const PoseSE2 &current_pose, const BaseRobotFootprintModel &robot_model)
Publish the robot footprints related to infeasible poses.
ros::Publisher local_plan_pub_
Publisher for the local plan.
ViaPointContainer via_points
bool initialized_
Keeps track about the correct initialization of this class.
void publishFeedbackMessage(const std::vector< boost::shared_ptr< TebOptimalPlanner > > &teb_planners, unsigned int selected_trajectory_idx, const ObstContainer &obstacles)
Publish a feedback message (multiple trajectory version)


teb_local_planner
Author(s): Christoph Rösmann
autogenerated on Wed Jun 3 2020 04:03:08