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

mavlink / MAVSDK / 23830665824

01 Apr 2026 03:35AM UTC coverage: 50.498%. First build
23830665824

Pull #2833

github

web-flow
Merge 743a48bcf into 721efdc45
Pull Request #2833: Backport recent main fixes and features to v3

623 of 797 new or added lines in 27 files covered. (78.17%)

19254 of 38128 relevant lines covered (50.5%)

669.04 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

55
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

62
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

73
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

82
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

93
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

100
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

111
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

120
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
bool operator==(const Mocap::AngularVelocityBody& lhs, const Mocap::AngularVelocityBody& rhs)
×
132
{
133
    return ((std::isnan(rhs.roll_rad_s) && std::isnan(lhs.roll_rad_s)) ||
×
134
            rhs.roll_rad_s == lhs.roll_rad_s) &&
×
135
           ((std::isnan(rhs.pitch_rad_s) && std::isnan(lhs.pitch_rad_s)) ||
×
136
            rhs.pitch_rad_s == lhs.pitch_rad_s) &&
×
137
           ((std::isnan(rhs.yaw_rad_s) && std::isnan(lhs.yaw_rad_s)) ||
×
138
            rhs.yaw_rad_s == lhs.yaw_rad_s);
×
139
}
140

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

152
bool operator==(const Mocap::Covariance& lhs, const Mocap::Covariance& rhs)
×
153
{
154
    return (rhs.covariance_matrix == lhs.covariance_matrix);
×
155
}
156

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

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

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

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

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

212
bool operator==(const Mocap::VisionSpeedEstimate& lhs, const Mocap::VisionSpeedEstimate& rhs)
×
213
{
214
    return (rhs.time_usec == lhs.time_usec) && (rhs.speed_ned == lhs.speed_ned) &&
×
NEW
215
           (rhs.speed_covariance == lhs.speed_covariance) &&
×
NEW
216
           (rhs.reset_counter == lhs.reset_counter);
×
217
}
218

219
std::ostream& operator<<(std::ostream& str, Mocap::VisionSpeedEstimate const& vision_speed_estimate)
×
220
{
221
    str << std::setprecision(15);
×
222
    str << "vision_speed_estimate:" << '\n' << "{\n";
×
223
    str << "    time_usec: " << vision_speed_estimate.time_usec << '\n';
×
224
    str << "    speed_ned: " << vision_speed_estimate.speed_ned << '\n';
×
225
    str << "    speed_covariance: " << vision_speed_estimate.speed_covariance << '\n';
×
NEW
226
    str << "    reset_counter: " << vision_speed_estimate.reset_counter << '\n';
×
227
    str << '}';
×
228
    return str;
×
229
}
230

231
bool operator==(const Mocap::AttitudePositionMocap& lhs, const Mocap::AttitudePositionMocap& rhs)
×
232
{
233
    return (rhs.time_usec == lhs.time_usec) && (rhs.q == lhs.q) &&
×
234
           (rhs.position_body == lhs.position_body) && (rhs.pose_covariance == lhs.pose_covariance);
×
235
}
236

237
std::ostream&
238
operator<<(std::ostream& str, Mocap::AttitudePositionMocap const& attitude_position_mocap)
×
239
{
240
    str << std::setprecision(15);
×
241
    str << "attitude_position_mocap:" << '\n' << "{\n";
×
242
    str << "    time_usec: " << attitude_position_mocap.time_usec << '\n';
×
243
    str << "    q: " << attitude_position_mocap.q << '\n';
×
244
    str << "    position_body: " << attitude_position_mocap.position_body << '\n';
×
245
    str << "    pose_covariance: " << attitude_position_mocap.pose_covariance << '\n';
×
246
    str << '}';
×
247
    return str;
×
248
}
249

250
std::ostream& operator<<(std::ostream& str, Mocap::Odometry::MavFrame const& mav_frame)
×
251
{
252
    switch (mav_frame) {
×
253
        case Mocap::Odometry::MavFrame::MocapNed:
×
254
            return str << "Mocap Ned";
×
255
        case Mocap::Odometry::MavFrame::LocalFrd:
×
256
            return str << "Local Frd";
×
257
        default:
×
258
            return str << "Unknown";
×
259
    }
260
}
261

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

300
std::ostream& operator<<(std::ostream& str, Mocap::Odometry const& odometry)
×
301
{
302
    str << std::setprecision(15);
×
303
    str << "odometry:" << '\n' << "{\n";
×
304
    str << "    time_usec: " << odometry.time_usec << '\n';
×
305
    str << "    frame_id: " << odometry.frame_id << '\n';
×
306
    str << "    position_body: " << odometry.position_body << '\n';
×
307
    str << "    q: " << odometry.q << '\n';
×
308
    str << "    speed_body: " << odometry.speed_body << '\n';
×
309
    str << "    angular_velocity_body: " << odometry.angular_velocity_body << '\n';
×
310
    str << "    pose_covariance: " << odometry.pose_covariance << '\n';
×
311
    str << "    velocity_covariance: " << odometry.velocity_covariance << '\n';
×
NEW
312
    str << "    reset_counter: " << odometry.reset_counter << '\n';
×
NEW
313
    str << "    estimator_type: " << odometry.estimator_type << '\n';
×
NEW
314
    str << "    quality_percent: " << odometry.quality_percent << '\n';
×
315
    str << '}';
×
316
    return str;
×
317
}
318

319
std::ostream& operator<<(std::ostream& str, Mocap::Result const& result)
×
320
{
321
    switch (result) {
×
322
        case Mocap::Result::Unknown:
×
323
            return str << "Unknown";
×
324
        case Mocap::Result::Success:
×
325
            return str << "Success";
×
326
        case Mocap::Result::NoSystem:
×
327
            return str << "No System";
×
328
        case Mocap::Result::ConnectionError:
×
329
            return str << "Connection Error";
×
330
        case Mocap::Result::InvalidRequestData:
×
331
            return str << "Invalid Request Data";
×
332
        case Mocap::Result::Unsupported:
×
333
            return str << "Unsupported";
×
334
        default:
×
335
            return str << "Unknown";
×
336
    }
337
}
338

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