Skip to content

Commit

Permalink
fieldcheck: adjust required fence action based on vehicle type
Browse files Browse the repository at this point in the history
this was enforcing a non-existant fence action on Plane...
  • Loading branch information
peterbarker committed Jan 22, 2024
1 parent e67c511 commit 05975c6
Showing 1 changed file with 10 additions and 2 deletions.
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

0 comments on commit 05975c6

Please sign in to comment.