Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 25 additions & 16 deletions docs/challenge/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,51 @@ The idea for the deployment is to have an environment that exactly matches the i

We use a [Vicon](https://www.vicon.com/) motion tracking system to track the motion of the drone. The Vicon system consists of several cameras that are placed around the track, and a base station that calculates object poses by triangulation. Gates, obstacles and the drone are all equipped with reflective markers, which can be tracked by the cameras. Since we'd need to resort to numerical differentiation to get velocity information, we're running state estimators that filter the noisy Vicon measurements and provide smoother estimates of the drone's state.

As mentioned in the [Installation and Setup](../getting_started/setup.md) section, you need to run two terminals to launch a ROS2 node with the `motion_capture_tracking` package that make the Vicon poses available:
After completing the [hardware setup](../getting_started/setup.md#hardware-setup-ubuntu-only), you need a total of *three* open terminals in the repository to deploy your controller. The commands below use the deploy environment.

In the first terminal, run this command to launch the translation layer from the motion capture cameras to ROS2.

```bash
pixi shell -e deploy
ros2 launch motion_capture_tracking launch.py
pixi run -e deploy mocap
```

!!! warning
If you cannot see the drone in RVIZ, it is likely that Vicon is not turned on, or the drone is not selected for tracking in the Vicon system.

The second terminal is used to launch the estimator for the drone. If you want to use the default settings, it's enough to specify your drone ID with the `--drone_name` argument. For advanced settings, you need to modify the `estimators.toml` file in the `drone-estimators` repository or pass a path to your TOML file with the `--settings` argument.
The second terminal is used to launch the estimator for the drone. If you want to use the default settings, it's enough to specify your drone ID with `pixi run -e deploy estimator <drone_name>`. You need to use the actual DEC number on the drone or the name shown in rviz. If the estimator works, you should see the frequency information in the terminal.

```bash
pixi shell -e deploy
python -m drone_estimators.ros_nodes.ros2_node --drone_name cf52
pixi run -e deploy estimator cf01
```

## Generating Tracks for Level 3 Deployment
## Deploying Your Controller

To deploy your controller on the real drone, use the deployment script in the `lsy_drone_racing/scripts` folder. Place the drone on its start position, power it on, and launch the estimators.

!!! note
Make sure the drone has enough battery to complete the track. If a red LED is constantly turned on, the drone is low on battery. A blinking red LED indicates that the battery is sufficiently charged.

For level 3 deployment, you need to generate new configuration file with a track layout based on the real-world positions of the gates and obstacles. To do so, use the `save_track_as_config.py` script in the `lsy_drone_racing/scripts` folder.
In the third terminal, start the deploy environment with `pixi shell -e deploy` and the deployment script with the correct configuration and controller.

```bash
python scripts/save_track_as_config.py --config <config_name> --save_config_to <config_output_path>
pixi shell -e deploy
python scripts/deploy.py
# or
python scripts/deploy.py --config <config_name>.toml --controller <controller_name>.py
```

The script will query the Vicon system for the current positions of all gates and obstacles, and generate a new deploy-ready TOML configuration file with the specified name.
!!! note
Be careful when flying the drone! Make sure to kill the process (**Ctrl+C**) immediately when your controller is unstable.

## Deploying Your Controller
The deployment script will first check if the real track poses and the drone starting pose is within acceptable bounds of the configured track. If not, the script will print an error message and terminate. If the poses are correct, the drone will take off, fly through the track, print out the final lap time, and land automatically.

To deploy your controller on the real drone, use the deployment script in the `lsy_drone_racing/scripts` folder. Place the drone on its start position, power it on, and launch the estimators.
## Saving a Track Layout (Optional)

!!! note
Make sure the drone has enough battery to complete the track. If a red LED is constantly turned on, the drone is low on battery. A blinking red LED indicates that the battery is sufficiently charged.
If you want to save the measured layout for later use, run the `save_track_as_config.py` script in the `lsy_drone_racing/scripts` folder:

```bash
python scripts/deploy.py --config <config_name> --controller <controller_name>
pixi shell -e deploy
python scripts/save_track_as_config.py --config <config_name>.toml --save_config_to <output_name>.toml
```

The deployment script will first check if the real track poses and the drone starting pose is within acceptable bounds of the configured track. If not, the script will print an error message and terminate. If the poses are correct, the drone will take off, fly through the track, print out the final lap time, and land automatically.
The script saves the measured gate, obstacle, and drone starting poses to `config/<output_name>.toml`.
4 changes: 3 additions & 1 deletion docs/challenge/simulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The first part of the challenge is to complete the race track in simulation. To

## Running the Simulation

Once you have installed the `lsy_drone_racing` package, you should be able to start a simulation run with
Once you have installed the `lsy_drone_racing` package, you should be able to start a simulation inside a `pixi shell` with

```bash
python scripts/sim.py
Expand All @@ -18,6 +18,8 @@ python scripts/sim.py -r -n 10

This will render the simulation (`-r` or `--render`) and run 10 races in succession (`-n` or `--n_runs`). For a list of all arguments, use `-h` or `--help`.

By default, rendering follows the `render` setting in the `[sim]` section of the config file. Use `--render=True` or `--render=False` to override it for the current run without modifying the configuration file.

## Switching Between Configurations

You can choose which configuration to use by changing the `--config` command line option. For example, to run the example controller on the hardest scenario, use the following command:
Expand Down
Loading