Skip to content

Commit 5a29a18

Browse files
ohyaiamhereohyaiamhere
authored andcommitted
Tools: Modify MANUAL_CONTROL autotest for Rover to include yaw
1 parent 9fd9c12 commit 5a29a18

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

Tools/autotest/rover.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,53 +1131,56 @@ def MANUAL_CONTROL(self):
11311131

11321132
self.progress("now override to stop")
11331133
throttle_override_normalized = 0
1134+
yaw_override_normalized = 0
11341135
expected_throttle = 0 # in VFR_HUD
1136+
want_speed = 5.0
1137+
want_yaw = 0.002
11351138

11361139
tstart = self.get_sim_time_cached()
11371140
while True:
11381141
if self.get_sim_time_cached() - tstart > 10:
1139-
raise AutoTestTimeoutException("Did not reach speed")
1142+
raise AutoTestTimeoutException("Did not reach speed or yaw")
11401143
self.progress("Sending normalized throttle of %d" % (throttle_override_normalized,))
11411144
self.mav.mav.manual_control_send(
11421145
1, # target system
11431146
32767, # x (pitch)
11441147
32767, # y (roll)
11451148
throttle_override_normalized, # z (thrust)
1146-
32767, # r (yaw)
1149+
yaw_override_normalized, # r (yaw)
11471150
0) # button mask
11481151

11491152
m = self.assert_receive_message('VFR_HUD')
1150-
want_speed = 2.0
1151-
self.progress("Speed=%f want=<%f throttle=%u want=%u" %
1152-
(m.groundspeed, want_speed, m.throttle, expected_throttle))
1153-
if m.groundspeed < want_speed and m.throttle == expected_throttle:
1153+
n = self.assert_receive_message('ATTITUDE')
1154+
self.progress("Speed=%f want=<%f throttle=%u want=%u yaw=%f want_yaw=%f" %
1155+
(m.groundspeed, want_speed, m.throttle, expected_throttle, n.yaw, want_yaw))
1156+
if m.groundspeed < want_speed and m.throttle == expected_throttle and n.yaw < want_yaw:
11541157
break
11551158

11561159
self.progress("now override to stop - but set the switch on the RC transmitter to deny overrides; this should send the speed back up to 5 metres/second") # noqa
11571160
self.set_rc(12, 1000)
11581161

11591162
throttle_override_normalized = 500
1163+
yaw_override_normalized = 500
11601164
expected_throttle = 36 # in VFR_HUD, corresponding to normal_rc_throttle adjusted for channel min/max
11611165

11621166
tstart = self.get_sim_time_cached()
11631167
while True:
11641168
if self.get_sim_time_cached() - tstart > 10:
1165-
raise AutoTestTimeoutException("Did not stop")
1169+
raise AutoTestTimeoutException("Override did not stop")
11661170
self.progress("Sending normalized throttle of %u" % (throttle_override_normalized,))
11671171
self.mav.mav.manual_control_send(
11681172
1, # target system
11691173
32767, # x (pitch)
11701174
32767, # y (roll)
11711175
throttle_override_normalized, # z (thrust)
1172-
32767, # r (yaw)
1176+
yaw_override_normalized, # r (yaw)
11731177
0) # button mask
11741178

11751179
m = self.assert_receive_message('VFR_HUD')
1176-
want_speed = 5.0
1177-
1178-
self.progress("Speed=%f want=>%f throttle=%u want=%u" %
1179-
(m.groundspeed, want_speed, m.throttle, expected_throttle))
1180-
if m.groundspeed > want_speed and m.throttle == expected_throttle:
1180+
n = self.assert_receive_message('ATTITUDE')
1181+
self.progress("Speed=%f want=>%f throttle=%u want=%u yaw=%f want_yaw=%f" %
1182+
(m.groundspeed, want_speed, m.throttle, expected_throttle, n.yaw, want_yaw))
1183+
if m.groundspeed > want_speed and m.throttle == expected_throttle and n.yaw > want_yaw:
11811184
break
11821185

11831186
# re-enable RC overrides

0 commit comments

Comments
 (0)