EasyFleet
A simple-by-default framework for multi-robot, multi-capability fleets built on ROS 2
Loading...
Searching...
No Matches
simple_controller.hpp
1// Copyright 2026 Intelligent Robotics Lab
2//
3// This file is part of the project EasyFleet
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16#ifndef EASYFLEET_MISSION_MANAGER__SIMPLE_CONTROLLER_HPP_
17#define EASYFLEET_MISSION_MANAGER__SIMPLE_CONTROLLER_HPP_
18
19#include <chrono>
20#include <functional>
21#include <memory>
22#include <optional>
23#include <string>
24#include <vector>
25
26#include "rclcpp/rclcpp.hpp"
27
28#include "easyfleet_mission_manager/fleet_session.hpp"
29#include "easyfleet_mission_manager/robot_handle.hpp"
30
31namespace easyfleet
32{
33
37
64class SimpleController
65{
66public:
67 SimpleController() = default;
68
71 void add_robot(RobotHandle & robot) {session_.add_robot(robot);}
72
75 const std::vector<std::reference_wrapper<RobotHandle>> & robots() const noexcept
76 {
77 return session_.robots();
78 }
79
84 std::optional<std::reference_wrapper<RobotHandle>> find_robot(
85 const std::string & name) const noexcept
86 {
87 return session_.find_robot(name);
88 }
89
92 void discover_capabilities(std::chrono::milliseconds window = std::chrono::milliseconds(2500))
93 {
94 session_.discover_capabilities(window);
95 }
96
98 void spin_some() {session_.spin_some();}
99
102 void spin_for(std::chrono::milliseconds duration) {session_.spin_for(duration);}
103
106 rclcpp::Node::SharedPtr node() const noexcept {return session_.node();}
107
109 void shutdown() {session_.shutdown();}
110
111private:
112 FleetSession session_;
113};
114
115} // namespace easyfleet
116
117#endif // EASYFLEET_MISSION_MANAGER__SIMPLE_CONTROLLER_HPP_
Everything talking to a fleet from a mission-control process actually needs, regardless of what decid...
Definition fleet_session.hpp:79
A remote robot's capabilities, as seen and commanded from a mission script.
Definition robot_handle.hpp:75
void discover_capabilities(std::chrono::milliseconds window=std::chrono::milliseconds(2500))
See FleetSession::discover_capabilities().
Definition simple_controller.hpp:92
std::optional< std::reference_wrapper< RobotHandle > > find_robot(const std::string &name) const noexcept
See FleetSession::find_robot().
Definition simple_controller.hpp:84
rclcpp::Node::SharedPtr node() const noexcept
See FleetSession::node().
Definition simple_controller.hpp:106
void shutdown()
See FleetSession::shutdown().
Definition simple_controller.hpp:109
void spin_for(std::chrono::milliseconds duration)
See FleetSession::spin_for().
Definition simple_controller.hpp:102
void spin_some()
See FleetSession::spin_some().
Definition simple_controller.hpp:98
void add_robot(RobotHandle &robot)
Adds robot to this controller's session.
Definition simple_controller.hpp:71
const std::vector< std::reference_wrapper< RobotHandle > > & robots() const noexcept
See FleetSession::robots().
Definition simple_controller.hpp:75