搜索
bottom↓
回复: 6

求教MWC飞控上位机软件串口传送格式

[复制链接]

出0入0汤圆

发表于 2013-2-14 23:00:09 | 显示全部楼层 |阅读模式
想用MWC的上位机软件调试四轴,但不知道串口的传送格式,最好是一幅数据的完整数据格式,每个字节或位的定义,双向传送的格式,望高手指教,谢谢!

阿莫论坛20周年了!感谢大家的支持与爱护!!

知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)

出0入0汤圆

 楼主| 发表于 2013-2-14 23:04:00 | 显示全部楼层
就是通讯协议.

出0入0汤圆

发表于 2013-2-15 12:28:33 来自手机 | 显示全部楼层
你用串口监控软件分析下   就行   我之前做过  现在忘了   现在用的自己的上位机

出0入0汤圆

发表于 2013-2-15 13:05:01 | 显示全部楼层
MultiWii Serial Protocol

updated 04 July

Multiwii serial protocol was redesigned:
• 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
• 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 I was looking for.
Even with a partial implementation, the predefined structures are not light enough for what I have in mind.
Some messages are however inspired from mavlink structure.

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 new parameters 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
MSP_SERVO
8 servos
MSP_MOTOR
8 motors
MSP_RC
8 rc chan
MSP_RAW_GPS
fix, numsat, lat, lon, alt, speed
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
MSP_BOX
tabl of 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, allowing an easier extension for future checkbox)
MSP_PIDNAMES
the textual PID names
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

multiwii input message
MSP_SET_RAW_RC
8 rc chan: it's a way to command multiwii via a "serial RC transmitter"
MSP_SET_RAW_GPS
fix, numsat, lat, lon, alt, speed: it's a way to inject in multiwii GPS data coming for instance from an OSD with an integrated GPS
MSP_SET_PID
8 P I D
MSP_SET_BOX
11 checkbox
MSP_SET_RC_TUNING
rc rate, rc expo, rollpitch rate, yaw rate, dyn throttle PID
MSP_ACC_CALIBRATION
to calibrate ACC
MSP_MAG_CALIBRATION
to calibrate 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

出0入0汤圆

 楼主| 发表于 2013-2-15 17:38:28 | 显示全部楼层
wangjt1988 发表于 2013-2-15 12:28
你用串口监控软件分析下   就行   我之前做过  现在忘了   现在用的自己的上位机 ...

我用过你的上位机,很好用,谢谢,希望以后多交流,你是电力系统的?

出0入0汤圆

 楼主| 发表于 2013-2-15 17:39:30 | 显示全部楼层
elsonx 发表于 2013-2-15 13:05
MultiWii Serial Protocol

updated 04 July

谢谢,

出0入0汤圆

发表于 2013-2-15 19:21:15 | 显示全部楼层
bg4aew 发表于 2013-2-15 17:38
我用过你的上位机,很好用,谢谢,希望以后多交流,你是电力系统的?

学的电气专业
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-7-23 23:32

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表