From 33b1b134325ba647d659862563724b71def019e9 Mon Sep 17 00:00:00 2001 From: Martina Date: Sat, 28 Apr 2018 15:04:33 +0200 Subject: [PATCH] mc_pos_control: replace define with parameter to enable/disable obstacle avoidance --- src/modules/mc_pos_control/mc_pos_control_main.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/modules/mc_pos_control/mc_pos_control_main.cpp b/src/modules/mc_pos_control/mc_pos_control_main.cpp index 9a70239d3b..1f40ec7ec0 100644 --- a/src/modules/mc_pos_control/mc_pos_control_main.cpp +++ b/src/modules/mc_pos_control/mc_pos_control_main.cpp @@ -82,8 +82,6 @@ #define SIGMA_SINGLE_OP 0.000001f #define SIGMA_NORM 0.001f -/* temporary solution to enable and disable obstacle avoidance */ -#define ENABLE_OBSTACLE_AVOIDANCE false /** * Multicopter position control app start / stop handling function @@ -179,6 +177,7 @@ private: DEFINE_PARAMETERS( (ParamInt) _test_flight_tasks, /**< temporary flag for the transition to flight tasks */ + (ParamInt) _test_obstacle_avoidance, /**< temporary flag to enable obstacle avoidance */ (ParamFloat) _manual_thr_min, /**< minimal throttle output when flying in manual mode */ (ParamFloat) _manual_thr_max, /**< maximal throttle output when flying in manual mode */ (ParamFloat) @@ -3492,8 +3491,8 @@ MulticopterPositionControl::use_obstacle_avoidance() { /* check that external obstacle avoidance is sending data and that the first point is valid */ - return (ENABLE_OBSTACLE_AVOIDANCE && (hrt_elapsed_time((hrt_abstime *)&_traj_wp_avoidance.timestamp) < - TRAJECTORY_STREAM_TIMEOUT_US) && (_traj_wp_avoidance.point_valid[trajectory_waypoint_s::POINT_0] == true)); + return (_test_obstacle_avoidance.get() && (hrt_elapsed_time((hrt_abstime *)&_traj_wp_avoidance.timestamp) < + TRAJECTORY_STREAM_TIMEOUT_US) && (_traj_wp_avoidance.point_valid[trajectory_waypoint_s::POINT_0] == true)); } bool