Receive Mavlink Message

452 views
Skip to first unread message

Enzo Buono

unread,
Sep 22, 2015, 5:24:32 AM9/22/15
to MAVLink
Hi to all,
I created a custom GCS application, it works fine but recently I have a problem. When I use my GCS for the first time, I can receive only 2 messages: Heartbeat and another message created by me. I can't read another messages like GPS_RAW_INT,it seems that the drone sends me only Heartbeat and a my custom message, but I can send every type of command. But If I connect first with Mission Planner then disconnect and after connect with my GCS I can read all the messages with my application. I don't understand why. I use a c++ application with a similar code for receiving message:

static void communication_receive(void)
{
	mavlink_message_t msg;
	mavlink_status_t status;
 
	// COMMUNICATION THROUGH EXTERNAL UART PORT (XBee serial)
 
	while(uart0_char_available())
	{
		uint8_t c = uart0_get_char();
		// Try to get a new message
		if(mavlink_parse_char(MAVLINK_COMM_0, c, &msg, &status)) {
			// Handle message
 
			switch(msg.msgid)
			{
			        case MAVLINK_MSG_ID_HEARTBEAT:
			        {
				  // E.g. read GCS heartbeat and go into
                                  // comm lost mode if timer times out
			        }
			        break;
			case MAVLINK_MSG_ID_COMMAND_LONG:
				// EXECUTE ACTION
				break;

Thomas Lillis

unread,
Feb 7, 2016, 2:16:11 AM2/7/16
to MAVLink
Hey Enzo,

You may need to request that you get all the packets. Try out what this post suggests:

Reply all
Reply to author
Forward
0 new messages