4
$\begingroup$

I'm developing a program for communicating with Ardupilot using Mavlink. I've generated code based on the Mavlink definition for Ardupilot, and I have the basic communication working.

What I can't figure out, is how to request Ardupilot to send a specific Mavlink message. I'd like Ardupilot to send me Mavlink message Attitude (#30) every second. How can I do this?

$\endgroup$
  • $\begingroup$ I would like take gps location of ardupilot like as above. I understand there is location but how to print in my serial monitor. Can you help me $\endgroup$ – Can Aydın Feb 5 '15 at 13:46
3
$\begingroup$

If you carefully go through Ardupilot code, you will find all the mavlink communication related function are put in file GCS_Mavlink.pde. If you wish to receive particular message you will have to look into and modify this file.

Mavlink message attitude(#30) is handled in this function within ardupliot. So you will have to modify and the ardupilot code and call this function at desired time interval. Similarly you can find relevant functions for desired messages already build within code.

If you wish to send any mavlink message on your own then I would suggest you to go through particular mavlink message file. All transfer functions related to particular message are defined within message file. For example, in order to send attitude(#30), go to mavlink_msg_attitude.h and refer to function mavlink_msg_attitude_send().

One should also refer here for more mavlink related information.

$\endgroup$
0
$\begingroup$

nikhil's answer is not correct: You definitely don't have to change the ArduCopter code just to get it to stream ATTITUDE messages (if that were true, how are all the ground control station apps showing the vehicle's changing attitude?)

In ArduCopter, the ATTITUDE message is streamed at a constant rate in Hz that is determined by the value of the SR0_EXTRA1 parameter. I think the default rate is 10 Hz, but you should check the value of that parameter on your vehicle. You may also want to check the values of SR0_EXTRA2 and SR0_EXTRA3.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.