Mavlink Stuck at &msg

I'm trying to set new waypoint to APM, but to start with, i'm just trying to send it to QGC.

The command

mavlink_msg_global_position_pack(1, 1, &msg, millis(), 44.584237, 29.239516, new_alt, 0, 0, 2);

does nothing.

I'm wondering, what do I have to include to that "msg" ? Shouldn't checksum, sequence, length etc be filled by MavLink?

So far, haven't found if MavLink is as simple as one command (ex. the position) and i'm searching the internet (and especially diydrones).

Tried xml generator, but isn't that for custom messages? Which, apparently, i don't need since i want to send data, not do custom things?

My complete (simple) code which compiles without errors.

#include <FastSerial.h>
#include "../mavlink/include/mavlink.h"        // Mavlink interface
int new_alt = 20;
void setup() {
    Serial.begin(57600);}

void loop() {
    mavlink_message_t msg;
    uint8_t buf[MAVLINK_MAX_PACKET_LEN];
        uint16_t len = mavlink_msg_to_send_buffer(buf, &msg);

    mavlink_msg_global_position_pack(1, 1, &msg, millis(), 40.584757, 22.959516, new_alt, 0, 0, 2);
    Serial.write(buf, len);
        delay(10);
        new_alt += 2;
}

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

Join diydrones

Email me when people reply –

Activity

Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21
More…