I can't include the MAVlink v2 library in Arduino

981 views
Skip to first unread message

8HOKEIAAC

unread,
Jun 1, 2021, 8:55:40 AM6/1/21
to MAVLink
Hello,

How can I use the  c_library_v2 (https://github.com/mavlink/c_library_v2)? It seems that it doesn't include the "mavlink.h" file directly when I import it to my Arduino project. 

I have downloaded the library and included it with the predefined option in the Arduino IDE, bu I always get the same error:

Screenshot_4.png

I am using the PX4 autopilot.

Best regards

Hamish Willee

unread,
Jun 1, 2021, 8:55:45 PM6/1/21
to MAVLink
I haven't tried this, but I suggest you look at the example here: https://github.com/mavlink/c_uart_interface_example

This includes the header as shown:
#include <common/mavlink.h>

If that doesn't help, you might also post on PX4 discuss: https://discuss.px4.io/c/mavlink/23

8HOKEIAAC

unread,
Jun 2, 2021, 6:39:12 AM6/2/21
to MAVLink
Hi there,
I have tried that, and the result is very similar. It gives an "error compiling to the Adafruit ESP32 Feather". But now it doesn't even say what is that error.
I also posted a thread in PX4 forum (https://discuss.px4.io/t/missing-header-files-in-mavlink-library/22593), and I am waiting for answers. I guess I just need to wait for someone to answer me here or there.
Best

8HOKEIAAC

unread,
Jun 2, 2021, 10:54:22 AM6/2/21
to MAVLink
UPDATE: I pasted only the common folder in the libraries, and drag the "protocol.h", "mavlink_types.h", etc., files into that folder.
Now I manage to get some messages (the ones I was getting before I tried this, from and older mavlink library), but not all of them. 

It’s very odd because they are all in the same library, in the same folder, but I can get some but the ones I want I can’t. The “common” folder of the “c_library_v2” is the only folder that I have there.

Why is this happening?
Message has been deleted

Patrick JP

unread,
Sep 16, 2022, 10:17:48 AM9/16/22
to mav...@googlegroups.com
Hi,

I have created a minimal arduino example here: https://github.com/patrickelectric/minimal-arduino-mavlink-example

Em sex., 16 de set. de 2022 às 07:54, Alejandro Pariente Migoya <alejan...@gmail.com> escreveu:
You need to create a header file lets say "mavlinkv2.h" in the root folder /mavlink and that one should look like that:

#ifndef MAVLINK_H
#define MAVLINK_H

#ifndef MAVLINK_STX
#define MAVLINK_STX 254
#endif

#ifndef MAVLINK_ENDIAN
#define MAVLINK_ENDIAN MAVLINK_LITTLE_ENDIAN
#endif

#ifndef MAVLINK_ALIGNED_FIELDS
#define MAVLINK_ALIGNED_FIELDS 1
#endif

#ifndef MAVLINK_CRC_EXTRA
#define MAVLINK_CRC_EXTRA 1
#endif
 
#include "all/all.h" //all or the dialect you desire
#include "protocol.h"


#endif // MAVLINK_H

then from arduino just call #include <mavlinkv2.h>

hope it helps
--
Sie erhalten diese Nachricht, weil Sie in Google Groups E-Mails von der Gruppe "MAVLink" abonniert haben.
Wenn Sie sich von dieser Gruppe abmelden und keine E-Mails mehr von dieser Gruppe erhalten möchten, senden Sie eine E-Mail an mavlink+u...@googlegroups.com.
Wenn Sie diese Diskussion im Web verfolgen möchten, rufen Sie https://groups.google.com/d/msgid/mavlink/9b9da0ac-73a9-41ba-8f6c-321d99a551c0n%40googlegroups.com auf.


--
Patrick José Pereira
Electronics Engineer

ALEJANDRO PARIENTE MIGOYA

unread,
Sep 18, 2022, 3:21:30 AM9/18/22
to mav...@googlegroups.com

Hi,

 

That’s great, my problem is that even though I can include the library properly, it is causing memory problems when uploading the program to Arduino Uno. It is not normal, idk why….

 

Thanks,

 

Alejandro

Hello,

I am using the PX4 autopilot.

Best regards

--
Sie erhalten diese Nachricht, weil Sie in Google Groups E-Mails von der Gruppe "MAVLink" abonniert haben.
Wenn Sie sich von dieser Gruppe abmelden und keine E-Mails mehr von dieser Gruppe erhalten möchten, senden Sie eine E-Mail an mavlink+u...@googlegroups.com.
Wenn Sie diese Diskussion im Web verfolgen möchten, rufen Sie https://groups.google.com/d/msgid/mavlink/9b9da0ac-73a9-41ba-8f6c-321d99a551c0n%40googlegroups.com auf.


 

--

Patrick José Pereira
Electronics Engineer

--
Sie erhalten diese Nachricht, weil Sie in Google Groups ein Thema der Gruppe "MAVLink" abonniert haben.
Wenn Sie sich von diesem Thema abmelden möchten, rufen Sie https://groups.google.com/d/topic/mavlink/sN88hoCPA8k/unsubscribe auf.
Wenn Sie sich von dieser Gruppe und allen Themen dieser Gruppe abmelden möchten, senden Sie eine E-Mail an mavlink+u...@googlegroups.com.
Wenn Sie diese Diskussion im Web verfolgen möchten, rufen Sie https://groups.google.com/d/msgid/mavlink/CANN23N%3DfKy2y3Bf8cYUe7sO12K8rjtHXt1voNWCmZLXqyKNiyA%40mail.gmail.com auf.

 

Reply all
Reply to author
Forward
0 new messages