<commit_before>.. _configuration:

Configuration
=============

After completing :ref:`installation`,
a significant amount of configuration is needed before the Crazyswarm is ready to fly.
Follow the steps below.

Set up radio communication
--------------------------
Since the Crazyflies share radios and communication channels, they need to have a unique identifier/address.
The convention in the Crazyswarm is to use the following address::

    0xE7E7E7E7<X>

where ``<X>`` is the number of the Crazyflie in the hexadecimal system. For example cf1 will use address ``0xE7E7E7E701`` and cf10 uses address ``0xE7E7E7E70A``.
The easiest way to assign addresses is to use the official Crazyflie Python Client.

1. Physically label your Crazyflies with numbers.
2. Assign addresses using the Crazyflie Python Client (use a USB cable for easiest handling).
3. Each radio can control about 15 Crazyflies. If you have more than 15 CFs you will need to assign different channels to the Crazyflies. For example, if you have 49 Crazyflies you'll need three unique channels. It is up to you which channels you assign to which CF, but a good way is to use the Crazyflie number modulo the number of channels. For example, cf1 is assigned to channel 80, cf2 is assigned to channel 90, cf3 is assigned to channel 100, cf4 is assigned to channel 80 and so on.

Note: Crazyflies must be rebooted after any change of the channel/address for the changes to take effect.

Finally, add the user permissions to use the USB Radio without being root.

  - Option 1: follow the `official instructions <https://www.bitcraze.io/documentation/repository/crazyflie-lib-python/master/installation/usb_permissions>`_.
  - Option 2: Use the script: ``./pc_permissions.sh``


Update firmware
---------------
Crazyswarm is tested with the official Bitcraze firmwares for the Crazyflie and Crazyradio.
We supply the binary image of the Crazyradio firmware in the ``/prebuilt`` directory.

1. Upgrade the firmwares of your Crazyflies with the latest official release using `cfclient`. This will update STM32, NRF51, and attached decks (e.g., LightHouse deck). We tested version 2021.6.

   .. note::
      If you use a custom-built firmware, you can also use `chooser.py`, see below.
      To flash on the command line, check out the official Bitcraze documentation: `STM32 <https://www.bitcraze.io/documentation/repository/crazyflie-firmware/master/building-and-flashing/build/>`_, `NRF51 <https://github.com/bitcraze/crazyflie2-nrf-firmware/blob/master/docs/build/build.md>`_.

2. Upgrade the firmware of your Crazyradios with the latest `official firmware <https://github.com/bitcraze/crazyradio-firmware>`_. Note that this is even required for newly bought Crazyradios.
<commit_msg>Add git clone crazyradio repo to instructions<commit_after>.. _configuration:

Configuration
=============

After completing :ref:`installation`,
a significant amount of configuration is needed before the Crazyswarm is ready to fly.
Follow the steps below.

Set up radio communication
--------------------------
Since the Crazyflies share radios and communication channels, they need to have a unique identifier/address.
The convention in the Crazyswarm is to use the following address::

    0xE7E7E7E7<X>

where ``<X>`` is the number of the Crazyflie in the hexadecimal system. For example cf1 will use address ``0xE7E7E7E701`` and cf10 uses address ``0xE7E7E7E70A``.
The easiest way to assign addresses is to use the official Crazyflie Python Client.

1. Physically label your Crazyflies with numbers.
2. Assign addresses using the Crazyflie Python Client (use a USB cable for easiest handling).
3. Each radio can control about 15 Crazyflies. If you have more than 15 CFs you will need to assign different channels to the Crazyflies. For example, if you have 49 Crazyflies you'll need three unique channels. It is up to you which channels you assign to which CF, but a good way is to use the Crazyflie number modulo the number of channels. For example, cf1 is assigned to channel 80, cf2 is assigned to channel 90, cf3 is assigned to channel 100, cf4 is assigned to channel 80 and so on.

Note: Crazyflies must be rebooted after any change of the channel/address for the changes to take effect.

Finally, add the user permissions to use the USB Radio without being root.

  - Option 1: follow the `official instructions <https://www.bitcraze.io/documentation/repository/crazyflie-lib-python/master/installation/usb_permissions>`_.
  - Option 2: Use the script: ``./pc_permissions.sh``


Update firmware
---------------
Crazyswarm is tested with the official Bitcraze firmwares for the Crazyflie and Crazyradio.
We supply the binary image of the Crazyradio firmware in the ``/prebuilt`` directory.

1. Upgrade the firmwares of your Crazyflies with the latest official release using `cfclient`. This will update STM32, NRF51, and attached decks (e.g., LightHouse deck). We tested version 2021.6.

   .. note::
      If you use a custom-built firmware, you can also use `chooser.py`, see below.
      To flash on the command line, check out the official Bitcraze documentation: `STM32 <https://www.bitcraze.io/documentation/repository/crazyflie-firmware/master/building-and-flashing/build/>`_, `NRF51 <https://github.com/bitcraze/crazyflie2-nrf-firmware/blob/master/docs/build/build.md>`_.

2. Upgrade the firmware of your Crazyradios with the latest `official firmware <https://github.com/bitcraze/crazyradio-firmware>`_. Note that this is even required for newly bought Crazyradios.
    
    #. ``git clone https://github.com/bitcraze/crazyradio-firmware.git``
{'fraction_non_alphanumeric': 0.08512911843276937, 'fraction_numerical': 0.021727515583259128, 'mean_word_length': 4.100817438692098, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 9, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '732762', 'n_tokens_mistral': 1675, 'n_tokens_neox': 1525, 'n_words': 731}