16#ifndef EASYFLEET_MISSION_MANAGER__ROBOT_HANDLE_HPP_
17#define EASYFLEET_MISSION_MANAGER__ROBOT_HANDLE_HPP_
25#include "easyfleet_mission_manager/capability_info.hpp"
26#include "easyfleet_mission_manager/capability_state.hpp"
27#include "easyfleet_mission_manager/detail/running_capability.hpp"
28#include "easyfleet_mission_manager/mission_helpers.hpp"
84 const std::string &
name()
const noexcept;
125 template<
typename ActionT>
127 const std::string & capability_type,
128 const typename ActionT::Goal & goal =
typename ActionT::Goal(),
129 std::chrono::seconds timeout = easyfleet_mission_manager::kRunTimeout);
146 CapabilityState
capability_state(
const std::string & capability_type)
const;
155 bool is_alive(
const std::string & capability_type)
const;
170 const std::vector<easyfleet_mission_manager::CapabilityInfo> &
capabilities()
const noexcept;
173 friend class FleetSession;
180 void attach(FleetSession & session);
181 void set_capabilities(std::vector<easyfleet_mission_manager::CapabilityInfo>
capabilities);
188 const std::string & capability_type,
189 std::chrono::steady_clock::time_point when);
193 void check_timeouts();
196 std::vector<easyfleet_mission_manager::CapabilityInfo> capabilities_;
197 std::map<std::string,
198 std::unique_ptr<easyfleet_mission_manager::detail::RunningCapabilityBase>> running_;
199 std::map<std::string, std::chrono::steady_clock::time_point> last_heartbeat_;
206 FleetSession * session_{
nullptr};
Everything talking to a fleet from a mission-control process actually needs, regardless of what decid...
Definition fleet_session.hpp:79
const std::string & name() const noexcept
This robot's identity, as passed to the constructor.
Definition robot_handle.cpp:45
RobotHandle(std::string name)
Constructs a handle for the robot identified by name.
Definition robot_handle.cpp:40
bool is_alive(const std::string &capability_type) const
Whether a heartbeat has been seen recently on /capabilities_status for this capability – continuously...
Definition robot_handle.cpp:81
void stop_capability(const std::string &capability_type)
Asks capability_type to stop whatever it's doing, if anything.
Definition robot_handle.cpp:59
void print_capabilities() const
Prints every discovered capability of this robot, like today's print_capability_info()/print_capabili...
Definition robot_handle.cpp:90
CapabilityState capability_state(const std::string &capability_type) const
Current state of the last run_capability() call for this type (or IDLE if none has been made).
Definition robot_handle.cpp:72
bool has_capability(const std::string &capability_type) const
True if this robot announced an active capability of this type (per the SimpleController's last disco...
Definition robot_handle.cpp:50
void run_capability(const std::string &capability_type, const typename ActionT::Goal &goal=typename ActionT::Goal(), std::chrono::seconds timeout=easyfleet_mission_manager::kRunTimeout)
Sends goal to capability_type and returns immediately – the counterpart to today's blocking easyfleet...
Definition robot_handle_impl.hpp:45
bool is_capability_running(const std::string &capability_type) const
Shorthand for capability_state(capability_type) == CapabilityState::RUNNING.
Definition robot_handle.cpp:67
const std::vector< easyfleet_mission_manager::CapabilityInfo > & capabilities() const noexcept
Every capability this robot announced, as discovered – the full CapabilityInfo (type,...
Definition robot_handle.cpp:101