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

mavlink / MAVSDK / 4053943449

pending completion
4053943449

push

github

GitHub
Merge pull request #1964 from akkawimo/potaito/distance-sensor-server

17 of 17 new or added lines in 3 files covered. (100.0%)

7418 of 23664 relevant lines covered (31.35%)

22.06 hits per line

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

1.1
/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
bool operator==(const TelemetryServer::Position& lhs, const TelemetryServer::Position& rhs)
×
135
{
136
    return ((std::isnan(rhs.latitude_deg) && std::isnan(lhs.latitude_deg)) ||
×
137
            rhs.latitude_deg == lhs.latitude_deg) &&
×
138
           ((std::isnan(rhs.longitude_deg) && std::isnan(lhs.longitude_deg)) ||
×
139
            rhs.longitude_deg == lhs.longitude_deg) &&
×
140
           ((std::isnan(rhs.absolute_altitude_m) && std::isnan(lhs.absolute_altitude_m)) ||
×
141
            rhs.absolute_altitude_m == lhs.absolute_altitude_m) &&
×
142
           ((std::isnan(rhs.relative_altitude_m) && std::isnan(lhs.relative_altitude_m)) ||
×
143
            rhs.relative_altitude_m == lhs.relative_altitude_m);
×
144
}
145

146
std::ostream& operator<<(std::ostream& str, TelemetryServer::Position const& position)
×
147
{
148
    str << std::setprecision(15);
×
149
    str << "position:" << '\n' << "{\n";
×
150
    str << "    latitude_deg: " << position.latitude_deg << '\n';
×
151
    str << "    longitude_deg: " << position.longitude_deg << '\n';
×
152
    str << "    absolute_altitude_m: " << position.absolute_altitude_m << '\n';
×
153
    str << "    relative_altitude_m: " << position.relative_altitude_m << '\n';
×
154
    str << '}';
×
155
    return str;
×
156
}
157

158
bool operator==(const TelemetryServer::Heading& lhs, const TelemetryServer::Heading& rhs)
×
159
{
160
    return (
161
        (std::isnan(rhs.heading_deg) && std::isnan(lhs.heading_deg)) ||
×
162
        rhs.heading_deg == lhs.heading_deg);
×
163
}
164

165
std::ostream& operator<<(std::ostream& str, TelemetryServer::Heading const& heading)
×
166
{
167
    str << std::setprecision(15);
×
168
    str << "heading:" << '\n' << "{\n";
×
169
    str << "    heading_deg: " << heading.heading_deg << '\n';
×
170
    str << '}';
×
171
    return str;
×
172
}
173

174
bool operator==(const TelemetryServer::Quaternion& lhs, const TelemetryServer::Quaternion& rhs)
×
175
{
176
    return ((std::isnan(rhs.w) && std::isnan(lhs.w)) || rhs.w == lhs.w) &&
×
177
           ((std::isnan(rhs.x) && std::isnan(lhs.x)) || rhs.x == lhs.x) &&
×
178
           ((std::isnan(rhs.y) && std::isnan(lhs.y)) || rhs.y == lhs.y) &&
×
179
           ((std::isnan(rhs.z) && std::isnan(lhs.z)) || rhs.z == lhs.z) &&
×
180
           (rhs.timestamp_us == lhs.timestamp_us);
×
181
}
182

183
std::ostream& operator<<(std::ostream& str, TelemetryServer::Quaternion const& quaternion)
×
184
{
185
    str << std::setprecision(15);
×
186
    str << "quaternion:" << '\n' << "{\n";
×
187
    str << "    w: " << quaternion.w << '\n';
×
188
    str << "    x: " << quaternion.x << '\n';
×
189
    str << "    y: " << quaternion.y << '\n';
×
190
    str << "    z: " << quaternion.z << '\n';
×
191
    str << "    timestamp_us: " << quaternion.timestamp_us << '\n';
×
192
    str << '}';
×
193
    return str;
×
194
}
195

196
bool operator==(const TelemetryServer::EulerAngle& lhs, const TelemetryServer::EulerAngle& rhs)
×
197
{
198
    return ((std::isnan(rhs.roll_deg) && std::isnan(lhs.roll_deg)) ||
×
199
            rhs.roll_deg == lhs.roll_deg) &&
×
200
           ((std::isnan(rhs.pitch_deg) && std::isnan(lhs.pitch_deg)) ||
×
201
            rhs.pitch_deg == lhs.pitch_deg) &&
×
202
           ((std::isnan(rhs.yaw_deg) && std::isnan(lhs.yaw_deg)) || rhs.yaw_deg == lhs.yaw_deg) &&
×
203
           (rhs.timestamp_us == lhs.timestamp_us);
×
204
}
205

206
std::ostream& operator<<(std::ostream& str, TelemetryServer::EulerAngle const& euler_angle)
×
207
{
208
    str << std::setprecision(15);
×
209
    str << "euler_angle:" << '\n' << "{\n";
×
210
    str << "    roll_deg: " << euler_angle.roll_deg << '\n';
×
211
    str << "    pitch_deg: " << euler_angle.pitch_deg << '\n';
×
212
    str << "    yaw_deg: " << euler_angle.yaw_deg << '\n';
×
213
    str << "    timestamp_us: " << euler_angle.timestamp_us << '\n';
×
214
    str << '}';
×
215
    return str;
×
216
}
217

218
bool operator==(
×
219
    const TelemetryServer::AngularVelocityBody& lhs,
220
    const TelemetryServer::AngularVelocityBody& rhs)
221
{
222
    return ((std::isnan(rhs.roll_rad_s) && std::isnan(lhs.roll_rad_s)) ||
×
223
            rhs.roll_rad_s == lhs.roll_rad_s) &&
×
224
           ((std::isnan(rhs.pitch_rad_s) && std::isnan(lhs.pitch_rad_s)) ||
×
225
            rhs.pitch_rad_s == lhs.pitch_rad_s) &&
×
226
           ((std::isnan(rhs.yaw_rad_s) && std::isnan(lhs.yaw_rad_s)) ||
×
227
            rhs.yaw_rad_s == lhs.yaw_rad_s);
×
228
}
229

230
std::ostream&
231
operator<<(std::ostream& str, TelemetryServer::AngularVelocityBody const& angular_velocity_body)
×
232
{
233
    str << std::setprecision(15);
×
234
    str << "angular_velocity_body:" << '\n' << "{\n";
×
235
    str << "    roll_rad_s: " << angular_velocity_body.roll_rad_s << '\n';
×
236
    str << "    pitch_rad_s: " << angular_velocity_body.pitch_rad_s << '\n';
×
237
    str << "    yaw_rad_s: " << angular_velocity_body.yaw_rad_s << '\n';
×
238
    str << '}';
×
239
    return str;
×
240
}
241

242
bool operator==(const TelemetryServer::GpsInfo& lhs, const TelemetryServer::GpsInfo& rhs)
×
243
{
244
    return (rhs.num_satellites == lhs.num_satellites) && (rhs.fix_type == lhs.fix_type);
×
245
}
246

247
std::ostream& operator<<(std::ostream& str, TelemetryServer::GpsInfo const& gps_info)
×
248
{
249
    str << std::setprecision(15);
×
250
    str << "gps_info:" << '\n' << "{\n";
×
251
    str << "    num_satellites: " << gps_info.num_satellites << '\n';
×
252
    str << "    fix_type: " << gps_info.fix_type << '\n';
×
253
    str << '}';
×
254
    return str;
×
255
}
256

257
bool operator==(const TelemetryServer::RawGps& lhs, const TelemetryServer::RawGps& rhs)
×
258
{
259
    return (rhs.timestamp_us == lhs.timestamp_us) &&
×
260
           ((std::isnan(rhs.latitude_deg) && std::isnan(lhs.latitude_deg)) ||
×
261
            rhs.latitude_deg == lhs.latitude_deg) &&
×
262
           ((std::isnan(rhs.longitude_deg) && std::isnan(lhs.longitude_deg)) ||
×
263
            rhs.longitude_deg == lhs.longitude_deg) &&
×
264
           ((std::isnan(rhs.absolute_altitude_m) && std::isnan(lhs.absolute_altitude_m)) ||
×
265
            rhs.absolute_altitude_m == lhs.absolute_altitude_m) &&
×
266
           ((std::isnan(rhs.hdop) && std::isnan(lhs.hdop)) || rhs.hdop == lhs.hdop) &&
×
267
           ((std::isnan(rhs.vdop) && std::isnan(lhs.vdop)) || rhs.vdop == lhs.vdop) &&
×
268
           ((std::isnan(rhs.velocity_m_s) && std::isnan(lhs.velocity_m_s)) ||
×
269
            rhs.velocity_m_s == lhs.velocity_m_s) &&
×
270
           ((std::isnan(rhs.cog_deg) && std::isnan(lhs.cog_deg)) || rhs.cog_deg == lhs.cog_deg) &&
×
271
           ((std::isnan(rhs.altitude_ellipsoid_m) && std::isnan(lhs.altitude_ellipsoid_m)) ||
×
272
            rhs.altitude_ellipsoid_m == lhs.altitude_ellipsoid_m) &&
×
273
           ((std::isnan(rhs.horizontal_uncertainty_m) &&
×
274
             std::isnan(lhs.horizontal_uncertainty_m)) ||
×
275
            rhs.horizontal_uncertainty_m == lhs.horizontal_uncertainty_m) &&
×
276
           ((std::isnan(rhs.vertical_uncertainty_m) && std::isnan(lhs.vertical_uncertainty_m)) ||
×
277
            rhs.vertical_uncertainty_m == lhs.vertical_uncertainty_m) &&
×
278
           ((std::isnan(rhs.velocity_uncertainty_m_s) &&
×
279
             std::isnan(lhs.velocity_uncertainty_m_s)) ||
×
280
            rhs.velocity_uncertainty_m_s == lhs.velocity_uncertainty_m_s) &&
×
281
           ((std::isnan(rhs.heading_uncertainty_deg) && std::isnan(lhs.heading_uncertainty_deg)) ||
×
282
            rhs.heading_uncertainty_deg == lhs.heading_uncertainty_deg) &&
×
283
           ((std::isnan(rhs.yaw_deg) && std::isnan(lhs.yaw_deg)) || rhs.yaw_deg == lhs.yaw_deg);
×
284
}
285

286
std::ostream& operator<<(std::ostream& str, TelemetryServer::RawGps const& raw_gps)
×
287
{
288
    str << std::setprecision(15);
×
289
    str << "raw_gps:" << '\n' << "{\n";
×
290
    str << "    timestamp_us: " << raw_gps.timestamp_us << '\n';
×
291
    str << "    latitude_deg: " << raw_gps.latitude_deg << '\n';
×
292
    str << "    longitude_deg: " << raw_gps.longitude_deg << '\n';
×
293
    str << "    absolute_altitude_m: " << raw_gps.absolute_altitude_m << '\n';
×
294
    str << "    hdop: " << raw_gps.hdop << '\n';
×
295
    str << "    vdop: " << raw_gps.vdop << '\n';
×
296
    str << "    velocity_m_s: " << raw_gps.velocity_m_s << '\n';
×
297
    str << "    cog_deg: " << raw_gps.cog_deg << '\n';
×
298
    str << "    altitude_ellipsoid_m: " << raw_gps.altitude_ellipsoid_m << '\n';
×
299
    str << "    horizontal_uncertainty_m: " << raw_gps.horizontal_uncertainty_m << '\n';
×
300
    str << "    vertical_uncertainty_m: " << raw_gps.vertical_uncertainty_m << '\n';
×
301
    str << "    velocity_uncertainty_m_s: " << raw_gps.velocity_uncertainty_m_s << '\n';
×
302
    str << "    heading_uncertainty_deg: " << raw_gps.heading_uncertainty_deg << '\n';
×
303
    str << "    yaw_deg: " << raw_gps.yaw_deg << '\n';
×
304
    str << '}';
×
305
    return str;
×
306
}
307

308
bool operator==(const TelemetryServer::Battery& lhs, const TelemetryServer::Battery& rhs)
×
309
{
310
    return ((std::isnan(rhs.voltage_v) && std::isnan(lhs.voltage_v)) ||
×
311
            rhs.voltage_v == lhs.voltage_v) &&
×
312
           ((std::isnan(rhs.remaining_percent) && std::isnan(lhs.remaining_percent)) ||
×
313
            rhs.remaining_percent == lhs.remaining_percent);
×
314
}
315

316
std::ostream& operator<<(std::ostream& str, TelemetryServer::Battery const& battery)
×
317
{
318
    str << std::setprecision(15);
×
319
    str << "battery:" << '\n' << "{\n";
×
320
    str << "    voltage_v: " << battery.voltage_v << '\n';
×
321
    str << "    remaining_percent: " << battery.remaining_percent << '\n';
×
322
    str << '}';
×
323
    return str;
×
324
}
325

326
bool operator==(const TelemetryServer::RcStatus& lhs, const TelemetryServer::RcStatus& rhs)
×
327
{
328
    return (rhs.was_available_once == lhs.was_available_once) &&
×
329
           (rhs.is_available == lhs.is_available) &&
×
330
           ((std::isnan(rhs.signal_strength_percent) && std::isnan(lhs.signal_strength_percent)) ||
×
331
            rhs.signal_strength_percent == lhs.signal_strength_percent);
×
332
}
333

334
std::ostream& operator<<(std::ostream& str, TelemetryServer::RcStatus const& rc_status)
×
335
{
336
    str << std::setprecision(15);
×
337
    str << "rc_status:" << '\n' << "{\n";
×
338
    str << "    was_available_once: " << rc_status.was_available_once << '\n';
×
339
    str << "    is_available: " << rc_status.is_available << '\n';
×
340
    str << "    signal_strength_percent: " << rc_status.signal_strength_percent << '\n';
×
341
    str << '}';
×
342
    return str;
×
343
}
344

345
bool operator==(const TelemetryServer::StatusText& lhs, const TelemetryServer::StatusText& rhs)
×
346
{
347
    return (rhs.type == lhs.type) && (rhs.text == lhs.text);
×
348
}
349

350
std::ostream& operator<<(std::ostream& str, TelemetryServer::StatusText const& status_text)
×
351
{
352
    str << std::setprecision(15);
×
353
    str << "status_text:" << '\n' << "{\n";
×
354
    str << "    type: " << status_text.type << '\n';
×
355
    str << "    text: " << status_text.text << '\n';
×
356
    str << '}';
×
357
    return str;
×
358
}
359

360
bool operator==(
×
361
    const TelemetryServer::ActuatorControlTarget& lhs,
362
    const TelemetryServer::ActuatorControlTarget& rhs)
363
{
364
    return (rhs.group == lhs.group) && (rhs.controls == lhs.controls);
×
365
}
366

367
std::ostream&
368
operator<<(std::ostream& str, TelemetryServer::ActuatorControlTarget const& actuator_control_target)
×
369
{
370
    str << std::setprecision(15);
×
371
    str << "actuator_control_target:" << '\n' << "{\n";
×
372
    str << "    group: " << actuator_control_target.group << '\n';
×
373
    str << "    controls: [";
×
374
    for (auto it = actuator_control_target.controls.begin();
×
375
         it != actuator_control_target.controls.end();
×
376
         ++it) {
×
377
        str << *it;
×
378
        str << (it + 1 != actuator_control_target.controls.end() ? ", " : "]\n");
×
379
    }
380
    str << '}';
×
381
    return str;
×
382
}
383

384
bool operator==(
×
385
    const TelemetryServer::ActuatorOutputStatus& lhs,
386
    const TelemetryServer::ActuatorOutputStatus& rhs)
387
{
388
    return (rhs.active == lhs.active) && (rhs.actuator == lhs.actuator);
×
389
}
390

391
std::ostream&
392
operator<<(std::ostream& str, TelemetryServer::ActuatorOutputStatus const& actuator_output_status)
×
393
{
394
    str << std::setprecision(15);
×
395
    str << "actuator_output_status:" << '\n' << "{\n";
×
396
    str << "    active: " << actuator_output_status.active << '\n';
×
397
    str << "    actuator: [";
×
398
    for (auto it = actuator_output_status.actuator.begin();
×
399
         it != actuator_output_status.actuator.end();
×
400
         ++it) {
×
401
        str << *it;
×
402
        str << (it + 1 != actuator_output_status.actuator.end() ? ", " : "]\n");
×
403
    }
404
    str << '}';
×
405
    return str;
×
406
}
407

408
bool operator==(const TelemetryServer::Covariance& lhs, const TelemetryServer::Covariance& rhs)
×
409
{
410
    return (rhs.covariance_matrix == lhs.covariance_matrix);
×
411
}
412

413
std::ostream& operator<<(std::ostream& str, TelemetryServer::Covariance const& covariance)
×
414
{
415
    str << std::setprecision(15);
×
416
    str << "covariance:" << '\n' << "{\n";
×
417
    str << "    covariance_matrix: [";
×
418
    for (auto it = covariance.covariance_matrix.begin(); it != covariance.covariance_matrix.end();
×
419
         ++it) {
×
420
        str << *it;
×
421
        str << (it + 1 != covariance.covariance_matrix.end() ? ", " : "]\n");
×
422
    }
423
    str << '}';
×
424
    return str;
×
425
}
426

427
bool operator==(const TelemetryServer::VelocityBody& lhs, const TelemetryServer::VelocityBody& rhs)
×
428
{
429
    return ((std::isnan(rhs.x_m_s) && std::isnan(lhs.x_m_s)) || rhs.x_m_s == lhs.x_m_s) &&
×
430
           ((std::isnan(rhs.y_m_s) && std::isnan(lhs.y_m_s)) || rhs.y_m_s == lhs.y_m_s) &&
×
431
           ((std::isnan(rhs.z_m_s) && std::isnan(lhs.z_m_s)) || rhs.z_m_s == lhs.z_m_s);
×
432
}
433

434
std::ostream& operator<<(std::ostream& str, TelemetryServer::VelocityBody const& velocity_body)
×
435
{
436
    str << std::setprecision(15);
×
437
    str << "velocity_body:" << '\n' << "{\n";
×
438
    str << "    x_m_s: " << velocity_body.x_m_s << '\n';
×
439
    str << "    y_m_s: " << velocity_body.y_m_s << '\n';
×
440
    str << "    z_m_s: " << velocity_body.z_m_s << '\n';
×
441
    str << '}';
×
442
    return str;
×
443
}
444

445
bool operator==(const TelemetryServer::PositionBody& lhs, const TelemetryServer::PositionBody& rhs)
×
446
{
447
    return ((std::isnan(rhs.x_m) && std::isnan(lhs.x_m)) || rhs.x_m == lhs.x_m) &&
×
448
           ((std::isnan(rhs.y_m) && std::isnan(lhs.y_m)) || rhs.y_m == lhs.y_m) &&
×
449
           ((std::isnan(rhs.z_m) && std::isnan(lhs.z_m)) || rhs.z_m == lhs.z_m);
×
450
}
451

452
std::ostream& operator<<(std::ostream& str, TelemetryServer::PositionBody const& position_body)
×
453
{
454
    str << std::setprecision(15);
×
455
    str << "position_body:" << '\n' << "{\n";
×
456
    str << "    x_m: " << position_body.x_m << '\n';
×
457
    str << "    y_m: " << position_body.y_m << '\n';
×
458
    str << "    z_m: " << position_body.z_m << '\n';
×
459
    str << '}';
×
460
    return str;
×
461
}
462

463
std::ostream& operator<<(std::ostream& str, TelemetryServer::Odometry::MavFrame const& mav_frame)
×
464
{
465
    switch (mav_frame) {
×
466
        case TelemetryServer::Odometry::MavFrame::Undef:
×
467
            return str << "Undef";
×
468
        case TelemetryServer::Odometry::MavFrame::BodyNed:
×
469
            return str << "Body Ned";
×
470
        case TelemetryServer::Odometry::MavFrame::VisionNed:
×
471
            return str << "Vision Ned";
×
472
        case TelemetryServer::Odometry::MavFrame::EstimNed:
×
473
            return str << "Estim Ned";
×
474
        default:
×
475
            return str << "Unknown";
×
476
    }
477
}
478
bool operator==(const TelemetryServer::Odometry& lhs, const TelemetryServer::Odometry& rhs)
×
479
{
480
    return (rhs.time_usec == lhs.time_usec) && (rhs.frame_id == lhs.frame_id) &&
×
481
           (rhs.child_frame_id == lhs.child_frame_id) && (rhs.position_body == lhs.position_body) &&
×
482
           (rhs.q == lhs.q) && (rhs.velocity_body == lhs.velocity_body) &&
×
483
           (rhs.angular_velocity_body == lhs.angular_velocity_body) &&
×
484
           (rhs.pose_covariance == lhs.pose_covariance) &&
×
485
           (rhs.velocity_covariance == lhs.velocity_covariance);
×
486
}
487

488
std::ostream& operator<<(std::ostream& str, TelemetryServer::Odometry const& odometry)
×
489
{
490
    str << std::setprecision(15);
×
491
    str << "odometry:" << '\n' << "{\n";
×
492
    str << "    time_usec: " << odometry.time_usec << '\n';
×
493
    str << "    frame_id: " << odometry.frame_id << '\n';
×
494
    str << "    child_frame_id: " << odometry.child_frame_id << '\n';
×
495
    str << "    position_body: " << odometry.position_body << '\n';
×
496
    str << "    q: " << odometry.q << '\n';
×
497
    str << "    velocity_body: " << odometry.velocity_body << '\n';
×
498
    str << "    angular_velocity_body: " << odometry.angular_velocity_body << '\n';
×
499
    str << "    pose_covariance: " << odometry.pose_covariance << '\n';
×
500
    str << "    velocity_covariance: " << odometry.velocity_covariance << '\n';
×
501
    str << '}';
×
502
    return str;
×
503
}
504

505
bool operator==(
×
506
    const TelemetryServer::DistanceSensor& lhs, const TelemetryServer::DistanceSensor& rhs)
507
{
508
    return ((std::isnan(rhs.minimum_distance_m) && std::isnan(lhs.minimum_distance_m)) ||
×
509
            rhs.minimum_distance_m == lhs.minimum_distance_m) &&
×
510
           ((std::isnan(rhs.maximum_distance_m) && std::isnan(lhs.maximum_distance_m)) ||
×
511
            rhs.maximum_distance_m == lhs.maximum_distance_m) &&
×
512
           ((std::isnan(rhs.current_distance_m) && std::isnan(lhs.current_distance_m)) ||
×
513
            rhs.current_distance_m == lhs.current_distance_m);
×
514
}
515

516
std::ostream& operator<<(std::ostream& str, TelemetryServer::DistanceSensor const& distance_sensor)
×
517
{
518
    str << std::setprecision(15);
×
519
    str << "distance_sensor:" << '\n' << "{\n";
×
520
    str << "    minimum_distance_m: " << distance_sensor.minimum_distance_m << '\n';
×
521
    str << "    maximum_distance_m: " << distance_sensor.maximum_distance_m << '\n';
×
522
    str << "    current_distance_m: " << distance_sensor.current_distance_m << '\n';
×
523
    str << '}';
×
524
    return str;
×
525
}
526

527
bool operator==(
×
528
    const TelemetryServer::ScaledPressure& lhs, const TelemetryServer::ScaledPressure& rhs)
529
{
530
    return (rhs.timestamp_us == lhs.timestamp_us) &&
×
531
           ((std::isnan(rhs.absolute_pressure_hpa) && std::isnan(lhs.absolute_pressure_hpa)) ||
×
532
            rhs.absolute_pressure_hpa == lhs.absolute_pressure_hpa) &&
×
533
           ((std::isnan(rhs.differential_pressure_hpa) &&
×
534
             std::isnan(lhs.differential_pressure_hpa)) ||
×
535
            rhs.differential_pressure_hpa == lhs.differential_pressure_hpa) &&
×
536
           ((std::isnan(rhs.temperature_deg) && std::isnan(lhs.temperature_deg)) ||
×
537
            rhs.temperature_deg == lhs.temperature_deg) &&
×
538
           ((std::isnan(rhs.differential_pressure_temperature_deg) &&
×
539
             std::isnan(lhs.differential_pressure_temperature_deg)) ||
×
540
            rhs.differential_pressure_temperature_deg == lhs.differential_pressure_temperature_deg);
×
541
}
542

543
std::ostream& operator<<(std::ostream& str, TelemetryServer::ScaledPressure const& scaled_pressure)
×
544
{
545
    str << std::setprecision(15);
×
546
    str << "scaled_pressure:" << '\n' << "{\n";
×
547
    str << "    timestamp_us: " << scaled_pressure.timestamp_us << '\n';
×
548
    str << "    absolute_pressure_hpa: " << scaled_pressure.absolute_pressure_hpa << '\n';
×
549
    str << "    differential_pressure_hpa: " << scaled_pressure.differential_pressure_hpa << '\n';
×
550
    str << "    temperature_deg: " << scaled_pressure.temperature_deg << '\n';
×
551
    str << "    differential_pressure_temperature_deg: "
×
552
        << scaled_pressure.differential_pressure_temperature_deg << '\n';
×
553
    str << '}';
×
554
    return str;
×
555
}
556

557
bool operator==(const TelemetryServer::PositionNed& lhs, const TelemetryServer::PositionNed& rhs)
×
558
{
559
    return ((std::isnan(rhs.north_m) && std::isnan(lhs.north_m)) || rhs.north_m == lhs.north_m) &&
×
560
           ((std::isnan(rhs.east_m) && std::isnan(lhs.east_m)) || rhs.east_m == lhs.east_m) &&
×
561
           ((std::isnan(rhs.down_m) && std::isnan(lhs.down_m)) || rhs.down_m == lhs.down_m);
×
562
}
563

564
std::ostream& operator<<(std::ostream& str, TelemetryServer::PositionNed const& position_ned)
×
565
{
566
    str << std::setprecision(15);
×
567
    str << "position_ned:" << '\n' << "{\n";
×
568
    str << "    north_m: " << position_ned.north_m << '\n';
×
569
    str << "    east_m: " << position_ned.east_m << '\n';
×
570
    str << "    down_m: " << position_ned.down_m << '\n';
×
571
    str << '}';
×
572
    return str;
×
573
}
574

575
bool operator==(const TelemetryServer::VelocityNed& lhs, const TelemetryServer::VelocityNed& rhs)
×
576
{
577
    return ((std::isnan(rhs.north_m_s) && std::isnan(lhs.north_m_s)) ||
×
578
            rhs.north_m_s == lhs.north_m_s) &&
×
579
           ((std::isnan(rhs.east_m_s) && std::isnan(lhs.east_m_s)) ||
×
580
            rhs.east_m_s == lhs.east_m_s) &&
×
581
           ((std::isnan(rhs.down_m_s) && std::isnan(lhs.down_m_s)) || rhs.down_m_s == lhs.down_m_s);
×
582
}
583

584
std::ostream& operator<<(std::ostream& str, TelemetryServer::VelocityNed const& velocity_ned)
×
585
{
586
    str << std::setprecision(15);
×
587
    str << "velocity_ned:" << '\n' << "{\n";
×
588
    str << "    north_m_s: " << velocity_ned.north_m_s << '\n';
×
589
    str << "    east_m_s: " << velocity_ned.east_m_s << '\n';
×
590
    str << "    down_m_s: " << velocity_ned.down_m_s << '\n';
×
591
    str << '}';
×
592
    return str;
×
593
}
594

595
bool operator==(
×
596
    const TelemetryServer::PositionVelocityNed& lhs,
597
    const TelemetryServer::PositionVelocityNed& rhs)
598
{
599
    return (rhs.position == lhs.position) && (rhs.velocity == lhs.velocity);
×
600
}
601

602
std::ostream&
603
operator<<(std::ostream& str, TelemetryServer::PositionVelocityNed const& position_velocity_ned)
×
604
{
605
    str << std::setprecision(15);
×
606
    str << "position_velocity_ned:" << '\n' << "{\n";
×
607
    str << "    position: " << position_velocity_ned.position << '\n';
×
608
    str << "    velocity: " << position_velocity_ned.velocity << '\n';
×
609
    str << '}';
×
610
    return str;
×
611
}
612

613
bool operator==(const TelemetryServer::GroundTruth& lhs, const TelemetryServer::GroundTruth& rhs)
×
614
{
615
    return ((std::isnan(rhs.latitude_deg) && std::isnan(lhs.latitude_deg)) ||
×
616
            rhs.latitude_deg == lhs.latitude_deg) &&
×
617
           ((std::isnan(rhs.longitude_deg) && std::isnan(lhs.longitude_deg)) ||
×
618
            rhs.longitude_deg == lhs.longitude_deg) &&
×
619
           ((std::isnan(rhs.absolute_altitude_m) && std::isnan(lhs.absolute_altitude_m)) ||
×
620
            rhs.absolute_altitude_m == lhs.absolute_altitude_m);
×
621
}
622

623
std::ostream& operator<<(std::ostream& str, TelemetryServer::GroundTruth const& ground_truth)
×
624
{
625
    str << std::setprecision(15);
×
626
    str << "ground_truth:" << '\n' << "{\n";
×
627
    str << "    latitude_deg: " << ground_truth.latitude_deg << '\n';
×
628
    str << "    longitude_deg: " << ground_truth.longitude_deg << '\n';
×
629
    str << "    absolute_altitude_m: " << ground_truth.absolute_altitude_m << '\n';
×
630
    str << '}';
×
631
    return str;
×
632
}
633

634
bool operator==(
×
635
    const TelemetryServer::FixedwingMetrics& lhs, const TelemetryServer::FixedwingMetrics& rhs)
636
{
637
    return ((std::isnan(rhs.airspeed_m_s) && std::isnan(lhs.airspeed_m_s)) ||
×
638
            rhs.airspeed_m_s == lhs.airspeed_m_s) &&
×
639
           ((std::isnan(rhs.throttle_percentage) && std::isnan(lhs.throttle_percentage)) ||
×
640
            rhs.throttle_percentage == lhs.throttle_percentage) &&
×
641
           ((std::isnan(rhs.climb_rate_m_s) && std::isnan(lhs.climb_rate_m_s)) ||
×
642
            rhs.climb_rate_m_s == lhs.climb_rate_m_s);
×
643
}
644

645
std::ostream&
646
operator<<(std::ostream& str, TelemetryServer::FixedwingMetrics const& fixedwing_metrics)
×
647
{
648
    str << std::setprecision(15);
×
649
    str << "fixedwing_metrics:" << '\n' << "{\n";
×
650
    str << "    airspeed_m_s: " << fixedwing_metrics.airspeed_m_s << '\n';
×
651
    str << "    throttle_percentage: " << fixedwing_metrics.throttle_percentage << '\n';
×
652
    str << "    climb_rate_m_s: " << fixedwing_metrics.climb_rate_m_s << '\n';
×
653
    str << '}';
×
654
    return str;
×
655
}
656

657
bool operator==(
×
658
    const TelemetryServer::AccelerationFrd& lhs, const TelemetryServer::AccelerationFrd& rhs)
659
{
660
    return ((std::isnan(rhs.forward_m_s2) && std::isnan(lhs.forward_m_s2)) ||
×
661
            rhs.forward_m_s2 == lhs.forward_m_s2) &&
×
662
           ((std::isnan(rhs.right_m_s2) && std::isnan(lhs.right_m_s2)) ||
×
663
            rhs.right_m_s2 == lhs.right_m_s2) &&
×
664
           ((std::isnan(rhs.down_m_s2) && std::isnan(lhs.down_m_s2)) ||
×
665
            rhs.down_m_s2 == lhs.down_m_s2);
×
666
}
667

668
std::ostream&
669
operator<<(std::ostream& str, TelemetryServer::AccelerationFrd const& acceleration_frd)
×
670
{
671
    str << std::setprecision(15);
×
672
    str << "acceleration_frd:" << '\n' << "{\n";
×
673
    str << "    forward_m_s2: " << acceleration_frd.forward_m_s2 << '\n';
×
674
    str << "    right_m_s2: " << acceleration_frd.right_m_s2 << '\n';
×
675
    str << "    down_m_s2: " << acceleration_frd.down_m_s2 << '\n';
×
676
    str << '}';
×
677
    return str;
×
678
}
679

680
bool operator==(
×
681
    const TelemetryServer::AngularVelocityFrd& lhs, const TelemetryServer::AngularVelocityFrd& rhs)
682
{
683
    return ((std::isnan(rhs.forward_rad_s) && std::isnan(lhs.forward_rad_s)) ||
×
684
            rhs.forward_rad_s == lhs.forward_rad_s) &&
×
685
           ((std::isnan(rhs.right_rad_s) && std::isnan(lhs.right_rad_s)) ||
×
686
            rhs.right_rad_s == lhs.right_rad_s) &&
×
687
           ((std::isnan(rhs.down_rad_s) && std::isnan(lhs.down_rad_s)) ||
×
688
            rhs.down_rad_s == lhs.down_rad_s);
×
689
}
690

691
std::ostream&
692
operator<<(std::ostream& str, TelemetryServer::AngularVelocityFrd const& angular_velocity_frd)
×
693
{
694
    str << std::setprecision(15);
×
695
    str << "angular_velocity_frd:" << '\n' << "{\n";
×
696
    str << "    forward_rad_s: " << angular_velocity_frd.forward_rad_s << '\n';
×
697
    str << "    right_rad_s: " << angular_velocity_frd.right_rad_s << '\n';
×
698
    str << "    down_rad_s: " << angular_velocity_frd.down_rad_s << '\n';
×
699
    str << '}';
×
700
    return str;
×
701
}
702

703
bool operator==(
×
704
    const TelemetryServer::MagneticFieldFrd& lhs, const TelemetryServer::MagneticFieldFrd& rhs)
705
{
706
    return ((std::isnan(rhs.forward_gauss) && std::isnan(lhs.forward_gauss)) ||
×
707
            rhs.forward_gauss == lhs.forward_gauss) &&
×
708
           ((std::isnan(rhs.right_gauss) && std::isnan(lhs.right_gauss)) ||
×
709
            rhs.right_gauss == lhs.right_gauss) &&
×
710
           ((std::isnan(rhs.down_gauss) && std::isnan(lhs.down_gauss)) ||
×
711
            rhs.down_gauss == lhs.down_gauss);
×
712
}
713

714
std::ostream&
715
operator<<(std::ostream& str, TelemetryServer::MagneticFieldFrd const& magnetic_field_frd)
×
716
{
717
    str << std::setprecision(15);
×
718
    str << "magnetic_field_frd:" << '\n' << "{\n";
×
719
    str << "    forward_gauss: " << magnetic_field_frd.forward_gauss << '\n';
×
720
    str << "    right_gauss: " << magnetic_field_frd.right_gauss << '\n';
×
721
    str << "    down_gauss: " << magnetic_field_frd.down_gauss << '\n';
×
722
    str << '}';
×
723
    return str;
×
724
}
725

726
bool operator==(const TelemetryServer::Imu& lhs, const TelemetryServer::Imu& rhs)
×
727
{
728
    return (rhs.acceleration_frd == lhs.acceleration_frd) &&
×
729
           (rhs.angular_velocity_frd == lhs.angular_velocity_frd) &&
×
730
           (rhs.magnetic_field_frd == lhs.magnetic_field_frd) &&
×
731
           ((std::isnan(rhs.temperature_degc) && std::isnan(lhs.temperature_degc)) ||
×
732
            rhs.temperature_degc == lhs.temperature_degc) &&
×
733
           (rhs.timestamp_us == lhs.timestamp_us);
×
734
}
735

736
std::ostream& operator<<(std::ostream& str, TelemetryServer::Imu const& imu)
×
737
{
738
    str << std::setprecision(15);
×
739
    str << "imu:" << '\n' << "{\n";
×
740
    str << "    acceleration_frd: " << imu.acceleration_frd << '\n';
×
741
    str << "    angular_velocity_frd: " << imu.angular_velocity_frd << '\n';
×
742
    str << "    magnetic_field_frd: " << imu.magnetic_field_frd << '\n';
×
743
    str << "    temperature_degc: " << imu.temperature_degc << '\n';
×
744
    str << "    timestamp_us: " << imu.timestamp_us << '\n';
×
745
    str << '}';
×
746
    return str;
×
747
}
748

749
std::ostream& operator<<(std::ostream& str, TelemetryServer::Result const& result)
×
750
{
751
    switch (result) {
×
752
        case TelemetryServer::Result::Unknown:
×
753
            return str << "Unknown";
×
754
        case TelemetryServer::Result::Success:
×
755
            return str << "Success";
×
756
        case TelemetryServer::Result::NoSystem:
×
757
            return str << "No System";
×
758
        case TelemetryServer::Result::ConnectionError:
×
759
            return str << "Connection Error";
×
760
        case TelemetryServer::Result::Busy:
×
761
            return str << "Busy";
×
762
        case TelemetryServer::Result::CommandDenied:
×
763
            return str << "Command Denied";
×
764
        case TelemetryServer::Result::Timeout:
×
765
            return str << "Timeout";
×
766
        case TelemetryServer::Result::Unsupported:
×
767
            return str << "Unsupported";
×
768
        default:
×
769
            return str << "Unknown";
×
770
    }
771
}
772

773
std::ostream& operator<<(std::ostream& str, TelemetryServer::FixType const& fix_type)
×
774
{
775
    switch (fix_type) {
×
776
        case TelemetryServer::FixType::NoGps:
×
777
            return str << "No Gps";
×
778
        case TelemetryServer::FixType::NoFix:
×
779
            return str << "No Fix";
×
780
        case TelemetryServer::FixType::Fix2D:
×
781
            return str << "Fix 2D";
×
782
        case TelemetryServer::FixType::Fix3D:
×
783
            return str << "Fix 3D";
×
784
        case TelemetryServer::FixType::FixDgps:
×
785
            return str << "Fix Dgps";
×
786
        case TelemetryServer::FixType::RtkFloat:
×
787
            return str << "Rtk Float";
×
788
        case TelemetryServer::FixType::RtkFixed:
×
789
            return str << "Rtk Fixed";
×
790
        default:
×
791
            return str << "Unknown";
×
792
    }
793
}
794

795
std::ostream& operator<<(std::ostream& str, TelemetryServer::VtolState const& vtol_state)
×
796
{
797
    switch (vtol_state) {
×
798
        case TelemetryServer::VtolState::Undefined:
×
799
            return str << "Undefined";
×
800
        case TelemetryServer::VtolState::TransitionToFw:
×
801
            return str << "Transition To Fw";
×
802
        case TelemetryServer::VtolState::TransitionToMc:
×
803
            return str << "Transition To Mc";
×
804
        case TelemetryServer::VtolState::Mc:
×
805
            return str << "Mc";
×
806
        case TelemetryServer::VtolState::Fw:
×
807
            return str << "Fw";
×
808
        default:
×
809
            return str << "Unknown";
×
810
    }
811
}
812

813
std::ostream& operator<<(std::ostream& str, TelemetryServer::StatusTextType const& status_text_type)
×
814
{
815
    switch (status_text_type) {
×
816
        case TelemetryServer::StatusTextType::Debug:
×
817
            return str << "Debug";
×
818
        case TelemetryServer::StatusTextType::Info:
×
819
            return str << "Info";
×
820
        case TelemetryServer::StatusTextType::Notice:
×
821
            return str << "Notice";
×
822
        case TelemetryServer::StatusTextType::Warning:
×
823
            return str << "Warning";
×
824
        case TelemetryServer::StatusTextType::Error:
×
825
            return str << "Error";
×
826
        case TelemetryServer::StatusTextType::Critical:
×
827
            return str << "Critical";
×
828
        case TelemetryServer::StatusTextType::Alert:
×
829
            return str << "Alert";
×
830
        case TelemetryServer::StatusTextType::Emergency:
×
831
            return str << "Emergency";
×
832
        default:
×
833
            return str << "Unknown";
×
834
    }
835
}
836

837
std::ostream& operator<<(std::ostream& str, TelemetryServer::LandedState const& landed_state)
×
838
{
839
    switch (landed_state) {
×
840
        case TelemetryServer::LandedState::Unknown:
×
841
            return str << "Unknown";
×
842
        case TelemetryServer::LandedState::OnGround:
×
843
            return str << "On Ground";
×
844
        case TelemetryServer::LandedState::InAir:
×
845
            return str << "In Air";
×
846
        case TelemetryServer::LandedState::TakingOff:
×
847
            return str << "Taking Off";
×
848
        case TelemetryServer::LandedState::Landing:
×
849
            return str << "Landing";
×
850
        default:
×
851
            return str << "Unknown";
×
852
    }
853
}
854

855
} // 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

© 2026 Coveralls, Inc