Skip to content

Commit

Permalink
autotest: fix tests for using RC options to for control channels
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Feb 14, 2024
1 parent a7f7bce commit 8f46c4b
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
3 changes: 0 additions & 3 deletions Tools/autotest/arducopter.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ def close(self):
def is_copter(self):
return True

def get_stick_arming_channel(self):
return int(self.get_parameter("RCMAP_YAW"))

def get_disarm_delay(self):
return int(self.get_parameter("DISARM_DELAY"))

Expand Down
3 changes: 0 additions & 3 deletions Tools/autotest/arduplane.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ def apply_defaultfile_parameters(self):
def is_plane(self):
return True

def get_stick_arming_channel(self):
return int(self.get_parameter("RCMAP_YAW"))

def get_disarm_delay(self):
return int(self.get_parameter("LAND_DISARMDELAY"))

Expand Down
4 changes: 0 additions & 4 deletions Tools/autotest/default_params/vee-gull 005.param
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,6 @@ RC9_MAX,1900
RC9_MIN,1100
RC9_REVERSED,0
RC9_TRIM,1500
RCMAP_PITCH,2
RCMAP_ROLL,1
RCMAP_THROTTLE,3
RCMAP_YAW,4
RELAY_DEFAULT,0
RELAY1_PIN,13
RLL_RATE_D,0.000000
Expand Down
2 changes: 1 addition & 1 deletion Tools/autotest/param_metadata/mdemit.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import os

# Parameter groups disabled at compile time (Vehicle-specific)
sub_blacklist = ['AVOID_', 'CIRCLE_', 'FLOW', 'MIS_', 'PRX', 'RALLY_', 'RCMAP_', 'RPM', 'TERRAIN_', 'WPNAV_']
sub_blacklist = ['AVOID_', 'CIRCLE_', 'FLOW', 'MIS_', 'PRX', 'RALLY_', 'RPM', 'TERRAIN_', 'WPNAV_']

# Parameter groups with redundant information (ie RCn_, SERVOn_)
# We can keep the documentation concise by only documenting these once
Expand Down
3 changes: 0 additions & 3 deletions Tools/autotest/quadplane.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ def defaults_filepath(self):
def is_plane(self):
return True

def get_stick_arming_channel(self):
return int(self.get_parameter("RCMAP_YAW"))

def get_disarm_delay(self):
return int(self.get_parameter("LAND_DISARMDELAY"))

Expand Down
5 changes: 3 additions & 2 deletions Tools/autotest/rover.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ def default_speedup(self):
def is_rover(self):
return True

def get_stick_arming_channel(self):
return int(self.get_parameter("RCMAP_ROLL"))
def rc_option_value_for_arming_channel(self):
# Rover uses the "steer" channel for arming
return 205

##########################################################
# TESTS DRIVE
Expand Down
20 changes: 16 additions & 4 deletions Tools/autotest/vehicle_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -5251,10 +5251,6 @@ def set_output_to_trim(self, chan):
out_trim = int(self.get_parameter("RC%u_TRIM" % chan))
self.set_rc(chan, out_trim)

def get_stick_arming_channel(self):
"""Return the Rudder channel number as set in parameter."""
raise ErrorException("Rudder parameter is not supported by vehicle %s frame %s", (self.vehicleinfo_key(), self.frame))

def get_disarm_delay(self):
"""Return disarm delay value."""
raise ErrorException("Disarm delay is not supported by vehicle %s frame %s", (self.vehicleinfo_key(), self.frame))
Expand Down Expand Up @@ -5286,6 +5282,22 @@ def set_safetyswitch(self, value, target_system=1, target_component=1):
timeout=30
)

def max_rc_channels(self):
return 16

def rc_option_value_for_arming_channel(self):
return 204

def get_stick_arming_channel(self):
option = self.rc_option_value_for_arming_channel()
for i in range(1, self.max_rc_channels() + 1):
v = self.get_parameter("RC%u_OPTION" % i)
self.progress("v=%u" % v)
if v == option:
self.progress("yaw is on channel %u" % i)
return i
raise PreconditionFailedException("No stick arming channel configured")

def armed(self):
"""Return true if vehicle is armed and safetyoff"""
self.wait_heartbeat()
Expand Down

0 comments on commit 8f46c4b

Please sign in to comment.