Skip to content

Commit

Permalink
Improved betaflight instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
JacopoPan committed Aug 19, 2023
1 parent 519fe6b commit 837bf07
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ conda create -n drones python=3.10
conda activate drones

pip3 install --upgrade pip
pip3 install -e . # ff needed, `sudo apt install build-essentials` to install `gcc` and build `pybullet`
pip3 install -e . # if needed, `sudo apt install build-essentials` to install `gcc` and build `pybullet`

```

Expand All @@ -40,7 +40,7 @@ python3 learn.py

### Betaflight SITL example (Ubuntu only)

In one terminal, run the Betaflight SITL binary
First, check the steps in the docstrings of [`beta.py`](https://github.com/utiasDSL/gym-pybullet-drones/blob/main/gym_pybullet_drones/examples/beta.py), then, in one terminal, run the Betaflight SITL binary

```sh
git clone https://github.com/betaflight/betaflight
Expand All @@ -53,6 +53,7 @@ betaflight/obj/main/betaflight_SITL.elf
In another terminal, run the example

```sh
conda activate drones
cd gym_pybullet_drones/examples/
python3 beta.py # also check the steps in the file's docstrings
```
Expand Down
27 changes: 17 additions & 10 deletions gym_pybullet_drones/examples/beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,36 @@
Setup
-----
Step 1: Clone betaflight https://github.com/betaflight/betaflight
Step 1: Clone betaflight:
$ git clone https://github.com/betaflight/betaflight
$ cd betaflight/
$ make arm_sdk_install
$ cd betaflight/
Step 2: Comment out line `delayMicroseconds_real(50); // max rate 20kHz` from Betaflight's SIMULATOR_BUILD
https://github.com/betaflight/betaflight/blob/master/src/main/main.c#L52
Step 2: Comment out line `delayMicroseconds_real(50); // max rate 20kHz`
(https://github.com/betaflight/betaflight/blob/master/src/main/main.c#L52)
from Betaflight's `SIMULATOR_BUILD` and compile:
$ cd betaflight/
$ make arm_sdk_install
$ make TARGET=SITL
Step 3: Install betaflight configurator https://github.com/betaflight/betaflight-configurator/releases
Step 3: Install betaflight configurator (https://github.com/betaflight/betaflight-configurator/releases):
$ wget https://github.com/betaflight/betaflight-configurator/releases/download/10.9.0/betaflight-configurator_10.9.0_amd64.deb
$ sudo dpkg -i betaflight-configurator_10.9.0_amd64.deb
If needed, also run:
$ apt install libgconf-2-4
$ apt --fix-broken install
Step 4: Load the configuration file onto the target using the BF configurator
Step 4: Load the configuration file onto the target using the BF configurator:
First, start the SITL controller:
$ ./obj/main/betaflight_SITL.elf
Type address `tcp://localhost:5761` (top right) and click `Connect`
Find the `Presets` tab (on the left) -> `Load backup` -> select file `../assets/beta.txt`
Example
-------
In one terminal build and run SITL Betaflight:
In one terminal run the SITL Betaflight:
$ cd betaflight/
$ make TARGET=SITL
$ betaflight/obj/main/betaflight_SITL.elf
$ ./obj/main/betaflight_SITL.elf
In a separate terminal, run:
Expand Down

0 comments on commit 837bf07

Please sign in to comment.