public static void sendWaypointCount(Drone drone, int count) { msg_mission_count msg = new msg_mission_count(); msg.target_system = 1; msg.target_component = 1; msg.count = (short) count; drone.MavClient.sendMavPacket(msg.pack()); }
public static void sendSetCurrentWaypoint(Drone drone, short i) { msg_mission_set_current msg = new msg_mission_set_current(); msg.target_system = 1; msg.target_component = 1; msg.seq = i; drone.MavClient.sendMavPacket(msg.pack()); }
public static void requestWayPoint(Drone drone, int index) { msg_mission_request msg = new msg_mission_request(); msg.target_system = 1; msg.target_component = 1; msg.seq = (short) index; drone.MavClient.sendMavPacket(msg.pack()); }
public static void sendAck(Drone drone) { msg_mission_ack msg = new msg_mission_ack(); msg.target_system = 1; msg.target_component = 1; msg.type = MAV_MISSION_RESULT.MAV_MISSION_ACCEPTED; drone.MavClient.sendMavPacket(msg.pack()); }
@Override protected void onStart() { super.onStart(); drone.events.addDroneListener(this); app.conectionListner = this; drone.MavClient.queryConnectionState(); }
@Override public void onMapLongClick(Coord2D coord) { getPreferences(); if (drone.MavClient.isConnected()) { if (drone.guidedPoint.isInitialized()) { drone.guidedPoint.newGuidedCoord(coord); } else { if (guidedModeOnLongPress) { GuidedDialog dialog = new GuidedDialog(); dialog.setCoord(DroneHelper.CoordToLatLang(coord)); dialog.setListener(this); dialog.show(getChildFragmentManager(), "GUIDED dialog"); } } } }
/** * Change info mode panel when drone mode changes * * @param drone */ public void onModeChanged(Drone drone) { switch (drone.state.getMode()) { case ROTOR_RTL: modeInfoPanel = new ModeRTLFragment(); break; case ROTOR_AUTO: modeInfoPanel = new ModeAutoFragment(); break; case ROTOR_LAND: modeInfoPanel = new ModeLandFragment(); break; case ROTOR_LOITER: modeInfoPanel = new ModeLoiterFragment(); break; case ROTOR_STABILIZE: modeInfoPanel = new ModeStabilizeFragment(); break; case ROTOR_ACRO: modeInfoPanel = new ModeAcroFragment(); break; case ROTOR_ALT_HOLD: modeInfoPanel = new ModeAltholdFragment(); break; case ROTOR_CIRCLE: modeInfoPanel = new ModeCircleFragment(); break; case ROTOR_GUIDED: modeInfoPanel = new ModeGuidedFragment(); break; case ROTOR_POSITION: modeInfoPanel = new ModePositionFragment(); break; case ROTOR_TOY: modeInfoPanel = new ModeDriftFragment(); break; case ROTOR_CHASEME: break; default: modeInfoPanel = new ModeDisconnectedFragment(); break; } if (!drone.MavClient.isConnected()) { modeInfoPanel = new ModeDisconnectedFragment(); } fragmentManager.beginTransaction().replace(R.id.modeInfoPanel, modeInfoPanel).commit(); }
public static void requestWaypointsList(Drone drone) { msg_mission_request_list msg = new msg_mission_request_list(); msg.target_system = 1; msg.target_component = 1; drone.MavClient.sendMavPacket(msg.pack()); }
@Override public boolean onMenuItemSelected(int featureId, MenuItem item) { switch (item.getItemId()) { case R.id.menu_zoom: zoom(); return true; case R.id.menu_save_file: menuSaveFile(); return true; case R.id.menu_open_file: openMissionFile(); return true; // Menu option Send to APM is pressed case R.id.menu_send_to_apm: // Start of modification for waypoint safety checks // Check that the drone is connected before we try and send mission if (drone.MavClient.isConnected()) { // Use the method to make sure the input method safe // Initialize tts engine before use?, seems like first attempt doesn't make any words if (checkValidMission()) { // Mission path on tablet is valid // Set sync flag to true drone.waypointsSynced = true; // Sent mission to tablet drone.mission.sendMissionToAPM(); // Let user know that mission is valid drone.tts.speak("Mission valid"); } else { // Mission path on tablet is invalid // let user know waypoint path is invalid drone.tts.speak("Mission incorrect"); // Set sync flag to false drone.waypointsSynced = false; // Put in a break here as we had a failure? } } else { drone.tts.speak("No telemetry link"); } return true; case R.id.menu_clear_wp: clearWaypointsAndUpdate(); return true; default: return super.onMenuItemSelected(featureId, item); } }