Skip to content

Commit

Permalink
AP_Mount: Set relative pan to true for servo mounts
Browse files Browse the repository at this point in the history
  • Loading branch information
spark404 authored and tridge committed Mar 3, 2021
1 parent 44902ef commit 0dbe2e0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
16 changes: 1 addition & 15 deletions libraries/AP_Mount/AP_Mount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions libraries/AP_Mount/AP_Mount.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -193,8 +190,6 @@ class AP_Mount
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:
Expand Down
8 changes: 3 additions & 5 deletions libraries/AP_Mount/AP_Mount_Servo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 0dbe2e0

Please sign in to comment.