13 #include <Eigen/Eigen>
15 #include <px4_ros2/third_party/nlohmann/json_fwd.hpp>
17 #include <rclcpp/rclcpp.hpp>
35 const nlohmann::json & json()
const
40 bool contains(
const std::string & key)
const;
43 T at(
const std::string & key)
const;
53 std::shared_ptr<nlohmann::json> _data;
56 enum class MissionFrame
61 static inline std::string missionFrameStr(MissionFrame frame)
64 case MissionFrame::Global:
73 explicit Waypoint(Eigen::Vector3d a_coordinate, MissionFrame a_frame = MissionFrame::Global)
74 : coordinate(std::move(a_coordinate)), frame(a_frame) {}
76 Eigen::Vector3d coordinate;
78 MissionFrame frame{MissionFrame::Global};
80 friend void from_json(
const nlohmann::json & j,
Waypoint & o);
81 friend void to_json(nlohmann::json & j,
const Waypoint & o);
84 enum class NavigationItemType
96 std::variant<Waypoint> data;
98 friend void from_json(
const nlohmann::json & j,
NavigationItem & o);
107 : name(std::move(a_name)), arguments(std::move(a_arguments)) {}
114 friend void from_json(
const nlohmann::json & j,
ActionItem & o);
115 friend void to_json(nlohmann::json & j,
const ActionItem & o);
118 using MissionItem = std::variant<NavigationItem, ActionItem>;
163 std::vector<MissionItem> mission_items,
165 : _mission_defaults(mission_defaults), _mission_items(std::move(mission_items)) {}
169 const std::vector<MissionItem> & items()
const {
return _mission_items;}
171 bool indexValid(
int index)
const
173 return index >= 0 && index < static_cast<int>(_mission_items.size());
176 friend void from_json(
const nlohmann::json & j,
Mission & o);
177 friend void to_json(nlohmann::json & j,
const Mission & o);
179 std::string checksum()
const;
183 std::vector<MissionItem> _mission_items;
194 std::shared_ptr<rclcpp::Node> node, std::filesystem::path filename,
195 std::function<
void(std::shared_ptr<Mission>)> on_mission_update);
202 std::shared_ptr<rclcpp::Node> _node;
203 const std::filesystem::path _filename;
204 const std::function<void(std::shared_ptr<Mission>)> _on_mission_update;
207 rclcpp::TimerBase::SharedPtr _update_timer;
Arguments passed to an action from the mission JSON definition.
Definition: mission.hpp:29
bool resuming() const
Check if the action is being resumed.
File monitor to load a mission from a JSON file.
Definition: mission.hpp:191
Mission definition.
Definition: mission.hpp:158
Definition: mission.hpp:104
Definition: mission.hpp:144
Definition: mission.hpp:90
Definition: mission.hpp:121
std::optional< float > max_heading_rate
[rad/s]
Definition: mission.hpp:124
std::optional< float > vertical_velocity
[m/s]
Definition: mission.hpp:123
std::optional< float > horizontal_velocity
[m/s]
Definition: mission.hpp:122
Definition: mission.hpp:71