• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mavlink / MAVSDK / 13298134957

13 Feb 2025 01:04AM UTC coverage: 44.549% (-0.08%) from 44.629%
13298134957

push

github

web-flow
Telemetry and TelemetryServer improvements (#2511)

* proto: update to latest main (1.2.1)

This fixes a regression with 1.2.0 regarding extra options.

* Add attitude and expanded fixed wing metrics for TelemetryServer

* Bug fix for ranges on attitude and heading messages

* Re-order FixedwingMetrics fields for backward compatibility

* PR feedback: altitude_msl -> absolute_altitude_m

* Proto update

* proto based on main

* Proto -> main

---------

Co-authored-by: Julian Oes <julian@oes.ch>
Co-authored-by: Jon Reeves <jon.reeves@elroyair.com>

0 of 53 new or added lines in 4 files covered. (0.0%)

7 existing lines in 4 files now uncovered.

14593 of 32757 relevant lines covered (44.55%)

284.58 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

1.08
/src/mavsdk/plugins/telemetry_server/telemetry_server.cpp
1
// WARNING: THIS FILE IS AUTOGENERATED! As such, it should not be edited.
2
// Edits need to be made to the proto files
3
// (see
4
// https://github.com/mavlink/MAVSDK-Proto/blob/master/protos/telemetry_server/telemetry_server.proto)
5

6
#include <iomanip>
7

8
#include "telemetry_server_impl.h"
9
#include "plugins/telemetry_server/telemetry_server.h"
10

11
namespace mavsdk {
12

13
using Position = TelemetryServer::Position;
14
using Heading = TelemetryServer::Heading;
15
using Quaternion = TelemetryServer::Quaternion;
16
using EulerAngle = TelemetryServer::EulerAngle;
17
using AngularVelocityBody = TelemetryServer::AngularVelocityBody;
18
using GpsInfo = TelemetryServer::GpsInfo;
19
using RawGps = TelemetryServer::RawGps;
20
using Battery = TelemetryServer::Battery;
21
using RcStatus = TelemetryServer::RcStatus;
22
using StatusText = TelemetryServer::StatusText;
23
using ActuatorControlTarget = TelemetryServer::ActuatorControlTarget;
24
using ActuatorOutputStatus = TelemetryServer::ActuatorOutputStatus;
25
using Covariance = TelemetryServer::Covariance;
26
using VelocityBody = TelemetryServer::VelocityBody;
27
using PositionBody = TelemetryServer::PositionBody;
28
using Odometry = TelemetryServer::Odometry;
29
using DistanceSensor = TelemetryServer::DistanceSensor;
30
using ScaledPressure = TelemetryServer::ScaledPressure;
31
using PositionNed = TelemetryServer::PositionNed;
32
using VelocityNed = TelemetryServer::VelocityNed;
33
using PositionVelocityNed = TelemetryServer::PositionVelocityNed;
34
using GroundTruth = TelemetryServer::GroundTruth;
35
using FixedwingMetrics = TelemetryServer::FixedwingMetrics;
36
using AccelerationFrd = TelemetryServer::AccelerationFrd;
37
using AngularVelocityFrd = TelemetryServer::AngularVelocityFrd;
38
using MagneticFieldFrd = TelemetryServer::MagneticFieldFrd;
39
using Imu = TelemetryServer::Imu;
40

41
TelemetryServer::TelemetryServer(std::shared_ptr<ServerComponent> server_component) :
1✔
42
    ServerPluginBase(),
43
    _impl{std::make_unique<TelemetryServerImpl>(server_component)}
1✔
44
{}
1✔
45

46
TelemetryServer::~TelemetryServer() {}
1✔
47

48
TelemetryServer::Result TelemetryServer::publish_position(
×
49
    Position position, VelocityNed velocity_ned, Heading heading) const
50
{
51
    return _impl->publish_position(position, velocity_ned, heading);
×
52
}
53

54
TelemetryServer::Result TelemetryServer::publish_home(Position home) const
×
55
{
56
    return _impl->publish_home(home);
×
57
}
58

59
TelemetryServer::Result TelemetryServer::publish_sys_status(
×
60
    Battery battery,
61
    bool rc_receiver_status,
62
    bool gyro_status,
63
    bool accel_status,
64
    bool mag_status,
65
    bool gps_status) const
66
{
67
    return _impl->publish_sys_status(
×
68
        battery, rc_receiver_status, gyro_status, accel_status, mag_status, gps_status);
×
69
}
70

71
TelemetryServer::Result
72
TelemetryServer::publish_extended_sys_state(VtolState vtol_state, LandedState landed_state) const
×
73
{
74
    return _impl->publish_extended_sys_state(vtol_state, landed_state);
×
75
}
76

77
TelemetryServer::Result TelemetryServer::publish_raw_gps(RawGps raw_gps, GpsInfo gps_info) const
×
78
{
79
    return _impl->publish_raw_gps(raw_gps, gps_info);
×
80
}
81

82
TelemetryServer::Result TelemetryServer::publish_battery(Battery battery) const
×
83
{
84
    return _impl->publish_battery(battery);
×
85
}
86

87
TelemetryServer::Result TelemetryServer::publish_status_text(StatusText status_text) const
3✔
88
{
89
    return _impl->publish_status_text(status_text);
3✔
90
}
91

92
TelemetryServer::Result TelemetryServer::publish_odometry(Odometry odometry) const
×
93
{
94
    return _impl->publish_odometry(odometry);
×
95
}
96

97
TelemetryServer::Result
98
TelemetryServer::publish_position_velocity_ned(PositionVelocityNed position_velocity_ned) const
×
99
{
100
    return _impl->publish_position_velocity_ned(position_velocity_ned);
×
101
}
102

103
TelemetryServer::Result TelemetryServer::publish_ground_truth(GroundTruth ground_truth) const
×
104
{
105
    return _impl->publish_ground_truth(ground_truth);
×
106
}
107

108
TelemetryServer::Result TelemetryServer::publish_imu(Imu imu) const
×
109
{
110
    return _impl->publish_imu(imu);
×
111
}
112

113
TelemetryServer::Result TelemetryServer::publish_scaled_imu(Imu imu) const
×
114
{
115
    return _impl->publish_scaled_imu(imu);
×
116
}
117

118
TelemetryServer::Result TelemetryServer::publish_raw_imu(Imu imu) const
×
119
{
120
    return _impl->publish_raw_imu(imu);
×
121
}
122

123
TelemetryServer::Result TelemetryServer::publish_unix_epoch_time(uint64_t time_us) const
×
124
{
125
    return _impl->publish_unix_epoch_time(time_us);
×
126
}
127

128
TelemetryServer::Result
129
TelemetryServer::publish_distance_sensor(DistanceSensor distance_sensor) const
×
130
{
131
    return _impl->publish_distance_sensor(distance_sensor);
×
132
}
133

134
TelemetryServer::Result
NEW
135
TelemetryServer::publish_attitude(EulerAngle angle, AngularVelocityBody angular_velocity) const
×
136
{
NEW
137
    return _impl->publish_attitude(angle, angular_velocity);
×
138
}
139

140
TelemetryServer::Result
NEW
141
TelemetryServer::publish_visual_flight_rules_hud(FixedwingMetrics fixed_wing_metrics) const
×
142
{
NEW
143
    return _impl->publish_visual_flight_rules_hud(fixed_wing_metrics);
×
144
}
145

UNCOV
146
bool operator==(const TelemetryServer::Position& lhs, const TelemetryServer::Position& rhs)
×
147
{
148
    return ((std::isnan(rhs.latitude_deg) && std::isnan(lhs.latitude_deg)) ||
×
149
            rhs.latitude_deg == lhs.latitude_deg) &&
×
150
           ((std::isnan(rhs.longitude_deg) && std::isnan(lhs.longitude_deg)) ||
×
151
            rhs.longitude_deg == lhs.longitude_deg) &&
×
152
           ((std::isnan(rhs.absolute_altitude_m) && std::isnan(lhs.absolute_altitude_m)) ||
×
153
            rhs.absolute_altitude_m == lhs.absolute_altitude_m) &&
×
154
           ((std::isnan(rhs.relative_altitude_m) && std::isnan(lhs.relative_altitude_m)) ||
×
155
            rhs.relative_altitude_m == lhs.relative_altitude_m);
×
156
}
157

158
std::ostream& operator<<(std::ostream& str, TelemetryServer::Position const& position)
×
159
{
160
    str << std::setprecision(15);
×
161
    str << "position:" << '\n' << "{\n";
×
162
    str << "    latitude_deg: " << position.latitude_deg << '\n';
×
163
    str << "    longitude_deg: " << position.longitude_deg << '\n';
×
164
    str << "    absolute_altitude_m: " << position.absolute_altitude_m << '\n';
×
165
    str << "    relative_altitude_m: " << position.relative_altitude_m << '\n';
×
166
    str << '}';
×
167
    return str;
×
168
}
169

170
bool operator==(const TelemetryServer::Heading& lhs, const TelemetryServer::Heading& rhs)
×
171
{
172
    return (
173
        (std::isnan(rhs.heading_deg) && std::isnan(lhs.heading_deg)) ||
×
174
        rhs.heading_deg == lhs.heading_deg);
×
175
}
176

177
std::ostream& operator<<(std::ostream& str, TelemetryServer::Heading const& heading)
×
178
{
179
    str << std::setprecision(15);
×
180
    str << "heading:" << '\n' << "{\n";
×
181
    str << "    heading_deg: " << heading.heading_deg << '\n';
×
182
    str << '}';
×
183
    return str;
×
184
}
185

186
bool operator==(const TelemetryServer::Quaternion& lhs, const TelemetryServer::Quaternion& rhs)
×
187
{
188
    return ((std::isnan(rhs.w) && std::isnan(lhs.w)) || rhs.w == lhs.w) &&
×
189
           ((std::isnan(rhs.x) && std::isnan(lhs.x)) || rhs.x == lhs.x) &&
×
190
           ((std::isnan(rhs.y) && std::isnan(lhs.y)) || rhs.y == lhs.y) &&
×
191
           ((std::isnan(rhs.z) && std::isnan(lhs.z)) || rhs.z == lhs.z) &&
×
192
           (rhs.timestamp_us == lhs.timestamp_us);
×
193
}
194

195
std::ostream& operator<<(std::ostream& str, TelemetryServer::Quaternion const& quaternion)
×
196
{
197
    str << std::setprecision(15);
×
198
    str << "quaternion:" << '\n' << "{\n";
×
199
    str << "    w: " << quaternion.w << '\n';
×
200
    str << "    x: " << quaternion.x << '\n';
×
201
    str << "    y: " << quaternion.y << '\n';
×
202
    str << "    z: " << quaternion.z << '\n';
×
203
    str << "    timestamp_us: " << quaternion.timestamp_us << '\n';
×
204
    str << '}';
×
205
    return str;
×
206
}
207

208
bool operator==(const TelemetryServer::EulerAngle& lhs, const TelemetryServer::EulerAngle& rhs)
×
209
{
210
    return ((std::isnan(rhs.roll_deg) && std::isnan(lhs.roll_deg)) ||
×
211
            rhs.roll_deg == lhs.roll_deg) &&
×
212
           ((std::isnan(rhs.pitch_deg) && std::isnan(lhs.pitch_deg)) ||
×
213
            rhs.pitch_deg == lhs.pitch_deg) &&
×
214
           ((std::isnan(rhs.yaw_deg) && std::isnan(lhs.yaw_deg)) || rhs.yaw_deg == lhs.yaw_deg) &&
×
215
           (rhs.timestamp_us == lhs.timestamp_us);
×
216
}
217

218
std::ostream& operator<<(std::ostream& str, TelemetryServer::EulerAngle const& euler_angle)
×
219
{
220
    str << std::setprecision(15);
×
221
    str << "euler_angle:" << '\n' << "{\n";
×
222
    str << "    roll_deg: " << euler_angle.roll_deg << '\n';
×
223
    str << "    pitch_deg: " << euler_angle.pitch_deg << '\n';
×
224
    str << "    yaw_deg: " << euler_angle.yaw_deg << '\n';
×
225
    str << "    timestamp_us: " << euler_angle.timestamp_us << '\n';
×
226
    str << '}';
×
227
    return str;
×
228
}
229

230
bool operator==(
×
231
    const TelemetryServer::AngularVelocityBody& lhs,
232
    const TelemetryServer::AngularVelocityBody& rhs)
233
{
234
    return ((std::isnan(rhs.roll_rad_s) && std::isnan(lhs.roll_rad_s)) ||
×
235
            rhs.roll_rad_s == lhs.roll_rad_s) &&
×
236
           ((std::isnan(rhs.pitch_rad_s) && std::isnan(lhs.pitch_rad_s)) ||
×
237
            rhs.pitch_rad_s == lhs.pitch_rad_s) &&
×
238
           ((std::isnan(rhs.yaw_rad_s) && std::isnan(lhs.yaw_rad_s)) ||
×
239
            rhs.yaw_rad_s == lhs.yaw_rad_s);
×
240
}
241

242
std::ostream&
243
operator<<(std::ostream& str, TelemetryServer::AngularVelocityBody const& angular_velocity_body)
×
244
{
245
    str << std::setprecision(15);
×
246
    str << "angular_velocity_body:" << '\n' << "{\n";
×
247
    str << "    roll_rad_s: " << angular_velocity_body.roll_rad_s << '\n';
×
248
    str << "    pitch_rad_s: " << angular_velocity_body.pitch_rad_s << '\n';
×
249
    str << "    yaw_rad_s: " << angular_velocity_body.yaw_rad_s << '\n';
×
250
    str << '}';
×
251
    return str;
×
252
}
253

254
bool operator==(const TelemetryServer::GpsInfo& lhs, const TelemetryServer::GpsInfo& rhs)
×
255
{
256
    return (rhs.num_satellites == lhs.num_satellites) && (rhs.fix_type == lhs.fix_type);
×
257
}
258

259
std::ostream& operator<<(std::ostream& str, TelemetryServer::GpsInfo const& gps_info)
×
260
{
261
    str << std::setprecision(15);
×
262
    str << "gps_info:" << '\n' << "{\n";
×
263
    str << "    num_satellites: " << gps_info.num_satellites << '\n';
×
264
    str << "    fix_type: " << gps_info.fix_type << '\n';
×
265
    str << '}';
×
266
    return str;
×
267
}
268

269
bool operator==(const TelemetryServer::RawGps& lhs, const TelemetryServer::RawGps& rhs)
×
270
{
271
    return (rhs.timestamp_us == lhs.timestamp_us) &&
×
272
           ((std::isnan(rhs.latitude_deg) && std::isnan(lhs.latitude_deg)) ||
×
273
            rhs.latitude_deg == lhs.latitude_deg) &&
×
274
           ((std::isnan(rhs.longitude_deg) && std::isnan(lhs.longitude_deg)) ||
×
275
            rhs.longitude_deg == lhs.longitude_deg) &&
×
276
           ((std::isnan(rhs.absolute_altitude_m) && std::isnan(lhs.absolute_altitude_m)) ||
×
277
            rhs.absolute_altitude_m == lhs.absolute_altitude_m) &&
×
278
           ((std::isnan(rhs.hdop) && std::isnan(lhs.hdop)) || rhs.hdop == lhs.hdop) &&
×
279
           ((std::isnan(rhs.vdop) && std::isnan(lhs.vdop)) || rhs.vdop == lhs.vdop) &&
×
280
           ((std::isnan(rhs.velocity_m_s) && std::isnan(lhs.velocity_m_s)) ||
×
281
            rhs.velocity_m_s == lhs.velocity_m_s) &&
×
282
           ((std::isnan(rhs.cog_deg) && std::isnan(lhs.cog_deg)) || rhs.cog_deg == lhs.cog_deg) &&
×
283
           ((std::isnan(rhs.altitude_ellipsoid_m) && std::isnan(lhs.altitude_ellipsoid_m)) ||
×
284
            rhs.altitude_ellipsoid_m == lhs.altitude_ellipsoid_m) &&
×
285
           ((std::isnan(rhs.horizontal_uncertainty_m) &&
×
286
             std::isnan(lhs.horizontal_uncertainty_m)) ||
×
287
            rhs.horizontal_uncertainty_m == lhs.horizontal_uncertainty_m) &&
×
288
           ((std::isnan(rhs.vertical_uncertainty_m) && std::isnan(lhs.vertical_uncertainty_m)) ||
×
289
            rhs.vertical_uncertainty_m == lhs.vertical_uncertainty_m) &&
×
290
           ((std::isnan(rhs.velocity_uncertainty_m_s) &&
×
291
             std::isnan(lhs.velocity_uncertainty_m_s)) ||
×
292
            rhs.velocity_uncertainty_m_s == lhs.velocity_uncertainty_m_s) &&
×
293
           ((std::isnan(rhs.heading_uncertainty_deg) && std::isnan(lhs.heading_uncertainty_deg)) ||
×
294
            rhs.heading_uncertainty_deg == lhs.heading_uncertainty_deg) &&
×
295
           ((std::isnan(rhs.yaw_deg) && std::isnan(lhs.yaw_deg)) || rhs.yaw_deg == lhs.yaw_deg);
×
296
}
297

298
std::ostream& operator<<(std::ostream& str, TelemetryServer::RawGps const& raw_gps)
×
299
{
300
    str << std::setprecision(15);
×
301
    str << "raw_gps:" << '\n' << "{\n";
×
302
    str << "    timestamp_us: " << raw_gps.timestamp_us << '\n';
×
303
    str << "    latitude_deg: " << raw_gps.latitude_deg << '\n';
×
304
    str << "    longitude_deg: " << raw_gps.longitude_deg << '\n';
×
305
    str << "    absolute_altitude_m: " << raw_gps.absolute_altitude_m << '\n';
×
306
    str << "    hdop: " << raw_gps.hdop << '\n';
×
307
    str << "    vdop: " << raw_gps.vdop << '\n';
×
308
    str << "    velocity_m_s: " << raw_gps.velocity_m_s << '\n';
×
309
    str << "    cog_deg: " << raw_gps.cog_deg << '\n';
×
310
    str << "    altitude_ellipsoid_m: " << raw_gps.altitude_ellipsoid_m << '\n';
×
311
    str << "    horizontal_uncertainty_m: " << raw_gps.horizontal_uncertainty_m << '\n';
×
312
    str << "    vertical_uncertainty_m: " << raw_gps.vertical_uncertainty_m << '\n';
×
313
    str << "    velocity_uncertainty_m_s: " << raw_gps.velocity_uncertainty_m_s << '\n';
×
314
    str << "    heading_uncertainty_deg: " << raw_gps.heading_uncertainty_deg << '\n';
×
315
    str << "    yaw_deg: " << raw_gps.yaw_deg << '\n';
×
316
    str << '}';
×
317
    return str;
×
318
}
319

320
bool operator==(const TelemetryServer::Battery& lhs, const TelemetryServer::Battery& rhs)
×
321
{
322
    return ((std::isnan(rhs.voltage_v) && std::isnan(lhs.voltage_v)) ||
×
323
            rhs.voltage_v == lhs.voltage_v) &&
×
324
           ((std::isnan(rhs.remaining_percent) && std::isnan(lhs.remaining_percent)) ||
×
325
            rhs.remaining_percent == lhs.remaining_percent);
×
326
}
327

328
std::ostream& operator<<(std::ostream& str, TelemetryServer::Battery const& battery)
×
329
{
330
    str << std::setprecision(15);
×
331
    str << "battery:" << '\n' << "{\n";
×
332
    str << "    voltage_v: " << battery.voltage_v << '\n';
×
333
    str << "    remaining_percent: " << battery.remaining_percent << '\n';
×
334
    str << '}';
×
335
    return str;
×
336
}
337

338
bool operator==(const TelemetryServer::RcStatus& lhs, const TelemetryServer::RcStatus& rhs)
×
339
{
340
    return (rhs.was_available_once == lhs.was_available_once) &&
×
341
           (rhs.is_available == lhs.is_available) &&
×
342
           ((std::isnan(rhs.signal_strength_percent) && std::isnan(lhs.signal_strength_percent)) ||
×
343
            rhs.signal_strength_percent == lhs.signal_strength_percent);
×
344
}
345

346
std::ostream& operator<<(std::ostream& str, TelemetryServer::RcStatus const& rc_status)
×
347
{
348
    str << std::setprecision(15);
×
349
    str << "rc_status:" << '\n' << "{\n";
×
350
    str << "    was_available_once: " << rc_status.was_available_once << '\n';
×
351
    str << "    is_available: " << rc_status.is_available << '\n';
×
352
    str << "    signal_strength_percent: " << rc_status.signal_strength_percent << '\n';
×
353
    str << '}';
×
354
    return str;
×
355
}
356

357
bool operator==(const TelemetryServer::StatusText& lhs, const TelemetryServer::StatusText& rhs)
×
358
{
359
    return (rhs.type == lhs.type) && (rhs.text == lhs.text);
×
360
}
361

362
std::ostream& operator<<(std::ostream& str, TelemetryServer::StatusText const& status_text)
×
363
{
364
    str << std::setprecision(15);
×
365
    str << "status_text:" << '\n' << "{\n";
×
366
    str << "    type: " << status_text.type << '\n';
×
367
    str << "    text: " << status_text.text << '\n';
×
368
    str << '}';
×
369
    return str;
×
370
}
371

372
bool operator==(
×
373
    const TelemetryServer::ActuatorControlTarget& lhs,
374
    const TelemetryServer::ActuatorControlTarget& rhs)
375
{
376
    return (rhs.group == lhs.group) && (rhs.controls == lhs.controls);
×
377
}
378

379
std::ostream&
380
operator<<(std::ostream& str, TelemetryServer::ActuatorControlTarget const& actuator_control_target)
×
381
{
382
    str << std::setprecision(15);
×
383
    str << "actuator_control_target:" << '\n' << "{\n";
×
384
    str << "    group: " << actuator_control_target.group << '\n';
×
385
    str << "    controls: [";
×
386
    for (auto it = actuator_control_target.controls.begin();
×
387
         it != actuator_control_target.controls.end();
×
388
         ++it) {
×
389
        str << *it;
×
390
        str << (it + 1 != actuator_control_target.controls.end() ? ", " : "]\n");
×
391
    }
392
    str << '}';
×
393
    return str;
×
394
}
395

396
bool operator==(
×
397
    const TelemetryServer::ActuatorOutputStatus& lhs,
398
    const TelemetryServer::ActuatorOutputStatus& rhs)
399
{
400
    return (rhs.active == lhs.active) && (rhs.actuator == lhs.actuator);
×
401
}
402

403
std::ostream&
404
operator<<(std::ostream& str, TelemetryServer::ActuatorOutputStatus const& actuator_output_status)
×
405
{
406
    str << std::setprecision(15);
×
407
    str << "actuator_output_status:" << '\n' << "{\n";
×
408
    str << "    active: " << actuator_output_status.active << '\n';
×
409
    str << "    actuator: [";
×
410
    for (auto it = actuator_output_status.actuator.begin();
×
411
         it != actuator_output_status.actuator.end();
×
412
         ++it) {
×
413
        str << *it;
×
414
        str << (it + 1 != actuator_output_status.actuator.end() ? ", " : "]\n");
×
415
    }
416
    str << '}';
×
417
    return str;
×
418
}
419

420
bool operator==(const TelemetryServer::Covariance& lhs, const TelemetryServer::Covariance& rhs)
×
421
{
422
    return (rhs.covariance_matrix == lhs.covariance_matrix);
×
423
}
424

425
std::ostream& operator<<(std::ostream& str, TelemetryServer::Covariance const& covariance)
×
426
{
427
    str << std::setprecision(15);
×
428
    str << "covariance:" << '\n' << "{\n";
×
429
    str << "    covariance_matrix: [";
×
430
    for (auto it = covariance.covariance_matrix.begin(); it != covariance.covariance_matrix.end();
×
431
         ++it) {
×
432
        str << *it;
×
433
        str << (it + 1 != covariance.covariance_matrix.end() ? ", " : "]\n");
×
434
    }
435
    str << '}';
×
436
    return str;
×
437
}
438

439
bool operator==(const TelemetryServer::VelocityBody& lhs, const TelemetryServer::VelocityBody& rhs)
×
440
{
441
    return ((std::isnan(rhs.x_m_s) && std::isnan(lhs.x_m_s)) || rhs.x_m_s == lhs.x_m_s) &&
×
442
           ((std::isnan(rhs.y_m_s) && std::isnan(lhs.y_m_s)) || rhs.y_m_s == lhs.y_m_s) &&
×
443
           ((std::isnan(rhs.z_m_s) && std::isnan(lhs.z_m_s)) || rhs.z_m_s == lhs.z_m_s);
×
444
}
445

446
std::ostream& operator<<(std::ostream& str, TelemetryServer::VelocityBody const& velocity_body)
×
447
{
448
    str << std::setprecision(15);
×
449
    str << "velocity_body:" << '\n' << "{\n";
×
450
    str << "    x_m_s: " << velocity_body.x_m_s << '\n';
×
451
    str << "    y_m_s: " << velocity_body.y_m_s << '\n';
×
452
    str << "    z_m_s: " << velocity_body.z_m_s << '\n';
×
453
    str << '}';
×
454
    return str;
×
455
}
456

457
bool operator==(const TelemetryServer::PositionBody& lhs, const TelemetryServer::PositionBody& rhs)
×
458
{
459
    return ((std::isnan(rhs.x_m) && std::isnan(lhs.x_m)) || rhs.x_m == lhs.x_m) &&
×
460
           ((std::isnan(rhs.y_m) && std::isnan(lhs.y_m)) || rhs.y_m == lhs.y_m) &&
×
461
           ((std::isnan(rhs.z_m) && std::isnan(lhs.z_m)) || rhs.z_m == lhs.z_m);
×
462
}
463

464
std::ostream& operator<<(std::ostream& str, TelemetryServer::PositionBody const& position_body)
×
465
{
466
    str << std::setprecision(15);
×
467
    str << "position_body:" << '\n' << "{\n";
×
468
    str << "    x_m: " << position_body.x_m << '\n';
×
469
    str << "    y_m: " << position_body.y_m << '\n';
×
470
    str << "    z_m: " << position_body.z_m << '\n';
×
471
    str << '}';
×
472
    return str;
×
473
}
474

475
std::ostream& operator<<(std::ostream& str, TelemetryServer::Odometry::MavFrame const& mav_frame)
×
476
{
477
    switch (mav_frame) {
×
478
        case TelemetryServer::Odometry::MavFrame::Undef:
×
479
            return str << "Undef";
×
480
        case TelemetryServer::Odometry::MavFrame::BodyNed:
×
481
            return str << "Body Ned";
×
482
        case TelemetryServer::Odometry::MavFrame::VisionNed:
×
483
            return str << "Vision Ned";
×
484
        case TelemetryServer::Odometry::MavFrame::EstimNed:
×
485
            return str << "Estim Ned";
×
486
        default:
×
487
            return str << "Unknown";
×
488
    }
489
}
490
bool operator==(const TelemetryServer::Odometry& lhs, const TelemetryServer::Odometry& rhs)
×
491
{
492
    return (rhs.time_usec == lhs.time_usec) && (rhs.frame_id == lhs.frame_id) &&
×
493
           (rhs.child_frame_id == lhs.child_frame_id) && (rhs.position_body == lhs.position_body) &&
×
494
           (rhs.q == lhs.q) && (rhs.velocity_body == lhs.velocity_body) &&
×
495
           (rhs.angular_velocity_body == lhs.angular_velocity_body) &&
×
496
           (rhs.pose_covariance == lhs.pose_covariance) &&
×
497
           (rhs.velocity_covariance == lhs.velocity_covariance);
×
498
}
499

500
std::ostream& operator<<(std::ostream& str, TelemetryServer::Odometry const& odometry)
×
501
{
502
    str << std::setprecision(15);
×
503
    str << "odometry:" << '\n' << "{\n";
×
504
    str << "    time_usec: " << odometry.time_usec << '\n';
×
505
    str << "    frame_id: " << odometry.frame_id << '\n';
×
506
    str << "    child_frame_id: " << odometry.child_frame_id << '\n';
×
507
    str << "    position_body: " << odometry.position_body << '\n';
×
508
    str << "    q: " << odometry.q << '\n';
×
509
    str << "    velocity_body: " << odometry.velocity_body << '\n';
×
510
    str << "    angular_velocity_body: " << odometry.angular_velocity_body << '\n';
×
511
    str << "    pose_covariance: " << odometry.pose_covariance << '\n';
×
512
    str << "    velocity_covariance: " << odometry.velocity_covariance << '\n';
×
513
    str << '}';
×
514
    return str;
×
515
}
516

517
bool operator==(
×
518
    const TelemetryServer::DistanceSensor& lhs, const TelemetryServer::DistanceSensor& rhs)
519
{
520
    return ((std::isnan(rhs.minimum_distance_m) && std::isnan(lhs.minimum_distance_m)) ||
×
521
            rhs.minimum_distance_m == lhs.minimum_distance_m) &&
×
522
           ((std::isnan(rhs.maximum_distance_m) && std::isnan(lhs.maximum_distance_m)) ||
×
523
            rhs.maximum_distance_m == lhs.maximum_distance_m) &&
×
524
           ((std::isnan(rhs.current_distance_m) && std::isnan(lhs.current_distance_m)) ||
×
525
            rhs.current_distance_m == lhs.current_distance_m);
×
526
}
527

528
std::ostream& operator<<(std::ostream& str, TelemetryServer::DistanceSensor const& distance_sensor)
×
529
{
530
    str << std::setprecision(15);
×
531
    str << "distance_sensor:" << '\n' << "{\n";
×
532
    str << "    minimum_distance_m: " << distance_sensor.minimum_distance_m << '\n';
×
533
    str << "    maximum_distance_m: " << distance_sensor.maximum_distance_m << '\n';
×
534
    str << "    current_distance_m: " << distance_sensor.current_distance_m << '\n';
×
535
    str << '}';
×
536
    return str;
×
537
}
538

539
bool operator==(
×
540
    const TelemetryServer::ScaledPressure& lhs, const TelemetryServer::ScaledPressure& rhs)
541
{
542
    return (rhs.timestamp_us == lhs.timestamp_us) &&
×
543
           ((std::isnan(rhs.absolute_pressure_hpa) && std::isnan(lhs.absolute_pressure_hpa)) ||
×
544
            rhs.absolute_pressure_hpa == lhs.absolute_pressure_hpa) &&
×
545
           ((std::isnan(rhs.differential_pressure_hpa) &&
×
546
             std::isnan(lhs.differential_pressure_hpa)) ||
×
547
            rhs.differential_pressure_hpa == lhs.differential_pressure_hpa) &&
×
548
           ((std::isnan(rhs.temperature_deg) && std::isnan(lhs.temperature_deg)) ||
×
549
            rhs.temperature_deg == lhs.temperature_deg) &&
×
550
           ((std::isnan(rhs.differential_pressure_temperature_deg) &&
×
551
             std::isnan(lhs.differential_pressure_temperature_deg)) ||
×
552
            rhs.differential_pressure_temperature_deg == lhs.differential_pressure_temperature_deg);
×
553
}
554

555
std::ostream& operator<<(std::ostream& str, TelemetryServer::ScaledPressure const& scaled_pressure)
×
556
{
557
    str << std::setprecision(15);
×
558
    str << "scaled_pressure:" << '\n' << "{\n";
×
559
    str << "    timestamp_us: " << scaled_pressure.timestamp_us << '\n';
×
560
    str << "    absolute_pressure_hpa: " << scaled_pressure.absolute_pressure_hpa << '\n';
×
561
    str << "    differential_pressure_hpa: " << scaled_pressure.differential_pressure_hpa << '\n';
×
562
    str << "    temperature_deg: " << scaled_pressure.temperature_deg << '\n';
×
563
    str << "    differential_pressure_temperature_deg: "
×
564
        << scaled_pressure.differential_pressure_temperature_deg << '\n';
×
565
    str << '}';
×
566
    return str;
×
567
}
568

569
bool operator==(const TelemetryServer::PositionNed& lhs, const TelemetryServer::PositionNed& rhs)
×
570
{
571
    return ((std::isnan(rhs.north_m) && std::isnan(lhs.north_m)) || rhs.north_m == lhs.north_m) &&
×
572
           ((std::isnan(rhs.east_m) && std::isnan(lhs.east_m)) || rhs.east_m == lhs.east_m) &&
×
573
           ((std::isnan(rhs.down_m) && std::isnan(lhs.down_m)) || rhs.down_m == lhs.down_m);
×
574
}
575

576
std::ostream& operator<<(std::ostream& str, TelemetryServer::PositionNed const& position_ned)
×
577
{
578
    str << std::setprecision(15);
×
579
    str << "position_ned:" << '\n' << "{\n";
×
580
    str << "    north_m: " << position_ned.north_m << '\n';
×
581
    str << "    east_m: " << position_ned.east_m << '\n';
×
582
    str << "    down_m: " << position_ned.down_m << '\n';
×
583
    str << '}';
×
584
    return str;
×
585
}
586

587
bool operator==(const TelemetryServer::VelocityNed& lhs, const TelemetryServer::VelocityNed& rhs)
×
588
{
589
    return ((std::isnan(rhs.north_m_s) && std::isnan(lhs.north_m_s)) ||
×
590
            rhs.north_m_s == lhs.north_m_s) &&
×
591
           ((std::isnan(rhs.east_m_s) && std::isnan(lhs.east_m_s)) ||
×
592
            rhs.east_m_s == lhs.east_m_s) &&
×
593
           ((std::isnan(rhs.down_m_s) && std::isnan(lhs.down_m_s)) || rhs.down_m_s == lhs.down_m_s);
×
594
}
595

596
std::ostream& operator<<(std::ostream& str, TelemetryServer::VelocityNed const& velocity_ned)
×
597
{
598
    str << std::setprecision(15);
×
599
    str << "velocity_ned:" << '\n' << "{\n";
×
600
    str << "    north_m_s: " << velocity_ned.north_m_s << '\n';
×
601
    str << "    east_m_s: " << velocity_ned.east_m_s << '\n';
×
602
    str << "    down_m_s: " << velocity_ned.down_m_s << '\n';
×
603
    str << '}';
×
604
    return str;
×
605
}
606

607
bool operator==(
×
608
    const TelemetryServer::PositionVelocityNed& lhs,
609
    const TelemetryServer::PositionVelocityNed& rhs)
610
{
611
    return (rhs.position == lhs.position) && (rhs.velocity == lhs.velocity);
×
612
}
613

614
std::ostream&
615
operator<<(std::ostream& str, TelemetryServer::PositionVelocityNed const& position_velocity_ned)
×
616
{
617
    str << std::setprecision(15);
×
618
    str << "position_velocity_ned:" << '\n' << "{\n";
×
619
    str << "    position: " << position_velocity_ned.position << '\n';
×
620
    str << "    velocity: " << position_velocity_ned.velocity << '\n';
×
621
    str << '}';
×
622
    return str;
×
623
}
624

625
bool operator==(const TelemetryServer::GroundTruth& lhs, const TelemetryServer::GroundTruth& rhs)
×
626
{
627
    return ((std::isnan(rhs.latitude_deg) && std::isnan(lhs.latitude_deg)) ||
×
628
            rhs.latitude_deg == lhs.latitude_deg) &&
×
629
           ((std::isnan(rhs.longitude_deg) && std::isnan(lhs.longitude_deg)) ||
×
630
            rhs.longitude_deg == lhs.longitude_deg) &&
×
631
           ((std::isnan(rhs.absolute_altitude_m) && std::isnan(lhs.absolute_altitude_m)) ||
×
632
            rhs.absolute_altitude_m == lhs.absolute_altitude_m);
×
633
}
634

635
std::ostream& operator<<(std::ostream& str, TelemetryServer::GroundTruth const& ground_truth)
×
636
{
637
    str << std::setprecision(15);
×
638
    str << "ground_truth:" << '\n' << "{\n";
×
639
    str << "    latitude_deg: " << ground_truth.latitude_deg << '\n';
×
640
    str << "    longitude_deg: " << ground_truth.longitude_deg << '\n';
×
641
    str << "    absolute_altitude_m: " << ground_truth.absolute_altitude_m << '\n';
×
642
    str << '}';
×
643
    return str;
×
644
}
645

646
bool operator==(
×
647
    const TelemetryServer::FixedwingMetrics& lhs, const TelemetryServer::FixedwingMetrics& rhs)
648
{
649
    return ((std::isnan(rhs.airspeed_m_s) && std::isnan(lhs.airspeed_m_s)) ||
×
650
            rhs.airspeed_m_s == lhs.airspeed_m_s) &&
×
651
           ((std::isnan(rhs.throttle_percentage) && std::isnan(lhs.throttle_percentage)) ||
×
652
            rhs.throttle_percentage == lhs.throttle_percentage) &&
×
653
           ((std::isnan(rhs.climb_rate_m_s) && std::isnan(lhs.climb_rate_m_s)) ||
×
NEW
654
            rhs.climb_rate_m_s == lhs.climb_rate_m_s) &&
×
NEW
655
           ((std::isnan(rhs.groundspeed_m_s) && std::isnan(lhs.groundspeed_m_s)) ||
×
NEW
656
            rhs.groundspeed_m_s == lhs.groundspeed_m_s) &&
×
NEW
657
           ((std::isnan(rhs.heading_deg) && std::isnan(lhs.heading_deg)) ||
×
NEW
658
            rhs.heading_deg == lhs.heading_deg) &&
×
NEW
659
           ((std::isnan(rhs.absolute_altitude_m) && std::isnan(lhs.absolute_altitude_m)) ||
×
NEW
660
            rhs.absolute_altitude_m == lhs.absolute_altitude_m);
×
661
}
662

663
std::ostream&
664
operator<<(std::ostream& str, TelemetryServer::FixedwingMetrics const& fixedwing_metrics)
×
665
{
666
    str << std::setprecision(15);
×
667
    str << "fixedwing_metrics:" << '\n' << "{\n";
×
668
    str << "    airspeed_m_s: " << fixedwing_metrics.airspeed_m_s << '\n';
×
669
    str << "    throttle_percentage: " << fixedwing_metrics.throttle_percentage << '\n';
×
670
    str << "    climb_rate_m_s: " << fixedwing_metrics.climb_rate_m_s << '\n';
×
NEW
671
    str << "    groundspeed_m_s: " << fixedwing_metrics.groundspeed_m_s << '\n';
×
NEW
672
    str << "    heading_deg: " << fixedwing_metrics.heading_deg << '\n';
×
NEW
673
    str << "    absolute_altitude_m: " << fixedwing_metrics.absolute_altitude_m << '\n';
×
674
    str << '}';
×
675
    return str;
×
676
}
677

678
bool operator==(
×
679
    const TelemetryServer::AccelerationFrd& lhs, const TelemetryServer::AccelerationFrd& rhs)
680
{
681
    return ((std::isnan(rhs.forward_m_s2) && std::isnan(lhs.forward_m_s2)) ||
×
682
            rhs.forward_m_s2 == lhs.forward_m_s2) &&
×
683
           ((std::isnan(rhs.right_m_s2) && std::isnan(lhs.right_m_s2)) ||
×
684
            rhs.right_m_s2 == lhs.right_m_s2) &&
×
685
           ((std::isnan(rhs.down_m_s2) && std::isnan(lhs.down_m_s2)) ||
×
686
            rhs.down_m_s2 == lhs.down_m_s2);
×
687
}
688

689
std::ostream&
690
operator<<(std::ostream& str, TelemetryServer::AccelerationFrd const& acceleration_frd)
×
691
{
692
    str << std::setprecision(15);
×
693
    str << "acceleration_frd:" << '\n' << "{\n";
×
694
    str << "    forward_m_s2: " << acceleration_frd.forward_m_s2 << '\n';
×
695
    str << "    right_m_s2: " << acceleration_frd.right_m_s2 << '\n';
×
696
    str << "    down_m_s2: " << acceleration_frd.down_m_s2 << '\n';
×
697
    str << '}';
×
698
    return str;
×
699
}
700

701
bool operator==(
×
702
    const TelemetryServer::AngularVelocityFrd& lhs, const TelemetryServer::AngularVelocityFrd& rhs)
703
{
704
    return ((std::isnan(rhs.forward_rad_s) && std::isnan(lhs.forward_rad_s)) ||
×
705
            rhs.forward_rad_s == lhs.forward_rad_s) &&
×
706
           ((std::isnan(rhs.right_rad_s) && std::isnan(lhs.right_rad_s)) ||
×
707
            rhs.right_rad_s == lhs.right_rad_s) &&
×
708
           ((std::isnan(rhs.down_rad_s) && std::isnan(lhs.down_rad_s)) ||
×
709
            rhs.down_rad_s == lhs.down_rad_s);
×
710
}
711

712
std::ostream&
713
operator<<(std::ostream& str, TelemetryServer::AngularVelocityFrd const& angular_velocity_frd)
×
714
{
715
    str << std::setprecision(15);
×
716
    str << "angular_velocity_frd:" << '\n' << "{\n";
×
717
    str << "    forward_rad_s: " << angular_velocity_frd.forward_rad_s << '\n';
×
718
    str << "    right_rad_s: " << angular_velocity_frd.right_rad_s << '\n';
×
719
    str << "    down_rad_s: " << angular_velocity_frd.down_rad_s << '\n';
×
720
    str << '}';
×
721
    return str;
×
722
}
723

724
bool operator==(
×
725
    const TelemetryServer::MagneticFieldFrd& lhs, const TelemetryServer::MagneticFieldFrd& rhs)
726
{
727
    return ((std::isnan(rhs.forward_gauss) && std::isnan(lhs.forward_gauss)) ||
×
728
            rhs.forward_gauss == lhs.forward_gauss) &&
×
729
           ((std::isnan(rhs.right_gauss) && std::isnan(lhs.right_gauss)) ||
×
730
            rhs.right_gauss == lhs.right_gauss) &&
×
731
           ((std::isnan(rhs.down_gauss) && std::isnan(lhs.down_gauss)) ||
×
732
            rhs.down_gauss == lhs.down_gauss);
×
733
}
734

735
std::ostream&
736
operator<<(std::ostream& str, TelemetryServer::MagneticFieldFrd const& magnetic_field_frd)
×
737
{
738
    str << std::setprecision(15);
×
739
    str << "magnetic_field_frd:" << '\n' << "{\n";
×
740
    str << "    forward_gauss: " << magnetic_field_frd.forward_gauss << '\n';
×
741
    str << "    right_gauss: " << magnetic_field_frd.right_gauss << '\n';
×
742
    str << "    down_gauss: " << magnetic_field_frd.down_gauss << '\n';
×
743
    str << '}';
×
744
    return str;
×
745
}
746

747
bool operator==(const TelemetryServer::Imu& lhs, const TelemetryServer::Imu& rhs)
×
748
{
749
    return (rhs.acceleration_frd == lhs.acceleration_frd) &&
×
750
           (rhs.angular_velocity_frd == lhs.angular_velocity_frd) &&
×
751
           (rhs.magnetic_field_frd == lhs.magnetic_field_frd) &&
×
752
           ((std::isnan(rhs.temperature_degc) && std::isnan(lhs.temperature_degc)) ||
×
753
            rhs.temperature_degc == lhs.temperature_degc) &&
×
754
           (rhs.timestamp_us == lhs.timestamp_us);
×
755
}
756

757
std::ostream& operator<<(std::ostream& str, TelemetryServer::Imu const& imu)
×
758
{
759
    str << std::setprecision(15);
×
760
    str << "imu:" << '\n' << "{\n";
×
761
    str << "    acceleration_frd: " << imu.acceleration_frd << '\n';
×
762
    str << "    angular_velocity_frd: " << imu.angular_velocity_frd << '\n';
×
763
    str << "    magnetic_field_frd: " << imu.magnetic_field_frd << '\n';
×
764
    str << "    temperature_degc: " << imu.temperature_degc << '\n';
×
765
    str << "    timestamp_us: " << imu.timestamp_us << '\n';
×
766
    str << '}';
×
767
    return str;
×
768
}
769

770
std::ostream& operator<<(std::ostream& str, TelemetryServer::Result const& result)
×
771
{
772
    switch (result) {
×
773
        case TelemetryServer::Result::Unknown:
×
774
            return str << "Unknown";
×
775
        case TelemetryServer::Result::Success:
×
776
            return str << "Success";
×
777
        case TelemetryServer::Result::NoSystem:
×
778
            return str << "No System";
×
779
        case TelemetryServer::Result::ConnectionError:
×
780
            return str << "Connection Error";
×
781
        case TelemetryServer::Result::Busy:
×
782
            return str << "Busy";
×
783
        case TelemetryServer::Result::CommandDenied:
×
784
            return str << "Command Denied";
×
785
        case TelemetryServer::Result::Timeout:
×
786
            return str << "Timeout";
×
787
        case TelemetryServer::Result::Unsupported:
×
788
            return str << "Unsupported";
×
789
        default:
×
790
            return str << "Unknown";
×
791
    }
792
}
793

794
std::ostream& operator<<(std::ostream& str, TelemetryServer::FixType const& fix_type)
×
795
{
796
    switch (fix_type) {
×
797
        case TelemetryServer::FixType::NoGps:
×
798
            return str << "No Gps";
×
799
        case TelemetryServer::FixType::NoFix:
×
800
            return str << "No Fix";
×
801
        case TelemetryServer::FixType::Fix2D:
×
802
            return str << "Fix 2D";
×
803
        case TelemetryServer::FixType::Fix3D:
×
804
            return str << "Fix 3D";
×
805
        case TelemetryServer::FixType::FixDgps:
×
806
            return str << "Fix Dgps";
×
807
        case TelemetryServer::FixType::RtkFloat:
×
808
            return str << "Rtk Float";
×
809
        case TelemetryServer::FixType::RtkFixed:
×
810
            return str << "Rtk Fixed";
×
811
        default:
×
812
            return str << "Unknown";
×
813
    }
814
}
815

816
std::ostream& operator<<(std::ostream& str, TelemetryServer::VtolState const& vtol_state)
×
817
{
818
    switch (vtol_state) {
×
819
        case TelemetryServer::VtolState::Undefined:
×
820
            return str << "Undefined";
×
821
        case TelemetryServer::VtolState::TransitionToFw:
×
822
            return str << "Transition To Fw";
×
823
        case TelemetryServer::VtolState::TransitionToMc:
×
824
            return str << "Transition To Mc";
×
825
        case TelemetryServer::VtolState::Mc:
×
826
            return str << "Mc";
×
827
        case TelemetryServer::VtolState::Fw:
×
828
            return str << "Fw";
×
829
        default:
×
830
            return str << "Unknown";
×
831
    }
832
}
833

834
std::ostream& operator<<(std::ostream& str, TelemetryServer::StatusTextType const& status_text_type)
×
835
{
836
    switch (status_text_type) {
×
837
        case TelemetryServer::StatusTextType::Debug:
×
838
            return str << "Debug";
×
839
        case TelemetryServer::StatusTextType::Info:
×
840
            return str << "Info";
×
841
        case TelemetryServer::StatusTextType::Notice:
×
842
            return str << "Notice";
×
843
        case TelemetryServer::StatusTextType::Warning:
×
844
            return str << "Warning";
×
845
        case TelemetryServer::StatusTextType::Error:
×
846
            return str << "Error";
×
847
        case TelemetryServer::StatusTextType::Critical:
×
848
            return str << "Critical";
×
849
        case TelemetryServer::StatusTextType::Alert:
×
850
            return str << "Alert";
×
851
        case TelemetryServer::StatusTextType::Emergency:
×
852
            return str << "Emergency";
×
853
        default:
×
854
            return str << "Unknown";
×
855
    }
856
}
857

858
std::ostream& operator<<(std::ostream& str, TelemetryServer::LandedState const& landed_state)
×
859
{
860
    switch (landed_state) {
×
861
        case TelemetryServer::LandedState::Unknown:
×
862
            return str << "Unknown";
×
863
        case TelemetryServer::LandedState::OnGround:
×
864
            return str << "On Ground";
×
865
        case TelemetryServer::LandedState::InAir:
×
866
            return str << "In Air";
×
867
        case TelemetryServer::LandedState::TakingOff:
×
868
            return str << "Taking Off";
×
869
        case TelemetryServer::LandedState::Landing:
×
870
            return str << "Landing";
×
871
        default:
×
872
            return str << "Unknown";
×
873
    }
874
}
875

876
} // namespace mavsdk
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc