How can I send MAVLink commands directly using Dronkit-Android?

1.3k Views Asked by At

I am trying to have it go on a mission by only setting to auto. After some research it cannot perform the takeoff on the mission as it requires initiate throttle to begin that. With more research to by pass this I can use MAV_CMD_MISSION_START. Only issue is I have been searching the docs and I can't find anything that has it send a MavLink Message. The docs has something like this, but I have no clue how to use it properly and there is little example or documentation on how to use it.

Was hoping if there was some simple command to send commands to the drone?

Hopefully, someone has some experience in this.

2

There are 2 best solutions below

1
On

To accomplish your task, you can issue a takeoff command to the drone as shown in this guide.

After the takeoff command is issued, you can switch the flight mode to auto to start the mission, using the Drone#changeVehicleMode(...) method.

0
On

This command isn't supported by the current version of APM:Copter (v3.2). It is only supported in 3.3 (which is in beta as of July '15). That's why this command isn't in Dronekit-Android yet. But it will be supported by Dronekit-Android in about a week. You will call it like this:

MissionApi.getApi(drone).startMission(true, true, new AbstractCommandListener() {
                @Override
                public void onSuccess() {
                    Toast.makeText(getContext(), "success", Toast.LENGTH_LONG).show();
                }

                @Override
                public void onError(int i) {
                    Toast.makeText(getContext(), "failcode: " + i, Toast.LENGTH_LONG).show();
                }

                @Override
                public void onTimeout() {
                    Toast.makeText(getContext(), "timeout", Toast.LENGTH_LONG).show();
                }
            });