Replies: 5 comments
-
And if
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Radiomaster Ranger Micro 2.4ghz,115200 air/ground speed, mLRS using MspX, external power, USB-C to steamdeck Sorry for the long logs lol. I had interference from an onboard pi hotspot at first but caught it |
Beta Was this translation helpful? Give feedback.
-
Having at least 75 sessions without context is not particularly useful, but some general observations:
There are two ways mwp /
|
Beta Was this translation helpful? Give feedback.
-
In order to smooth development merges etc. it is now necessary to force HID support when building:
|
Beta Was this translation helpful? Give feedback.
-
Experimental Support for mwp / MSP_SET_RAW_RC and HID devices
Nomenclature
MSP_SET_RAW_RC
MSP message providing RC channel dataHID
Human Interface Device. Typically Joysticks and Game Controllers.Note: This is experimental. The procedure described below may seem complex (it's not really), it provides steps for validating that the system works and may provide guidance as to how it be improved / integrated into the mwp UI.
Overview
From mwp 25.04.03, mwp is able to receive RC channel data from an HID source and multiplex generated
MSP_SET_RAW_RC
messages along with other telemetry messages processed by mwp. This enables the model to be controlled by a joystick or game controller connected to the device running mwp (or when running mwp on a Linux based game controller like Steam Deck).Interface
mwp uses an external UDP HID server (
mwp-hid-server
). This provides flexibility for third parties to provide an alternative implementation, as well as convenience for experimentation.The HID server listens on a defined UDP port (default
31025
) for the following commands:raw
: Returns 16int16
values, little endian, representing 16 RC channels.info
: Returns information (free form text) on the connected HID device.quit
: Terminates the servertext
: Returns a text string of 16 space separated channel values.set
: sets RC data for the first four channels (a testing aid). Data is provided as a set of space separated values, for exampleset 1600 1700 1010 1889
.mwp's reference implementation has the following options:
rc-mapfile
is a simple text file that maps the capabilities of the HID device to RC Channels. This is discussed below in the following section.verbose
will display channel values every 10 seconds.RC Channel Mapping
mwp's reference HID server uses the well known SDL ( Simple DirectMedia Layer) library. This library handles numerous input devices (Joysticks, Game Controllers) in well defined manner across multiple platforms.
mwp provides a tool
mwp-hid-test
to allow the user to identify the inputs on their HID devices and allocate / map inputs to RC Channels. SDL provides for the following HID inputs:Note that "Hats" and "Balls" are effectively undefined in the reference server solely because the author has no example of such devices.
mwp-hid-test
usageThe user plugs in the required HID controller and starts the application (from a shell / terminal). She can then exercises all the required (stick / switch / button) inputs.
mwp-hid-test
will record the input, best shown by example:The application is started, the device (Boxer radio in HID mode) is detected. If multiple devices are detected, the user will be asked which entry they wish to use.
In the example above:
After exercising all required inputs, the user should prepare a mapping file; this is a simple text file mapping "Axis" and "Button" inputs to RC Channels (RC channels numbered from 1).
Notes:
#
or;
are ignored;
or#
are ignored (comments / notes).Definition lines are of the form
Axis N = Channel X
orButton M = Channel Y
.Axis N
orButton M
data is that shown bymwp-hid-test
. The Channel is the RC channel for that input.mwp-hid-server
maps the value from SDL (-32608
to32607
) to RC range1000
-2000
. Buttons are mapped fromoff
=1000
toon
=2000
.For Game Controllers, it is (probably) possible to provide a SDL Mapping file as a parameter to
mwp-hid-test
(for example, see https://github.com/mdqinc/SDL_GameControllerDB), that will (possibly) help the SDL library to manage the device.Usage and Testing
Note: The author has access only to Radiomaster radios in HID mode (no dedicated Joysticks or Game Controllers). While this works for me, it may not yet work for you.
Build development mwp, the HID test tool and server
It may be necessary to first install some additional dependencies:
Then using your clone of the mwptools repositiory:
The HID tools are (post 2025-04-12), installed as part of the build, previously, or for local experiments, they can be built independently:
cd src/samples/hidex make install
Note this installs to
$HOME/.local
; if you want to install elsewhere, setprefix
(and usesudo
as required):make && sudo make install prefix=/usr
Initial Tests
Standalone
Once you've installed
mwp-hid-server
, you can test it "standalone' if you wish:In one terminal:
# rc-mapfile.txt is the RC mapping file created earlier: $ mwp-hid-server -v rc-mapfile.txt
Then you can send it some commands:
Note: A later post describes mwp's
mwp-hid-cli
may be used instead ofnc
orbash
to send commands to exercisemwp-hid-server
.Ensure
mwp-hid-server
is closed before trying with mwp.mwp
mwp currently requires that an environment variable
MWP_MSP_RC
is set, defining the channel mapping file (and any othermwp-hid-server
parameter. In the event that there is a user requirement, this might be replaced by a UI dialog is future.For now: e.g.
MWP_MSP_RC="/home/user/boxer.txt" mwp
Or persistently set in a shell startup file or
~/.config/mwp/cmdopts
.When mwp starts, it will auomatically invoke
mwp-hid-server
.When the main telemetry channel is started, the "stick display" icon will show in the bottom right of the map:
This may be expanded (click on the icon) to show the sticks.
Note:
Other Considerations
MSP_SET_RAW_RC
(minimum of 5Hz refesh) and mwp's telemetry requirement (minimum say (also) 5 MSP/sec, though it this is not a hard limit, rather a usability desire).USE_MSP_RC_OVERRIDE
/MSP RC Override
and a backup TX.MSP_SET_RAW_RC
messages every 150 milliseconds (c. 7Hz). This interval may be configurable in the future. It was chosen to minimise the chances of fail-safe while maintaining a decent telemetry rate.Serial Usage Metrics
mwp can monitor MSP message rates and automatically log the information. If you are testing this
MSP_SET_RAW_RC
functionality in mwp, please add the following to~/.config/mwp/cmdopts
/%LOCALAPPDATA%\mwp\cmdopts
:This will log MSP throughput every minute into
mwp_stderr_YYYY_MM_DD.txt
.mwp_stderr_YYYY-MM-DD.txt
log file).Example
Telemetry device: Ebyte E220 LoRa, 115200 ground speed, 38400 air speed, USB connection to GCS.
mwp_stderr_YYYY-MM-DD.txt
file with lines like:This device appears usable.
Postscript
The author owns no game controllers and a limited range of older telemetry devices, so if this capability is to become production, user involvement in the test and evaluation process is needed.
Beta Was this translation helpful? Give feedback.
All reactions