Nav2 Navigation Stack - jazzy  jazzy
ROS 2 Navigation Stack
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
opennav_docking::DockDatabase Class Reference

An object to contain docks and docking plugins. More...

#include <nav2_docking/opennav_docking/include/opennav_docking/dock_database.hpp>

Public Member Functions

 DockDatabase (std::shared_ptr< std::mutex > mutex=std::make_shared< std::mutex >())
 A constructor for opennav_docking::DockDatabase.
 
bool initialize (const rclcpp_lifecycle::LifecycleNode::WeakPtr &parent, std::shared_ptr< tf2_ros::Buffer > tf)
 A setup function to populate database. More...
 
 ~DockDatabase ()
 A destructor for opennav_docking::DockDatabase.
 
void activate ()
 An activation method.
 
void deactivate ()
 An deactivation method.
 
DockfindDock (const std::string &dock_id)
 Find a dock instance & plugin in the databases from ID. More...
 
ChargingDock::Ptr findDockPlugin (const std::string &type)
 Find a dock plugin to use for a given type. More...
 
unsigned int instance_size () const
 Get the number of docks in the database. More...
 
unsigned int plugin_size () const
 Get the number of dock types in the database. More...
 

Protected Member Functions

bool getDockPlugins (const rclcpp_lifecycle::LifecycleNode::SharedPtr &node, std::shared_ptr< tf2_ros::Buffer > tf)
 Populate database of dock type plugins. More...
 
bool getDockInstances (const rclcpp_lifecycle::LifecycleNode::SharedPtr &node)
 Populate database of dock instances. More...
 
DockfindDockInstance (const std::string &dock_id)
 Find a dock instance in the database from ID. More...
 
void reloadDbCb (const std::shared_ptr< nav2_msgs::srv::ReloadDockDatabase::Request > request, std::shared_ptr< nav2_msgs::srv::ReloadDockDatabase::Response > response)
 Service request to reload database of docks. More...
 

Protected Attributes

rclcpp_lifecycle::LifecycleNode::WeakPtr node_
 
std::shared_ptr< std::mutex > mutex_
 
DockPluginMap dock_plugins_
 
DockMap dock_instances_
 
pluginlib::ClassLoader< opennav_docking_core::ChargingDockdock_loader_
 
rclcpp::Service< nav2_msgs::srv::ReloadDockDatabase >::SharedPtr reload_db_service_
 

Detailed Description

An object to contain docks and docking plugins.

Definition at line 40 of file dock_database.hpp.

Member Function Documentation

◆ findDock()

Dock * opennav_docking::DockDatabase::findDock ( const std::string &  dock_id)

Find a dock instance & plugin in the databases from ID.

Parameters
dock_idId of dock to find
Returns
Dock pointer

Definition at line 107 of file dock_database.cpp.

References findDockInstance(), and findDockPlugin().

Here is the call graph for this function:

◆ findDockInstance()

Dock * opennav_docking::DockDatabase::findDockInstance ( const std::string &  dock_id)
protected

Find a dock instance in the database from ID.

Parameters
dock_idId of dock to find
Returns
Dock pointer

Definition at line 124 of file dock_database.cpp.

Referenced by findDock().

Here is the caller graph for this function:

◆ findDockPlugin()

ChargingDock::Ptr opennav_docking::DockDatabase::findDockPlugin ( const std::string &  type)

Find a dock plugin to use for a given type.

Parameters
typeDock type to find plugin for
Returns
Dock plugin pointer

Definition at line 133 of file dock_database.cpp.

Referenced by findDock().

Here is the caller graph for this function:

◆ getDockInstances()

bool opennav_docking::DockDatabase::getDockInstances ( const rclcpp_lifecycle::LifecycleNode::SharedPtr &  node)
protected

Populate database of dock instances.

Parameters
NodeNode to get values from

Definition at line 187 of file dock_database.cpp.

Referenced by initialize().

Here is the caller graph for this function:

◆ getDockPlugins()

bool opennav_docking::DockDatabase::getDockPlugins ( const rclcpp_lifecycle::LifecycleNode::SharedPtr &  node,
std::shared_ptr< tf2_ros::Buffer >  tf 
)
protected

Populate database of dock type plugins.

Parameters
NodeNode to get values from
tfTF buffer
Returns
bool If successful

Definition at line 147 of file dock_database.cpp.

Referenced by initialize().

Here is the caller graph for this function:

◆ initialize()

bool opennav_docking::DockDatabase::initialize ( const rclcpp_lifecycle::LifecycleNode::WeakPtr &  parent,
std::shared_ptr< tf2_ros::Buffer >  tf 
)

A setup function to populate database.

Parameters
parentWeakptr to the node to use to get interances and parameters
tfTF buffer
Returns
If successful

Definition at line 31 of file dock_database.cpp.

References getDockInstances(), getDockPlugins(), and reloadDbCb().

Here is the call graph for this function:

◆ instance_size()

unsigned int opennav_docking::DockDatabase::instance_size ( ) const

Get the number of docks in the database.

Returns
unsigned int Number of dock instances in the database

Definition at line 234 of file dock_database.cpp.

◆ plugin_size()

unsigned int opennav_docking::DockDatabase::plugin_size ( ) const

Get the number of dock types in the database.

Returns
unsigned int Number of dock types in the database

Definition at line 229 of file dock_database.cpp.

◆ reloadDbCb()

void opennav_docking::DockDatabase::reloadDbCb ( const std::shared_ptr< nav2_msgs::srv::ReloadDockDatabase::Request >  request,
std::shared_ptr< nav2_msgs::srv::ReloadDockDatabase::Response >  response 
)
protected

Service request to reload database of docks.

Parameters
requestService request
responseService response

Definition at line 82 of file dock_database.cpp.

Referenced by initialize().

Here is the caller graph for this function:

The documentation for this class was generated from the following files: