20 namespace std_plugins {
33 PluginBase::initialize(uas_);
34 MissionBase::initialize(&
rp_nh);
37 wp_type = plugin::WP_TYPE::RALLY;
93 if (rp_nh.
hasParam(
"enable_partial_push")) {
108 auto wpl = boost::make_shared<mavros_msgs::WaypointList>();
112 wpl->waypoints.clear();
113 wpl->waypoints.reserve(
waypoints.size());
115 wpl->waypoints.push_back(it);
124 bool pull_cb(mavros_msgs::WaypointPull::Request &req,
125 mavros_msgs::WaypointPull::Response &res)
147 bool push_cb(mavros_msgs::WaypointPush::Request &req,
148 mavros_msgs::WaypointPush::Response &res)
156 if (req.start_index) {
162 res.wp_transfered = 0;
166 if (
waypoints.size() < req.start_index + req.waypoints.size()) {
169 res.wp_transfered = 0;
176 uint16_t seq = req.start_index;
177 for (
auto &it : req.waypoints) {
220 bool clear_cb(mavros_msgs::WaypointClear::Request &req,
221 mavros_msgs::WaypointClear::Response &res)
void mission_request_list()
MAVROS Plugin base class.
ros::Timer schedule_timer
#define ROS_INFO_NAMED(name,...)
void publish(const boost::shared_ptr< M > &message) const
ros::ServiceServer clear_srv
const ros::Duration BOOTUP_TIME_DT
#define ROS_WARN_NAMED(name,...)
ros::Publisher rp_list_pub
std::recursive_mutex mutex
HandlerInfo make_handler(const mavlink::msgid_t id, void(_C::*fn)(const mavlink::mavlink_message_t *msg, const mavconn::Framing framing))
void restart_timeout_timer(void)
void handle_mission_item_int(const mavlink::mavlink_message_t *msg, WP_ITEM_INT &wpi)
handle MISSION_ITEM_INT mavlink msg handles and stores mission items when pulling waypoints ...
MissionBase(std::string _name)
bool has_capability(T capability)
Function to check if the flight controller has a capability.
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
void handle_mission_count(const mavlink::mavlink_message_t *msg, mavlink::common::msg::MISSION_COUNT &mcnt)
handle MISSION_COUNT mavlink msg Handles a mission count from FCU in a Waypoint Pull Triggers a pull ...
void enable_capabilities_cb()
void publish_waypoints() override
publish the updated waypoint list after operation
std::lock_guard< std::recursive_mutex > lock_guard
bool push_cb(mavros_msgs::WaypointPush::Request &req, mavros_msgs::WaypointPush::Response &res)
ros::ServiceServer pull_srv
void capabilities_cb(UAS::MAV_CAP capabilities) override
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
bool mission_item_int_support_confirmed
bool is_ardupilotmega()
Check that FCU is APM.
mavlink::common::MAV_PROTOCOL_CAPABILITY MAV_CAP
Subscriptions get_subscriptions() override
Return vector of MAVLink message subscriptions (handlers)
bool wait_fetch_all()
wait until a waypoint pull is complete. Pull happens asynchronously, this function blocks until it is...
ros::ServiceServer push_srv
std::vector< mavros_msgs::Waypoint > send_waypoints
Rallypoint manipulation plugin.
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
bool wait_push_all()
wait until a waypoint push is complete. Push happens asynchronously, this function blocks until it is...
void mission_write_partial_list(uint16_t start_index, uint16_t end_index)
std::unique_lock< std::recursive_mutex > unique_lock
bool pull_cb(mavros_msgs::WaypointPull::Request &req, mavros_msgs::WaypointPull::Response &res)
void handle_mission_request_int(const mavlink::mavlink_message_t *msg, mavlink::common::msg::MISSION_REQUEST_INT &mreq)
handle MISSION_REQUEST_INT mavlink msg handles and acts on misison request from FCU ...
void handle_mission_item(const mavlink::mavlink_message_t *msg, WP_ITEM &wpi)
handle MISSION_ITEM mavlink msg handles and stores mission items when pulling waypoints ...
void enable_connection_cb()
std::vector< HandlerInfo > Subscriptions
Subscriptions vector.
bool getParam(const std::string &key, std::string &s) const
void handle_mission_ack(const mavlink::mavlink_message_t *msg, mavlink::common::msg::MISSION_ACK &mack)
handle MISSION_ACK mavlink msg Handles a MISSION_ACK which marks the end of a push, or a failure
void connection_cb(bool connected) override
void schedule_pull(const ros::Duration &dt)
void initialize(UAS &uas_) override
Plugin initializer.
bool hasParam(const std::string &key) const
bool clear_cb(mavros_msgs::WaypointClear::Request &req, mavros_msgs::WaypointClear::Response &res)
bool use_mission_item_int
void handle_mission_request(const mavlink::mavlink_message_t *msg, mavlink::common::msg::MISSION_REQUEST &mreq)
handle MISSION_REQUEST mavlink msg handles and acts on misison request from FCU
std::vector< mavros_msgs::Waypoint > waypoints
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
void mission_count(uint16_t cnt)