Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copter: Configurable yaw offset for DO_SET_ROI #28486

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ArduCopter/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,14 @@ const AP_Param::GroupInfo ParametersG2::var_info2[] = {
// @User: Advanced
AP_GROUPINFO("FS_EKF_FILT", 8, ParametersG2, fs_ekf_filt_hz, FS_EKF_FILT_DEFAULT),

// @Param: ROI_YAW_OFFSET
// @DisplayName: ROI yaw offset
// @Description: Offset applied to yaw when pointing to region of interest. Zero offset points nose at ROI.
// @Range: -18000 18000
// @Units: cdeg
// @User: Advanced
AP_GROUPINFO("ROI_YAW_OFFSET", 9, ParametersG2, roi_yaw_offset, 0),

// ID 62 is reserved for the AP_SUBGROUPEXTENSION

AP_GROUPEND
Expand Down
2 changes: 2 additions & 0 deletions ArduCopter/Parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,8 @@ class ParametersG2 {
// EKF variance filter cutoff
AP_Float fs_ekf_filt_hz;

AP_Float roi_yaw_offset;

#if WEATHERVANE_ENABLED
AC_WeatherVane weathervane;
#endif
Expand Down
4 changes: 3 additions & 1 deletion ArduCopter/autoyaw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ Mode::AutoYaw Mode::auto_yaw;
// roi_yaw - returns heading towards location held in roi
float Mode::AutoYaw::roi_yaw() const
{
return get_bearing_cd(copter.inertial_nav.get_position_xy_cm(), roi.xy());
float yaw = get_bearing_cd(copter.inertial_nav.get_position_xy_cm(), roi.xy());
yaw += copter.g2.roi_yaw_offset;
return wrap_360_cd(yaw);
}

// returns a yaw in degrees, direction of vehicle travel:
Expand Down
Loading