Sending waypoints throgh Mavlink in Mission Mode

Ground Stations and utilities for Windows, Linux, Android, & others

Sending waypoints throgh Mavlink in Mission Mode

Postby Grigoriy » Wed Nov 16, 2016 8:27 pm

Hello,

For some reason, I could not find such a simple question on the forum..

I try to send mission commands to AQ6, according to description here: http://qgroundcontrol.org/mavlink/waypoint_protocol
I do not receive WAYPOINT_REQUEST_LIST (I receive only messages with IDs: 30, 35, 36, 26, 24, 29, 1 and 0, which are heartbeat, status of the UAV, etc.). https://pixhawk.ethz.ch/mavlink/

I send to serial port Waypoint_Count (with a number of WPs equal to 1) and listen on a serial port. I see only msg.msgid-s mentioned above (0,1, 30, 35, etc).
Do you have any ideas what I should check and how to fix the issue that the AQ6 doesn't send me Waypoint_Request ? (I expect to see #40, with Mission_Request).

What I use: AQ6 (I think the version of the firmware is 6.6), RaspberryPi2 (I connect it to a serial port of the AQ6), Wi-Fi module connected to RaspberryPi.

Thank you for your time!

P.S.1.
I send amount of waypoints as follows:
uint8_t buf[MAVLINK_MAX_PACKET_LEN];
mavlink_msg_mission_count_pack(UGVSYSID, UGVCOMPID, &msg, Dquad2SYSID, Dquad2COMPID, 1);
uint16_t len = mavlink_msg_to_send_buffer(buf, &msg);
serial.serialsendf((const char*)buf,len);

I read serial port as follows:
serial.serialreceive(&buf2,1);
int request = mavlink_parse_char(MAVLINK_COMM_0, buf2, &msg_rec, &status);

if(msg_rec.msgid!=30 && msg_rec.msgid!=35 && msg_rec.msgid!=36 && msg_rec.msgid!=26 && msg_rec.msgid!=24 && msg_rec.msgid!=29 && msg_rec.msgid!=1 && msg_rec.msgid!=0){
printf("Received from serial port, id: %d \n", msg_rec.msgid);
}

It receives nothing related to Waypoint_Request...
Grigoriy
 
Posts: 18
Joined: Fri Sep 30, 2016 1:32 am

Re: Sending waypoints throgh Mavlink in Mission Mode

Postby Max » Wed Nov 16, 2016 11:18 pm

Hi Grigoriy,

The protocol documentation is a bit misleading and simplified, I think. There's no WAYPOINT_REQUEST or WAYPOINT_anything message in MAVLink, for instance. The message names are actually prefixed with "MISSION".

The proper answer to MISSION_COUNT is a MISSION_ACK followed by MISSION_REQUEST message with seq=0. After that AQ expects a MISSION_ITEM message with seq=0, after which it will request the next wpt using a new MISSION_REQUEST message with seq=1.... and so on until the number of wpts specified in the original MISSION_COUNT message.

To fully understand what AQ is expecting/doing, I suggest reading aq_mavlink.c source for whichever AQ firmware version you're using. There have been some changes over time, though the basic mission programming sequence hasn't changed.

HTH,
-Max
Max
 
Posts: 2814
Joined: Mon Aug 13, 2012 9:45 pm
Location: Near Ithaca, NY, USA

Re: Sending waypoints throgh Mavlink in Mission Mode

Postby Max » Wed Nov 16, 2016 11:25 pm

PS. Make sure the target_system parameter is correct in your MISSION_COUNT message. It needs to match the MAV_ID AQ sends at startup and as system_id field in each Mavlink message. Otherwise your message will be ignored (and same for any other mission/command message).
Max
 
Posts: 2814
Joined: Mon Aug 13, 2012 9:45 pm
Location: Near Ithaca, NY, USA

Re: Sending waypoints throgh Mavlink in Mission Mode

Postby Grigoriy » Thu Nov 17, 2016 8:52 pm

Thank you for your very detailed answer!
Indeed, I found out that in my case the sysID I used was a wrong one. The UAV just ignored my commands.
Grigoriy
 
Posts: 18
Joined: Fri Sep 30, 2016 1:32 am


Return to AQ Software

Who is online

Users browsing this forum: No registered users and 1 guest

cron