The bridge for connecting Betaflight SITL to X-Plane simulators airplane model
The BF-SITL-X-Plane Bridge can be used for debug airplanes version of betaflight firmware.
https://youtu.be/C_nt6-sjDcw?si=touE_RLNcDkhfH8M
To run Betaflight SITL from Windows you need to install Windows Linux Subsystem (WSL) with Ubuntu OS.
The link to SITL using manual.
To get last airplane SITL version you need to build Betaflight with SITL target by setting USE_WING options.
The example of ready to use compiled SITL file can be loaded from "release/SITL" directory of this repository.
- To setup SITL by using Betaflight configurator you need to run websockify proxy
Copy websockify file from "release/websockify" repository directory to your PC disk.
-
Run WSL from command line by using cmd console. Go to your websockify directory and run websockify proxi server by command:
./websockify 127.0.0.1:6761 127.0.0.1:5761 -
Run second WSL instance from command line by using cmd. Go to your SITL directory and run SITL: ./betaflight_SITL.elf
-
Set "Enable manual connection mode" in configurators option.
-
Set port value in configurator "port" field as ws://127.0.0.1:6761
-
Load yours RC airplane "diff" data into SITL by using Configurator cli, save config. Can use SITL/cli_setup_example.txt config file for example.
-
Restart SITL and Betaflight configurator, connect to SITL
-
Go to Motors configurator tab and set motors protocol as PWM, save config.
-
Restart SITL and Betaflight configurator, connect to SITL, set pid loop freq on the configuration page (select 1k ... 8k), save config.
The SITL is configured.
Install 11 or 12 versions of X-Plane. The demo version can used for short test flights.
Aircraft\Extra Aircraft\Wing640 directory contains model what is similar my airplane. This is flywing type airplane with one motors and ailerons control by roll and pitch together. The wingspan is 620mm, the weight is around 280g.
Copy this directory in X-Plane install path.
This model is created in x-plane maker programm. Use this programm to edit model performance.
Notice: If yours airplane has other controls (elevator, rudder, 2-motors) you need to create own X-Plane model in plane maker. You can copy "plugins" directory into your X-Plane model to use this Betaflight SITL bridge.
The setup.xml (release/Aircraft/Extra Aircraft/Wing640/plugins/Betaflight-SITL/setup.xml) file contains setup follow my SITL/cli_setup_example.txt diff file. You can change some settings for yours fly wing airplane in this setup file.
The "Modes" section contains flight modes setup: Arm, Manual, Angle. The Acro is default. You can write in this section rc channels numbers and RC value to On flight mode.
The "Input" section contains RC input settings. You should write rc aux channel numbers for "throttle", "stick_pitch", "stick_roll" controls. You can add "stick_yaw" row into this section if yours plane has rudder or 2-motors differencial control.
The "Output" section contains servo output settings. You can write servo numbers for "motor1", "aileron_left", "aileron_right" channels. You can add "elevator", "rudder" or "motor2" row if yours plane has these controls. Use "reverse" flag to revert servo control.
- Run X-Plane and select Wing640 model. Start flight.
- Start WSL session, go to SITL directory and start SITL, set your windows IP address as SITL run parameter (172.20.144.1 in my case):
./betaflight_SITL.elf 172.20.144.1
- Go to X-Plane "plugins" menu. By using this menu you can Arm/Disarm (set throttle to idle before) SITL and select flight mode.
You can use Betaflight configurator during simulation to check RC channels, flight modes state and Arm disabled flags. Look at "SITL setup" manual above.
Betaflight: https://betaflight.com/
Betaflight SITL manual: https://betaflight.com/docs/development/sitl
X-Plane: https://www.x-plane.com/
X-Plane SDK: https://developer.x-plane.com/sdk/
X-Plane Datarefs: https://developer.x-plane.com/datarefs/
Plane maker manual: https://developer.x-plane.com/manuals/planemaker/
INAV-X-Plane-HITL: https://github.com/RomanLut/INAV-X-Plane-HITL, Thank's for start point my project.