2
2
3
3
#include < mavsdk/mavsdk.h>
4
4
#include < mavsdk/plugins/action/action.h>
5
- #include < mavsdk/plugins/param/param.h>
6
5
#include < mavsdk/plugins/geofence/geofence.h>
7
6
#include < mavsdk/plugins/mavlink_passthrough/mavlink_passthrough.h>
8
7
#include < mavsdk/plugins/mission_raw/mission_raw.h>
8
+ #include < mavsdk/plugins/param/param.h>
9
9
#include < mavsdk/plugins/telemetry/telemetry.h>
10
10
11
11
#include < atomic>
@@ -80,8 +80,7 @@ MavlinkClient::MavlinkClient(OBCConfig config)
80
80
// require a recompile to change the typing of a specific parameter if you
81
81
// get it wrong.
82
82
auto result = mavsdk::Param::Result::Unknown;
83
- if (param == " FS_LONG_TIMEOUT" ||
84
- param == " AFS_RC_FAIL_TIME" ||
83
+ if (param == " FS_LONG_TIMEOUT" || param == " AFS_RC_FAIL_TIME" ||
85
84
param == " FS_SHORT_TIMEOUT" ) {
86
85
result = this ->param ->set_param_float (param, val);
87
86
} else {
@@ -175,22 +174,16 @@ MavlinkClient::MavlinkClient(OBCConfig config)
175
174
});
176
175
177
176
this ->passthrough ->subscribe_message (WIND_COV, [this ](const mavlink_message_t & message) {
178
- // auto payload = message.payload64;
177
+ auto payload = message.payload64 ;
179
178
// LOG_F(INFO, "UNIX TIME: %lu", payload[0]);
180
179
181
180
/*
182
181
NOT TESTED - don't actually know where the data is in thie uint64_t[]
183
182
TODO - test on actual pixhawk to make sure that the data makes sense
184
183
*/
185
-
186
- // this->data.wind.x = payload[1];
187
- // this->data.wind.y = payload[2];
188
- // this->data.wind.z = payload[3];
189
-
190
- // can try and implement this for real if we need actual wind data
191
- this ->data .wind .x = 0 ;
192
- this ->data .wind .y = 0 ;
193
- this ->data .wind .z = 0 ;
184
+ this ->data .wind .x = (payload[1 ] >> 56 ) & 0xFF ;
185
+ this ->data .wind .y = (payload[1 ] >> 48 ) & 0xFF ;
186
+ this ->data .wind .z = (payload[1 ] >> 40 ) & 0xFF ;
194
187
});
195
188
// this->telemetry->subscribe_attitude_euler(
196
189
// [this](mavsdk::Telemetry::EulerAngle attitude) {
@@ -205,8 +198,7 @@ MavlinkClient::MavlinkClient(OBCConfig config)
205
198
}
206
199
207
200
bool MavlinkClient::uploadMissionUntilSuccess (std::shared_ptr<MissionState> state,
208
- bool upload_geofence,
209
- const MissionPath& path) const {
201
+ bool upload_geofence, const MissionPath& path) const {
210
202
if (upload_geofence) {
211
203
if (!this ->uploadGeofenceUntilSuccess (state)) {
212
204
return false ;
@@ -282,7 +274,6 @@ bool MavlinkClient::uploadWaypointsUntilSuccess(std::shared_ptr<MissionState> st
282
274
const MissionPath& waypoints) const {
283
275
LOG_SCOPE_F (INFO, " Uploading waypoints" );
284
276
285
-
286
277
while (true ) {
287
278
LOG_F (INFO, " Sending waypoint information..." );
288
279
@@ -379,9 +370,7 @@ mavsdk::Telemetry::FlightMode MavlinkClient::flight_mode() {
379
370
return this ->data .flight_mode ;
380
371
}
381
372
382
- int32_t MavlinkClient::curr_waypoint () const {
383
- return this ->mission ->mission_progress ().current ;
384
- }
373
+ int32_t MavlinkClient::curr_waypoint () const { return this ->mission ->mission_progress ().current ; }
385
374
386
375
bool MavlinkClient::isMissionFinished () {
387
376
// Boolean representing if mission is finished
0 commit comments