These are chat archives for dronekit/dronekit-android

27th
Jan 2016
kalnir
@kalnir
Jan 27 2016 16:48
Hello - I am very new to dronekit and I have a question. I am trying to download the mission on a drone to my app and I wanted to know where the mission is loaded after MissionApi.loadWaypoints() is called
kalnir
@kalnir
Jan 27 2016 17:12
i.e. what variable I can use to access the mission after calling the loadWaypoints function
chaviw
@chaviw
Jan 27 2016 17:16
@kalnir When you call MissionApi.loadWaypoints() you will receive a event in your implementation of DroneListener.onDroneEvent(String event, Bundle extras). You need to make sure you register the listener in your Drone object by setting registerDroneListener(). The event that you will receive is AttributeEvent.MISSION_RECEIVED.
You can then get the mission items by retreiving the drone attribute AttributeType.MISSION.
Example: Mission droneMission = drone.getAttribute(AttributeType.MISSION);
kalnir
@kalnir
Jan 27 2016 17:18
Okay I am doing both of those but the droneMission size is always empty
chaviw
@chaviw
Jan 27 2016 17:18
@kalnir Have you loaded a mission onto the vehicle?
kalnir
@kalnir
Jan 27 2016 17:19
Yes, it shows up on Tower
chaviw
@chaviw
Jan 27 2016 17:19
Are you also receiving the onDroneEvent() with AttributeEvent.MISSION_RECEIVED
kalnir
@kalnir
Jan 27 2016 17:22
Yes, I am. The logs show that I am receiving the event, but I'm not able to access the mission itself
chaviw
@chaviw
Jan 27 2016 17:22
Can you post a snippet of your code?
kalnir
@kalnir
Jan 27 2016 17:24
Mission mission = drone.getAttribute(AttributeType.MISSION);
List<MissionItem> missionItems = mission.getMissionItems();
        for(int i = 0; i < missionItems.size(); i++) {
            Log.d("missionDownload", "Mission item - " + Integer.toString(i) + "/" + Integer.toString(missionItems.size()));
            MissionItem item = missionItems.get(i);
            if(item instanceof MissionItem.SpatialItem) {
                Log.d("missionDownload", "is spatial item");
                MissionItem.SpatialItem spatialItem = (MissionItem.SpatialItem)item;
                LatLongAlt coordinate = spatialItem.getCoordinate();
            }
This is in a function that is called after AttributeEvent.MISSION_RECEIVED is received
kalnir
@kalnir
Jan 27 2016 17:32
Not sure if this is relevant, but I am also unable to import com.o3dr.android.client.apis.MissionApi and hence having to use the deprecated call to loadWaypoints () via com.o3dr.android.client.Drone
chaviw
@chaviw
Jan 27 2016 17:35
@kalnir I don’t think that’s related. But the issue could still be related to the fact that you’re using an old version dronekit-android. Can you try using the latest found here https://bintray.com/3drobotics/maven/dronekit-android/view
This should also fix your import issue
kalnir
@kalnir
Jan 27 2016 17:38
Okay, I'll try that. Thank you for your help!
Mouli
@MouliKav
Jan 27 2016 21:47
Hi all
Mouli
@MouliKav
Jan 27 2016 21:55
Hi All, I am trying to set PWM values to channel 9, which is conneced to a motor, by using setServo and mavLink, but it doesn't work. I also tried the Experiemental API but no luck. Could you please help me with a solution?