赞
踩
STX:数据包起始标志,0xFE;
STX:数据包起始标志,0xFD;
LEN:PAYLOAD的长度;
SEQ:数据包序号,0~255,每次发送一个数据包,序号就会累加,循环往复,用于检测丢包;
SYS ID:设备系统级的ID,表明自己的ID身份!
COMP ID:设备组件级的ID,一个相同系统可能有多个不同组件都使用MAVLink进行通信;
PAYLOAD:存放通信数据,可能是信息、命令等;
MAVPACKED(
typedef struct __mavlink_message {
uint16_t checksum; ///< sent at end of packet
uint8_t magic; ///< protocol magic marker
uint8_t len; ///< Length of payload
uint8_t seq; ///< Sequence of packet
uint8_t sysid; ///< ID of message sender system/aircraft
uint8_t compid; ///< ID of the message sender component
uint8_t msgid; ///< ID of message in payload
uint64_t payload64[(MAVLINK_MAX_PAYLOAD_LEN+MAVLINK_NUM_CHECKSUM_BYTES+7)/8];
}) mavlink_message_t;
MAVPACKED(
typedef struct __mavlink_message {
uint16_t checksum; ///< sent at end of packet
uint8_t magic; ///< protocol magic marker
uint8_t len; ///< Length of payload
uint8_t incompat_flags; ///< flags that must be understood
uint8_t compat_flags; ///< flags that can be ignored if not understood
uint8_t seq; ///< Sequence of packet
uint8_t sysid; ///< ID of message sender system/aircraft
uint8_t compid; ///< ID of the message sender component
uint32_t msgid:24; ///< ID of message in payload
uint64_t payload64[(MAVLINK_MAX_PAYLOAD_LEN+MAVLINK_NUM_CHECKSUM_BYTES+7)/8];
uint8_t ck[2]; ///< incoming checksum bytes
uint8_t signature[MAVLINK_SIGNATURE_BLOCK_LEN];
}) mavlink_message_t;
0.mavlink github
git clone https://github.com/mavlink/mavlink.git
1.ModuleNotFoundError: No module named ‘pymavlink.generator’
# https://blog.csdn.net/qq_41256129/article/details/117202591
pip install pymavlink
pip如果需要升级
python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple/
python mavgenerate.py
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。