AVBP Mission plugin » History » Version 11
Rafael Bailon-Ruiz, 2021-03-11 15:06
1 | 1 | Rafael Bailon-Ruiz | h1. AVBP Mission plugin |
---|---|---|---|
2 | 2 | Rafael Bailon-Ruiz | |
3 | The _AVBP mission plugin_ is an aircraft plugin, built upon the standard Mission Manager, to supervise adaptive mapping missions. |
||
4 | It is defined in the <code class="python">cams_avbp.plugins.mission</code> module. |
||
5 | 3 | Rafael Bailon-Ruiz | |
6 | 6 | Rafael Bailon-Ruiz | h2. Scenario definition |
7 | 5 | Rafael Bailon-Ruiz | |
8 | 7 | Rafael Bailon-Ruiz | <code class="python">AVBPMission</code> must de declared in the plugins section. The <code class="python">Missions</code> plugin is required and must be included first in the list. Example: |
9 | 5 | Rafael Bailon-Ruiz | |
10 | <pre><code class="yaml"> |
||
11 | aircrafts: |
||
12 | 200: |
||
13 | replay: false |
||
14 | type: 'pprz' |
||
15 | plugins: |
||
16 | # Other plugins ... |
||
17 | - Missions: |
||
18 | backup_file: '/PATH/TO/backup_200.bin' |
||
19 | Goto: *goto_defaults |
||
20 | Segment: *segment_defaults |
||
21 | - AVBPMission |
||
22 | </code></pre> |
||
23 | |||
24 | 3 | Rafael Bailon-Ruiz | h2. User remote control |
25 | |||
26 | 4 | Rafael Bailon-Ruiz | You can make remote procedure calls using the http API, that you can issue with a web browser or from the command line with <code class="shell">curl</code>. For instance: |
27 | 3 | Rafael Bailon-Ruiz | |
28 | <pre><code class="shell"> |
||
29 | curl -v "http://127.0.0.1:8000/runtime/call_method/?uav_id=200&plugin=AVBPMission&method=stop" |
||
30 | </code></pre> |
||
31 | |||
32 | 8 | Rafael Bailon-Ruiz | calls the _stop_ method of the uav _200_ defined in the _AVBPMission_ plugin. |
33 | |||
34 | h2. Event handlers |
||
35 | |||
36 | h3. Aircraft status handlers |
||
37 | 9 | Rafael Bailon-Ruiz | |
38 | 8 | Rafael Bailon-Ruiz | Status messages originated in paparazzi related to the aircraft state and mission execution status. |
39 | |||
40 | <pre><code class="python"> |
||
41 | def flight_param_callback(self, msg): |
||
42 | """ |
||
43 | Receive pprz FLIGHT_PARAM messages |
||
44 | |||
45 | http://docs.paparazziuav.org/latest/paparazzi_messages.html#FLIGHT_PARAM |
||
46 | """ |
||
47 | pass |
||
48 | |||
49 | def engine_status_callback(self, engineStatus): |
||
50 | """ |
||
51 | Receive pprz ENGINE_STATUS messages |
||
52 | |||
53 | http://docs.paparazziuav.org/latest/paparazzi_messages.html#ENGINE_STATUS |
||
54 | """ |
||
55 | pass |
||
56 | |||
57 | def mission_status_callback(self, missionStatus): |
||
58 | """ |
||
59 | Receive pprz MISSION_STATUS messages |
||
60 | |||
61 | http://docs.paparazziuav.org/latest/paparazzi_messages.html#MISSION_STATUS |
||
62 | """ |
||
63 | pass |
||
64 | |||
65 | def nav_status_callback(self, navStatus): |
||
66 | """ |
||
67 | Receive pprz NAV_STATUS messages |
||
68 | |||
69 | http://docs.paparazziuav.org/latest/paparazzi_messages.html#NAV_STATUS |
||
70 | """ |
||
71 | pass |
||
72 | |||
73 | def ap_status_callback(self, apStatus): |
||
74 | """ |
||
75 | Receive pprz AP_STATUS messages |
||
76 | |||
77 | http://docs.paparazziuav.org/latest/paparazzi_messages.html#AP_STATUS |
||
78 | """ |
||
79 | pass |
||
80 | </code></pre> |
||
81 | |||
82 | h3. Sensor sample handlers |
||
83 | 9 | Rafael Bailon-Ruiz | |
84 | 8 | Rafael Bailon-Ruiz | Handler for the internal CAMS event "add_sample". It is called each time a sensor sample is disseminated from another plugin of the same UAV. |
85 | |||
86 | <pre><code class="python"> |
||
87 | def add_sample(self, sample: ty.Union[AbstractSensorSample, SensorSample]): |
||
88 | """Catch sensor samples coming from other plugins""" |
||
89 | pass |
||
90 | </code></pre> |
||
91 | |||
92 | h3. Interaction methods |
||
93 | |||
94 | These functions are not called periodically by CAMS, but manually by the operators to trigger certain actions. More can be defined provided by <code class="python">__pluginmethods__</code> is update accordingly. |
||
95 | |||
96 | <pre><code class="python"> |
||
97 | def stop(self): |
||
98 | """Disable the AVBPProbe plugin""" |
||
99 | pass |
||
100 | |||
101 | def pause(self, *args, **kwargs): |
||
102 | """Specific stop signal just for the AVBPMission plugin""" |
||
103 | pass |
||
104 | |||
105 | def play(self, *args, **kwargs): |
||
106 | """Specific start signal just for the AVBPMission plugin |
||
107 | |||
108 | You can activate this method manually with: |
||
109 | curl -v "http://127.0.0.1:8000/runtime/call_method/?uav_id=200&plugin=AVBPMission&method=play |
||
110 | |||
111 | or browsing to http://127.0.0.1:8000/rpc (Call UAV plugin method) |
||
112 | """ |
||
113 | pass |
||
114 | </code></pre> |
||
115 | 10 | Rafael Bailon-Ruiz | |
116 | h2. Available commands |
||
117 | |||
118 | The <code class="python">self</code> argument of every plugin method (declared in <code class="python">__pluginmethods__</code>) is the AircraftPprz from nephelae_paparazzi the plugin is attached to. |
||
119 | |||
120 | h3. Create a mission |
||
121 | 11 | Rafael Bailon-Ruiz | |
122 | 10 | Rafael Bailon-Ruiz | <pre><code class="python"> |
123 | _logger.debug("Create a 'Goto' test mission") |
||
124 | goto_mission_params = {"wp_east": 500.0, "wp_north": 300.0, "wp_alt": 500.0} |
||
125 | mission = self.create_mission('Goto', insertMode=InsertMode.ReplaceAll, |
||
126 | **goto_mission_params) |
||
127 | _logger.debug("mission %s created", mission) |
||
128 | |||
129 | _logger.debug("Create a 'Segment' test mission") |
||
130 | segment_mission_params = {"segment_east_1": 500.0, "segment_north_1": 300.0, |
||
131 | "segment_east_2": 300.0, "segment_north_2": 500.0, |
||
132 | "segment_alt": 500.0} |
||
133 | mission = self.create_mission('Segment', insertMode=InsertMode.Append, |
||
134 | **segment_mission_params) |
||
135 | _logger.debug("mission %s created", mission) |
||
136 | </code></pre> |
||
137 | |||
138 | These missions can either be validated with the gui (operator) OR |