These are chat archives for dronekit/dronekit-android

3rd
Sep 2015
Glen Gregory
@ggregory8
Sep 03 2015 01:10
I'm thinking extra attribute EXTRA_AUTOPILOT_MESSAGE should contain the message. So I am successfully detecting the message event but the extra attribute always seems to be Null i.e I get this alert on my app 'Message: Null'. Is there a special type I should be using instead of String?
''' @Override
public void onDroneEvent(String event, Bundle extras) {
    switch (event) {
        // GG TODO
        case AttributeEvent.AUTOPILOT_MESSAGE:
            String message = this.drone.getAttribute(AttributeEventExtra.EXTRA_AUTOPILOT_MESSAGE);

            alertUser("Message: " + message);
            break;
        '''
Fredia Huya-Kouadio
@ne0fhyk
Sep 03 2015 01:11
the attribute is part of the bundle 'extras'
so to retrieve it, you can use 'extras.getString(AttributeEventExtra.EXTRA_AUTOPILOT_MESSAGE)'
@ggregory8 the drone.getAttribute(...) method only accepts strings from the AttributeType class.
Glen Gregory
@ggregory8
Sep 03 2015 01:17
@ne0fhyk Great thanks for that! Exactly what I was after.
Glen Gregory
@ggregory8
Sep 03 2015 03:53
@ne0fhyk Any idea how to send do_set_home command to the UAV, is this available in the API? Are there any helpful API tools to construct mavlink messages yourself?
Fredia Huya-Kouadio
@ne0fhyk
Sep 03 2015 05:43
@ggregory8 it's being worked on, but not yet available.
for the moment, you can construct the corresponding mavlink message through the ExperimentalApi#sendMavlinkMessage(...))
Fredia Huya-Kouadio
@ne0fhyk
Sep 03 2015 05:49
and you can listen for upcoming mavlink messages by registering a MavLinkObserver object through the Drone#addMavlinkObserver) method.
Glen Gregory
@ggregory8
Sep 03 2015 06:01
Thanks. I'm still learning Android, whats the correct way to assign it? Something like
private ExperimentalApi exDrone;
exDrone = new ExperimentalApi();
Fredia Huya-Kouadio
@ne0fhyk
Sep 03 2015 06:06
for the latest available version of the library (v2.5.23), you can do
ExperimentalApi expApi = ExperimentalApi.getApi(drone);
where the drone instance is obtained as described in the guide.
Glen Gregory
@ggregory8
Sep 03 2015 06:07
Ok thanks. Are there helper functions for constructing the MavlinkMsg?
Sorry 'MavlinkMessage' for the MavlinkMessageWrapper
Fredia Huya-Kouadio
@ne0fhyk
Sep 03 2015 06:09
that version though introduced a new style to the api that we're still in the process of documenting, but the javadocs should be updated by tomorrow.
there's no helper functions for the mavlink msg, as that is an advanced api, that we typically discourage ppl from using unless absolutely necessary.
Glen Gregory
@ggregory8
Sep 03 2015 06:14
I'm using version 2.3 as per docs might look at using latest. When will do-set-home officially be added to api?
Fredia Huya-Kouadio
@ne0fhyk
Sep 03 2015 06:15
do-set-home will be added in version 2.6
Glen Gregory
@ggregory8
Sep 03 2015 06:19
Any rough timeframe on that? And rough timeframe on new documentation for new api style?
Thanks for your help though. I'll need to learn some more of java basics. Thought it might be quite similar to the python api but its very different.