MAV_CMD_NAV_WAYPOINT - with mavlink?

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;3691019812?profile=original

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

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • 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.

  • 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?

This reply was deleted.

Activity

DIY Robocars via Twitter
16 hours ago
DIY Robocars via Twitter
RT @SahikaGenc: AWS DeepRacer & Hot Wheels Track https://youtu.be/4H0Ei07RdR4 via @YouTube
Sep 14
DIY Robocars via Twitter
Sep 8
DIY Robocars via Twitter
RT @davsca1: We are releasing the code of our Fisher Information Field, the first dedicated map for perception-aware planning that is >10x…
Sep 8
DIY Robocars via Twitter
RT @SmallpixelCar: How this works: 1)object detection to find cones in single camera image, 30 frames/sec on @NVIDIAEmbedded Xavier. 2)comp…
Sep 8
DIY Robocars via Twitter
RT @SmallpixelCar: Use two color cones to guide the robocar. No map needed, on onsite training needed. Just place the cones and it will fol…
Sep 7
DIY Robocars via Twitter
Sep 7
DIY Robocars via Twitter
RT @roboton_io: Great to see http://roboton.io running at 60fps on the cheapest #chromebook we could find! #edtech #robotics #educat…
Sep 3
DIY Robocars via Twitter
RT @openmvcam: Crazy in-depth article about using the OpenMV Cam for Astrophotography: https://github.com/frank26080115/OpemMV-Astrophotography-Gear https://t.co/BPoK9QDEwS
Sep 3
DIY Robocars via Twitter
RT @openmvcam: Hi folks, it's finally here! Our first draft of our Arduino Interface Library is out! It works over SoftwareSerial, Hardware…
Sep 3
DIY Robocars via Twitter
RT @chr1sa: Please let them have an open API. This would be perfect for @DIYRobocars races https://twitter.com/NintendoAmerica/status/1301513099707658246
Sep 3
DIY Robocars via Twitter
RT @SmallpixelCar: Lanenet pretty much used all my GPU power on @NVIDIAEmbedded Xavier since I optimized with tensorRT. I need to run anoth…
Sep 3
xemone liked Max Gilson's profile
Aug 31
DIY Robocars via Twitter
RT @LyftLevel5: Our @kaggle competition on Motion Prediction for Autonomous Vehicles is now live! Experiment with the largest-ever self-dri…
Aug 24
DIY Robocars via Twitter
RT @chr1sa: Our next @DIYRobocars virtual AI car race will be on Sept 26th. Sign up here https://www.meetup.com/DIYRobocars/events/272786977/ https://t.co/UENKGSOWO8
Aug 24
DIY Robocars via Twitter
New ready-to-run @NVIDIAEmbedded JetRacer car from Waveshare. Perfect for the next @diyrobocars race as soon as we… https://twitter.com/i/web/status/1297960223013867520
Aug 24
More…