Ok, so I'm still very new to mavlink. My end goal is to use a microcontroller (either a PIC or a silabs 8051) to read in a mavlink datastream from a pixhawk, parse out a couple specific packets, and do stuff accordingly. I'm much more of a hardware guy than software guy, so go easy on me :)
So far I have:
1. Installed python 2.7
2. Downloaded, then double-clicked mavgenerate.py to run it.
2a. Selected common.xml, C language, protocol 1.0, and generated the source headers.
3. In MPLABx (Microchips PIC IDE), I make a new project, add #include <mavlink.h>, add the .h folders to the path, and get the following errors:
Using the XC8 PIC compiler:
other/common\common.h:28: error: (285) no identifier in declaration
other/common\common.h:28: warning: (374) missing basic type; int assumed
other/common\common.h:28: error: (285) no identifier in declaration
other/common\common.h:28: error: (314) ";" expected
Following this line:
#ifndef MAVLINK_MESSAGE_INFO
#define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, <redacted for brevity>
#endif
Using the HI-TECC PICC compiler I get a different set of errors for the snippet shown below.
other\mavlink_types.h:53: error: type specifier required for prototyped argument
other\mavlink_types.h:53: error: ")" expected
other\mavlink_types.h:53: error: "," expected
other\mavlink_types.h:53: error: can't mix prototyped and non-prototyped arguments
other\mavlink_types.h:53: error: type specifier required for prototyped argument
other\mavlink_types.h:53: error: type specifier required for prototyped argument
MAVPACKED(
typedef struct param_union {
union {
float param_float;
int32_t param_int32;
uint32_t param_uint32;
int16_t param_int16;
uint16_t param_uint16;
int8_t param_int8;
uint8_t param_uint8;
uint8_t bytes[4];
};
uint8_t type;
}) mavlink_param_union_t;
Oh, and both compilers give warnings about redefining preprocessor macros for every MAVLINK_MSG define.
Using the Keil C51 compiler, it has issues with the syntax around the same MAVPACKED union above.
C51 also doesn't have a native 64bit variable, so I think it's a moot point to continue.
Has anyone successfully compiled the mavlink code for a PIC or 8051? I only need basic functionality, so at this point I may just read and parse the data stream myself to look for the packets I need, but I was hoping to do it 'the right way', so if there are any changes made later on, I can easily make the changes.