ArduCopter: support for Mount following the lead vehicle in follow mode

This commit is contained in:
Asif Khan 2023-05-22 09:32:38 +05:30 committed by Tom Pittenger
parent d367483155
commit edf9fbdb60
1 changed files with 9 additions and 0 deletions

View File

@ -20,6 +20,15 @@ bool ModeFollow::init(const bool ignore_checks)
gcs().send_text(MAV_SEVERITY_WARNING, "Set FOLL_ENABLE = 1");
return false;
}
#if HAL_MOUNT_ENABLED
AP_Mount *mount = AP_Mount::get_singleton();
// follow the lead vehicle using sysid
if (g2.follow.option_is_enabled(AP_Follow::Option::MOUNT_FOLLOW_ON_ENTER) && mount != nullptr) {
mount->set_target_sysid(g2.follow.get_target_sysid());
}
#endif
// re-use guided mode
return ModeGuided::init(ignore_checks);
}