Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting specific mavlink message #403

Closed
santiandres33 opened this issue May 6, 2016 · 2 comments

Comments

@santiandres33
Copy link

@santiandres33 santiandres33 commented May 6, 2016

Hey Guys,

I am working with dronekit Android, and I am trying to get an specific mavlink message (25), although I don't why I am not getting it. Also try getting any other message but same result. Any thought maybe be very appreciated,

msg_message_interval msgMessageInterval = new msg_message_interval();
msgMessageInterval.message_id = 25;
msgMessageInterval.interval_us = 10;

            MavlinkMessageWrapper mavlinkMessageWrapper = new MavlinkMessageWrapper(msgMessageInterval);

            Log.d("REQUESTED MAV",mavlinkMessageWrapper.getMavLinkMessage().toString());

            ExperimentalApi.getApi(MainActivity.drone).sendMavlinkMessage(mavlinkMessageWrapper);

            MainActivity.drone.addMavlinkObserver(new MavlinkObserver() {
                @Override
                public void onMavlinkMessageReceived(MavlinkMessageWrapper mavlinkMessageWrapper) {
                    Log.d("Received Mavlinks:",mavlinkMessageWrapper.getMavLinkMessage().toString());

// Toast.makeText(getBaseContext(),mavlinkMessageWrapper.getMavLinkMessage().toString(),Toast.LENGTH_LONG).show();

@chaviw

This comment has been minimized.

Copy link

@chaviw chaviw commented Jul 20, 2016

Try switching the order when you add the observer and when you send the mavlink message.
It's always possible that the app is getting a response before you register the observer.

Also are you sure there's a response for that message?

Your code should be

MainActivity.drone.addMavlinkObserver(new MavlinkObserver() {
     @Override
     public void onMavlinkMessageReceived(MavlinkMessageWrapper mavlinkMessageWrapper) {           
         Log.d("Received Mavlinks:",mavlinkMessageWrapper.getMavLinkMessage().toString());
         //Toast.makeText(getBaseContext(),mavlinkMessageWrapper.getMavLinkMessage().toString(),Toast.LENGTH_LONG).show();

ExperimentalApi.getApi(MainActivity.drone).sendMavlinkMessage(mavlinkMessageWrapper);
@m4gr3d

This comment has been minimized.

Copy link
Member

@m4gr3d m4gr3d commented Jul 20, 2016

@santiandres33 In addition, make sure your drone object is connected and receiving telemetry before adding the mavlink observer object.
Also, I'm closing this issue, since this type of questions should be addressed to the gitter channel: https://gitter.im/dronekit/dronekit-android

@m4gr3d m4gr3d closed this Jul 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.