Hello,

Im current build and arduino based follow me box, I've got my apm and arduin oboards talking nicely over mavlink, i can read and send heartbeats happily, I'm now try to send a MAV_CMD_NAV_WAYPOINT as explained  here. I'm now trying to send my apm a set of co-ordinates to travel to (to be an offset from the gps connected - not connected at present)

By looking some other code around, notably in the follow-me code from the github repo here.

I've created the following MAVLink command based off the official follow-me code using a 

mavlink_msg_mission_item

//TARGET DRONE
uint8_t _target_system = 178; // Target drone id of 178
uint8_t _target_component = 0; // Target component, 0 = all

uint16_t seq = 0; // Sequence is always set to 0
uint8_t frame = MAV_FRAME_GLOBAL; // Set target frame to global default
uint16_t command = MAV_CMD_NAV_WAYPOINT; // Specific command for APM as it uses different paramters than the standard MAVLINK implementation
uint8_t current = 2; // Guided mode waypoint
uint8_t autocontinue = 0; // Always 0
float param1 = 0; // Loiter time
float param2 = 1; // Acceptable range from target - radius in meters
float param3 = 0; // Pass through waypoint
float param4 = 0; // Desired yaw angle
float x = 52.464217; // Latitude - degrees
float y = -1.280222; // Longitude - degrees
float z = 200; // Altitude - meters

// Initialize the required buffers
mavlink_message_t msg;
uint8_t buf[MAVLINK_MAX_PACKET_LEN];

// Pack the message
// NOTE : _target_systen & _target_component are defined in setup
// found by searching mission item .h from mavlink library
mavlink_msg_mission_item_pack(sysid,compid, &msg, _target_system, _target_component, seq, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z);

// Copy the message to the send buffer
uint16_t len = mavlink_msg_to_send_buffer(buf, &msg);

I've intercepted the command using QGC and it looks like this;

This however doesn't match exactly what the APM wants for a MAV_CMD_NAV_WAYPOINT, all the infomation the comand needs are there, but I am sending more information, will the APM just ignore this, and also do i have to fly in auto or guided mode?

I'm just looking for some clarification , specifically if I am correctly implement a MAV_CMD_NAV_WAYPOINT command within a mavlink_msg_mission_item packet?

Any help would be HUGELY appreciated,

Thanks!

Matt

Views: 4581

Reply to This

Replies to This Discussion

Matthew, I am interested in you work here. I am doing something similar and I have yet to understand exactly what the APM (Quadcopter in my case) wants in the mission_item message. I have formatted my messages very similar to the way you have. I have two questions for you. 

1. have you successfully completed you project.

2. What is the parameter 'current' supposed to be set to? I have seen a number of cases where it is set to 2 for guided mode waypoints though I don't see the documentation for this anywhere. In common.xml it says that the 'current' parameter is to be set to 0 or 1. Do you know why there is this discrepancy and can you point me in the right direction to understand it. 

I would like to be able to send Waypoints to my copter no matter what type e.g. guided mode, follow me, or just a mission. Any information you can give would be helpful.

Thanks, Aaron

Hello, I am currently working on a project quite similar to this as well?? I would please like to know if you succesfully completed yours. As I just have a few questions?

Hi, i have the same project as yours, can you please share with us the way you start, my problem is that i can't find libraries for mavlink on the arduino, i've found some but there is always an error somewhere, can you please post the libraries that you used.

your help will be appreciated.
BH.

Reply to Discussion

RSS

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service