More Sphinx doc (#2583)

Co-authored-by: Gautier Hattenberger <gautier.hattenberger@enac.fr>
This commit is contained in:
Fabien-B
2020-09-21 15:51:35 +02:00
committed by GitHub
parent 5e041b5090
commit 3bb42c00be
64 changed files with 1053 additions and 339 deletions
+2
View File
@@ -0,0 +1,2 @@
build/
+2
View File
@@ -0,0 +1,2 @@
sphinx_rtd_theme
Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

@@ -0,0 +1,29 @@
.. developer_guide communication
=============
Communication
=============
We saw in the User Guide :doc:`../user_guide/communication` section that you can change which messages are sent, and at which rate. We will see in this section how you can define and send your own messages.
Define a new message
--------------------
By default, PprzLink default message definition is used. You can find it in ``sw/ext/pprzlink/message_definitions/v1.0/messages.xml``. To add your own messages, you first need to copy this file in your ``conf`` directory.
Add your message in that file on the model of the other messages. Make sure to add it in the appropriate message class (telemetry, datalink, ground, ...), and make sure to use
a free name and a free ``id`` within this class. This *id* being encoded on a uin8_t, it must be comprise between 1 and 255 (0 is reserved). As you can see, there are not much left in the telemetry class...
.. note:: The ids are uniq within the class but the names are uniq in the whole file: you can't have two messages with the same name, even if they are in different classes.
Re-build paparazzi with ``make`` at the root directory. your message should now be present in the ``var/messages.xml`` file.
Send a telemetry message
------------------------
If you defined a new telemetry message, you now want the drone to send it. You can either send it manually from a module or use the Paparazzi periodic telemetry.
.. warning::
This section is not written yet, go to `http://wiki.paparazziuav.org/wiki/Telemetry <http://wiki.paparazziuav.org/wiki/Telemetry>`_.
@@ -1,9 +0,0 @@
.. developer_guide dev_second developer2
======================
Developer 2
======================
TBD
Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

@@ -1,4 +1,4 @@
.. developer_guide main_developer index_developer
.. developer_guide index_developer
=================
Developer Guide
@@ -10,5 +10,6 @@ TBD
:maxdepth: 2
system_overview
developer2
communication
modules
@@ -0,0 +1,9 @@
.. developer_guide modules
========
Modules
========
TBD
@@ -1,9 +1,43 @@
.. developer_guide dev_first system_overview
.. developer_guide system_overview
=========================
Detailed System Overview
System Architecture
=========================
TBD
The typical configuration constitute of a standard laptop as ground station and one or more drones, possibly with a RC transmitter for each as safety link. The Command and Control link is made by a pair of modems on the ground and in the drones.
.. image:: general_arch.png
Ground architecture
-------------------
The Gound Control Station (GCS) constits of multiples programs, communicating with each other by the software bus `Ivy <https://www.eei.cena.fr/products/ivy/>`_.
.. note::
Ivy is a simple protocol and a set of open-source (LGPL) libraries and programs that allows applications to broadcast information through text messages, with a publisher / subscriber mechanism based on regular expressions.
.. image:: agents_arch.png
The core Paparazzi programs are Link, which handle the communication with the drones, the Server, which maintain the state of all aircrafts, and the GCS, the user facing application to control the drones.
Many other tools have been developed for various use cases, they are available in the *Tools* menu of the paparazzi center. But more interesting: you can write your own tools that will interact with Paparazzi via the Ivy bus.
Airborne architecture
---------------------
In the case of a fixedwing aircraft, the airborne top level architecture is divided in two processes: the *AP* (autopilot) process which does most of the job, and the *FBW* (Fly by Wire) process. FBW manages the radio receiver and control the servos. In the catastrophic event that the AP process crashes, the aircraft can still be controlled via the RC transmitter.
For the rotorcraft, there is only one process called *Main*.
.. note::
It is planned to make a failsafe process for rotorcraft that will allow basic stabilization and control of the drone.
.. warning::
TODO: Explain airborne architecture
.. image:: airborne_arch.png
The aircraft is configured by various XML configuration files: *airframe*, *flight_plan*, *radio* and *telemetry*. theses will be covered in the :doc:`../user_guide/index_user_guide` section.
+2 -2
View File
@@ -27,9 +27,9 @@ Contents:
.. toctree::
:maxdepth: 2
quickstart/index_start
installation/index_installation
quickstart/index_quick_start
user_guide/index_user_guide
installation/index_installation
developer_guide/index_developer
tutorials/index_tutorials
support/index_support
@@ -13,6 +13,10 @@ The steps required to install the software needed to be able to let your UAS fly
- Compile the Paparazzi software from sourcecode
- Complete any final configuration
.. note::
If you run **Ubuntu** 16.04 or higher LTS (18.04, 20.04), go to the :doc:`../quickstart/install` page to get quickly running !
.. toctree::
:maxdepth: 2
Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

+59 -2
View File
@@ -1,9 +1,66 @@
.. quickstart main_quickstart first_flight
.. quickstart first_flight
======================
Experimental Flight
======================
Flying a Bebop2 ...
The easiest drone to fly with paparazzi is the **Bebop 2**, from Parrot. It is no longer produced but can still be found 2nd hand.
Using the Bebop 2 with Paparazzi
--------------------------------
Make sure to have a bebop with at least firmware v3.3.0. Update it from FreeFlight pro if needed.
- Start the Paparazzi Center (or Stop/remove all processes)
- Select the *bebop2* A/C and build it for the *ap* target
- Power up the Bebop
- Connect your laptop to the Bebop's wifi network
- Press the on/off button 4 times
- Press the "Upload" button and wait. The messages in the console should end with "DONE"
- Select the Flight UDP/Wifi session, then execute.
You should get the telemetry from the bebop.
Making the changes permanent
----------------------------
In the current state, you have to do the process all over again every time you restart the Bebop. However, you can start Paparazzi by default with the following steps:
- Power up the Bebop
- Connect your laptop to the Bebop's wifi network
- Press the on/off button 4 times
- Open a terminal and go to ``paparazzi/sw/tools/parrot``
Launch ``./bebop.py status``. You should get the current status of the drone's configuration. If it does not work, you may need to add the ``--host`` argument with the drone's IP address like so: ``./bebop.py --host 192.168.1.15 status``.
.. note::
The default IP address of the bebop is ``192.168.42.1``. In this case, you don't need the ``--host`` argument.
Install the autostart script with ``./bebop.py install_autostart``.
Change network settings
-----------------------
You can change the network settings of the drone to make it connect to an existing WiFi network: ``./bebop.py configure_network mySSID managed dhcp``. You can replace ``dhcp`` by a fixed IP address to use static IP instead of getting the address from your external router DHCP in ``managed`` mode.
Calibration
-----------
The default values may be good enough to be able to fly, but it is recommanded that you calibrate the drone before flying. Go to the :doc:`../tutorials/beginner/sensor_calibration` page to learn how to do that.
Connect a Joystick
------------------
.. note::
This part is optionnal but it is recommended to connect a joystick to have an easy way to control your drone, if something unexpected should happen.
Learn how to connect a joystick to your laptop to control your drone on this page: :doc:`../tutorials/beginner/use_joystick`
@@ -1,4 +1,4 @@
.. quickstart main_quickstart first_simu
.. quickstart first_simu
======================
Flight Simulation
@@ -19,7 +19,7 @@ The GCS layout can be changed, but in this layout there are 3 very important pan
- the red one (left) is the strips panel. Each aircraft have its own strip, which display the state of the aircraft, and let you send commands.
- the green panel (top right) is the map. The default background is black. Click on the google earth icon (green circle) to load the tiles.
- the purple panel feature various widgets. The first of these describe the flight plan.
- the purple panel features various widgets. The first of these describes the flight plan.
Now, lets launch the drone:
@@ -30,8 +30,3 @@ Now, lets launch the drone:
The drone should now move, and the current block will change to "Standby".
The Strip
=========
Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+103
View File
@@ -0,0 +1,103 @@
.. quickstart gcs_tour
====
GCS
====
The GCS is the main app used during the flight. Let's explore the 3 important panels.
.. image:: gcs.png
The Strips
==========
The strips panel is the red one on the left.
Aircraft status
+++++++++++++++
Starting from the top left corner to the bottom right we have:
.. image:: gcs_strip_1.png
- flight time
- ground speed. Hover on the ground speed to get the airspeed.
- throttle level (red background means throttle is killed. Orange otherwise.)
- name of the current navigation block
- Next line, the battery voltage. This widget also display a graph of the battery voltage over time.
- three status widgets:
+ The navigation mode (AUTO2, AUTO1, MANU, ...),
+ the radio command status,
+ the GPS status.
- the height above ground level (AGL) in meters and the vertical speed (in m/s).
- the "Block" group gives:
+ the block time (time since the drone is in the current block),
+ the stage time (stages are block childs),
+ the estimated time of arrival to the next waypoint (if applicable).
+ a "Mark" button to mark on the map the current position of the drone.
- Next line, below the *Bat*, this is the *Link* status. If link is lost, the number of seconds since the last message will be displayed here.
- At the right of the GPS status, this is the altitude of the drone compared to the target altitude.
- The next group display the drone altitude and the target altitude (MSL).
*Nav* group
+++++++++++
This group features some quick operations. From the top left corner:
.. image:: gcs_strip_fixed_settings.png
- the "Lauch" button, used for simulation only.
- the "Kill" button. It kills the drone throttle.
- "Resurrect" enables throttle back.
- decrease altitude
- increase altitude
- greatly increase altitude
- shift trajectory to the left
- recenter trajectory
- shift trajectory to the right
Commands
++++++++
.. image:: gcs_strip_fpsets.png
This group features user-defined buttons that can be used to either go to a flight plan block or to sets a specific value to a setting.
The map
=======
The map displays drones and waypoint positions. Waypoints can be moved by dragging them or clicking on them. Change the altitude and confirm the new position in the dialog window that will open.
Mouse position in various reference system is displayed on the top right corner (default is WGS84).
Click the google Earth icon to load the background map.
Aircraft panel
==============
The purple panel at the bottom is the Aircraft panel.
The **Flight Plan** tab display the full flight plan of the aircraft. Double clicking on a block makes the aircraft go to this block.
The **GPS** tab gives you info about GPS state. Its usually a good idea to wait for the *Pos accuracy* to be good enough (around 5 meters or less) before proceeding to a flight.
The **PFD** tab diplay a primary flight display. Very useful for the ground checks before take off, and if the aircraft is out of sight.
The **Link** tab gives detailed info about the link with the drone.
The **Settings** tab features all settings. Settings are hierarchically organised. Each setting is displayed as follow:
- name of the setting.
- its last known value. Click on it to update it. **?** means that the value is unknown.
- a mean to set a new value : it can be a drop-down box, radio buttons, or a slider.
- 2 buttons: the *Commit* button that will send the setting to the drone, and the *Undo* button that will set the setting back to its last value.
Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

@@ -0,0 +1,22 @@
.. quickstart index_quick_start
=================
Quick Start
=================
Welcome to the Paparazzi UAV user guide!
This section will let you go throught a quick installation and a first use of Paparazzi.
To start, go to the :doc:`install` page!
.. toctree::
:maxdepth: 1
install
system_overview
paparazzi_center_tour
first_simulation
gcs_tour
first_flight
@@ -1,17 +0,0 @@
.. quickstart main_quickstart index_start
=================
QuickStart
=================
This guide will let you to throught a quick installation and a first use of Paparazzi.
To start, go to the :doc:`install` page!
.. toctree::
:maxdepth: 3
install
paparazzi_center_tour
first_simulation
first_flight
+26 -8
View File
@@ -1,4 +1,4 @@
.. quickstart main_quickstart install
.. quickstart install
======================
Quick Install
@@ -8,14 +8,33 @@ Paparazzi runs best on **Ubuntu 16.04 or higher**, so this quick installation gu
Open a terminal and execute each lines below. If one fails, ask for help on gitter.
Add paparazzi repositories and install dependencies:
Version specific prerequisites
------------------------------
**If you have Ubuntu 20.04:**
.. code-block:: bash
sudo apt-get install python-is-python3 gcc-arm-none-eabi gdb-multiarch
**If you have Ubuntu 18.04 or lower:**
.. code-block:: bash
sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
sudo apt-get install gcc-arm-embedded
sudo apt-get update
Install Paparazzi
-----------------
Add paparazzi apt-repository and install dependencies:
.. code-block:: bash
sudo add-apt-repository -y ppa:paparazzi-uav/ppa
sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
sudo apt-get update
sudo apt-get -f -y install paparazzi-dev paparazzi-jsbsim gcc-arm-embedded
sudo apt-get -f -y install paparazzi-dev paparazzi-jsbsim dfu-util
Clone the repository:
@@ -38,8 +57,10 @@ Get the submodules and build Paparazzi. This step might take a long time the fir
.. code-block:: bash
make
make -j1
.. note::
The ``-j1`` argument may not be necessary, but if you are not familiar with paparazzi, its safer to use it. However, it will make paparazzi build much slower.
Finally, launch Paparazzi with
@@ -47,7 +68,4 @@ Finally, launch Paparazzi with
./paparazzi
.. note::
If it doesn't work, the previous step might have failed. In that case, recompile with with ``make -j1``, then try again to launch Paparazzi.
If all went well the Paparazzi Center should now be running. Please continue to the next page for a guided tour.
@@ -1,4 +1,4 @@
.. quickstart main_quickstart paparazzi_center_tour
.. quickstart paparazzi_center_tour
=================
Paparazzi Center
@@ -16,13 +16,18 @@ This panel is dedicated to the configuration of the aircrafts. You can change th
The *id* field is the **uniq** identifier of the aircraft, between 0 and 255.
An aircraft is composed of an airframe, a flight plan, some settings, a radio and a telemetry configuration file. These concepts are explained in the :doc:`../user_guide/index_user_guide`.
An aircraft is composed of an airframe, a flight plan, some settings, a radio and a telemetry configuration file. These concepts are explained later.
For now, remember that you can select other files by hitting the ``...`` button, or edit the current file with the ``Edit`` button.
.. note::
The ``Edit`` button open the file with *gedit* by default. You can change it by setting the ``EDITOR`` environnement variable.
Building panel
===============
This panel lets you choose for wich target you want to build the firmware with the **Target** combobox. Build and clean the firmware with the *Build* and *Clean* buttons.
This panel lets you choose for which target you want to build the firmware with the **Target** combobox. Build and clean the firmware with the *Build* and *Clean* buttons.
Some usual targets are:
@@ -37,11 +42,11 @@ If the selected target is not a simulator, you can choose how you want to flash
Execution and Running agents panels
====================================
In the Execution panel, a combo box provide a set of predefined and user sessions (collections of programs).
In the Execution panel, a combo box provides a set of sessions (collections of programs).
The Simulation session runs a server, a GCS and a simulator for the aircraft selected in the configuration panel. Note that *sim* or *nps* target must have been built prior to the simulation.
The launched programs can be stopped and restarted (Stop/Redo buttons).
The launched programs can be stopped and restarted individually (Stop/Redo buttons). All programs can be stopped and removed from the list at once by the *Stop/Remove All Processes* button. A common mistake is to have multiple instances of the same program running. This button is very handy to use!
Console panel
@@ -0,0 +1,18 @@
.. quickstart system_overview
========================
Overall System Overview
========================
The typical configuration constitute of a standard laptop as ground station and one or more drones, possibly with a RC transmitter for each as safety link. The Command and Control link is made by a pair of modems on the ground and in the drones.
.. image:: general_arch.png
The Gound Control Station (GCS) constitute of multiples programs, communicating with each other by a software bus.
.. image:: agents_arch.png
The core Paparazzi ground programs are Link, which handle the communication with the drones, the Server, which maintain the state of all aircrafts, and the GCS, the user facing application to control the drones.
Many other tools have been developed for various use case, they are available in the *Tools* menu of the paparazzi center.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

@@ -1,4 +1,4 @@
.. tutorials main_tutorials beginner add_drones
.. tutorials beginner add_drones
=========================
Add Drones
@@ -1,4 +1,4 @@
.. tutorials main_tutorials beginner airframe_setup
.. tutorials beginner airframe_setup
======================
Airframe Setup
@@ -1,4 +1,4 @@
.. tutorials main_tutorials beginner flight_plan
.. tutorials beginner flight_plan
======================
Flight Plan Setup
@@ -1,4 +1,4 @@
.. tutorials main_tutorials beginner gcs_setup
.. tutorials beginner gcs_setup
======================
GCS Setup
@@ -1,4 +1,4 @@
.. tutorials main_tutorials beginner
.. tutorials beginner
======================
Beginner
@@ -7,6 +7,7 @@ Beginner
TBD
.. toctree ::
use_joystick
gcs_setup
airframe_setup
add_drones
Binary file not shown.

After

Width:  |  Height:  |  Size: 470 KiB

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

@@ -1,9 +1,189 @@
.. tutorials main_tutorials beginner sensor_calibration
.. tutorials beginner sensor_calibration
======================
Sensor Calibration
======================
TBD
The Accelerometers and magnetometers must be calibrated for the drone to fly correctly.
Accelerometer calibration
==========================
1. Flash the board with your normal AP firmware (if it is not already on it.)
2. Switch to the "raw sensors" telemetry mode in the GCS via Settings->Telemetry and make sure that *Server* is running without the ``-n`` option.
.. figure:: raw_sensors.jpg
:alt: How to set raw sensors telemetry
:align: center
Set raw sensors telemetry mode
3. Move your IMU/airframe into different positions to record relevant measurements for each IMU axis.
+ It is important that you get the min/max sensor values on each axis: turn and hold the IMU on all six sides of the 'cube' for about 10 seconds per IMU axis.
+ During theses 10 seconds, the IMU must be absolutely static. Don't hold it in your hands as you will introduce too much vibrations, prefer holding it on a wall.
.. note::
We talk about the **IMU axis** here, not the drone's axis. So be carrefull if IMU axis are not aligned with the drone's axis.
.. figure:: acc_calibration.jpg
:alt: Orientations during accelerometer calibration
:align: center
Orientations during accelerometer calibration
4. Stop the server so it will write the log file (to var/logs).
5. Run the Python script on it to get your calibration coefficients and add them to your airframe file:
+ run the script:
``sw/tools/calibration/calibrate.py -s ACCEL -p var/logs/YY_MM_DD__hh_mm_ss.data``
.. note::
The calibration script needs scipy and matplotlib python libraries. If you don't have these, install them with ``sudo apt install python3-scipy python3-matplotlib``.
+ If the log file contains logs from more than one aircraft, you will need to use the ``-i <ac_id>`` option, e.g :
``sw/tools/calibration/calibrate.py -i 50 -s ACCEL -p var/logs/YY_MM_DD__hh_mm_ss.data``
+ If you kept the ``-p`` option, the script will show the plots.
+ Add (or replace) the output values from this script to the airframe file in the `IMU` section. For example:
.. code-block:: xml
<section name="IMU" prefix="IMU_">
<define name="ACCEL_X_NEUTRAL" value="-40"/>
<define name="ACCEL_Y_NEUTRAL" value="32"/>
<define name="ACCEL_Z_NEUTRAL" value="-33"/>
<define name="ACCEL_X_SENS" value="2.45746358482" integer="16"/>
<define name="ACCEL_Y_SENS" value="2.46030721866" integer="16"/>
<define name="ACCEL_Z_SENS" value="2.46583755829" integer="16"/>
...
</section>
.. note::
For the accelerometer calibration, your autopilot board does not necessarily need to be in your drone's airframe as it depends only on the specific accelerometer chip you have.
Magnetometer calibration
=========================
The procedure is very much similar to accelerometer calibration with two differences:
+ On step 3, Slowly spin your aircraft around all axes. Ideally you would spin it around all axes until you have densely covered the whole sphere with magnetometer measurements. (See figure below)
+ On step 5, use the ``MAG`` argument:
``sw/tools/calibration/calibrate.py -s MAG -p var/logs/YY_MM_DD__hh_mm_ss.data``
.. figure:: mag_calibration.png
:alt: A good calibration dataset
:align: center
A good calibration set
Copy the XML output in the *IMU* section of your airframe file.
.. note::
For the magnetometer calibration, your autopilot board **needs** to be in your drone's airframe as it depends on all interferences of the environment, like the wires around the magnetometer, the position of the battery, and maybe the position of saturn in the sky.
IMU orientation
================
The drone must know how your IMU is oriented.
The drone axis are defined like so:
- Z is vertical down, aligned with the gravity
- X is toward the front of the drone
- Y is to right of the drone
.. figure:: plane_axis.png
:alt: Plane axis
:align: center
Drone axis
According to how you mounted the autopilot board/IMU in the drone, the IMU axes are not necessarily aligned with the drone's axes.
Check if the axes are correct by watching the IMU_ACCEL message:
- Put your drone on its natural attitude. **az** value should be approx **-10**, **ax** and **ay** being around **0**.
- Nose down **ax** is **-10**, **ay** and **az** are **0**
- Right wing down, **ay** is **-10**, **ax** and **az** are **0**
If the signs are not correct (10 instead of -10), change them in the following lines :
.. code-block:: xml
<section name="IMU" prefix="IMU_">
...
<define name="ACCEL_X_SIGN" value="-1"/>
<define name="ACCEL_Y_SIGN" value="1"/>
<define name="ACCEL_Z_SIGN" value="-1"/>
...
</section>
.. note::
If the axis are not correct (e.g. X and Y should be swaped), you can switch them, however this is driver dependent. Here is an example for the Apogee autopilot, where X and Y are swaped:
.. code-block:: xml
<section name="IMU" prefix="IMU_">
...
<define name="APOGEE_CHAN_X" value="1"/>
<define name="APOGEE_CHAN_Y" value="0"/>
<define name="APOGEE_CHAN_Z" value="2"/>
...
</section>
You have to do the same thing for the GYRO signs. It is very likely that you will use the same signs as the ACCEL signs.
.. code-block:: xml
<section name="IMU" prefix="IMU_">
...
<define name="GYRO_P_SIGN" value="-1"/>
<define name="GYRO_Q_SIGN" value="1"/>
<define name="GYRO_R_SIGN" value="-1"/>
...
</section>
To check gyro signs, watch the IMU_GYRO message:
- **gp** must be positive when banking to the right (gq and gr approx 0)
- **gq** must be positive when pitching up (gp and gr approx 0)
- **gr** must be positive when heading clockwise from top view (gq and gq approx 0)
.. note::
The gyrometers measures rotation **speeds**, so if e.g. you bank the drone 45° right and stop, **gp** will increase, then come back to 0.
The resulting axes must form direct (right-handed) coordinates. That means that you will most probaly have a even number of changes: either two negative signs, or one negative sign and two axes swaped.
Finally, flash the drone with your modifications, then check the PFD. put the drone down and wait for 20-40s. If it turn, you have a bad setting. Then Check the directions of pitch up, pitch down, and rolls. For each check, rotate the drone by approx 20 degrees and wait. If the PFD move back, you probably miss a negative sign.
The IMU may not be perfectly aligned with the drone body. In this case, you can use the BODY_TO_IMU defines:
.. code-block:: xml
<section name="IMU" prefix="IMU_">
...
<define name="BODY_TO_IMU_PHI" value="0" unit="deg"/>
<define name="BODY_TO_IMU_THETA" value="3.0" unit="deg"/>
<define name="BODY_TO_IMU_PSI" value="0." unit="deg"/>
...
</section>
- PHI is the roll axis (around X)
- THETA is along the pitch axis (around Y)
- PSI is along the yaw axis (around Z)
In the example above from a fixedwing, BODY_TO_IMU_THETA is set to 3 degrees for the drone to be slightly pitching up.
@@ -1,4 +1,4 @@
.. tutorials main_tutorials beginner testing_and_tuning
.. tutorials beginner testing_and_tuning
======================
Testing and Tuning
@@ -0,0 +1,28 @@
.. tutorials beginner gcs_setup
===============
Use a Joystick
===============
You can use a joystick to command your drone via the datalink if you don't have an RC transmitter.
Currently supported joysticks are listed in the ``paparazzi/conf/joystick`` directory.
Learn how to configure a new joystick on this page: :doc:`../intermediate/create_joystick`
+ Open the airframe file of you aircraft and change the *radio_control* type to *datalink* : ``<module name="radio_control" type="datalink"/>``. Build and upload to the drone.
.. note:: For the first time you try it, remove the propeller blades from you drone : if your configuration is wrong, motors could start spinning and hurt you!
+ Start a session as usual for your drone
+ Start the "Joystick" tool : Tools->Joystick, and stop the program (it might already be crashed because of a bad options)
+ Edit the Joystick command : ``$PAPARAZZI_SRC/sw/ground_segment/joystick/input2ivy -ac AC_NAME JOYSTICK_CONFIG_FILE.xml``.
+ Replace **AC_NAME** by the name of the aircraft (it is probably good as it takes the current A/C), and replace **JOYSTICK_CONFIG_FILE** by a filename from ``paparazzi/conf/joystick``.
.. attention:: Initial sticks positions default to middle position until the axis has been moved. Move all axis to avoid bad surprises.
You can also use the ``-c`` option (c meaning *check*) to prevent sending messages with bad values. Messages will start beeing sent only when all axis received events.
``$PAPARAZZI_SRC/sw/ground_segment/joystick/input2ivy -ac AC_NAME JOYSTICK_CONFIG_FILE.xml -c``
.. note:: Save the programs as a new session to avoid doing that all over again every time!
@@ -0,0 +1,185 @@
.. tutorials intermediate create_joystick
====================================
Create a new joystick configuration
====================================
New joystick configurations can be added in the ``paparazzi/conf/joystick`` directory.
Profile a joystick
==================
Test if your joystick is recognized: plug your joystick then run ``dmesg``. The message is different for every device, but the last lines should look like these::
[49174.642275] usb 1-1: new low-speed USB device number 8 using xhci_hcd
[49174.812307] usb 1-1: New USB device found, idVendor=046d, idProduct=c214, bcdDevice= 2.05
[49174.812309] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[49174.812310] usb 1-1: Product: Logitech Attack 3
[49174.812311] usb 1-1: Manufacturer: Logitech
[49174.823264] input: Logitech Logitech Attack 3 as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:046D:C214.000B/input/input37
[49174.823608] hid-generic 0003:046D:C214.000B: input,hidraw4: USB HID v1.10 Joystick [Logitech Logitech Attack 3] on usb-0000:00:14.0-1/input0
Launch ``./sw/ground_segment/joystick/test_stick``. It will display joystick informations, then print current status::
Available button: 5 (0x5)
Available hats: 0 (0x0)
Available axes: 4 (0x4)
Axis 0 : parameters = [-32768,32768]
Axis 1 : parameters = [-32768,32768]
Axis 2 : parameters = [-32768,32768]
Axis 3 : parameters = [-32768,32768]
Input device name: "Amazing Joystick" on SDL device "0"
buttons 0 0 0 0 0 | hat 0 | axes 0 0 0 0
buttons 0 0 0 0 0 | hat 0 | axes 0 0 0 0
buttons 0 0 0 0 0 | hat 0 | axes 0 0 0 0
buttons 0 0 0 0 0 | hat 0 | axes 1 -40 0 0
buttons 0 0 0 0 0 | hat 0 | axes -33 -83 0 0
buttons 0 0 0 0 0 | hat 0 | axes -101 0 0 0
.. note:: Your joystick may need to be calibrated. Go to the :ref:`Calibration` section below.
Create a new file for your joystick in the ``paparazzi/conf/joystick`` directory with the syntax of the following example:
.. code-block:: xml
<joystick>
<input>
<axis index="0" name="roll" deadband="10" limit="1.00" exponent="0.7" trim="0"/>
<axis index="1" name="pitch"/>
<axis index="2" name="yaw"/>
<axis index="3" name="thrust"/>
<button index="0" name="fire"/>
<button index="1" name="top_center"/>
<button index="2" name="top_left"/>
<button index="3" name="top_right"/>
<button index="4" name="far_left"/>
</input>
<variables>
<var name="mode" default="0"/>
<set var="mode" value="0" on_event="top_left"/>
<set var="mode" value="1" on_event="top_center"/>
<set var="mode" value="2" on_event="top_right"/>
</variables>
<messages period="0.01">
<message class="datalink" name="RC_4CH" send_always="true">
<field name="mode" value="mode"/>
<field name="throttle" value="Fit(-thrust,-127,127,0,127)"/>
<field name="roll" value="roll"/>
<field name="yaw" value="yaw"/>
<field name="pitch" value="pitch"/>
</message>
<!-- resurrect throttle on fire button -->
<message class="ground" name="DL_SETTING" on_event="fire">
<field name="index" value="IndexOfSetting('autopilot.kill_throttle')"/>
<field name="value" value="0"/>
</message>
<!-- kill throttle on far_left button -->
<message class="ground" name="DL_SETTING" on_event="far_left">
<field name="index" value="IndexOfSetting('autopilot.kill_throttle')"/>
<field name="value" value="1"/>
</message>
</messages>
</joystick>
Inputs
------
Edit the *input* section according to your info given by *test_stick*. There are 3 kind of inputs :
- *axis*: "analog" stick that range from a min to a max value,
- *hat*: tiny stick or arrows that can have 8 directions (up, down, left, right, up-left, ...),
- *buttons*.
*name* and *index* attributes are mandatory for all.
Axis has 4 optionnal attributes:
- *deadband*: input values within the deadband output 0. Range in [0, 127].
- *exponent*: gives precise control around center values, and greater speed at high values. Range in [0, 1.0]. 0 has no effect, 1.0 has maximum effect.
- *limit*: limit the range of the output values, in percent. Range in [0, 1.0]. 1.0 has no effect.
- *trim*: set offset in output values. Range in [-127, 127].
These attributes are applied in that order : deadband, exponent, limit, trim.
Variables
---------
In the *variables* section, you can define integer variables with the *var* tag, with the *name* and *default* attributes. The *set* tag allows to set a value to a variable on an event. An event is the name of a button or a hat.
Messages
--------
The *period* attribute on the *messages* section is the period in seconds at which inputs will be checked.
In this section, you define which messages will be sent, the value of each field, and the conditions required to send the message.
The *message* tag has two required attributes: the *name* and *class* of the message, and two optionnal attributes : *send_always* and *on_event*.
*send_always* is a boolean that default to *false*. If set to *true*, messages will keep be sent at the *period* rate. If set to *false*, message will be sent only when one of its field change value.
*on_event* defines the event/condition required to send the message. Complexes conditions are evaluated. Here are some examples:
- ``on_event="button11 || button10"``
- ``on_event="(button11 || button10) && pitch > 100"``
In the message node, all fields must be specified except the *ac_id* field, that is filled by *input2ivy*.
*value* is a "C like" expression made of axis and variables names, operators, and a set of utily functions.
Thoses functions are:
- ``Scale(toto, min, max)`` : scale toto from default min/max values [-128, 127] to [*min*, *max*]
- ``Fit(x, min_in, max_in, min_out, max_out)`` : scale *x* from *min_in* *max_in* to *min_out*, *max_out*
- ``Bound(x, min, max)`` : bound x between *min* and *max*
- ``PprzMode(x)`` : scale input value to [0;1;2]. usefull for RC mode.
- ``JoystickID()`` : return the joystick ID.
- ``IndexOfEnum(NAME)`` : return the index of the enum member *NAME*
- ``IndexOfSetting('setting_name')`` : return the index of the setting *setting_name*.
- ``IndexOfBlock('block_name')`` : return the index of the block *block_name*.
- ``HatCentered(hat_name)``, ``HatUp(hat_name)``, ``HatRight(hat_name)``, ``HatRightUp(hat_name)``, ``HatDown(hat_name)``, ``HatRightDown(hat_name)``, ``HatLeft(hat_name)``, ``HatLeftUp(hat_name)``, ``HatLeftDown(hat_name)`` : return 1 or 0.
The operators are: *-*, *+*, *\**, *%*, *&&*, *||*, *<*, *>*
Some examples:
- ``value="roll"``
- ``value="(right-left)*127"``
- ``value="IndexOfSetting('autopilot.kill_throttle')"``
- ``value="Fit(-thrust,-127,127,0,127)"``
- ``value="IndexOfBlock('land here')"``
.. _Calibration:
Calibration
===========
Your joystick may need calibration. Uncalibrated joystick may send non-zero values when the sticks are in neutral position.
Install the joystick and the jstest-gtk packages via:
``sudo apt-get install joystick jstest-gtk``
Use the graphical jstest-gtk tool (or the commandline jstest) to view/edit your joystick calibration and axis/button mappings. Start it via:
``jstest-gtk``
**Store the calibration**
Your calibration and mapping will be lost once you unplug the joystick, so store your configuration via:
``sudo jscal-store /dev/input/js0``
If you replug your joystick the next time, udev should take care of automatically loading the appropriate configuration.
@@ -1,4 +1,4 @@
.. tutorials main_tutorials intermediate index_intermediate
.. tutorials intermediate
================================
Create a new radio configuration
@@ -1,96 +0,0 @@
.. user_guide main_user software airframe airframe_conf imu_configuration
=================
IMU Configuration
=================
The IMU is used by the drone to get its attitude and its angular speed around its axis. It is composed of 3 accelerometers and 3 gyroscopes. Some chip also embbed 3 magnetometers. This device needs to be calibrated, and the drone needs to know how it is fixed to its frame.
See http://wiki.paparazziuav.org/wiki/ImuCalibration for more details.
The accelerometers and gyro calibration is relative to the physical device you have. The magneto calibration is relative to the physival device AND the environment, i.e. the drone itself (battery, GPS...).
Accelerometer configuration
============================
**Add the IMU module**
In your airframe file in the `firmware` section, add the `imu` module corresponding to your hardware (Replace `apogee` in the example below.) :
.. code-block:: xml
<firmware name="fixedwing">
...
<module name="imu" type="apogee">
...
</firmware>
**Get the axis right !**
The drone must know how your IMU is oriented.
.. figure:: pictures_imu/plane_axis.png
:alt: Plane axis
:align: center
Plane axis
Accelerometer calibration
==========================
Here is the procedure:
1. Flash the board with your normal AP firmware (if it is not already on it.)
2. Switch to the "raw sensors" telemetry mode via GCS->Settings->Telemetry and launch "server" to record a log.
.. figure:: pictures_imu/raw_sensors.jpg
:alt: How to set raw sensors telemetry
:align: center
How to set raw sensors telemetry
3. Move your IMU/airframe into different positions to record relevant measurements for each axis.
+ It is important that you get the min/max sensor values on each axis: turn and hold the IMU on all six sides of the 'cube' for about 10 seconds per IMU axis.
+ During theses 10 seconds, the IMU must be absolutely static. Don't hold it in your hands, you will introduce too much vibrations.
+ Please note that we talk about the IMU axes here, and not the airframe axes.
.. figure:: pictures_imu/acc_calibration.jpg
:alt: Orientations during accelerometer calibration
:align: center
Orientations during accelerometer calibration
4. Stop the server so it will write the log file (to var/logs).
5. Run the Python script on it to get your calibration coefficients and add them to your airframe file.
+ run the script:
``sw/tools/calibration/calibrate.py -s ACCEL -p var/logs/YY_MM_DD__hh_mm_ss.data``
+ If the log file contains logs from more than one aircraft, you will need to use the ``-i <ac_id>`` option, e.g :
``sw/tools/calibration/calibrate.py -i 50 -s ACCEL -p var/logs/YY_MM_DD__hh_mm_ss.data``
+ If you kept the ``-p`` option, the script will show the plots.
+ Add (or replace) the output values from this script to the airframe file in the `IMU` section. For example:
.. code-block:: xml
<section name="IMU" prefix="IMU_">
<define name="ACCEL_X_NEUTRAL" value="-40"/>
<define name="ACCEL_Y_NEUTRAL" value="32"/>
<define name="ACCEL_Z_NEUTRAL" value="-33"/>
<define name="ACCEL_X_SENS" value="2.45746358482" integer="16"/>
<define name="ACCEL_Y_SENS" value="2.46030721866" integer="16"/>
<define name="ACCEL_Z_SENS" value="2.46583755829" integer="16"/>
...
</section>
@@ -1,4 +1,4 @@
.. tutorials main_tutorials intermediate
.. tutorials intermediate
======================
Intermediate
@@ -9,5 +9,5 @@ TBD
.. toctree ::
write_module
create_radio
imu_configuration
create_joystick
@@ -1,4 +1,4 @@
.. tutorials main_tutorials intermediate write_module
.. tutorials intermediate
======================
Write a New Module
Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

@@ -0,0 +1,54 @@
.. user_guide communication
=============
Communication
=============
This section will cover the communication in Paparazzi.
Communication in Paparazzi is achieved by the toolkit named **PprzLink**, which doc can be found `here <https://pprzlink.readthedocs.io/en/latest/>`_, and code is `there <https://github.com/paparazzi/pprzlink>`_.
Messages are divided in 5 classes:
- **Telemetry**: telemetry messages are sent by the drone to the ground station.
- **Datalink**: datalink messages are sent by the ground station to the drone.
- **Ground**: gound messages are sent by an agent running on the ground to an other one.
- **Alert**:
- **InterMcu**: intermcu messages are sent by a processor in the drone to an other processor within the same drone.
Existing messages can be seen on `this page <http://docs.paparazziuav.org/latest/paparazzi_messages.html>`_, which is generated from the PprzLink code. You can also see the messages in the `var/messages.xml` file, which is generated at the paparazzi compilation.
Visualising messages
--------------------
Remember the architecture ? Its time to use this *messages* tool at the bottom left!
.. image:: agents_arch.png
The *messages* tool allows you to visualize all messages on the ground network.
First, start a session as explained in the :doc:`../quickstart/first_simulation` page.
Then start the *messages* tool by going in the Paparazzi Center menu and hiting *Tools -> Messages*.
After a few seconds, the new window should fill with messages name and blinking green rectangles. Click on a message name to watch its content. The green rectangle appear each time a new message is received. If you click on a low-frequency message, you will also see a count-up on this rectangle. This is the time since the reception of the last message.
There can be multiples telemetry *modes*. In the GCS (the app with the map), on the botom widget, got to the *Settings* tab, then to the *System*, and *Telemetry* sub-tabs. Change the AP settings from *default* to *minimal* and hit the commit button. You will observe in the messages app that less messages are received.
Change telemetry messages and rates
___________________________________
You can edit which messages are sent by the drone and at what rate. In the Paparazzi Center left pane, hit the telemetry ``Edit`` button. An XML file should open with a text editor.
.. note::
If you want to change the default text editor, sets the ``$EDITOR`` environnement variable on your system. Paparazzi will use this editor.
Watch how the file is structured: there are *process* tags, inside which there are *mode* tags, inside which there are *message*. It matches what you seen in the GCS Telemetry settings. Don't worry too much about processes right now, keep in mind that are are mostly interested about the *Ap* process at the moment.
As an exercise, try to change the *period* of a message. This is the period in seconds at which this message will be sent by the drone. You can also add a message, picked from the telemetry message class.
For your modification to take effect, you need to re-Build the aircraft. Don't forget to *Stop/Remove all Processes* before. After building the aircraft, launch the simulation session and launch again the *messages* tool: you should now see the effects of your modifications.
@@ -0,0 +1,142 @@
.. user_guide directories_structure
=====================
Directories Structure
=====================
This chapter explains how files and directory are structured in Paparazzi.
Here is an extract of the Paparazzi tree:
.. code-block:: text
├── conf
│   ├── airframes
│   │   └── airframe.dtd
│   ├── autopilot
│   │   └── autopilot.dtd
│   ├── conf.xml
│   ├── control_panel.xml
│   ├── flight_plans
│   │   ├── basic.xml
│   │   └── flight_plan.dtd
│   ├── modules
│   │   └── baro_bmp3.xml
│   ├── radios
│   │   └── FrSkyX9D.xml
│   ├── settings
│   │   ├── fixedwing_basic.xml
│   │   └── settings.dtd
│   ├── telemetry
│   │   ├── default_fixedwing.xml
│   │   ├── default_rotorcraft.xml
│   │   └── telemetry.dtd
│   ├── tools
│   │   ├── blacklisted
│   │   ├── gcs.xml
│   │   └── messages.xml
├── doc
│   └── sphinx
│      └── source
├── Makefile
├── paparazzi
├── start.py
├── sw
│ ├── ext
│   ├── airborne
│   │   ├── autopilot.c
│   │   ├── autopilot.h
│ │ └── modules
│   │      ├── decawave
│   │      ├── demo_module
│   │      └── gps
│ ├── ground_segment
│   │   ├── tmtc
│   │   └── cockpit
│ └── simulator
└── var
├── aircrafts
│   └── Microjet
├── logs
│   ├── 20_06_25__11_39_10.data
│   ├── 20_06_25__11_39_10.log
└── messages.xml
From a user perspective, the ``conf`` directory is the most important.
Aircraft
--------
The ``conf/airframes``, ``conf/flight_plans``, ``conf/radios`` and ``conf/telemetry`` sub-directories must contain the corresponding files. You can add as many subdirectories as you want, but don't forget to maintain the relative path to the associated *dtd* file.
In this example tree for the *airframe* directory (located itself in the ``conf`` directory):
.. code-block:: text
airframe
├── airframe.dtd
├── examples
│   └── microjet.xml
└── nimp.xml
.. code-block:: xml
:caption: This is the first line of ``nimp.xml``:
<!DOCTYPE airframe SYSTEM "airframe.dtd">
.. code-block:: xml
:caption: This is the first line of ``examples/microjet.xml``:
<!DOCTYPE airframe SYSTEM "../airframe.dtd">
Aircrafts configurations (stored in ``conf`` files), and control panel files should be located in the ``userconf`` directory.
Tools
-----
The *Tools* in the Paparazzi Center come from the ``conf/tools`` directory. Each xml file produce a new entry in the *Tools* menu. You can add you own tools by creating a new xml file in this directory, and restarting the Paparazzi Center.
There are many tools that you will probably never use. You can remove these from the menu by adding their name to the ``blacklisted`` file.
Modules
-------
Modules configuration files are located in the ``conf/modules`` directory. The actual code of the modules is located in ``sw/airborne/modules``.
Software
--------
Paparazzi softwares are located in ``sw``. Airborne code, that will run on the drone itself, is located in ``sw/airborne``.
- ``sw/ext`` contains external software dependencies.
- ``sw/simulator`` contains the simulators
- ``sw/ground_segment/tmtc``, for "telemetry and telecommand" contains tools related to modems (link), and the server.
- ``sw/ground_segment/cockpit`` contains the GCS code
Doc
---
This documentation is stored in the ``doc/sphinx`` directory. Feel free to improve it!
Generated files
---------------
Compiled and generated files are located in the ``var`` directory.
``var/aircrafts`` contains the files generated by building your aircrafts.
``var/logs`` contains the logs written by the *Server* from real flights as well as for simulations if you remove the ``-n`` option on the server during a simulation.
``var/messages.xml`` list all PprzLink messages.
Launcher
--------
You can launch Paparazzi with the eponym executable file ``paparazzi``, or via the configuration utility ``start.py``. In the later case, you can choose what conf file and what control panel file you want to use.
@@ -0,0 +1,13 @@
.. user_guide flight_plan
============
Flight Plans
============
This section will cover the use of flight plans.
.. warning::
This section has not been written here yet, but an amazing doc is available at `http://wiki.paparazziuav.org/wiki/Flight_Plans <http://wiki.paparazziuav.org/wiki/Flight_Plans>`_. Go check it!
@@ -1,9 +0,0 @@
.. user_guide main_user hardware airframes
======================
Airframes
======================
TBD
@@ -1,9 +0,0 @@
.. user_guide main_user hardware electronics
======================
Electronics
======================
TBD
@@ -1,16 +0,0 @@
.. user_guide main_user hardware
======================
Hardware
======================
TBD
.. toctree::
airframes
electronics
sensors
@@ -1,9 +0,0 @@
.. user_guide main_user hardware sensors
======================
Sensors
======================
TBD

Some files were not shown because too many files have changed in this diff Show More