Skip to content

Commit dc012a1

Browse files
f5sohfilnet
authored andcommitted
Merged in f5soh/librepilot/LP-563_Reduce_telemetry (pull request #480)
LP-563 Reduce telemetry bandwidth Approved-by: Lalanne Laurent <f5soh@free.fr> Approved-by: Philippe Renon <philippe_renon@yahoo.fr> Approved-by: Alessio Morale <alessiomorale@gmail.com>
2 parents 45d2913 + 43c4718 commit dc012a1

28 files changed

Lines changed: 51 additions & 27 deletions

flight/modules/CameraStab/camerastab.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949

5050
#include "accessorydesired.h"
5151
#include "attitudestate.h"
52+
#include "mixersettings.h"
53+
#include "actuatorcommand.h"
5254
#include "camerastabsettings.h"
5355
#include "cameradesired.h"
5456
#include "hwsettings.h"
@@ -61,6 +63,8 @@
6163
// Private types
6264

6365
// Private variables
66+
static bool gimbalOutputEnabled = false;
67+
6468
static struct CameraStab_data {
6569
portTickType lastSysTime;
6670
float inputs[CAMERASTABSETTINGS_INPUT_NUMELEM];
@@ -83,6 +87,12 @@ static void attitudeUpdated(UAVObjEvent *ev);
8387
static void applyFeedForward(uint8_t index, float dT, float *attitude, CameraStabSettingsData *cameraStab);
8488
#endif
8589

90+
// this structure is equivalent to the UAVObjects for one mixer.
91+
typedef struct {
92+
uint8_t type;
93+
int8_t matrix[5];
94+
} __attribute__((packed)) Mixer_t;
95+
8696

8797
/**
8898
* Initialise the module, called on startup
@@ -150,6 +160,20 @@ static void attitudeUpdated(UAVObjEvent *ev)
150160
return;
151161
}
152162

163+
if (!gimbalOutputEnabled) {
164+
MixerSettingsData mixerSettings;
165+
MixerSettingsGet(&mixerSettings);
166+
Mixer_t *mixers = (Mixer_t *)&mixerSettings.Mixer1Type;
167+
for (int ct = 0; ct < ACTUATORCOMMAND_CHANNEL_NUMELEM; ct++) {
168+
uint8_t mixer_type = mixers[ct].type;
169+
if ((mixer_type >= MIXERSETTINGS_MIXER1TYPE_CAMERAROLLORSERVO1) &&
170+
(mixer_type <= MIXERSETTINGS_MIXER1TYPE_CAMERAYAW)) {
171+
gimbalOutputEnabled = true;
172+
}
173+
}
174+
return;
175+
}
176+
153177
AccessoryDesiredData accessory;
154178

155179
CameraStabSettingsData cameraStab;

shared/uavobjectdefinition/airspeedsensor.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<field name="TrueAirspeed" units="m/s" type="float" elements="1" defaultvalue="-1"/>
1111
<access gcs="readwrite" flight="readwrite"/>
1212
<telemetrygcs acked="false" updatemode="manual" period="0"/>
13-
<telemetryflight acked="false" updatemode="periodic" period="1000"/>
13+
<telemetryflight acked="false" updatemode="throttled" period="1000"/>
1414
<logging updatemode="manual" period="0"/>
1515
</object>
1616
</xml>

shared/uavobjectdefinition/airspeedstate.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<field name="TrueAirspeed" units="m/s" type="float" elements="1"/>
66
<access gcs="readwrite" flight="readwrite"/>
77
<telemetrygcs acked="false" updatemode="manual" period="0"/>
8-
<telemetryflight acked="false" updatemode="periodic" period="1000"/>
8+
<telemetryflight acked="false" updatemode="throttled" period="1000"/>
99
<logging updatemode="manual" period="0"/>
1010
</object>
1111
</xml>

shared/uavobjectdefinition/altitudeholdstatus.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<field name="ThrustDemand" units="" type="float" elements="1"/>
77
<access gcs="readwrite" flight="readwrite"/>
88
<telemetrygcs acked="false" updatemode="manual" period="0"/>
9-
<telemetryflight acked="false" updatemode="periodic" period="1000"/>
9+
<telemetryflight acked="false" updatemode="throttled" period="1000"/>
1010
<logging updatemode="manual" period="0"/>
1111
</object>
1212
</xml>

shared/uavobjectdefinition/auxmagsensor.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<field name="Status" units="" type="enum" elements="1" options="None,Ok" defaultvalue="None"/>
88
<access gcs="readwrite" flight="readwrite"/>
99
<telemetrygcs acked="false" updatemode="manual" period="0"/>
10-
<telemetryflight acked="false" updatemode="periodic" period="10000"/>
10+
<telemetryflight acked="false" updatemode="throttled" period="10000"/>
1111
<logging updatemode="manual" period="0"/>
1212
</object>
1313
</xml>

shared/uavobjectdefinition/barosensor.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<field name="Pressure" units="Pa" type="float" elements="1"/>
77
<access gcs="readwrite" flight="readwrite"/>
88
<telemetrygcs acked="false" updatemode="manual" period="0"/>
9-
<telemetryflight acked="false" updatemode="periodic" period="1000"/>
9+
<telemetryflight acked="false" updatemode="throttled" period="1000"/>
1010
<logging updatemode="manual" period="0"/>
1111
</object>
1212
</xml>

shared/uavobjectdefinition/cameradesired.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<field name="Trigger" units="" type="float" elements="1"/>
88
<access gcs="readwrite" flight="readwrite"/>
99
<telemetrygcs acked="false" updatemode="manual" period="0"/>
10-
<telemetryflight acked="false" updatemode="periodic" period="1000"/>
10+
<telemetryflight acked="false" updatemode="throttled" period="1000"/>
1111
<logging updatemode="manual" period="0"/>
1212
</object>
1313
</xml>

shared/uavobjectdefinition/debuglogstatus.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<field name="FreeSlots" units="" type="uint16" elements="1" description="The number of free log slots available"/>
88
<access gcs="readwrite" flight="readwrite"/>
99
<telemetrygcs acked="false" updatemode="manual" period="0"/>
10-
<telemetryflight acked="false" updatemode="periodic" period="1000"/>
10+
<telemetryflight acked="false" updatemode="throttled" period="1000"/>
1111
<logging updatemode="manual" period="0"/>
1212
</object>
1313
</xml>

shared/uavobjectdefinition/ekfstatevariance.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</field>
2121
<access gcs="readwrite" flight="readwrite"/>
2222
<telemetrygcs acked="false" updatemode="manual" period="0"/>
23-
<telemetryflight acked="false" updatemode="periodic" period="10000"/>
23+
<telemetryflight acked="false" updatemode="throttled" period="10000"/>
2424
<logging updatemode="manual" period="0"/>
2525
</object>
2626
</xml>

shared/uavobjectdefinition/fixedwingpathfollowerstatus.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<field name="Errors" units="" type="uint8" elementnames="Wind,Stallspeed,Lowspeed,Highspeed,Overspeed,Lowpower,Highpower,Rollcontrol,Pitchcontrol,AirspeedSensor" />
88
<access gcs="readwrite" flight="readwrite"/>
99
<telemetrygcs acked="false" updatemode="manual" period="0"/>
10-
<telemetryflight acked="false" updatemode="periodic" period="500"/>
10+
<telemetryflight acked="false" updatemode="throttled" period="500"/>
1111
<logging updatemode="manual" period="0"/>
1212
</object>
1313
</xml>

0 commit comments

Comments
 (0)