Program Listing for File Adapter.hpp
↰ Return to documentation for file (/tmp/ws/src/rmf_ros2/rmf_fleet_adapter/include/rmf_fleet_adapter/agv/Adapter.hpp
)
/*
* Copyright (C) 2020 Open Source Robotics Foundation
*
* 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 RMF_FLEET_ADAPTER__AGV__ADAPTER_HPP
#define RMF_FLEET_ADAPTER__AGV__ADAPTER_HPP
#include <rmf_fleet_adapter/agv/FleetUpdateHandle.hpp>
#include <rmf_fleet_adapter/agv/EasyTrafficLight.hpp>
#include <rmf_traffic/agv/VehicleTraits.hpp>
#include <rmf_traffic/agv/Graph.hpp>
#include <rclcpp/node.hpp>
namespace rmf_fleet_adapter {
namespace agv {
//==============================================================================
class Adapter : public std::enable_shared_from_this<Adapter>
{
public:
static std::shared_ptr<Adapter> init_and_make(
const std::string& node_name,
std::optional<rmf_traffic::Duration> discovery_timeout = std::nullopt);
static std::shared_ptr<Adapter> make(
const std::string& node_name,
const rclcpp::NodeOptions& node_options = rclcpp::NodeOptions(),
std::optional<rmf_traffic::Duration> discovery_timeout = std::nullopt);
std::shared_ptr<FleetUpdateHandle> add_fleet(
const std::string& fleet_name,
rmf_traffic::agv::VehicleTraits traits,
rmf_traffic::agv::Graph navigation_graph,
std::optional<std::string> server_uri = std::nullopt);
using Blockers = std::vector<EasyTrafficLight::Blocker>;
void add_easy_traffic_light(
std::function<void(EasyTrafficLightPtr handle)> handle_callback,
const std::string& fleet_name,
const std::string& robot_name,
rmf_traffic::agv::VehicleTraits traits,
std::function<void()> pause_callback,
std::function<void()> resume_callback,
std::function<void(Blockers)> deadlock_callback = nullptr);
std::shared_ptr<rclcpp::Node> node();
std::shared_ptr<const rclcpp::Node> node() const;
Adapter& start();
Adapter& stop();
Adapter& wait();
Adapter& wait_for(std::chrono::nanoseconds max_wait);
class Implementation;
private:
Adapter();
rmf_utils::unique_impl_ptr<Implementation> _pimpl;
};
using AdapterPtr = std::shared_ptr<Adapter>;
using ConstAdapterPtr = std::shared_ptr<const Adapter>;
} // namespace agv
} // namespace rmf_fleet_adapter
#endif // RMF_FLEET_ADAPTER__AGV__ADAPTER_HPP