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

mavlink / MAVSDK / 4065365825

pending completion
4065365825

push

github

GitHub
Winch and Gripper plugins (#1958)

529 of 529 new or added lines in 5 files covered. (100.0%)

7387 of 24193 relevant lines covered (30.53%)

21.47 hits per line

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

0.0
/src/mavsdk/plugins/winch/winch.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/winch/winch.proto)
4

5
#include <iomanip>
6

7
#include "winch_impl.h"
8
#include "plugins/winch/winch.h"
9

10
namespace mavsdk {
11

12
using StatusFlags = Winch::StatusFlags;
13
using Status = Winch::Status;
14

15
Winch::Winch(System& system) : PluginBase(), _impl{std::make_unique<WinchImpl>(system)} {}
×
16

17
Winch::Winch(std::shared_ptr<System> system) :
×
18
    PluginBase(),
19
    _impl{std::make_unique<WinchImpl>(system)}
×
20
{}
×
21

22
Winch::~Winch() {}
×
23

24
Winch::StatusHandle Winch::subscribe_status(const StatusCallback& callback)
×
25
{
26
    return _impl->subscribe_status(callback);
×
27
}
28

29
void Winch::unsubscribe_status(StatusHandle handle)
×
30
{
31
    _impl->unsubscribe_status(handle);
×
32
}
×
33

34
Winch::Status Winch::status() const
×
35
{
36
    return _impl->status();
×
37
}
38

39
void Winch::relax_async(uint32_t instance, const ResultCallback callback)
×
40
{
41
    _impl->relax_async(instance, callback);
×
42
}
×
43

44
Winch::Result Winch::relax(uint32_t instance) const
×
45
{
46
    return _impl->relax(instance);
×
47
}
48

49
void Winch::relative_length_control_async(
×
50
    uint32_t instance, float length_m, float rate_m_s, const ResultCallback callback)
51
{
52
    _impl->relative_length_control_async(instance, length_m, rate_m_s, callback);
×
53
}
×
54

55
Winch::Result
56
Winch::relative_length_control(uint32_t instance, float length_m, float rate_m_s) const
×
57
{
58
    return _impl->relative_length_control(instance, length_m, rate_m_s);
×
59
}
60

61
void Winch::rate_control_async(uint32_t instance, float rate_m_s, const ResultCallback callback)
×
62
{
63
    _impl->rate_control_async(instance, rate_m_s, callback);
×
64
}
×
65

66
Winch::Result Winch::rate_control(uint32_t instance, float rate_m_s) const
×
67
{
68
    return _impl->rate_control(instance, rate_m_s);
×
69
}
70

71
void Winch::lock_async(uint32_t instance, const ResultCallback callback)
×
72
{
73
    _impl->lock_async(instance, callback);
×
74
}
×
75

76
Winch::Result Winch::lock(uint32_t instance) const
×
77
{
78
    return _impl->lock(instance);
×
79
}
80

81
void Winch::deliver_async(uint32_t instance, const ResultCallback callback)
×
82
{
83
    _impl->deliver_async(instance, callback);
×
84
}
×
85

86
Winch::Result Winch::deliver(uint32_t instance) const
×
87
{
88
    return _impl->deliver(instance);
×
89
}
90

91
void Winch::hold_async(uint32_t instance, const ResultCallback callback)
×
92
{
93
    _impl->hold_async(instance, callback);
×
94
}
×
95

96
Winch::Result Winch::hold(uint32_t instance) const
×
97
{
98
    return _impl->hold(instance);
×
99
}
100

101
void Winch::retract_async(uint32_t instance, const ResultCallback callback)
×
102
{
103
    _impl->retract_async(instance, callback);
×
104
}
×
105

106
Winch::Result Winch::retract(uint32_t instance) const
×
107
{
108
    return _impl->retract(instance);
×
109
}
110

111
void Winch::load_line_async(uint32_t instance, const ResultCallback callback)
×
112
{
113
    _impl->load_line_async(instance, callback);
×
114
}
×
115

116
Winch::Result Winch::load_line(uint32_t instance) const
×
117
{
118
    return _impl->load_line(instance);
×
119
}
120

121
void Winch::abandon_line_async(uint32_t instance, const ResultCallback callback)
×
122
{
123
    _impl->abandon_line_async(instance, callback);
×
124
}
×
125

126
Winch::Result Winch::abandon_line(uint32_t instance) const
×
127
{
128
    return _impl->abandon_line(instance);
×
129
}
130

131
void Winch::load_payload_async(uint32_t instance, const ResultCallback callback)
×
132
{
133
    _impl->load_payload_async(instance, callback);
×
134
}
×
135

136
Winch::Result Winch::load_payload(uint32_t instance) const
×
137
{
138
    return _impl->load_payload(instance);
×
139
}
140

141
bool operator==(const Winch::StatusFlags& lhs, const Winch::StatusFlags& rhs)
×
142
{
143
    return (rhs.healthy == lhs.healthy) && (rhs.fully_retracted == lhs.fully_retracted) &&
×
144
           (rhs.moving == lhs.moving) && (rhs.clutch_engaged == lhs.clutch_engaged) &&
×
145
           (rhs.locked == lhs.locked) && (rhs.dropping == lhs.dropping) &&
×
146
           (rhs.arresting == lhs.arresting) && (rhs.ground_sense == lhs.ground_sense) &&
×
147
           (rhs.retracting == lhs.retracting) && (rhs.redeliver == lhs.redeliver) &&
×
148
           (rhs.abandon_line == lhs.abandon_line) && (rhs.locking == lhs.locking) &&
×
149
           (rhs.load_line == lhs.load_line) && (rhs.load_payload == lhs.load_payload);
×
150
}
151

152
std::ostream& operator<<(std::ostream& str, Winch::StatusFlags const& status_flags)
×
153
{
154
    str << std::setprecision(15);
×
155
    str << "status_flags:" << '\n' << "{\n";
×
156
    str << "    healthy: " << status_flags.healthy << '\n';
×
157
    str << "    fully_retracted: " << status_flags.fully_retracted << '\n';
×
158
    str << "    moving: " << status_flags.moving << '\n';
×
159
    str << "    clutch_engaged: " << status_flags.clutch_engaged << '\n';
×
160
    str << "    locked: " << status_flags.locked << '\n';
×
161
    str << "    dropping: " << status_flags.dropping << '\n';
×
162
    str << "    arresting: " << status_flags.arresting << '\n';
×
163
    str << "    ground_sense: " << status_flags.ground_sense << '\n';
×
164
    str << "    retracting: " << status_flags.retracting << '\n';
×
165
    str << "    redeliver: " << status_flags.redeliver << '\n';
×
166
    str << "    abandon_line: " << status_flags.abandon_line << '\n';
×
167
    str << "    locking: " << status_flags.locking << '\n';
×
168
    str << "    load_line: " << status_flags.load_line << '\n';
×
169
    str << "    load_payload: " << status_flags.load_payload << '\n';
×
170
    str << '}';
×
171
    return str;
×
172
}
173

174
bool operator==(const Winch::Status& lhs, const Winch::Status& rhs)
×
175
{
176
    return (rhs.time_usec == lhs.time_usec) &&
×
177
           ((std::isnan(rhs.line_length_m) && std::isnan(lhs.line_length_m)) ||
×
178
            rhs.line_length_m == lhs.line_length_m) &&
×
179
           ((std::isnan(rhs.speed_m_s) && std::isnan(lhs.speed_m_s)) ||
×
180
            rhs.speed_m_s == lhs.speed_m_s) &&
×
181
           ((std::isnan(rhs.tension_kg) && std::isnan(lhs.tension_kg)) ||
×
182
            rhs.tension_kg == lhs.tension_kg) &&
×
183
           ((std::isnan(rhs.voltage_v) && std::isnan(lhs.voltage_v)) ||
×
184
            rhs.voltage_v == lhs.voltage_v) &&
×
185
           ((std::isnan(rhs.current_a) && std::isnan(lhs.current_a)) ||
×
186
            rhs.current_a == lhs.current_a) &&
×
187
           (rhs.temperature_c == lhs.temperature_c) && (rhs.status_flags == lhs.status_flags);
×
188
}
189

190
std::ostream& operator<<(std::ostream& str, Winch::Status const& status)
×
191
{
192
    str << std::setprecision(15);
×
193
    str << "status:" << '\n' << "{\n";
×
194
    str << "    time_usec: " << status.time_usec << '\n';
×
195
    str << "    line_length_m: " << status.line_length_m << '\n';
×
196
    str << "    speed_m_s: " << status.speed_m_s << '\n';
×
197
    str << "    tension_kg: " << status.tension_kg << '\n';
×
198
    str << "    voltage_v: " << status.voltage_v << '\n';
×
199
    str << "    current_a: " << status.current_a << '\n';
×
200
    str << "    temperature_c: " << status.temperature_c << '\n';
×
201
    str << "    status_flags: " << status.status_flags << '\n';
×
202
    str << '}';
×
203
    return str;
×
204
}
205

206
std::ostream& operator<<(std::ostream& str, Winch::Result const& result)
×
207
{
208
    switch (result) {
×
209
        case Winch::Result::Unknown:
×
210
            return str << "Unknown";
×
211
        case Winch::Result::Success:
×
212
            return str << "Success";
×
213
        case Winch::Result::NoSystem:
×
214
            return str << "No System";
×
215
        case Winch::Result::Busy:
×
216
            return str << "Busy";
×
217
        case Winch::Result::Timeout:
×
218
            return str << "Timeout";
×
219
        case Winch::Result::Unsupported:
×
220
            return str << "Unsupported";
×
221
        case Winch::Result::Failed:
×
222
            return str << "Failed";
×
223
        default:
×
224
            return str << "Unknown";
×
225
    }
226
}
227

228
std::ostream& operator<<(std::ostream& str, Winch::WinchAction const& winch_action)
×
229
{
230
    switch (winch_action) {
×
231
        case Winch::WinchAction::Relaxed:
×
232
            return str << "Relaxed";
×
233
        case Winch::WinchAction::RelativeLengthControl:
×
234
            return str << "Relative Length Control";
×
235
        case Winch::WinchAction::RateControl:
×
236
            return str << "Rate Control";
×
237
        case Winch::WinchAction::Lock:
×
238
            return str << "Lock";
×
239
        case Winch::WinchAction::Deliver:
×
240
            return str << "Deliver";
×
241
        case Winch::WinchAction::Hold:
×
242
            return str << "Hold";
×
243
        case Winch::WinchAction::Retract:
×
244
            return str << "Retract";
×
245
        case Winch::WinchAction::LoadLine:
×
246
            return str << "Load Line";
×
247
        case Winch::WinchAction::AbandonLine:
×
248
            return str << "Abandon Line";
×
249
        case Winch::WinchAction::LoadPayload:
×
250
            return str << "Load Payload";
×
251
        default:
×
252
            return str << "Unknown";
×
253
    }
254
}
255

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