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

mavlink / MAVSDK / 24110638161

08 Apr 2026 12:10AM UTC coverage: 50.459%. First build
24110638161

Pull #2855

github

web-flow
Merge a88a02493 into 9d13e3cca
Pull Request #2855: core: hide symbols by default, export only public API

15 of 379 new or added lines in 39 files covered. (3.96%)

19243 of 38136 relevant lines covered (50.46%)

668.58 hits per line

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

0.0
/src/mavsdk/plugins/mocap/mocap.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 https://github.com/mavlink/MAVSDK-Proto/blob/master/protos/mocap/mocap.proto)
4

5
#include <iomanip>
6

7
#include "mocap_impl.h"
8
#include "plugins/mocap/mocap.h"
9

10
namespace mavsdk {
11

12
using PositionBody = Mocap::PositionBody;
13
using AngleBody = Mocap::AngleBody;
14
using SpeedBody = Mocap::SpeedBody;
15
using SpeedNed = Mocap::SpeedNed;
16
using AngularVelocityBody = Mocap::AngularVelocityBody;
17
using Covariance = Mocap::Covariance;
18
using Quaternion = Mocap::Quaternion;
19
using VisionPositionEstimate = Mocap::VisionPositionEstimate;
20
using VisionSpeedEstimate = Mocap::VisionSpeedEstimate;
21
using AttitudePositionMocap = Mocap::AttitudePositionMocap;
22
using Odometry = Mocap::Odometry;
23

24
Mocap::Mocap(System& system) : PluginBase(), _impl{std::make_unique<MocapImpl>(system)} {}
×
25

26
Mocap::Mocap(std::shared_ptr<System> system) :
×
27
    PluginBase(),
28
    _impl{std::make_unique<MocapImpl>(system)}
×
29
{}
×
30

31
Mocap::~Mocap() {}
×
32

33
Mocap::Result
34
Mocap::set_vision_position_estimate(VisionPositionEstimate vision_position_estimate) const
×
35
{
36
    return _impl->set_vision_position_estimate(vision_position_estimate);
×
37
}
38

39
Mocap::Result Mocap::set_vision_speed_estimate(VisionSpeedEstimate vision_speed_estimate) const
×
40
{
41
    return _impl->set_vision_speed_estimate(vision_speed_estimate);
×
42
}
43

44
Mocap::Result
45
Mocap::set_attitude_position_mocap(AttitudePositionMocap attitude_position_mocap) const
×
46
{
47
    return _impl->set_attitude_position_mocap(attitude_position_mocap);
×
48
}
49

50
Mocap::Result Mocap::set_odometry(Odometry odometry) const
×
51
{
52
    return _impl->set_odometry(odometry);
×
53
}
54

NEW
55
MAVSDK_PUBLIC bool operator==(const Mocap::PositionBody& lhs, const Mocap::PositionBody& rhs)
×
56
{
57
    return ((std::isnan(rhs.x_m) && std::isnan(lhs.x_m)) || rhs.x_m == lhs.x_m) &&
×
58
           ((std::isnan(rhs.y_m) && std::isnan(lhs.y_m)) || rhs.y_m == lhs.y_m) &&
×
59
           ((std::isnan(rhs.z_m) && std::isnan(lhs.z_m)) || rhs.z_m == lhs.z_m);
×
60
}
61

NEW
62
MAVSDK_PUBLIC std::ostream& operator<<(std::ostream& str, Mocap::PositionBody const& position_body)
×
63
{
64
    str << std::setprecision(15);
×
65
    str << "position_body:" << '\n' << "{\n";
×
66
    str << "    x_m: " << position_body.x_m << '\n';
×
67
    str << "    y_m: " << position_body.y_m << '\n';
×
68
    str << "    z_m: " << position_body.z_m << '\n';
×
69
    str << '}';
×
70
    return str;
×
71
}
72

NEW
73
MAVSDK_PUBLIC bool operator==(const Mocap::AngleBody& lhs, const Mocap::AngleBody& rhs)
×
74
{
75
    return ((std::isnan(rhs.roll_rad) && std::isnan(lhs.roll_rad)) ||
×
76
            rhs.roll_rad == lhs.roll_rad) &&
×
77
           ((std::isnan(rhs.pitch_rad) && std::isnan(lhs.pitch_rad)) ||
×
78
            rhs.pitch_rad == lhs.pitch_rad) &&
×
79
           ((std::isnan(rhs.yaw_rad) && std::isnan(lhs.yaw_rad)) || rhs.yaw_rad == lhs.yaw_rad);
×
80
}
81

NEW
82
MAVSDK_PUBLIC std::ostream& operator<<(std::ostream& str, Mocap::AngleBody const& angle_body)
×
83
{
84
    str << std::setprecision(15);
×
85
    str << "angle_body:" << '\n' << "{\n";
×
86
    str << "    roll_rad: " << angle_body.roll_rad << '\n';
×
87
    str << "    pitch_rad: " << angle_body.pitch_rad << '\n';
×
88
    str << "    yaw_rad: " << angle_body.yaw_rad << '\n';
×
89
    str << '}';
×
90
    return str;
×
91
}
92

NEW
93
MAVSDK_PUBLIC bool operator==(const Mocap::SpeedBody& lhs, const Mocap::SpeedBody& rhs)
×
94
{
95
    return ((std::isnan(rhs.x_m_s) && std::isnan(lhs.x_m_s)) || rhs.x_m_s == lhs.x_m_s) &&
×
96
           ((std::isnan(rhs.y_m_s) && std::isnan(lhs.y_m_s)) || rhs.y_m_s == lhs.y_m_s) &&
×
97
           ((std::isnan(rhs.z_m_s) && std::isnan(lhs.z_m_s)) || rhs.z_m_s == lhs.z_m_s);
×
98
}
99

NEW
100
MAVSDK_PUBLIC std::ostream& operator<<(std::ostream& str, Mocap::SpeedBody const& speed_body)
×
101
{
102
    str << std::setprecision(15);
×
103
    str << "speed_body:" << '\n' << "{\n";
×
104
    str << "    x_m_s: " << speed_body.x_m_s << '\n';
×
105
    str << "    y_m_s: " << speed_body.y_m_s << '\n';
×
106
    str << "    z_m_s: " << speed_body.z_m_s << '\n';
×
107
    str << '}';
×
108
    return str;
×
109
}
110

NEW
111
MAVSDK_PUBLIC bool operator==(const Mocap::SpeedNed& lhs, const Mocap::SpeedNed& rhs)
×
112
{
113
    return ((std::isnan(rhs.north_m_s) && std::isnan(lhs.north_m_s)) ||
×
114
            rhs.north_m_s == lhs.north_m_s) &&
×
115
           ((std::isnan(rhs.east_m_s) && std::isnan(lhs.east_m_s)) ||
×
116
            rhs.east_m_s == lhs.east_m_s) &&
×
117
           ((std::isnan(rhs.down_m_s) && std::isnan(lhs.down_m_s)) || rhs.down_m_s == lhs.down_m_s);
×
118
}
119

NEW
120
MAVSDK_PUBLIC std::ostream& operator<<(std::ostream& str, Mocap::SpeedNed const& speed_ned)
×
121
{
122
    str << std::setprecision(15);
×
123
    str << "speed_ned:" << '\n' << "{\n";
×
124
    str << "    north_m_s: " << speed_ned.north_m_s << '\n';
×
125
    str << "    east_m_s: " << speed_ned.east_m_s << '\n';
×
126
    str << "    down_m_s: " << speed_ned.down_m_s << '\n';
×
127
    str << '}';
×
128
    return str;
×
129
}
130

131
MAVSDK_PUBLIC bool
NEW
132
operator==(const Mocap::AngularVelocityBody& lhs, const Mocap::AngularVelocityBody& rhs)
×
133
{
134
    return ((std::isnan(rhs.roll_rad_s) && std::isnan(lhs.roll_rad_s)) ||
×
135
            rhs.roll_rad_s == lhs.roll_rad_s) &&
×
136
           ((std::isnan(rhs.pitch_rad_s) && std::isnan(lhs.pitch_rad_s)) ||
×
137
            rhs.pitch_rad_s == lhs.pitch_rad_s) &&
×
138
           ((std::isnan(rhs.yaw_rad_s) && std::isnan(lhs.yaw_rad_s)) ||
×
139
            rhs.yaw_rad_s == lhs.yaw_rad_s);
×
140
}
141

142
MAVSDK_PUBLIC std::ostream&
NEW
143
operator<<(std::ostream& str, Mocap::AngularVelocityBody const& angular_velocity_body)
×
144
{
145
    str << std::setprecision(15);
×
146
    str << "angular_velocity_body:" << '\n' << "{\n";
×
147
    str << "    roll_rad_s: " << angular_velocity_body.roll_rad_s << '\n';
×
148
    str << "    pitch_rad_s: " << angular_velocity_body.pitch_rad_s << '\n';
×
149
    str << "    yaw_rad_s: " << angular_velocity_body.yaw_rad_s << '\n';
×
150
    str << '}';
×
151
    return str;
×
152
}
153

NEW
154
MAVSDK_PUBLIC bool operator==(const Mocap::Covariance& lhs, const Mocap::Covariance& rhs)
×
155
{
156
    return (rhs.covariance_matrix == lhs.covariance_matrix);
×
157
}
158

NEW
159
MAVSDK_PUBLIC std::ostream& operator<<(std::ostream& str, Mocap::Covariance const& covariance)
×
160
{
161
    str << std::setprecision(15);
×
162
    str << "covariance:" << '\n' << "{\n";
×
163
    str << "    covariance_matrix: [";
×
164
    for (auto it = covariance.covariance_matrix.begin(); it != covariance.covariance_matrix.end();
×
165
         ++it) {
×
166
        str << *it;
×
167
        str << (it + 1 != covariance.covariance_matrix.end() ? ", " : "]\n");
×
168
    }
169
    str << '}';
×
170
    return str;
×
171
}
172

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

NEW
181
MAVSDK_PUBLIC std::ostream& operator<<(std::ostream& str, Mocap::Quaternion const& quaternion)
×
182
{
183
    str << std::setprecision(15);
×
184
    str << "quaternion:" << '\n' << "{\n";
×
185
    str << "    w: " << quaternion.w << '\n';
×
186
    str << "    x: " << quaternion.x << '\n';
×
187
    str << "    y: " << quaternion.y << '\n';
×
188
    str << "    z: " << quaternion.z << '\n';
×
189
    str << '}';
×
190
    return str;
×
191
}
192

193
MAVSDK_PUBLIC bool
NEW
194
operator==(const Mocap::VisionPositionEstimate& lhs, const Mocap::VisionPositionEstimate& rhs)
×
195
{
196
    return (rhs.time_usec == lhs.time_usec) && (rhs.position_body == lhs.position_body) &&
×
197
           (rhs.angle_body == lhs.angle_body) && (rhs.pose_covariance == lhs.pose_covariance) &&
×
198
           (rhs.reset_counter == lhs.reset_counter);
×
199
}
200

201
MAVSDK_PUBLIC std::ostream&
202
operator<<(std::ostream& str, Mocap::VisionPositionEstimate const& vision_position_estimate)
×
203
{
204
    str << std::setprecision(15);
×
205
    str << "vision_position_estimate:" << '\n' << "{\n";
×
206
    str << "    time_usec: " << vision_position_estimate.time_usec << '\n';
×
207
    str << "    position_body: " << vision_position_estimate.position_body << '\n';
×
208
    str << "    angle_body: " << vision_position_estimate.angle_body << '\n';
×
209
    str << "    pose_covariance: " << vision_position_estimate.pose_covariance << '\n';
×
210
    str << "    reset_counter: " << vision_position_estimate.reset_counter << '\n';
×
211
    str << '}';
×
212
    return str;
×
213
}
214

215
MAVSDK_PUBLIC bool
NEW
216
operator==(const Mocap::VisionSpeedEstimate& lhs, const Mocap::VisionSpeedEstimate& rhs)
×
217
{
218
    return (rhs.time_usec == lhs.time_usec) && (rhs.speed_ned == lhs.speed_ned) &&
×
219
           (rhs.speed_covariance == lhs.speed_covariance) &&
×
220
           (rhs.reset_counter == lhs.reset_counter);
×
221
}
222

223
MAVSDK_PUBLIC std::ostream&
NEW
224
operator<<(std::ostream& str, Mocap::VisionSpeedEstimate const& vision_speed_estimate)
×
225
{
226
    str << std::setprecision(15);
×
227
    str << "vision_speed_estimate:" << '\n' << "{\n";
×
228
    str << "    time_usec: " << vision_speed_estimate.time_usec << '\n';
×
229
    str << "    speed_ned: " << vision_speed_estimate.speed_ned << '\n';
×
230
    str << "    speed_covariance: " << vision_speed_estimate.speed_covariance << '\n';
×
231
    str << "    reset_counter: " << vision_speed_estimate.reset_counter << '\n';
×
232
    str << '}';
×
233
    return str;
×
234
}
235

236
MAVSDK_PUBLIC bool
NEW
237
operator==(const Mocap::AttitudePositionMocap& lhs, const Mocap::AttitudePositionMocap& rhs)
×
238
{
239
    return (rhs.time_usec == lhs.time_usec) && (rhs.q == lhs.q) &&
×
240
           (rhs.position_body == lhs.position_body) && (rhs.pose_covariance == lhs.pose_covariance);
×
241
}
242

243
MAVSDK_PUBLIC std::ostream&
244
operator<<(std::ostream& str, Mocap::AttitudePositionMocap const& attitude_position_mocap)
×
245
{
246
    str << std::setprecision(15);
×
247
    str << "attitude_position_mocap:" << '\n' << "{\n";
×
248
    str << "    time_usec: " << attitude_position_mocap.time_usec << '\n';
×
249
    str << "    q: " << attitude_position_mocap.q << '\n';
×
250
    str << "    position_body: " << attitude_position_mocap.position_body << '\n';
×
251
    str << "    pose_covariance: " << attitude_position_mocap.pose_covariance << '\n';
×
252
    str << '}';
×
253
    return str;
×
254
}
255

256
MAVSDK_PUBLIC std::ostream&
NEW
257
operator<<(std::ostream& str, Mocap::Odometry::MavFrame const& mav_frame)
×
258
{
259
    switch (mav_frame) {
×
260
        case Mocap::Odometry::MavFrame::MocapNed:
×
261
            return str << "Mocap Ned";
×
262
        case Mocap::Odometry::MavFrame::LocalFrd:
×
263
            return str << "Local Frd";
×
264
        default:
×
265
            return str << "Unknown";
×
266
    }
267
}
268

269
MAVSDK_PUBLIC std::ostream&
270
operator<<(std::ostream& str, Mocap::Odometry::MavEstimatorType const& mav_estimator_type)
×
271
{
272
    switch (mav_estimator_type) {
×
273
        case Mocap::Odometry::MavEstimatorType::Unknown:
×
274
            return str << "Unknown";
×
275
        case Mocap::Odometry::MavEstimatorType::Naive:
×
276
            return str << "Naive";
×
277
        case Mocap::Odometry::MavEstimatorType::Vision:
×
278
            return str << "Vision";
×
279
        case Mocap::Odometry::MavEstimatorType::Vio:
×
280
            return str << "Vio";
×
281
        case Mocap::Odometry::MavEstimatorType::Gps:
×
282
            return str << "Gps";
×
283
        case Mocap::Odometry::MavEstimatorType::GpsIns:
×
284
            return str << "Gps Ins";
×
285
        case Mocap::Odometry::MavEstimatorType::Mocap:
×
286
            return str << "Mocap";
×
287
        case Mocap::Odometry::MavEstimatorType::Lidar:
×
288
            return str << "Lidar";
×
289
        case Mocap::Odometry::MavEstimatorType::Autopilot:
×
290
            return str << "Autopilot";
×
291
        default:
×
292
            return str << "Unknown";
×
293
    }
294
}
NEW
295
MAVSDK_PUBLIC bool operator==(const Mocap::Odometry& lhs, const Mocap::Odometry& rhs)
×
296
{
297
    return (rhs.time_usec == lhs.time_usec) && (rhs.frame_id == lhs.frame_id) &&
×
298
           (rhs.position_body == lhs.position_body) && (rhs.q == lhs.q) &&
×
299
           (rhs.speed_body == lhs.speed_body) &&
×
300
           (rhs.angular_velocity_body == lhs.angular_velocity_body) &&
×
301
           (rhs.pose_covariance == lhs.pose_covariance) &&
×
302
           (rhs.velocity_covariance == lhs.velocity_covariance) &&
×
303
           (rhs.reset_counter == lhs.reset_counter) && (rhs.estimator_type == lhs.estimator_type) &&
×
304
           (rhs.quality_percent == lhs.quality_percent);
×
305
}
306

NEW
307
MAVSDK_PUBLIC std::ostream& operator<<(std::ostream& str, Mocap::Odometry const& odometry)
×
308
{
309
    str << std::setprecision(15);
×
310
    str << "odometry:" << '\n' << "{\n";
×
311
    str << "    time_usec: " << odometry.time_usec << '\n';
×
312
    str << "    frame_id: " << odometry.frame_id << '\n';
×
313
    str << "    position_body: " << odometry.position_body << '\n';
×
314
    str << "    q: " << odometry.q << '\n';
×
315
    str << "    speed_body: " << odometry.speed_body << '\n';
×
316
    str << "    angular_velocity_body: " << odometry.angular_velocity_body << '\n';
×
317
    str << "    pose_covariance: " << odometry.pose_covariance << '\n';
×
318
    str << "    velocity_covariance: " << odometry.velocity_covariance << '\n';
×
319
    str << "    reset_counter: " << odometry.reset_counter << '\n';
×
320
    str << "    estimator_type: " << odometry.estimator_type << '\n';
×
321
    str << "    quality_percent: " << odometry.quality_percent << '\n';
×
322
    str << '}';
×
323
    return str;
×
324
}
325

NEW
326
MAVSDK_PUBLIC std::ostream& operator<<(std::ostream& str, Mocap::Result const& result)
×
327
{
328
    switch (result) {
×
329
        case Mocap::Result::Unknown:
×
330
            return str << "Unknown";
×
331
        case Mocap::Result::Success:
×
332
            return str << "Success";
×
333
        case Mocap::Result::NoSystem:
×
334
            return str << "No System";
×
335
        case Mocap::Result::ConnectionError:
×
336
            return str << "Connection Error";
×
337
        case Mocap::Result::InvalidRequestData:
×
338
            return str << "Invalid Request Data";
×
339
        case Mocap::Result::Unsupported:
×
340
            return str << "Unsupported";
×
341
        default:
×
342
            return str << "Unknown";
×
343
    }
344
}
345

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