mavlink/c_uart_interface_example

How to add new message?

promistrio opened this issue · 0 comments

Good day! I add new message in https://github.com/mavlink/mavlink use ./mavgenerate.py (for 1.0) and replace common on generated common. After that, I got a lot of errors. How should I create a new message?

g++ -I mavlink/include/mavlink/v1.0 mavlink_control.cpp serial_port.cpp autopilot_interface.cpp -o mavlink_control -lpthread In file included from mavlink/include/mavlink/v1.0/common/common.h:1269:0, from mavlink/include/mavlink/v1.0/common/mavlink.h:32, from mavlink_control.h:70, from mavlink_control.cpp:56: mavlink/include/mavlink/v1.0/common/./mavlink_msg_heartbeat.h:7:38: error: types may not be defined in parameter types typedef struct __mavlink_heartbeat_t { ^ In file included from mavlink/include/mavlink/v1.0/common/common.h:1269:0, from mavlink/include/mavlink/v1.0/common/mavlink.h:32, from mavlink_control.h:70, from mavlink_control.cpp:56: mavlink/include/mavlink/v1.0/common/./mavlink_msg_heartbeat.h:14:1: error: typedef declaration invalid in parameter declaration }) mavlink_heartbeat_t; ^ mavlink/include/mavlink/v1.0/common/./mavlink_msg_heartbeat.h:14:4: error: expected constructor, destructor, or type conversion before ‘mavlink_heartbeat_t’ }) mavlink_heartbeat_t; ^ mavlink/include/mavlink/v1.0/common/./mavlink_msg_heartbeat.h: In function ‘uint16_t mavlink_msg_heartbeat_pack(uint8_t, uint8_t, mavlink_message_t*, uint8_t, uint8_t, uint8_t, uint32_t, uint8_t)’: mavlink/include/mavlink/v1.0/common/./mavlink_msg_heartbeat.h:80:5: error: ‘mavlink_heartbeat_t’ was not declared in this scope mavlink_heartbeat_t packet; ^ mavlink/include/mavlink/v1.0/common/./mavlink_msg_heartbeat.h:81:5: error: ‘packet’ was not declared in this scope packet.custom_mode = custom_mode; ^ mavlink/include/mavlink/v1.0/common/./mavlink_msg_heartbeat.h:92:159: error: too many arguments to function ‘uint16_t mavlink_finalize_message(mavlink_message_t*, uint8_t, uint8_t, uint8_t, uint8_t)’ return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_HEARTBEAT_LEN, MAVLINK_MSG_ID_HEARTBEAT_CRC); ^ In file included from mavlink/include/mavlink/v1.0/common/../protocol.h:79:0, from mavlink/include/mavlink/v1.0/common/common.h:30, from mavlink/include/mavlink/v1.0/common/mavlink.h:32, from mavlink_control.h:70, from mavlink_control.cpp:56: mavlink/include/mavlink/v1.0/common/../mavlink_helpers.h:99:25: note: declared here MAVLINK_HELPER uint16_t mavlink_finalize_message(mavlink_message_t* msg, uint8_t system_id, uint8_t component_id, ^ In file included from mavlink/include/mavlink/v1.0/common/common.h:1269:0, from mavlink/include/mavlink/v1.0/common/mavlink.h:32, from mavlink_control.h:70, from mavlink_control.cpp:56: mavlink/include/mavlink/v1.0/common/./mavlink_msg_heartbeat.h: In function ‘uint16_t mavlink_msg_heartbeat_pack_chan(uint8_t, uint8_t, uint8_t, mavlink_message_t*, uint8_t, uint8_t, uint8_t, uint32_t, uint8_t)’: mavlink/include/mavlink/v1.0/common/./mavlink_msg_heartbeat.h:123:5: error: ‘mavlink_heartbeat_t’ was not declared in this scope mavlink_heartbeat_t packet; ^ mavlink/include/mavlink/v1.0/common/./mavlink_msg_heartbeat.h:124:5: error: ‘packet’ was not declared in this scope packet.custom_mode = custom_mode; ^ mavlink/include/mavlink/v1.0/common/./mavlink_msg_heartbeat.h:135:170: error: too many arguments to function ‘uint16_t mavlink_finalize_message_chan(mavlink_message_t*, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)’ return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_HEARTBEAT_LEN, MAVLINK_MSG_ID_HEARTBEAT_CRC); ^