From 0dbe2e072c1613e8cb8753a878bdd9fb78177393 Mon Sep 17 00:00:00 2001 From: Hugo Trippaers Date: Wed, 27 Jan 2021 12:28:14 +0100 Subject: [PATCH] AP_Mount: Set relative pan to true for servo mounts --- libraries/AP_Mount/AP_Mount.cpp | 16 +--------------- libraries/AP_Mount/AP_Mount.h | 5 ----- libraries/AP_Mount/AP_Mount_Servo.cpp | 8 +++----- 3 files changed, 4 insertions(+), 25 deletions(-) diff --git a/libraries/AP_Mount/AP_Mount.cpp b/libraries/AP_Mount/AP_Mount.cpp index 2c29141e23..1a7af63454 100644 --- a/libraries/AP_Mount/AP_Mount.cpp +++ b/libraries/AP_Mount/AP_Mount.cpp @@ -213,13 +213,7 @@ const AP_Param::GroupInfo AP_Mount::var_info[] = { // 23 formerly _K_RATE - // @Param: _OPTIONS - // @DisplayName: Options field - // @Description: User configurable options; 0 = Enable Relative Pan on Servo Mounts - // @Values: 0:RelativePan - // @Bitmask: 0:RelativePan - // @User: Standard - AP_GROUPINFO("_OPTIONS", 24, AP_Mount, state[0]._options, 0), + // 24 is AVAILABLE #if AP_MOUNT_MAX_INSTANCES > 1 // @Param: 2_DEFLT_MODE @@ -401,14 +395,6 @@ const AP_Param::GroupInfo AP_Mount::var_info[] = { // @Values: 0:None, 1:Servo, 2:3DR Solo, 3:Alexmos Serial, 4:SToRM32 MAVLink, 5:SToRM32 Serial // @User: Standard AP_GROUPINFO("2_TYPE", 42, AP_Mount, state[1]._type, 0), - - // @Param: 2_OPTIONS - // @DisplayName: Options field for Mount 2 - // @Description: User configurable options; 0 = Enable Relative Pan on Servo Mounts - // @Values: 0:RelativePan - // @Bitmask: 0:RelativePan - // @User: Standard - AP_GROUPINFO("2_OPTIONS", 43, AP_Mount, state[1]._options, 0), #endif // AP_MOUNT_MAX_INSTANCES > 1 AP_GROUPEND diff --git a/libraries/AP_Mount/AP_Mount.h b/libraries/AP_Mount/AP_Mount.h index c1e507fbb3..fc1d85979a 100644 --- a/libraries/AP_Mount/AP_Mount.h +++ b/libraries/AP_Mount/AP_Mount.h @@ -40,9 +40,6 @@ // maximum number of mounts #define AP_MOUNT_MAX_INSTANCES 1 -// options (see _OPTIONS parameter) -#define AP_MOUNT_OPTION_RELATIVE_PAN (1<<0) - // declare backend classes class AP_Mount_Backend; class AP_Mount_Servo; @@ -193,8 +190,6 @@ protected: Location _target_sysid_location; // sysid target location bool _target_sysid_location_set; - AP_Int8 _options; // Options field, bit 0 = use relative pan - } state[AP_MOUNT_MAX_INSTANCES]; private: diff --git a/libraries/AP_Mount/AP_Mount_Servo.cpp b/libraries/AP_Mount/AP_Mount_Servo.cpp index 89aeab5de0..f4a459eb1a 100644 --- a/libraries/AP_Mount/AP_Mount_Servo.cpp +++ b/libraries/AP_Mount/AP_Mount_Servo.cpp @@ -35,8 +35,6 @@ void AP_Mount_Servo::update() _last_check_servo_map_ms = now; } - uint8_t relative_pan = _state._options & AP_MOUNT_OPTION_RELATIVE_PAN; - switch(get_mode()) { // move mount to a "retracted position" or to a position where a fourth servo can retract the entire mount into the fuselage case MAV_MOUNT_MODE_RETRACT: @@ -72,7 +70,7 @@ void AP_Mount_Servo::update() // point mount to a GPS point given by the mission planner case MAV_MOUNT_MODE_GPS_POINT: { - if (calc_angle_to_roi_target(_angle_ef_target_rad, _flags.tilt_control, _flags.pan_control, relative_pan)) { + if (calc_angle_to_roi_target(_angle_ef_target_rad, _flags.tilt_control, _flags.pan_control, true)) { stabilize(); } break; @@ -85,7 +83,7 @@ void AP_Mount_Servo::update() } _state._roi_target = AP::ahrs().get_home(); _state._roi_target_set = true; - if (calc_angle_to_roi_target(_angle_ef_target_rad, _flags.tilt_control, _flags.pan_control, relative_pan)) { + if (calc_angle_to_roi_target(_angle_ef_target_rad, _flags.tilt_control, _flags.pan_control, true)) { stabilize(); } break; @@ -94,7 +92,7 @@ void AP_Mount_Servo::update() if (calc_angle_to_sysid_target(_angle_ef_target_rad, _flags.tilt_control, _flags.pan_control, - relative_pan)) { + true)) { stabilize(); } break;