#Unable to connect to Betaflight SITL using the Configurator

9 messages · Page 1 of 1 (latest)

granite latch
#

Hello,

I am trying to use the Betaflight SITL in my own simulator and as a first step tried to connect to the SITL using the Betaflight Configurator.

I tried the following:

  1. Download Betaflight from the Github release page (version 4.5.1 and 4.5.0)
  2. Build the SITL using the commands: make arm_sdk_install && make TARGET=SITL
  3. Run the SITL:
./betaflight_SITL.elf
[SITL] The SITL will output to IP 127.0.0.1:9002 (Gazebo) and 127.0.0.1:9001 (RealFlightBridge)
[system]Init...
[SITL] init PwmOut UDP link to gazebo 127.0.0.1:9002...0
[SITL] init PwmOut UDP link to RF9 127.0.0.1:9001...0
[SITL] start UDP server @9003...0
[SITL] start UDP server for RC input @9004...0
[FLASH_Unlock] loaded 'eeprom.bin', size = 32768 / 32768
[timer]Init...
bind port 5761 for UART1
debugInit
unusedPinsInit
  1. Start the proxy (but as far as I understand its only necessary when using the online configurator?)
./websockify 127.0.0.1:6761 127.0.0.1:5761


Warning: 'self.pem' not found
Waiting for connections on 127.0.0.1:6761
  1. Trying to connect to the SITL using the Betaflight Configurator:
    (see screenshot)

But it simply states:
2025-01-07 @12:58:26 -- Chrome API Error: Failed to connect to the port..
2025-01-07 @12:58:26 -- Failed to open serial port

The same error message appears whether I use port 5761 directly or port 6761.
In the webinterface I don't see any option to choose websocket as a possibility to connect to the running SITL instance. I am only able to select USB devices but cannot write down a connection string manually.

Did I do something wrong in setting up the SITL/ configurator or is my connection string incorrect?

#

Oh well.... I randomly tried other connection strings with different protocols and using TCP seems to work as the configurator is now connected:

tcp://127.0.0.1:5761

ruby saddle
#

Yes websockify is needed to allow tcp connection with online app

acoustic wing
granite latch
#

Thank you, the readme is very informative 👍
I was wondering how to connect via the online configurator and the "Enable Manual connection mode" was what I was searching 👌

#

Yesterday I already managed to implement the FDM packet into my simulation and I can now fly the drone using my attached RC controller in my own simulation together with betaflight SITL 😅
Feels very similar to flying the drone in reality 👌

#

@ruby saddle I also forked betaflight and made changes to the sitl.c file (in the 4.5 maintainance branch, as I am also using 4.5.2 on the real drone): https://github.com/itssme/betaflight/commit/f6c9a5f7c45f04bb27e1d45b619b859d9865227e
I need to run multiple instances of the SITL on the same computer/ docker container and needed to make the port numbers configurable. If you point me into a direction on how you want this to be implemented to fit with the existing code base, I could make a PR from this (currently its just using env variables directly, as this is the simplest way from me to integrate it into my own reinforcement learning workflow)

#

I also saw how other projects are handling this and they simply search and replace the defined ports and then build betaflight a bunch of times. But as I am running up to 64 instances at the same time, this is unfeasible.
https://github.com/utiasDSL/gym-pybullet-drones/blob/main/gym_pybullet_drones/assets/clone_bfs.sh#L48-L58

GitHub

PyBullet Gymnasium environments for single and multi-agent reinforcement learning of quadcopter control - utiasDSL/gym-pybullet-drones

ruby saddle
#