查看: 1610|回复: 0

基于 Arduino 的 MultiWii 飞控的 MSP 协议。

[复制链接]
  • TA的每日心情
    开心
    2018-11-18 00:25
  • 签到天数: 238 天

    [LV.7]常住居民III

    发表于 2018-8-18 15:40 | 显示全部楼层 |阅读模式
    MSP 协议.

    MultiWii Serial Protocol

    updated 04 July


    Multiwii serial protocol was redesigned:
    MSG协议已经重新设计:

    • to     be light, as before
    • 轻量级
    • to     be generic: it can be used transparenlty by a GUI, OSD, telemetry     or home made config tool.
           ie no more specific OSD code should be coded in multiwii
    • 通用, 有OSD兼容。
    • to     be bit wire efficient: only requested data are transmitted in a     binary format
    • 高效,以二进制格式发送。
    • to     be quite secure: data are sent with a checksum, preventing     corrupted configuration to be injected.
    • 安全,数据校验码。
    • to     be header sensitive: as it is designed with a specific header, it can be     mixed with other frame, like GPS frame
           ie, it will be possible to connect either a GUI or a GPS on the same     serial port without changing the conf
    • 支持头部跟踪。
    • to     be less sensitive to evolutions:
           ie in case of parameter evolution, the main protocol will remain     compatible and the GUI will be much less version dependent.
           variable data length allows to consider only the beginning of a message,     leaving the other octets at the end to extend transparently the message     (for instance to add a new PID)


    I thought first about an implementation of Mavlink, but I think it's not what Iwas looking for.
    Even with a partial implementation, the predefined structures are not lightenough for what I have in mind.
    Some messages are however inspired from mavlink structure.
    Mavlink 不够轻量级,但是部分结构参考了它。

    The main rule remains: Multiwii never sends something on its own.
    A request must be done in each case to retrieve or set data.
    Each messages received are acknowledged even if there is no data inside.
    原则:
    在没有数据请求时,飞控不发送任何数据。

    There are 2 main messages to consider:

    • request     message to multiwii
    • 请求飞控数据
    • multiwii     output message
    • 飞控返回数据

    request message to multiwii
    To request simple data without parameters / send a specific command / inject newparameters in multiwii
    messages are formated like this:
    $M>[data length][code][data][checksum]
    1 octet '$'
    1 octet 'M'
    1 octet '>'
    1 octet [data length]
    1 octet [code]
    several octets [data]
    1 octet [checksum]

    [data length] can be 0 in case of no param command

    multiwii output message
    messages are formated like this:
    $M>[data length][code][data][checksum]
    1 octet '$'
    1 octet 'M'
    1 octet '>'
    1 octet [data length]
    1 octet [code]
    several octets [data]
    1 octet [checksum]

    if the message is unknown:
    $M|[0][code][checksum]
    1 octet '$'
    1 octet 'M'
    1 octet '|'
    1 octet 0
    1 octet [unknown code]
    1 octet [checksum]


    list of message codes
    multiwii output message
    MSP_IDENT
    multitype + version
    硬件版本
    MSP_STATUS
    cycletime & errors_count & sensor present & box activation
    周期、错误数、传感器状态、激活状态
    MSP_RAW_IMU
    9 DOF output
    9自由度输出
    MSP_SERVO
    8 servos
    8个舵机
    MSP_MOTOR
    8 motors
    8个舵机
    MSP_RC
    8 rc chan
    8个Futaba遥控通道
    MSP_RAW_GPS
    fix, numsat, lat, lon, alt, speed
    GPS数据
    MSP_COMP_GPS
    distance to home, direction to home
    离家距离,离家方向
    MSP_ATTITUDE
    angles and heading
    航向
    MSP_ALTITUDE
    altitude
    高度
    MSP_BAT
    vbat, powermetersum
    电池、功
    MSP_RC_TUNING
    rc rate, rc expo, rollpitch rate, yaw rate, dyn throttle PID
    遥控参数
    MSP_PID
    table of P I D
    PID
    MSP_BOX
    tabl of checkbox
    CheckBox
    MSP_MISC
    powermeter trig
    其它
    MSP_MOTOR_PINS
    which pins are in use for motors & servos, for GUI
    电机、舵机对应引脚
    MSP_BOXNAMES
    the textual aux switch names (it's a way to build a more generic GUI, allowingan easier extension for future checkbox)
    MSP_PIDNAMES
    the textual PID names
    PID名称
    MSP_WP
    get a WP, WP# is in the payload, returns (WP#, lat, lon, alt, flags) WP#0-home,WP#16-poshold
    MSP_DEBUG
    debug1,debug2,debug3,debug4 variable

    multiwiiinput message
    MSP_SET_RAW_RC
    8 rc chan: it's a way to command multiwii via a "serial RCtransmitter"
    MSP_SET_RAW_GPS
    fix, numsat, lat, lon, alt, speed: it's a way to inject in multiwii GPS datacoming for instance from an OSD with an integrated GPS
    MSP_SET_PID
    8 P I D
    设置8个PID
    MSP_SET_BOX
    11 checkbox
    设置11个选项
    MSP_SET_RC_TUNING
    rc rate, rc expo, rollpitch rate, yaw rate, dyn throttle PID
    设置遥控选项
    MSP_ACC_CALIBRATION
    to calibrate ACC
    校准ACC
    MSP_MAG_CALIBRATION
    to calibrate MAG
    校准MAG
    MSP_SET_MISC
    powermeter trig
    设置其它
    MSP_RESET_CONF
    to reset all params to default (new feature)
    重置全部参数
    MSP_EEPROM_WRITE
    to write current params to EEPROM
    当前参数保存到EEPROM


    ===============================================================

    原始资料:
    [sf] MSP协议.pdf (113.04 KB, 下载次数: 26)
    您需要登录后才可以回帖 登录 | 立即注册  

    本版积分规则

    热门推荐

    求助灯带怎么用
    求助灯带怎么用
    买了灯带,不知道怎么用,点不亮啊,求大师指导
    【Arduino】168种传感器系列实验(136)---2路I2C电平转换模块
    【Arduino】168种传感器系
    【Arduino】168种传感器模块系列实验(136)---2路I2C电平转换模块 37款传感器与模块
    大家好,我叫Bunny Code
    大家好,我叫Bunny Code
    大家好,我叫Bunny Code,是新来的朋友,现在正式上线了,happy birthday to you,真
    【Arduino】108种传感器模块系列实验(104)---MAX30102手腕心率
    【Arduino】108种传感器模
    37款传感器与模块的提法,在网络上广泛流传,其实Arduino能够兼容的传感器模块肯定是
    呼吸灯实验
    呼吸灯实验
    本文节选自《Arduino程序设计基础》 之前的章节已经介绍了多种方法控制LED,但单是开
    Copyright   ©2015-2016  Arduino中文社区  Powered by©Discuz!   ( 蜀ICP备14017632号-3 )
    快速回复 返回顶部 返回列表