Program Listing for File dock_database.hpp
↰ Return to documentation for file (include/opennav_docking/dock_database.hpp
)
// Copyright (c) 2024 Open Navigation LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef OPENNAV_DOCKING__DOCK_DATABASE_HPP_
#define OPENNAV_DOCKING__DOCK_DATABASE_HPP_
#include <vector>
#include <memory>
#include <string>
#include "rclcpp/rclcpp.hpp"
#include "pluginlib/class_loader.hpp"
#include "pluginlib/class_list_macros.hpp"
#include "nav2_util/lifecycle_node.hpp"
#include "nav2_util/node_utils.hpp"
#include "nav2_util/simple_action_server.hpp"
#include "opennav_docking/utils.hpp"
#include "opennav_docking/types.hpp"
#include "opennav_docking_msgs/srv/reload_database.hpp"
namespace opennav_docking
{
class DockDatabase
{
public:
DockDatabase();
bool initialize(
const rclcpp_lifecycle::LifecycleNode::WeakPtr & parent, std::shared_ptr<tf2_ros::Buffer> tf);
~DockDatabase();
void activate();
void deactivate();
Dock * findDock(const std::string & dock_id);
ChargingDock::Ptr findDockPlugin(const std::string & type);
unsigned int instance_size() const;
unsigned int plugin_size() const;
protected:
bool getDockPlugins(
const rclcpp_lifecycle::LifecycleNode::SharedPtr & node, std::shared_ptr<tf2_ros::Buffer> tf);
bool getDockInstances(const rclcpp_lifecycle::LifecycleNode::SharedPtr & node);
Dock * findDockInstance(const std::string & dock_id);
void reloadDbCb(
const std::shared_ptr<opennav_docking_msgs::srv::ReloadDatabase::Request> request,
std::shared_ptr<opennav_docking_msgs::srv::ReloadDatabase::Response> response);
rclcpp_lifecycle::LifecycleNode::WeakPtr node_;
DockPluginMap dock_plugins_;
DockMap dock_instances_;
pluginlib::ClassLoader<opennav_docking_core::ChargingDock> dock_loader_;
rclcpp::Service<opennav_docking_msgs::srv::ReloadDatabase>::SharedPtr reload_db_service_;
};
} // namespace opennav_docking
#endif // OPENNAV_DOCKING__DOCK_DATABASE_HPP_