This class converts the costmap_2d into dynamic obstacles. More...
#include <costmap_to_dynamic_obstacles.h>
Public Member Functions | |
virtual void | compute () |
This method performs the actual work (conversion of the costmap to obstacles) More... | |
CostmapToDynamicObstacles () | |
Constructor. More... | |
ObstacleArrayConstPtr | getObstacles () |
Get a shared instance of the current obstacle container. More... | |
virtual void | initialize (ros::NodeHandle nh) |
Initialize the plugin. More... | |
virtual void | setCostmap2D (costmap_2d::Costmap2D *costmap) |
Pass a pointer to the costmap to the plugin. More... | |
virtual void | setOdomTopic (const std::string &odom_topic) |
Set name of robot's odometry topic. More... | |
virtual void | updateCostmap2D () |
Get updated data from the previously set Costmap2D. More... | |
void | visualize (const std::string &name, const cv::Mat &image) |
OpenCV Visualization. More... | |
virtual | ~CostmapToDynamicObstacles () |
Destructor. More... | |
Public Member Functions inherited from costmap_converter::BaseCostmapToDynamicObstacles | |
void | convertStaticObstacles () |
Apply the underlying plugin for static costmap conversion. More... | |
PolygonContainerConstPtr | getStaticPolygons () |
Get the converted polygons from the underlying plugin. More... | |
void | loadStaticCostmapConverterPlugin (const std::string &plugin_name, ros::NodeHandle nh_parent) |
Load underlying static costmap conversion plugin via plugin-loader. More... | |
void | setStaticCostmap (boost::shared_ptr< costmap_2d::Costmap2D > static_costmap) |
Set the costmap for the underlying plugin. More... | |
void | setStaticCostmapConverterPlugin (boost::shared_ptr< BaseCostmapToPolygons > static_costmap_converter) |
Set the underlying plugin for subsequent costmap conversion of the static background of the costmap. More... | |
bool | stackedCostmapConversion () |
Determines whether an additional plugin for subsequent costmap conversion is specified. More... | |
Public Member Functions inherited from costmap_converter::BaseCostmapToPolygons | |
virtual PolygonContainerConstPtr | getPolygons () |
Get a shared instance of the current polygon container. More... | |
void | startWorker (ros::Rate rate, costmap_2d::Costmap2D *costmap, bool spin_thread=false) |
Instantiate a worker that repeatedly coverts the most recent costmap to polygons. The worker is implemented as a timer event that is invoked at a specific rate . The passed costmap pointer must be valid at the complete time and must be lockable. By specifying the argument spin_thread the timer event is invoked in a separate thread and callback queue or otherwise it is called from the global callback queue (of the node in which the plugin is used). More... | |
void | stopWorker () |
Stop the worker that repeatedly converts the costmap to polygons. More... | |
virtual | ~BaseCostmapToPolygons () |
Destructor. More... | |
Protected Member Functions | |
void | getContour (unsigned int idx, std::vector< Point_t > &contour) |
Gets the last observed contour of a object and converts it from [px] to [m]. More... | |
Point_t | getEstimatedVelocityOfObject (unsigned int idx) |
Converts the estimated velocity of a tracked object to m/s and returns it. More... | |
void | updateObstacleContainer (ObstacleArrayPtr obstacles) |
Thread-safe update of the internal obstacle container (that is shared using getObstacles() from outside this class) More... | |
Protected Member Functions inherited from costmap_converter::BaseCostmapToDynamicObstacles | |
BaseCostmapToDynamicObstacles () | |
Protected constructor that should be called by subclasses. More... | |
Protected Member Functions inherited from costmap_converter::BaseCostmapToPolygons | |
BaseCostmapToPolygons () | |
Protected constructor that should be called by subclasses. More... | |
void | spinThread () |
Blocking method that checks for new timer events (active if startWorker() is called with spin_thread enabled) More... | |
void | workerCallback (const ros::TimerEvent &) |
The callback of the worker that performs the actual work (updating the costmap and converting it to polygons) More... | |
Private Member Functions | |
void | odomCallback (const nav_msgs::Odometry::ConstPtr &msg) |
modifications at runtime More... | |
void | reconfigureCB (CostmapToDynamicObstaclesConfig &config, uint32_t level) |
Callback for the dynamic_reconfigure node. More... | |
Private Attributes | |
std::unique_ptr< BackgroundSubtractor > | bg_sub_ |
cv::Ptr< BlobDetector > | blob_det_ |
costmap_2d::Costmap2D * | costmap_ |
cv::Mat | costmap_mat_ |
dynamic_reconfigure::Server< CostmapToDynamicObstaclesConfig > * | dynamic_recfg_ |
Point_t | ego_vel_ |
cv::Mat | fg_mask_ |
std::vector< cv::KeyPoint > | keypoints_ |
boost::mutex | mutex_ |
ObstacleArrayPtr | obstacles_ |
ros::Subscriber | odom_sub_ |
std::string | odom_topic_ = "/odom" |
bool | publish_static_obstacles_ = true |
std::unique_ptr< CTracker > | tracker_ |
This class converts the costmap_2d into dynamic obstacles.
Static obstacles are treated as point obstacles.
Definition at line 77 of file costmap_to_dynamic_obstacles.h.
costmap_converter::CostmapToDynamicObstacles::CostmapToDynamicObstacles | ( | ) |
Constructor.
Definition at line 11 of file costmap_to_dynamic_obstacles.cpp.
|
virtual |
Destructor.
Definition at line 18 of file costmap_to_dynamic_obstacles.cpp.
|
virtual |
This method performs the actual work (conversion of the costmap to obstacles)
Implements costmap_converter::BaseCostmapToPolygons.
Definition at line 144 of file costmap_to_dynamic_obstacles.cpp.
|
protected |
Gets the last observed contour of a object and converts it from [px] to [m].
[in] | idx | Index of the tracked object in the tracker |
[out] | contour | vector of Point_t, which represents the last observed contour in [m] in x,y,z coordinates |
Definition at line 445 of file costmap_to_dynamic_obstacles.cpp.
|
protected |
Converts the estimated velocity of a tracked object to m/s and returns it.
idx | Index of the tracked object in the tracker |
Definition at line 370 of file costmap_to_dynamic_obstacles.cpp.
|
virtual |
Get a shared instance of the current obstacle container.
Reimplemented from costmap_converter::BaseCostmapToPolygons.
Definition at line 358 of file costmap_to_dynamic_obstacles.cpp.
|
virtual |
Initialize the plugin.
nh | Nodehandle that defines the namespace for parameters |
Implements costmap_converter::BaseCostmapToPolygons.
Definition at line 24 of file costmap_to_dynamic_obstacles.cpp.
|
private |
modifications at runtime
Callback for the odometry messages of the observing robot.
Used to convert the velocity of obstacles to the /map frame.
msg | The Pointer to the nav_msgs::Odometry of the observing robot |
Definition at line 380 of file costmap_to_dynamic_obstacles.cpp.
|
private |
Callback for the dynamic_reconfigure node.
This callback allows to modify parameters dynamically at runtime without restarting the node
config | Reference to the dynamic reconfigure config |
level | Dynamic reconfigure level |
Definition at line 397 of file costmap_to_dynamic_obstacles.cpp.
|
virtual |
Pass a pointer to the costmap to the plugin.
costmap | Pointer to the costmap2d source |
Implements costmap_converter::BaseCostmapToPolygons.
Definition at line 332 of file costmap_to_dynamic_obstacles.cpp.
|
inlinevirtual |
Set name of robot's odometry topic.
Some plugins might require odometry information to compensate the robot's ego motion
odom_topic | topic name |
Reimplemented from costmap_converter::BaseCostmapToPolygons.
Definition at line 132 of file costmap_to_dynamic_obstacles.h.
|
virtual |
Get updated data from the previously set Costmap2D.
Implements costmap_converter::BaseCostmapToPolygons.
Definition at line 342 of file costmap_to_dynamic_obstacles.cpp.
|
protected |
Thread-safe update of the internal obstacle container (that is shared using getObstacles() from outside this class)
obstacles | Updated obstacle container |
Definition at line 364 of file costmap_to_dynamic_obstacles.cpp.
void costmap_converter::CostmapToDynamicObstacles::visualize | ( | const std::string & | name, |
const cv::Mat & | image | ||
) |
OpenCV Visualization.
name | Id/name of the opencv window |
image | Image to be visualized |
Definition at line 466 of file costmap_to_dynamic_obstacles.cpp.
|
private |
Definition at line 177 of file costmap_to_dynamic_obstacles.h.
|
private |
Definition at line 178 of file costmap_to_dynamic_obstacles.h.
|
private |
Definition at line 173 of file costmap_to_dynamic_obstacles.h.
|
private |
Definition at line 174 of file costmap_to_dynamic_obstacles.h.
|
private |
Dynamic reconfigure server to allow config
Definition at line 188 of file costmap_to_dynamic_obstacles.h.
|
private |
Definition at line 182 of file costmap_to_dynamic_obstacles.h.
|
private |
Definition at line 176 of file costmap_to_dynamic_obstacles.h.
|
private |
Definition at line 179 of file costmap_to_dynamic_obstacles.h.
|
private |
Definition at line 172 of file costmap_to_dynamic_obstacles.h.
|
private |
Definition at line 175 of file costmap_to_dynamic_obstacles.h.
|
private |
Definition at line 181 of file costmap_to_dynamic_obstacles.h.
|
private |
Definition at line 184 of file costmap_to_dynamic_obstacles.h.
|
private |
Definition at line 185 of file costmap_to_dynamic_obstacles.h.
|
private |
Definition at line 180 of file costmap_to_dynamic_obstacles.h.