Project

General

Profile

AVBP Mission plugin » History » Version 8

Rafael Bailon-Ruiz, 2021-03-11 15:01

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
Status messages originated in paparazzi related to the aircraft state and mission execution status.
38
39
<pre><code class="python">
40
def flight_param_callback(self, msg):
41
    """
42
    Receive pprz FLIGHT_PARAM messages
43
44
    http://docs.paparazziuav.org/latest/paparazzi_messages.html#FLIGHT_PARAM
45
    """
46
    pass
47
48
def engine_status_callback(self, engineStatus):
49
    """
50
    Receive pprz ENGINE_STATUS messages
51
52
    http://docs.paparazziuav.org/latest/paparazzi_messages.html#ENGINE_STATUS
53
    """
54
    pass
55
56
def mission_status_callback(self, missionStatus):
57
    """
58
    Receive pprz MISSION_STATUS messages
59
60
    http://docs.paparazziuav.org/latest/paparazzi_messages.html#MISSION_STATUS
61
    """
62
    pass
63
64
def nav_status_callback(self, navStatus):
65
    """
66
    Receive pprz NAV_STATUS messages
67
68
    http://docs.paparazziuav.org/latest/paparazzi_messages.html#NAV_STATUS
69
    """
70
    pass
71
72
def ap_status_callback(self, apStatus):
73
    """
74
    Receive pprz AP_STATUS messages
75
76
    http://docs.paparazziuav.org/latest/paparazzi_messages.html#AP_STATUS
77
    """
78
    pass
79
</code></pre>
80
81
h3. Sensor sample handlers
82
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.
83
84
<pre><code class="python">
85
def add_sample(self, sample: ty.Union[AbstractSensorSample, SensorSample]):
86
    """Catch sensor samples coming from other plugins"""
87
    pass
88
</code></pre>
89
90
h3. Interaction methods
91
92
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.
93
94
<pre><code class="python">
95
def stop(self):
96
    """Disable the AVBPProbe plugin"""
97
    pass
98
99
def pause(self, *args, **kwargs):
100
    """Specific stop signal just for the AVBPMission plugin"""
101
    pass
102
103
def play(self, *args, **kwargs):
104
    """Specific start signal just for the AVBPMission plugin
105
106
    You can activate this method manually with:
107
    curl -v "http://127.0.0.1:8000/runtime/call_method/?uav_id=200&plugin=AVBPMission&method=play
108
109
    or browsing to http://127.0.0.1:8000/rpc (Call UAV plugin method)
110
    """
111
    pass
112
</code></pre>