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

fieldcheck: adjust required fence action based on vehicle type #1310

Merged
merged 1 commit into from
Jan 22, 2024
Merged
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
12 changes: 10 additions & 2 deletions MAVProxy/modules/mavproxy_fieldcheck/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,19 @@ def whinge(self, message):
def check_parameters(self, fix=False):
'''check key parameters'''
want_values = {
"FENCE_ACTION": 4,
"FENCE_ENABLE": 1,
"FENCE_ACTION": 1, # 4 is break-or-land on Copter!
"FENCE_ALT_MAX": self.fc_settings.param_fence_maxalt,
"THR_FAILSAFE": 1,
"FS_SHORT_ACTN": 0,
"FS_LONG_ACTN": 1,
}

if self.vehicle_type == mavutil.mavlink.MAV_TYPE_FIXED_WING:
want_values["FENCE_ACTION"] = 1 # RTL
elif self.vehicle_type == mavutil.mavlink.MAV_TYPE_QUADROTOR:
want_values["FENCE_ACTION"] = 4 # Brake or RTL

ret = True
for key in want_values.keys():
want = want_values[key]
Expand Down Expand Up @@ -330,7 +336,9 @@ def check(self):
def mavlink_packet(self, m):
'''handle an incoming mavlink packet'''
if not self.done_heartbeat_check:
if self.master.messages.get('HEARTBEAT') is not None:
m = self.master.messages.get('HEARTBEAT')
if m is not None:
self.vehicle_type = m.type
self.check()
self.done_heartbeat_check = True

Expand Down