Browse Source

Tools: autotest: more efficient set_rc_from_map

master
Peter Barker 6 years ago committed by Peter Barker
parent
commit
e9552ec4e1
  1. 22
      Tools/autotest/common.py

22
Tools/autotest/common.py

@ -740,11 +740,23 @@ class AutoTest(ABC): @@ -740,11 +740,23 @@ class AutoTest(ABC):
16: 1500,
}
def set_rc_from_map(self, _map):
for chan in _map:
value = _map[chan]
self.set_rc(chan, value)
# self.mavproxy.send('rc %u value\n' % (chan, value))
def set_rc_from_map(self, _map, timeout=2000):
copy = _map.copy()
tstart = self.get_sim_time()
while len(copy.keys()):
if self.get_sim_time_cached() - tstart > timeout:
raise SetRCTimeout("Failed to set RC channels")
for chan in copy:
value = copy[chan]
self.send_set_rc(chan, value)
m = self.mav.recv_match(type='RC_CHANNELS', blocking=True)
self.progress("m: %s" % m)
new = dict()
for chan in copy:
chan_pwm = getattr(m, "chan" + str(chan) + "_raw")
if chan_pwm != copy[chan]:
new[chan] = copy[chan]
copy = new
def set_rc_default(self):
"""Setup all simulated RC control to 1500."""

Loading…
Cancel
Save