I’ve been working at adding MSP (multiwii serial protocol) support to Ardupilot, right now the code is on a test branch on my github and is very likely to change a lot in the future
This thread will serve as the base to create proper documentation and as a central point to collect feedback on the implementation.
The protocol decoder is ported from betaflight/inav and supports both MSPV1 and MSPV2.
It also supports iNav MSPV2 sensor messages for lidar and optical flow.
It should work with Matek 3901-L0X but I haven’t tested it yet (hardware yet to arrive).
The protocol stack can work in 2 ways:
- command mode (the stack responds to external commands) SERIALn_PROTOCOL=29
- command mode + periodic telemetry (for external OSDs like DJI) SERIALn_PROTOCOL=30
Note the actual SERIAL_PROTOCOL number might change while waiting for the code to get into master, right now we can use 29 and 30
Matek 3901-L0X
Lidar confirmed as working by @Tobias0, flow untested as of now
SERIAL_PROTOCOL = 29
RNGFND_TYPE = 31
FLOW_TYPE = 7
BYTE FROST FPV
SERIAL_PROTOCOL = 30
Not tested yet but should work with minor changes.
This OSD system should work in command mode (the OSD air unit periodically asks for telemetry packets)
DJI FPV Goggles and DJI Goggles RE + Ocusync Air
SERIAL_PROTOCOL = 30
SERIAL_BAUD = 115
DJI FPV Goggles (v01.00.0500)
Goggles RE (v01.00.0700)
DJI Goggles are supported both by responding to MSP polling (default) and periodically sending telemetry packets.
To periodically send telemetry packets set MSP_OPTIONS = 1 (MSP_OPTIONS is a bitmask, bit 0 is EnbaleTelemetryMode, bit 1 is InvertWindDirection). Telemetry mode allows 1 wire connections between the Air Unit and the flight controller.
The goggles can render 24 OSD items, this implementation should support all of them.
The code has been initially flight tested by @MadRC which is also the main tester since I do not have any hardware to test with
OSD items can be enabled and moved on screen by using parameters MSP_OSD_*
To enable RSSI set MSP_OSD_RSSI_EN = 1, to move it on screen use MSP_OSD_RSSI_X and MSP_OSD_RSSI_Y.
Coordinate’s ranges on MSP OSDs are different from ardupilot’s one:
- X range 0 - 27
- Y range 0 - 15
Note right now it uses custom dedicated parameters but in the future it might share them with the main OSD code.
Supported OSD widgets:
- MSP_OSD_FMODE shows !FS! when failsafe is triggered (battery, radioi, gcs, ekf)
- MSP_OSD_VCELL average cell voltage (cell count override MSP_OSD_NCELLS 0:AUTO, 1-N)
- MSP_OSD VBAT battery voltage
- MSP_OSD_MAH battery consumed mAh
- MSP_OSD_BATT battery usage bar %
- MSP_OSD_CURR battery current
- MSP_OSD_SATS gps sat count (shows 14 sats when there’s no fix it’s a known DJI issue)
- MSP_OSD_LAT, MSP_OSD_LON gps coordinates
- MSP_OSD_HDIST home distance
- MSP_OSD_HDIR home direction
- MSP_OSD_ALT altitude
- MSP_OSD_MSG text area with flight mode shared with status text messages and wind
- MSP_OSD_ROLL roll
- MSP_OSD_PITCH pitch
- MSP_OSD_RSSI rssi
- MSP_OSD_ARM arming status
- MSP_OSD_RTC date and time (RTC)
- MSP_OSD_PWR power in Watts
- MSP_OSD_VSPD numerical vertical speed
- MSP_OSD_GSPD ground speed
- MSP_OSD_ASPD_EN airspeed as override of ground speeed
- MSP_OSD_WIND_EN wind direction and speed (rendered as text and arrow next to the flightmode)
- MSP_OSD_TESC blheli ESC temperature
- MSP_OSD_UNITS 0:Imperial, 1:Metric
Artificial horizon:
- MSP_OSD_HBARS ladders
- MSP_OSD_CROSS crosshair
- MSP_OSD_HORIZ horizon line (does not work)
Ardupilot specific “features” and notes
- MSP_OSD_MSG enables the display of status text messages as a scrolling 12 chars text (12 is the maximum allowed by the DJI system). Each message is displayed up to MSP_OSD_MSGTIME, then it is hidden. The MSP_OSD_MSG widget is also used to display the current ardupilot flight mode (STAB, MANU, LOIT, etc) when there are no messages displayed. Upon flight mode changes the flightmode name will flash for 3 seconds even if there’s a text message scrolling, after the 3 seconds scrolling will resume for the remaining scrolling time.
The samee text area is used to display wind speed and direction. - MSP_OSD_SATS (gps sats number) will flash if there’s no fix (DJI issue shows 14 sats when no fix)
- MSP_OSD_HDIR and MSP_OSD_HDIST will flash if HOME is not set.
- MSP_OSD_ASPD (airspeed) is supported as override of the MSP_OSD_GSPD item, so if you enable airspeed display you’ll loose GSPD display.
Airspeed will flash if no estimate available. - MSP_OSD_RTC will flash id no GPS lock (required for valid date/time)
- MSP_OSD_VCELL and MSP_OSD_VBAT will flash on battery failsafe
Feedback is really welcome!
If anybody wants to try this code just ask for a build for a specific board or simply build it yourself from my test branch
Test binaries will be available as releases here.
Alex