The Gazebo support for Betaflight was added in this PR.
It's already available in master
branch.
-
betaflight_configurator: This package download and install in the workspace the ground control station. To connect with the SITL please use "Manual" and "Port: tcp://127.0.0.1:5761"
IMPORTANT: you need to modify the settings of the Betaflight SITL to enable arming and the motors. In order to do this you'll need to run the file
betaflight_SITL.elf
located in~/vg/install/betaflight_sim/share/betaflight_sim/bin/betaflight_SITL.elf
and connect to it through the programBetaflight Configurator
:- Open
Betaflight Configurator
- In the
Port
field on the top bar insert the addresstcp://127.0.0.1:5761
and clickConnect
- In the side tabs you need to configure the following:
Modes
: Configure arm inAUX1
(range1500
-2100
)Motors
: SelectPWM
and enable3D
Remember to clickSave
in order to commit the changes. You can shut down and reopenbetaflight_SITL.elf
to check that the settings have been saved inBetaflight Configurator
.
-
Once you have verified that the changes have been committed you will need to copy the configuration file
eeprom.bin
that has been generated from~/vg/install/betaflight_sim/share/betaflight_sim/bin/eeprom.bin
to~/vg/install/betaflight_sim/share/betaflight_sim/config/eeprom.bin
:cp ~/vg/install/betaflight_sim/share/betaflight_sim/bin/eeprom.bin ~/vg/install/betaflight_sim/share/betaflight_sim/config/eeprom.bin
- Open
-
betaflight_controller: When the drone is connected to SITL this requires an RC, otherwise the flight controller will generate a failsafe (RX_FAILSAFE). This program will open a UDP socket in the port 9004. Values are between [1000 - 2000]
- Connect a joystick
- You need to run
ros2 run joy joy_node
- And the
ros2 run betaflight_controller betaflight_joy_controller
.
-
betaflight_gazebo: This plugin will send the state data to the SITL and it will received the data from the motors [-1, 1].
-
Sending state output to SITL at UDP link: 127.0.0.1:9002
-
Receiving PWM from SITL at UDP server: 127.0.0.1:9003
-
betaflight_sim: Download and install the betaflight flight controller.
ros2 launch betaflight_sim quadcopter.launch.py