These are chat archives for dronekit/dronekit-android

Mar 2016
Mar 08 2016 05:37
Hey All, I'm trying to send some commands to get my drone to takeoff, fly a square, and land. I've got the takeoff and land with ControlApi and VehicleApi but my question is: How do I tell it to go forward 3 meters, or turn 90 degrees left?, which API functions should I be looking at using? (I assume ControlApi.climbTo will adjust altitude higher or lower)
I want to store the current lat/long then tell it to move forward 3 meters and determine the change in lat/distance to calculate the error/drift right now
Mar 08 2016 05:45
My second questions is after I had it go forward for 3 meters, what would be the best way to have it wait 5 seconds before turning 90 degrees left? I've tried adding sleep and wait functions but they both crash the android app I'm making.
Cee Jay
Mar 08 2016 09:57
@MrTate8 Im not sure if this is what you exactly need but there is a function in MathUtils called "newCoordFromBearingAndDistance()" It takes a bearing and distance and gives back the new Latitude and longitude. So if you want to go forwards 3 meters you give it 0.0, 3. To go right it will be 90.0, 3.
Then just use goto() in the Control API with the new LatLong
I should have mentioned "newCoordFromBearingAndDistance()" also takes the current LatLong
Mar 08 2016 17:40
@MrTate8 The second question you’re asking is not really a dronekit-android but rather a general android question. You can use a handler and execute the next command in the runnable after a specified amount of time. I sugguest you read a bit about that here, long)