mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-06 19:00:27 +08:00
GCS_MAVLink: remove rallypoint/fencepoint protocols
This commit is contained in:
committed by
Peter Barker
parent
76adf8644c
commit
bacda78e0e
@@ -4457,14 +4457,6 @@ void GCS_MAVLINK::handle_message(const mavlink_message_t &msg)
|
||||
handle_command_int(msg);
|
||||
break;
|
||||
|
||||
#if AC_POLYFENCE_FENCE_POINT_PROTOCOL_SUPPORT
|
||||
case MAVLINK_MSG_ID_FENCE_POINT:
|
||||
case MAVLINK_MSG_ID_FENCE_FETCH_POINT:
|
||||
send_received_message_deprecation_warning("FENCE_FETCH_POINT");
|
||||
handle_fence_message(msg);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if AP_TERRAIN_AVAILABLE
|
||||
case MAVLINK_MSG_ID_TERRAIN_DATA:
|
||||
case MAVLINK_MSG_ID_TERRAIN_CHECK: {
|
||||
@@ -4533,14 +4525,6 @@ void GCS_MAVLINK::handle_message(const mavlink_message_t &msg)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if AP_MAVLINK_RALLY_POINT_PROTOCOL_ENABLED
|
||||
case MAVLINK_MSG_ID_RALLY_POINT:
|
||||
case MAVLINK_MSG_ID_RALLY_FETCH_POINT:
|
||||
send_received_message_deprecation_warning("RALLY_FETCH_POINT");
|
||||
handle_common_rally_message(msg);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MAVLINK_MSG_ID_REQUEST_DATA_STREAM:
|
||||
if (option_enabled(Option::NOSTREAMOVERRIDE)) {
|
||||
// options indicate we are to ignore this stream rate
|
||||
|
||||
@@ -40,28 +40,6 @@ MAV_RESULT GCS_MAVLINK::handle_command_do_fence_enable(const mavlink_command_int
|
||||
}
|
||||
}
|
||||
|
||||
#if AC_POLYFENCE_FENCE_POINT_PROTOCOL_SUPPORT
|
||||
void GCS_MAVLINK::handle_fence_message(const mavlink_message_t &msg)
|
||||
{
|
||||
AC_Fence *fence = AP::fence();
|
||||
if (fence == nullptr) {
|
||||
return;
|
||||
}
|
||||
// send or receive fence points with GCS
|
||||
switch (msg.msgid) {
|
||||
case MAVLINK_MSG_ID_FENCE_POINT:
|
||||
case MAVLINK_MSG_ID_FENCE_FETCH_POINT:
|
||||
fence->polyfence().handle_msg(*this, msg);
|
||||
break;
|
||||
default:
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
||||
AP_HAL::panic("Unhandled common fence message");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif // AC_POLYFENCE_FENCE_POINT_PROTOCOL_SUPPORT
|
||||
|
||||
// fence_send_mavlink_status - send fence status to ground station
|
||||
void GCS_MAVLINK::send_fence_status() const
|
||||
{
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
GCS MAVLink functions related to upload and download of rally
|
||||
points with the ArduPilot-specific protocol comprised of
|
||||
MAVLINK_MSG_ID_RALLY_POINT and MAVLINK_MSG_ID_RALLY_FETCH_POINT.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GCS.h"
|
||||
#include <AP_Rally/AP_Rally.h>
|
||||
#include <AP_Logger/AP_Logger.h>
|
||||
|
||||
#if AP_MAVLINK_RALLY_POINT_PROTOCOL_ENABLED
|
||||
|
||||
void GCS_MAVLINK::handle_rally_point(const mavlink_message_t &msg) const
|
||||
{
|
||||
AP_Rally *r = AP::rally();
|
||||
if (r == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
mavlink_rally_point_t packet;
|
||||
mavlink_msg_rally_point_decode(&msg, &packet);
|
||||
|
||||
if (packet.idx >= r->get_rally_total() ||
|
||||
packet.idx >= r->get_rally_max()) {
|
||||
send_text(MAV_SEVERITY_WARNING,"Bad rally point ID");
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet.count != r->get_rally_total()) {
|
||||
send_text(MAV_SEVERITY_WARNING,"Bad rally point count");
|
||||
return;
|
||||
}
|
||||
|
||||
// sanity check location
|
||||
if (!check_latlng(packet.lat, packet.lng)) {
|
||||
return;
|
||||
}
|
||||
|
||||
RallyLocation rally_point;
|
||||
rally_point.lat = packet.lat;
|
||||
rally_point.lng = packet.lng;
|
||||
rally_point.alt = packet.alt;
|
||||
rally_point.break_alt = packet.break_alt;
|
||||
rally_point.land_dir = packet.land_dir;
|
||||
rally_point.flags = packet.flags;
|
||||
|
||||
if (!r->set_rally_point_with_index(packet.idx, rally_point)) {
|
||||
send_text(MAV_SEVERITY_CRITICAL, "Error setting rally point");
|
||||
}
|
||||
}
|
||||
|
||||
void GCS_MAVLINK::handle_rally_fetch_point(const mavlink_message_t &msg)
|
||||
{
|
||||
AP_Rally *r = AP::rally();
|
||||
if (r == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
mavlink_rally_fetch_point_t packet;
|
||||
mavlink_msg_rally_fetch_point_decode(&msg, &packet);
|
||||
|
||||
if (packet.idx > r->get_rally_total()) {
|
||||
send_text(MAV_SEVERITY_WARNING, "Bad rally point ID");
|
||||
return;
|
||||
}
|
||||
|
||||
RallyLocation rally_point;
|
||||
if (!r->get_rally_point_with_index(packet.idx, rally_point)) {
|
||||
send_text(MAV_SEVERITY_WARNING, "Failed to get rally point");
|
||||
return;
|
||||
}
|
||||
|
||||
mavlink_msg_rally_point_send(chan, msg.sysid, msg.compid, packet.idx,
|
||||
r->get_rally_total(), rally_point.lat, rally_point.lng,
|
||||
rally_point.alt, rally_point.break_alt, rally_point.land_dir,
|
||||
rally_point.flags);
|
||||
}
|
||||
|
||||
void GCS_MAVLINK::handle_common_rally_message(const mavlink_message_t &msg)
|
||||
{
|
||||
switch (msg.msgid) {
|
||||
case MAVLINK_MSG_ID_RALLY_POINT:
|
||||
handle_rally_point(msg);
|
||||
break;
|
||||
case MAVLINK_MSG_ID_RALLY_FETCH_POINT:
|
||||
handle_rally_fetch_point(msg);
|
||||
break;
|
||||
default:
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
||||
AP_HAL::panic("Unhandled common rally message");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif // AP_MAVLINK_RALLY_POINT_PROTOCOL_ENABLED
|
||||
@@ -71,14 +71,6 @@
|
||||
#define AP_MAVLINK_FAILURE_CREATION_ENABLED 1
|
||||
#endif
|
||||
|
||||
// CODE_REMOVAL
|
||||
// ArduPilot 4.6 sends deprecation warnings for RALLY_POINT/RALLY_FETCH_POINT
|
||||
// ArduPilot 4.7 stops compiling them in by default
|
||||
// ArduPilot 4.8 removes the code entirely
|
||||
#ifndef AP_MAVLINK_RALLY_POINT_PROTOCOL_ENABLED
|
||||
#define AP_MAVLINK_RALLY_POINT_PROTOCOL_ENABLED 0
|
||||
#endif
|
||||
|
||||
// this is for both read and write messages:
|
||||
#ifndef AP_MAVLINK_MSG_DEVICE_OP_ENABLED
|
||||
#define AP_MAVLINK_MSG_DEVICE_OP_ENABLED HAL_GCS_ENABLED
|
||||
|
||||
Reference in New Issue
Block a user