Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Ardupilot
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenSource
Ardupilot
Commits
da97c991
Commit
da97c991
authored
12 years ago
by
Randy Mackay
Browse files
Options
Downloads
Patches
Plain Diff
AutoTest: add circle mode test
parent
59206287
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tools/autotest/arducopter.py
+55
-13
55 additions, 13 deletions
Tools/autotest/arducopter.py
with
55 additions
and
13 deletions
Tools/autotest/arducopter.py
+
55
−
13
View file @
da97c991
...
@@ -425,23 +425,36 @@ def fly_simple(mavproxy, mav, side=100, timeout=120):
...
@@ -425,23 +425,36 @@ def fly_simple(mavproxy, mav, side=100, timeout=120):
hover
(
mavproxy
,
mav
)
hover
(
mavproxy
,
mav
)
return
not
failed
return
not
failed
#fly_circle - flies a circle with 20m radius
def
fly_circle
(
mavproxy
,
mav
,
maxaltchange
=
10
,
holdtime
=
75
,
timeout
=
125
):
def
land
(
mavproxy
,
mav
,
timeout
=
60
):
'''
hold loiter position
'''
'''
land the quad
'''
mavproxy
.
send
(
'
switch 5
\n
'
)
# loiter mode
print
(
"
STARTING LANDING
"
)
wait_mode
(
mav
,
'
LOITER
'
)
mavproxy
.
send
(
'
switch 2
\n
'
)
wait_mode
(
mav
,
'
LAND
'
)
print
(
"
Entered Landing Mode
"
)
ret
=
wait_altitude
(
mav
,
-
5
,
1
)
print
(
"
LANDING: ok= %s
"
%
ret
)
return
ret
# face west
print
(
"
turn west
"
)
mavproxy
.
send
(
'
rc 4 1580
\n
'
)
if
not
wait_heading
(
mav
,
270
):
return
False
mavproxy
.
send
(
'
rc 4 1500
\n
'
)
#set CIRCLE radius
mavproxy
.
send
(
'
param set CIRCLE_RADIUS 30
\n
'
)
# fly forward (east) at least 100m
mavproxy
.
send
(
'
rc 2 1100
\n
'
)
if
not
wait_distance
(
mav
,
100
):
return
False
# return pitch stick back to middle
mavproxy
.
send
(
'
rc 2 1500
\n
'
)
def
circle
(
mavproxy
,
mav
,
maxaltchange
=
10
,
holdtime
=
90
,
timeout
=
35
):
# set CIRCLE mode
'''
fly circle
'''
mavproxy
.
send
(
'
switch 1
\n
'
)
# circle mode
print
(
"
FLY CIRCLE
"
)
mavproxy
.
send
(
'
switch 1
\n
'
)
# CIRCLE mode
wait_mode
(
mav
,
'
CIRCLE
'
)
wait_mode
(
mav
,
'
CIRCLE
'
)
# wait
m
=
mav
.
recv_match
(
type
=
'
VFR_HUD
'
,
blocking
=
True
)
m
=
mav
.
recv_match
(
type
=
'
VFR_HUD
'
,
blocking
=
True
)
start_altitude
=
m
.
alt
start_altitude
=
m
.
alt
tstart
=
time
.
time
()
tstart
=
time
.
time
()
...
@@ -454,6 +467,15 @@ def circle(mavproxy, mav, maxaltchange=10, holdtime=90, timeout=35):
...
@@ -454,6 +467,15 @@ def circle(mavproxy, mav, maxaltchange=10, holdtime=90, timeout=35):
print
(
"
CIRCLE OK for %u seconds
"
%
holdtime
)
print
(
"
CIRCLE OK for %u seconds
"
%
holdtime
)
return
True
return
True
def
land
(
mavproxy
,
mav
,
timeout
=
60
):
'''
land the quad
'''
print
(
"
STARTING LANDING
"
)
mavproxy
.
send
(
'
switch 2
\n
'
)
wait_mode
(
mav
,
'
LAND
'
)
print
(
"
Entered Landing Mode
"
)
ret
=
wait_altitude
(
mav
,
-
5
,
1
)
print
(
"
LANDING: ok= %s
"
%
ret
)
return
ret
def
fly_mission
(
mavproxy
,
mav
,
height_accuracy
=-
1
,
target_altitude
=
None
):
def
fly_mission
(
mavproxy
,
mav
,
height_accuracy
=-
1
,
target_altitude
=
None
):
'''
fly a mission from a file
'''
'''
fly a mission from a file
'''
...
@@ -737,6 +759,26 @@ def fly_ArduCopter(viewerip=None, map=False):
...
@@ -737,6 +759,26 @@ def fly_ArduCopter(viewerip=None, map=False):
print
(
"
RTL failed
"
)
print
(
"
RTL failed
"
)
failed
=
True
failed
=
True
# Takeoff
print
(
"
# Takeoff
"
)
if
not
takeoff
(
mavproxy
,
mav
,
10
):
print
(
"
takeoff failed
"
)
failed
=
True
# Circle mode
print
(
"
# Fly CIRCLE mode
"
)
if
not
fly_circle
(
mavproxy
,
mav
):
print
(
"
fly_circle failed
"
)
failed
=
True
# RTL
print
(
"
#
"
)
print
(
"
########## Test RTL ##########
"
)
print
(
"
#
"
)
if
not
fly_RTL
(
mavproxy
,
mav
):
print
(
"
RTL failed
"
)
failed
=
True
# Fly mission #1
# Fly mission #1
print
(
"
# Upload mission1
"
)
print
(
"
# Upload mission1
"
)
if
not
upload_mission_from_file
(
mavproxy
,
mav
,
os
.
path
.
join
(
testdir
,
"
mission1.txt
"
)):
if
not
upload_mission_from_file
(
mavproxy
,
mav
,
os
.
path
.
join
(
testdir
,
"
mission1.txt
"
)):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment