-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
oneloop_valkenburg.xml
161 lines (160 loc) · 6.68 KB
/
oneloop_valkenburg.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<!DOCTYPE flight_plan SYSTEM "../flight_plan.dtd">
<flight_plan alt="70.0" ground_alt="0" lat0="52.168595" lon0="4.412444" max_dist_from_home="1070" name="Oneloop Valkenburg" security_height="2">
<header>
#include "autopilot.h"
#include "modules/datalink/datalink.h"
#include "modules/energy/electrical.h"
#include "modules/radio_control/radio_control.h"
#include "modules/ahrs/ahrs.h"
</header>
<waypoints>
<waypoint name="HOME" x="12.6" y="-48.7"/>
<waypoint name="CLIMB" x="62.6" y="-80.4"/>
<waypoint name="STDBY" lat="52.1682655" lon="4.4135103"/>
<waypoint name="p1" x="322.0" y="-254.3"/>
<waypoint name="p2" x="696.0" y="-148.1"/>
<waypoint name="p3" x="600.4" y="73.4"/>
<waypoint name="p4" x="238.6" y="-48.5"/>
<waypoint name="TD" lat="52.1681602" lon="4.4127708"/>
<waypoint name="FOLLOW" lat="52.16850964562752" lon="4.413635008734417"/>
<waypoint name="S1" lat="52.1669450" lon="4.4174372"/>
<waypoint name="S2" lat="52.1689871" lon="4.4208804"/>
<waypoint lat="52.169189" lon="4.410820" name="C1"/>
<waypoint lat="52.168049" lon="4.406923" name="C2"/>
<waypoint lat="52.166515" lon="4.408235" name="C3"/>
<waypoint lat="52.163255" lon="4.407668" name="C4"/>
<waypoint lat="52.161908" lon="4.410082" name="C5"/>
<waypoint lat="52.162641" lon="4.416992" name="C6"/>
<waypoint lat="52.164861" lon="4.427268" name="C7"/>
<waypoint lat="52.170422" lon="4.427511" name="C8"/>
<waypoint lat="52.172276" lon="4.424011" name="C9"/>
<waypoint lat="52.1673931" lon="4.4127541" name="p5"/>
<waypoint lat="52.1678569" lon="4.4150577" name="p6"/>
<waypoint lat="52.1689993" lon="4.4144979" name="p7"/>
<waypoint lat="52.1686045" lon="4.4121999" name="p8"/>
</waypoints>
<sectors>
<sector color="red" name="Hard_Geofence">
<corner name="C1"/>
<corner name="C2"/>
<corner name="C3"/>
<corner name="C4"/>
<corner name="C5"/>
<corner name="C6"/>
<corner name="C7"/>
<corner name="C8"/>
<corner name="C9"/>
</sector>
<sector color="blue" name="Soft_Geofence">
<corner name="p5"/>
<corner name="p6"/>
<corner name="p7"/>
<corner name="p8"/>
</sector>
</sectors>
<modules>
<!--module name="follow_me"/-->
<module name="nav" type="survey_rectangle_rotorcraft">
<define name="RECTANGLE_SURVEY_DEFAULT_SWEEP" value="100"/>
</module>
</modules>
<exceptions>
<!--Soft Geofencing (go back to Standby)-->
<exception cond="Or(!InsideSoft_Geofence(GetPosX(), GetPosY()), GetPosAlt() @GT 80.0) @AND
!(nav_block == IndexOfBlock('Wait GPS')) @AND
!(nav_block == IndexOfBlock('Geo init'))" deroute="safe"/>
<!-- Hard Geofencing (Kill) -->
<exception cond="(Or(!InsideHard_Geofence(GetPosX(), GetPosY()), GetPosAlt() @GT 80.0) @AND
!(IndexOfBlock('Holding point') @GT nav_block) @AND
!(nav_block >= IndexOfBlock('land here')) @AND
(autopilot_in_flight() == true) )" deroute="Landed"/>
<!-- RC lost -->
<exception cond="((radio_control.status == RC_REALLY_LOST) @AND
!(IndexOfBlock('Holding point') @GT nav_block) @AND
!(nav_block >= IndexOfBlock('land here')) @AND
(autopilot_in_flight() == true) )" deroute="Landed"/>
<!-- Datalink lost -->
<exception cond="((datalink_time @GT 5) @AND
!(IndexOfBlock('Holding point') @GT nav_block) @AND
!(nav_block >= IndexOfBlock('land here')) @AND
(autopilot_in_flight() == true) )" deroute="Landed"/>
<!-- Bat low (constant RPM descent)-->
<exception cond="(electrical.bat_low @AND
!(IndexOfBlock('Holding point') @GT nav_block) @AND
!(nav_block >= IndexOfBlock('land here')) @AND
(autopilot_in_flight() == true) )" deroute="land here"/>
<!-- Bat critical (constant RPM no stabilization)-->
<exception cond="(electrical.bat_critical @AND
!(IndexOfBlock('Holding point') @GT nav_block) @AND
!(nav_block >= IndexOfBlock('land here')) @AND
(autopilot_in_flight() == true) )" deroute="land here"/>
</exceptions>
<blocks>
<block name="Wait GPS">
<call_once fun="NavKillThrottle()"/>
<while cond="!GpsFixValid() || !state.ned_initialized_i"/>
</block>
<block name="Geo init">
<while cond="LessThan(NavBlockTime(), 10)"/>
<call_once fun="NavSetAltitudeReferenceHere()"/>
</block>
<block name="Holding point">
<call_once fun="NavKillThrottle()"/>
<attitude pitch="0" roll="0" throttle="0" until="FALSE" vmode="throttle"/>
</block>
<block key="r" name="Start Engine">
<call_once fun="NavResurrect()"/>
<attitude pitch="0" roll="0" throttle="0" until="FALSE" vmode="throttle"/>
<call_once fun="NavResurrect()"/>
</block>
<block key="t" name="Takeoff" strip_button="Takeoff" strip_icon="takeoff.png">
<exception cond="GetPosAlt() @GT 0.8" deroute="Standby"/>
<call_once fun="NavSetWaypointHere(WP_CLIMB)"/>
<stay climb="nav.climb_vspeed" vmode="climb" wp="CLIMB"/>
</block>
<block name="Pre-Standby">
<while cond="oneloop_andi.half_loop"/>
<!-- <call_once fun="NavSetWaypointPosAndAltHere(WP_STDBY)"/> -->
</block>
<block key="s" name="Standby" strip_button="Standby" strip_icon="home.png">
<stay wp="STDBY"/>
</block>
<block name="safe">
<stay wp="HOME"/>
</block>
<block name="Circle_CW">
<set value="false" var="force_forward"/>
<circle radius="100" wp="FOLLOW"/>
</block>
<block key="l" name="land here" strip_button="land here" strip_icon="land-right.png">
<call_once fun="NavSetWaypointHere(WP_TD)"/>
<go wp="TD"/>
<deroute block="Flare"/>
</block>
<block name="Land">
<go wp="TD"/>
<deroute block="Flare"/>
</block>
<block name="Flare">
<exception cond="NavDetectGround()" deroute="Holding point"/>
<exception cond="!nav_is_in_flight()" deroute="Landed"/>
<exception cond="0.10 @GT GetPosAlt()" deroute="Landed"/>
<call_once fun="NavStartDetectGround()"/>
<stay climb="nav.descend_vspeed" vmode="climb" wp="TD"/>
</block>
<block name="Safe landing">
<exception cond="!nav_is_in_flight()" deroute="Manual"/>
<exception cond="0.10 @GT GetPosAlt()" deroute="Manual"/>
<call_once fun="NavStartDetectGround()"/>
<stay climb="nav.descend_vspeed" vmode="climb" wp="TD"/>
</block>
<block name="Manual">
<set value="AP_MODE_ATTITUDE_DIRECT" var="autopilot_mode_auto2"/>
<stay wp="STDBY"/>
</block>
<block name="Landed">
<call_once fun="NavKillThrottle()"/>
<attitude pitch="0" roll="0" throttle="0" until="FALSE" vmode="throttle"/>
</block>
</blocks>
</flight_plan>