Repository navigation
autotest: add a test for AUTO takeoff while moving - #35129
haaaaaaarshs wants to merge 2 commits into
Conversation
peterbarker
left a comment
There was a problem hiding this comment.
This would be more satisfying if we could close the issue based on it.
Try making the vehicle go faster to see if you can reproduce?
|
|
||
| def AutoTakeoffWhileMoving(self): | ||
| """Check horizontal motion during an airborne AUTO takeoff.""" | ||
| self.context_push() |
There was a problem hiding this comment.
| self.context_push() |
not required, nor is the closing context pop
| finally: | ||
| self.context_pop() |
There was a problem hiding this comment.
| finally: | |
| self.context_pop() |
| self.change_mode('LOITER') | ||
| self.do_RTL() |
There was a problem hiding this comment.
| self.change_mode('LOITER') | |
| self.do_RTL() | |
| self.disarm_vehicle(force=True) |
| motion = self.assert_receive_message('LOCAL_POSITION_NED') | ||
| speed = (motion.vx ** 2 + motion.vy ** 2) ** 0.5 | ||
| if speed < 3: | ||
| raise NotAchievedException( | ||
| f'Initial horizontal speed was only {speed:.2f} m/s' | ||
| ) |
There was a problem hiding this comment.
Didn't you just wait for groundspeed to be achieved?!
| self.wait_current_waypoint(1) | ||
| takeoff_started = True | ||
| self.delay_sim_time(8, reason='observe airborne AUTO takeoff') | ||
| self.assert_current_waypoint(1) |
There was a problem hiding this comment.
You've just waited for this to be the current waypoint
| self.set_rc(2, 1500) | ||
| self.wait_current_waypoint(1) | ||
| takeoff_started = True | ||
| self.delay_sim_time(8, reason='observe airborne AUTO takeoff') |
There was a problem hiding this comment.
CI time isn't unlimited, prune your delays where they aren't required.
| self.delay_sim_time(8, reason='observe airborne AUTO takeoff') | ||
| self.assert_current_waypoint(1) | ||
| self.wait_groundspeed(0, 0.6, timeout=10, minimum_duration=1) | ||
| self.assert_current_waypoint(1) |
|
Hey Peter, thanks for taking a look! The SITL runs at around 10 m/s measured a maximum return of 0.58 m, so I still haven’t seen the larger return described in the issue under those conditions.I will work through your suggestions for simplifying the test and will update the PR after checking the changes. |
|
Hi @haaaaaaarshs, Txs for this. What's the purpose of the test though? Is there some issue you've seen taking off from a moving vehicle? |
|
Hi @rmackay9, the copter is already in the air and moving forward when it switches to AUTO with a takeoff command as the first item in the mission. The test checks for the backward movement described in the issue. I haven’t been able to reproduce the larger return myself. In my latest SITL run, the copter was moving at 10.17 m/s, and the maximum return was 0.57 m. Do you think this test is still useful even though I couldn’t reproduce the original behavior? |
Summary
Add a Copter SITL test for an AUTO takeoff started while moving.
Related to #6322.
Classification & Testing (check all that apply and add your own)
On commit ce01d4c, based on 546cf15, the Copter build, TakeoffAlt,
TakeoffCheck, and AutoTakeoffWhileMoving passed. The autotest command and
flake8 each exited with status 0. The moving-takeoff test recorded 18.7
seconds of samples, a maximum gap of 50 ms, and a maximum return of 0.38 m.
A broader CopterTests1d run on November 10 failed when FETtecESC and
CircleManualControlEntryLeft timed out waiting for messages. The cause
is unknown. That run used the earlier version of the test. The full
Linux CI matrix has not been run locally.
Description
The test sets MIS_RESTART=1, takes off in LOITER, moves forward, and
switches to AUTO with a 50 m takeoff command first in the mission. It
measures return along the initial direction until the mission reports
item 2, using a 1.5 m limit.
I did not reproduce the substantial return described in #6322 in two
manual attempts on an earlier checkout. The test does not establish
that the issue is fixed. The tolerance is provisional, and the
mission-item message may arrive slightly after the transition. Feedback
on the scenario and tolerance would be helpful.
Notes for Reviewers
I used Claude to revise the tests, for PR prechecks as well as interpreting the SITL results.