Rover: add avoidance library

This commit is contained in:
Randy Mackay 2017-12-12 15:12:16 +09:00
parent 5503a0069d
commit 489c42bdff
6 changed files with 13 additions and 2 deletions

View File

@ -109,7 +109,7 @@ bool AP_Arming_Rover::proximity_check(bool report)
// get closest object if we might use it for avoidance
float angle_deg, distance;
if (rover.g2.proximity.get_closest_object(angle_deg, distance)) {
if (rover.g2.avoid.proximity_avoidance_enabled() && rover.g2.proximity.get_closest_object(angle_deg, distance)) {
// display error if something is within 60cm
if (distance <= 0.6f) {
if (report) {

View File

@ -550,6 +550,10 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = {
// @Path: ../libraries/AP_Proximity/AP_Proximity.cpp
AP_SUBGROUPINFO(proximity, "PRX", 18, ParametersG2, AP_Proximity),
// @Group: AVOID_
// @Path: ../libraries/AC_Avoidance/AC_Avoid.cpp
AP_SUBGROUPINFO(avoid, "AVOID_", 19, ParametersG2, AC_Avoid),
AP_GROUPEND
};
@ -564,7 +568,8 @@ ParametersG2::ParametersG2(void)
attitude_control(rover.ahrs),
smart_rtl(rover.ahrs),
fence(rover.ahrs),
proximity(rover.serial_manager)
proximity(rover.serial_manager),
avoid(rover.ahrs, fence, rover.g2.proximity, &rover.g2.beacon)
{
AP_Param::setup_object_defaults(this, var_info);
}

View File

@ -336,6 +336,9 @@ public:
// proximity library
AP_Proximity proximity;
// avoidance library
AC_Avoid avoid;
};
extern const AP_Param::Info var_info[];

View File

@ -78,6 +78,7 @@
#include <StorageManager/StorageManager.h>
#include <AC_Fence/AC_Fence.h>
#include <AP_Proximity/AP_Proximity.h>
#include <AC_Avoidance/AC_Avoid.h>
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
#include <SITL/SITL.h>
#endif

View File

@ -50,3 +50,4 @@ LIBRARIES += AC_PID
LIBRARIES += AP_Proximity
LIBRARIES += AC_Fence
LIBRARIES += AP_SmartRTL
LIBRARIES += AC_Avoidance

View File

@ -24,6 +24,7 @@ def build(bld):
'AP_SmartRTL',
'AC_Fence',
'AP_Proximity',
'AC_Avoidance',
],
)