mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 03:11:35 +08:00
geofence: remove fence & fence_vertex messages
- this was never read - it was implemented wrong, leading to memory access violations in publishFence (an integer was passed instead of the fence_s struct)
This commit is contained in:
@@ -55,8 +55,6 @@ set(msg_file_names
|
|||||||
esc_report.msg
|
esc_report.msg
|
||||||
esc_status.msg
|
esc_status.msg
|
||||||
estimator_status.msg
|
estimator_status.msg
|
||||||
fence.msg
|
|
||||||
fence_vertex.msg
|
|
||||||
filtered_bottom_flow.msg
|
filtered_bottom_flow.msg
|
||||||
follow_target.msg
|
follow_target.msg
|
||||||
fw_pos_ctrl_status.msg
|
fw_pos_ctrl_status.msg
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
uint8 GEOFENCE_MAX_VERTICES = 16
|
|
||||||
|
|
||||||
uint32 count # number of actual vertices
|
|
||||||
fence_vertex[16] vertices # geofence positions
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
float32 lat # latitude in degrees, worst case float precision gives us 2 meter resolution at the equator
|
|
||||||
float32 lon # longitude in degrees, worst case float precision gives us 2 meter resolution at the equator
|
|
||||||
@@ -66,11 +66,7 @@ typedef enum {
|
|||||||
#if defined(MEMORY_CONSTRAINED_SYSTEM)
|
#if defined(MEMORY_CONSTRAINED_SYSTEM)
|
||||||
enum {
|
enum {
|
||||||
DM_KEY_SAFE_POINTS_MAX = 8,
|
DM_KEY_SAFE_POINTS_MAX = 8,
|
||||||
#ifdef __cplusplus
|
DM_KEY_FENCE_POINTS_MAX = 16,
|
||||||
DM_KEY_FENCE_POINTS_MAX = fence_s::GEOFENCE_MAX_VERTICES,
|
|
||||||
#else
|
|
||||||
DM_KEY_FENCE_POINTS_MAX = GEOFENCE_MAX_VERTICES,
|
|
||||||
#endif
|
|
||||||
DM_KEY_WAYPOINTS_OFFBOARD_0_MAX = NUM_MISSIONS_SUPPORTED,
|
DM_KEY_WAYPOINTS_OFFBOARD_0_MAX = NUM_MISSIONS_SUPPORTED,
|
||||||
DM_KEY_WAYPOINTS_OFFBOARD_1_MAX = NUM_MISSIONS_SUPPORTED,
|
DM_KEY_WAYPOINTS_OFFBOARD_1_MAX = NUM_MISSIONS_SUPPORTED,
|
||||||
DM_KEY_WAYPOINTS_ONBOARD_MAX = (NUM_MISSIONS_SUPPORTED / 10),
|
DM_KEY_WAYPOINTS_ONBOARD_MAX = (NUM_MISSIONS_SUPPORTED / 10),
|
||||||
@@ -81,11 +77,7 @@ enum {
|
|||||||
/** The maximum number of instances for each item type */
|
/** The maximum number of instances for each item type */
|
||||||
enum {
|
enum {
|
||||||
DM_KEY_SAFE_POINTS_MAX = 8,
|
DM_KEY_SAFE_POINTS_MAX = 8,
|
||||||
#ifdef __cplusplus
|
DM_KEY_FENCE_POINTS_MAX = 64,
|
||||||
DM_KEY_FENCE_POINTS_MAX = fence_s::GEOFENCE_MAX_VERTICES,
|
|
||||||
#else
|
|
||||||
DM_KEY_FENCE_POINTS_MAX = GEOFENCE_MAX_VERTICES,
|
|
||||||
#endif
|
|
||||||
DM_KEY_WAYPOINTS_OFFBOARD_0_MAX = NUM_MISSIONS_SUPPORTED,
|
DM_KEY_WAYPOINTS_OFFBOARD_0_MAX = NUM_MISSIONS_SUPPORTED,
|
||||||
DM_KEY_WAYPOINTS_OFFBOARD_1_MAX = NUM_MISSIONS_SUPPORTED,
|
DM_KEY_WAYPOINTS_OFFBOARD_1_MAX = NUM_MISSIONS_SUPPORTED,
|
||||||
DM_KEY_WAYPOINTS_ONBOARD_MAX = NUM_MISSIONS_SUPPORTED,
|
DM_KEY_WAYPOINTS_ONBOARD_MAX = NUM_MISSIONS_SUPPORTED,
|
||||||
|
|||||||
@@ -237,7 +237,6 @@ Geofence::addPoint(int argc, char *argv[])
|
|||||||
|
|
||||||
if ((argc == 1) && (strcmp("-clear", argv[0]) == 0)) {
|
if ((argc == 1) && (strcmp("-clear", argv[0]) == 0)) {
|
||||||
dm_clear(DM_KEY_FENCE_POINTS);
|
dm_clear(DM_KEY_FENCE_POINTS);
|
||||||
publishFence(0);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,7 +264,6 @@ Geofence::addPoint(int argc, char *argv[])
|
|||||||
|
|
||||||
if (dm_write(DM_KEY_FENCE_POINTS, ix, DM_PERSIST_POWER_ON_RESET, &vertex, sizeof(vertex)) == sizeof(vertex)) {
|
if (dm_write(DM_KEY_FENCE_POINTS, ix, DM_PERSIST_POWER_ON_RESET, &vertex, sizeof(vertex)) == sizeof(vertex)) {
|
||||||
if (last) {
|
if (last) {
|
||||||
publishFence((unsigned)ix + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -274,16 +272,6 @@ Geofence::addPoint(int argc, char *argv[])
|
|||||||
PX4_WARN("can't store fence point");
|
PX4_WARN("can't store fence point");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Geofence::publishFence(unsigned vertices)
|
|
||||||
{
|
|
||||||
if (_fence_pub == nullptr) {
|
|
||||||
_fence_pub = orb_advertise(ORB_ID(fence), &vertices);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
orb_publish(ORB_ID(fence), _fence_pub, &vertices);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
Geofence::loadFromFile(const char *filename)
|
Geofence::loadFromFile(const char *filename)
|
||||||
|
|||||||
@@ -43,6 +43,11 @@
|
|||||||
|
|
||||||
#include <cfloat>
|
#include <cfloat>
|
||||||
|
|
||||||
|
#include <uORB/topics/vehicle_global_position.h>
|
||||||
|
#include <uORB/topics/vehicle_gps_position.h>
|
||||||
|
#include <uORB/topics/sensor_combined.h>
|
||||||
|
#include <uORB/topics/home_position.h>
|
||||||
|
#include <controllib/blocks.hpp>
|
||||||
#include <controllib/block/BlockParam.hpp>
|
#include <controllib/block/BlockParam.hpp>
|
||||||
#include <controllib/blocks.hpp>
|
#include <controllib/blocks.hpp>
|
||||||
#include <drivers/drv_hrt.h>
|
#include <drivers/drv_hrt.h>
|
||||||
@@ -99,8 +104,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
void addPoint(int argc, char *argv[]);
|
void addPoint(int argc, char *argv[]);
|
||||||
|
|
||||||
void publishFence(unsigned vertices);
|
|
||||||
|
|
||||||
int loadFromFile(const char *filename);
|
int loadFromFile(const char *filename);
|
||||||
|
|
||||||
bool isEmpty() {return _vertices_count == 0;}
|
bool isEmpty() {return _vertices_count == 0;}
|
||||||
@@ -114,7 +117,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
Navigator *_navigator{nullptr};
|
Navigator *_navigator{nullptr};
|
||||||
|
|
||||||
orb_advert_t _fence_pub{nullptr}; /**< publish fence topic */
|
home_position_s _home_pos{0};
|
||||||
|
bool _home_pos_set{false};
|
||||||
|
|
||||||
hrt_abstime _last_horizontal_range_warning{0};
|
hrt_abstime _last_horizontal_range_warning{0};
|
||||||
hrt_abstime _last_vertical_range_warning{0};
|
hrt_abstime _last_vertical_range_warning{0};
|
||||||
|
|||||||
Reference in New Issue
Block a user