Nav2 Navigation Stack - lyrical  lyrical
ROS 2 Navigation Stack
non_charging_dock.hpp
1 // Copyright (c) 2024 Open Navigation LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef OPENNAV_DOCKING_CORE__NON_CHARGING_DOCK_HPP_
16 #define OPENNAV_DOCKING_CORE__NON_CHARGING_DOCK_HPP_
17 
18 #include <string>
19 #include <memory>
20 
21 #include "opennav_docking_core/charging_dock.hpp"
22 #include "nav2_ros_common/tf2_factories.hpp"
23 
24 
25 namespace opennav_docking_core
26 {
27 
33 {
34 public:
35  using Ptr = std::shared_ptr<NonChargingDock>;
36 
40  virtual ~NonChargingDock() {}
41 
47  virtual void configure(
48  const nav2::LifecycleNode::WeakPtr & parent,
49  const std::string & name, nav2::TransformBuffer::SharedPtr tf) = 0;
50 
54  virtual void cleanup() = 0;
55 
59  virtual void activate() = 0;
60 
64  virtual void deactivate() = 0;
65 
74  virtual geometry_msgs::msg::PoseStamped getStagingPose(
75  const geometry_msgs::msg::Pose & pose, const std::string & frame) = 0;
76 
82  virtual bool getRefinedPose(geometry_msgs::msg::PoseStamped & pose, std::string id) = 0;
83 
92  virtual bool isDocked() = 0;
93 
102  bool isCharging() final
103  {
104  throw std::runtime_error("This dock is not a charging dock!");
105  }
106 
116  bool disableCharging() final
117  {
118  throw std::runtime_error("This dock is not a charging dock!");
119  }
120 
124  bool hasStoppedCharging() final
125  {
126  throw std::runtime_error("This dock is not a charging dock!");
127  }
128 
132  virtual bool startDetectionProcess() = 0;
133 
137  virtual bool stopDetectionProcess() = 0;
138 
142  bool isCharger() final {return false;}
143 };
144 
145 } // namespace opennav_docking_core
146 
147 #endif // OPENNAV_DOCKING_CORE__NON_CHARGING_DOCK_HPP_
Abstract interface for a charging dock for the docking framework.
Abstract interface for a non-charging dock for the docking framework.
virtual ~NonChargingDock()
Virtual destructor.
virtual void deactivate()=0
Method to deactivate Behavior and any threads involved in execution.
bool disableCharging() final
Undocking while current is still flowing can damage a charge dock so some charge docks provide the ab...
bool isCharger() final
Gets if this is a charging-typed dock.
virtual bool getRefinedPose(geometry_msgs::msg::PoseStamped &pose, std::string id)=0
Method to obtain the refined pose of the dock, usually based on sensors.
virtual bool startDetectionProcess()=0
Start any detection pipelines required for pose refinement.
virtual geometry_msgs::msg::PoseStamped getStagingPose(const geometry_msgs::msg::Pose &pose, const std::string &frame)=0
Method to obtain the dock's staging pose. This method should likely be using TF and the dock's pose i...
virtual void activate()=0
Method to active Behavior and any threads involved in execution.
virtual bool isDocked()=0
Have we made contact with dock? This can be implemented in a variety of ways: by establishing communi...
bool hasStoppedCharging() final
Similar to isCharging() but called when undocking.
virtual void configure(const nav2::LifecycleNode::WeakPtr &parent, const std::string &name, nav2::TransformBuffer::SharedPtr tf)=0
bool isCharging() final
Are we charging? If a charge dock requires any sort of negotiation to begin charging,...
virtual bool stopDetectionProcess()=0
Stop any detection pipelines running for pose refinement.
virtual void cleanup()=0
Method to cleanup resources used on shutdown.