@@ -256,6 +256,35 @@ private void handleMissions(MAVLinkPacket packet) throws IOException {
256
256
sendToSource (request , true );
257
257
break ;
258
258
}
259
+ case msg_mission_item_int .MAVLINK_MSG_ID_MISSION_ITEM_INT : {
260
+ msg_mission_item_int msg = (msg_mission_item_int ) packet .unpack ();
261
+ int current = msg .current ;
262
+ if (current ==2 ) {
263
+ MAVLinkLogger .log (Level .INFO , "GOTO_POINT <<" , packet );
264
+ break ;
265
+ }
266
+ //shadow.getDesiredMission().add(msg);
267
+ if (msg .seq + 1 < desiredMissionCount ) {
268
+ MAVLinkLogger .log (Level .INFO , "MISSION_POINT <<" , packet );
269
+ msg_mission_request_int mission_request = new msg_mission_request_int ();
270
+ mission_request .seq = msg .seq + 1 ;
271
+ mission_request .sysid = msg .target_system ;
272
+ mission_request .compid = msg .target_component ;
273
+ mission_request .target_system = (short ) packet .sysid ;
274
+ mission_request .target_component = (short ) packet .compid ;
275
+ sendToSource (mission_request , true );
276
+ } else {
277
+ MAVLinkLogger .log (Level .INFO , "MISSION_STORED <<" , packet );
278
+ msg_mission_ack mission_ack = new msg_mission_ack ();
279
+ mission_ack .type = MAV_MISSION_RESULT .MAV_MISSION_ACCEPTED ;
280
+ mission_ack .sysid = msg .target_system ;
281
+ mission_ack .compid = msg .target_component ;
282
+ mission_ack .target_system = (short ) packet .sysid ;
283
+ mission_ack .target_component = (short ) packet .compid ;
284
+ sendToSource (mission_ack , true );
285
+ }
286
+ break ;
287
+ }
259
288
case msg_mission_item .MAVLINK_MSG_ID_MISSION_ITEM : {
260
289
MAVLinkLogger .log (Level .INFO , "<<" , packet );
261
290
msg_mission_item msg = (msg_mission_item ) packet .unpack ();
@@ -311,6 +340,15 @@ private synchronized void handleCommand(MAVLinkPacket packet) throws IOException
311
340
command_ack .sysid = msg .target_system ;
312
341
command_ack .compid = msg .target_component ;
313
342
sendToSource (command_ack , true );
343
+ } else if (packet .msgid == msg_set_mode .MAVLINK_MSG_ID_SET_MODE ) {
344
+ MAVLinkLogger .log (Level .INFO , "<<" , packet );
345
+ msg_set_mode msg = (msg_set_mode ) packet .unpack ();
346
+ msg_command_ack command_ack = new msg_command_ack ();
347
+ command_ack .command = 11 ; //msg.command;
348
+ command_ack .result = MAV_RESULT .MAV_RESULT_ACCEPTED ;
349
+ command_ack .sysid = msg .target_system ;
350
+ command_ack .compid = msg .target_system ; //msg.target_component;
351
+ sendToSource (command_ack , true );
314
352
}
315
353
}
316
354
0 commit comments