http://wiki.paparazziuav.org/w/api.php?action=feedcontributions&user=MJ&feedformat=atomPaparazziUAV - User contributions [en]2024-03-29T05:54:23ZUser contributionsMediaWiki 1.37.1http://wiki.paparazziuav.org/w/index.php?title=Sensors/Airspeed&diff=25090Sensors/Airspeed2020-08-06T01:09:09Z<p>MJ: /* MS45xx */</p>
<hr />
<div><categorytree style="float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;" mode=pages>Sensors</categorytree><br />
== Introduction ==<br />
By default, in the airborne code, airspeed is estimated by measuring the GPS ground speed. The related control loops are described [[Control_Loops|here]]. This gives reasonable results particularly in calm weather conditions. Adding an airspeed sensor measures actual airspeed resulting in better throttle control and aircraft performance especially in windy conditions. It is possible to build your own airspeed sensor by using pressure sensors. To start with adding airspeed sensors it is easier to buy pre-build calibrated airspeeds sensors. This page is currently mainly about how to do just that.<br />
<br />
== How does it work internally ==<br />
<br />
The altitude and airspeed loops are separated as shown in the diagram below. Basically the throttle and pitch are controlled independently and are not coupled in the control loops. Of course one affects the other but the control loops are independent. Please see the [[Control_Loops#Control_loops_using_Airspeed_Sensor|control loops]] for a more detailed block diagram. The airspeed is controlled by two cascaded Proportional–Integral (PI) loops. The first loop is used to regulate the ground speed and the second the airspeed. This is done just to ensure that if the ground speed drops below a certain value the airspeed will be increased to compensate in order to maintain a valid GPS heading. If you happen to have a 3axis magnetometer build in your airframe for getting the heading values, maintaining a certain GPS speed for getting a heading is not needed.<br />
<br />
[[Image:Airspeed.png|left|800px]]<br />
<br style="clear:both"><br />
The following plot is from an actual test flight after spending some time setting the loop gains Here the possibility to perform real-time tuning through the GCS is a real time saver. In the test, the an airplane was flying circles at a constant altitude, except in the end of the flight. The wind was about 5 m/s, judging from the ground speed variations. In the middle there is an example of what happens when the ground speed falls below the setpoint. Finally the altitude setpoint was changed to verify that the airspeed will be maintained while climbing.<br />
[[Image:PlotAS2.png|left|600px]]<br />
<br style="clear:both"><br />
The benefits of the airspeed hold are obvious in this example. The throttle adjusts to keep the airspeed close to the setpoint. <br />
[[Image:09_10_04__17_50_27_as1.png|left|600px]]<br />
<br style="clear:both"><br />
<br />
== Measuring ==<br />
<br />
Sometimes it is very helpful for tuning your aircraft that you only measure the airspeed without controlling you aircraft behavior. This can be accomplished in the following way:<br />
<br />
Replace the '''USE_AIRSPEED''' define with '''MEASURE_AIRSPEED'''.<br />
If you want to get sensor information as it is acquired without delay through the PERIODIC_SEND_ telemetry mechanism, please set '''SENSOR_SYNC_SEND''' instead. Note that defining MEASURE_AIRSPEED and not USE_AIRSPEED results in the normal AIRSPEED message containing rather useless information (it is simply four copies of estimator_airspeed, which is not updated by the airspeed sensor, though appears to be updated a very low rate '''FIX THIS?'''). Since the airspeed control loops are not active, one can vary the frequency of the raw measurements by adjusting the rate at which the airspeed_ets module is called in conf/modules/airspeed_ets.xml in the periodic function frequency.<br />
<br />
= Airspeed sensors =<br />
<br />
== EagleTree Airspeed Sensor ==<br />
<br />
=== Connecting an EagleTree Airspeed Sensor ===<br />
<br />
The [http://www.eagletreesystems.com/Standalone/standalone.htm EagleTree Airspeed Sensor] is a low cost module and comes with a very good pitot tube (Prandtl style, pitot-static tube) that includes static and dynamic ports, it's resolution is 0.45 m/s and it's max speed is 156 m/s. It has an [http://en.wikipedia.org/wiki/I²C I²C] interface that connects directly to the Autopilot I²C port. The paparazzi autopilot code is able to regulate the throttle in order to keep the airspeed constant (and a minimum ground speed). <br />
<br />
When you buy the airspeed sensor it is set to operate in the default mode. Make sure you did not set it somehow to 3rd party mode.<br />
<br />
First, connect the sensor directly to the TWOG, Tiny or Lisa/M autopilot board via the I²C connector. The connector is J6 on the TWOG and Tiny and I2C on Lisa board. The wires coming from the sensor module have the following layout:<br />
<br />
Red wire: 5V<br />
White wire: Ground<br />
Yellow wire: SDA<br />
Brown wire: SCL<br />
<br />
'''See the [[Module/Airspeed_ETS|airspeed_ets module]] page for configuration.'''<br />
<br />
=== EagleTree sensor in 3rd party mode ===<br />
<br />
While it is possible to use the sensors in a mode where values are the real values measured a.k.a. 3rd party mode, for regular use with the autopilot it has no specific advantage. Since the paparazzi already contain code to convert values to real speed values. Using the default setting is even a simpler if you have an eagletree logger and inbetween do some measurement with it, you do not need to reprogram the sensors if you connect them to the Autopilot board again. <br />
<br />
==== Direct mode ====<br />
<br />
Optionally if you have a special requirement and want to use the ''direct mode'', it is possible. For this at the moment one needs to use the Eagletree software under Windows. [[Image:SetSensorFor3rPartyModeRealValues.jpg|240px]]<br />
<br />
This software runs fine under Linux Wine. The application is using the USB port in HID mode. Make sure your run Wine 2.0 or higher.<br />
<br />
== Sensortechnics Airspeed Sensor ==<br />
<br />
[http://www.sensortechnics.com Sensortechnics] provides a lot of solution for pressure measurements, absolute or differential, using analog or digital (i2c) outputs.<br />
<br />
For airspeed measurements on low speed MAVs, a good choice is the [http://www.sensortechnics.com/en/products/pressure-sensors-and-transmitters/amplified-pressure-sensors/lba/ LBA series], especially the [http://www.sensortechnics.com/cms/upload/appnotes/AN_LBA_E_11162.pdf LBAS500UF6S].<br />
<br />
This sensor can be used with the generic [http://docs.paparazziuav.org/latest/module__airspeed_adc.html '''airspeed_adc''' module]. Note that it may be necessary to use a divisor bridge to adapt the 5V output of the sensor to the 3.3V ADC input of the autopilot.<br />
<br />
== MS45xx ==<br />
<br />
[[Image:MS4525DO.jpg|200px]]<br />
<br />
A MS4525DO based sensor user could benefit from built-in temperature compensation. <br />
<br />
Application notes to accompany this product:<br />
<br />
# [http://www.meas-spec.com/downloads/MS45xx_Series_Application_Note.pdf MS45xx Series Application Notes] <br />
# [http://www.meas-spec.com/downloads/Interfacing_to_MEAS_Digital_Pressure_Modules.pdf Interfacing to MEAS Digital Pressure Modules] <br />
# [http://www.meas-spec.com/downloads/Configuration,_POR_and_Power_Consumption.pdf Configuration, POR and Power Consumption.] <br />
<br />
[http://www.digikey.com/catalog/en/partgroup/ms4525do/29060 One can buy one here at digikey]<br />
<br />
To use MS4525 you can load the [http://docs.paparazziuav.org/latest/module__airspeed_ms45xx_i2c.html airspeed_ms45xx_i2c.xml module], e.g. put these lines in the modules section of your airframe file:<br />
{{Box Code|conf/airframes/myplane.xml|<br />
<source lang="xml"><br />
<modules><br />
<load name="airspeed_ms45xx_i2c.xml"><br />
<define name="MS45XX_I2C_DEV" value="i2c1"/><br />
<define name="MS45XX_PRESSURE_RANGE" value="1"/><br />
<define name="MS45XX_OUTPUT_TYPE" value="0"/><br />
<define name="MS45XX_PRESSURE_OFFSET" value="8549.0"/> <!-- 8542.0--><br />
</load><br />
</modules><br />
</source><br />
}}<br />
<br />
== Duo MS5611 ==<br />
<br />
Two MS5611 working in cooperation. see http://blueflyvario.blogspot.de/2013/06/air-speed-from-two-ms5611.html<br />
<br />
== [[Sensors/AMSYS|AMS 5812-0003 / AMS 5812-0001]]==<br />
<br />
[http://www.amsys.info/drucksensor/differenzdrucksensor.htm EU distributor]<br />
[http://www.servoflo.com/product-guide-downloads/low-pressure-guide/download/398/847/17.html US Distributor]<br />
<br />
Comes as sensor only and has a digital I2C and an analog 0.5 V - 4.5 V interface. At least two pull-up resistors (4.7 kOhm) and the wiring have to be added for I2C use. This can be done directly on the sensor and does not necessarily have to be on a special pcb.<br />
<br />
See [[Sensors/AMSYS|the sensor page]] for I2C addressing.<br />
<br />
The biggest advantage of the -0001 is its resolution, at a loiter airspeed of 8.5 m/s, the resolution of the -0001 is about 0,0038 m/s whereas the resolution of the MS4525 would be 0,082 m/s (using the data provided by 3DR).<br />
This advantage gets smaller, the faster the aircraft travels. At 25 m/s the resolution is about 0,0013 m/s and 0,028 m/s. Both resolutions should be more then enough at that speed.<br />
<br />
Maximum speed for the -0001 is about 41 m/s (0 ... 10.34 mbar), for the -0003 about 58 m/s (0 ... 20.68 mbar).<br />
<br />
= Future =<br />
<br />
Just as with everything in the UAS world, lots of improvements are still possible.<br />
<br />
'''What could be improved:'''<br />
<br />
# Maybe revert to GPS measurements only if the airspeed sensor fails.<br />
# Detect Swap of static/dynamic port at pre-flight test<br />
<br />
[[Category:Software]] [[Category:Sensors]] [[Category:User_Documentation]]</div>MJhttp://wiki.paparazziuav.org/w/index.php?title=Control_Loops&diff=25085Control Loops2020-08-05T18:30:05Z<p>MJ: /* General Information */</p>
<hr />
<div>This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.<br />
<br />
= General Information =<br />
<br />
All the possible combinations of control loops might not be fully detailed. This is especially the case when using extra features such as '''AGR_CLIMB''', '''STRONG_WIND''', etc.<br />
<br />
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.<br />
<br />
The variables' names are the ones used in the airborne code (written in '''C'''). Most of these can be used, all caps, in the [[Airframe Configuration]] file in order to define the default values of these variables. If you see all capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.<br />
<br />
The most direct way to determine vehicle behavior is to look at the source code. When determining which control loops are engaged by various flight plan blocks and stages, it may be helpful to look at sw/airborne/subsystems/nav.h and the generated flightplan file in <tt>var/<AIRCRAFT_NAME>/<TARGET>/generated/flight_plan.h</tt>.<br />
<br />
= Fixed-wing autopilot =<br />
<br />
== Global view ==<br />
<br />
[[Image:Diagram_general.png|General overview]]<br />
<br />
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of the configuration file.<br />
<br />
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.<br />
<br />
== Navigation loop ==<br />
<br />
The navigation loop is located in '''sw/airborne/subsystems/nav.*'''. The navigation routines are called from the [[Flight Plans]]. Advanced navigation routines are in '''sw/airborne/subsystems/navigation/'''.<br />
<br />
== Course loop ==<br />
<br />
[[Image:Diagram_course_loop.png|Course loop]]<br />
<br />
The course loop is the upper stage of the horizontal control.<br />
It is located in '''sw/airborne/firmwares/fixedwing/stabilization/stabilization_attitude.c''' (formerly fw_h_ctl.c).<br />
<br />
== Roll loop ==<br />
<br />
[[Image:Diagram_roll_loop.png|Roll loop]]<br />
<br />
The roll loop is the lower stage of the horizontal control and is used for lateral attitude stabilization. It is located in '''stabilization_attitude.c'''.<br />
If <tt>H_CTL_ROLL_ATTITUDE_GAIN</tt> is undefined, the code will fallback to a attitude-only loop, where <tt>estimator_p</tt> is disregarded and the gain for <tt>estimator_phi</tt> is <tt>H_CTL_ROLL_PGAIN</tt>.<br />
<br />
Note; estimator_phi is the measured roll angle, and estimator_p is the measured rate of change in roll angle.<br />
<br />
== Altitude loop ==<br />
<br />
[[Image:Diagram_altitude_loop.png|Altitude loop]]<br />
<br />
The altitude loop is the upper stage of the vertical control.<br />
It is located in '''sw/airborne/firmwares/fixedwing/guidance/guidance_v.c''' (formerly fw_v_ctl.c)<br />
If AGR_CLIMB is defined in the airframe file, the altitude loop also sets the v_ctl_auto_throttle_submode for use in the climb loop.<br />
<br />
== Auto Throttle and Auto Pitch climb loops ==<br />
<br />
Two climb loops are available. The are called from the [[Flight Plans#Navigation_modes|flight plan]] by changing the vertical navigation mode. The default mode is '''Auto Throttle'''. The '''Auto Pitch''' loop is only available if '''V_CTL_AUTO_PITCH_PGAIN''' is defined. Only one loop is active at a time. Note also that if '''USE_AIRSPEED''' is defined, then the Auto Throttle loop is replaced by the Auto Airspeed loop, see [[Control_Loops#Control_loops_using_Airspeed_Sensor|below]].<br />
<br />
=== Auto throttle loop ===<br />
[[Image:Diagram_auto_throttle_loop.png|Auto Throttle climb loop]]<br />
<br />
If '''AGR_CLIMB''' is defined, then the auto throttle submode is used to determine setpoint outputs. This may be the standard control loop outputs, the aggressive outputs (static setpoints defined in airframe file) or a blend of both.<br />
<br />
=== Auto pitch loop ===<br />
[[Image:Diagram_auto_pitch_loop.png|924px|Auto Pitch climb loop]]<br />
<br />
The climb loop is the intermediate stage of the vertical control. It is located in '''guidance_v.c'''.<br />
<br />
== Pitch loop ==<br />
<br />
[[Image:Diagram_pitch_loop.png|Pitch loop]]<br />
<br />
The pitch loop is the lower stage of the vertical control and is used for longitudinal attitude stabilization. It is located in '''stabilization_attitude.c'''.<br />
The first sum block of the diagram is not completely accurate. The input to the pitch stabilization loop is h_ctl_pitch_setpoint, though v_ctl_pitch_of_vz is not a direct input. Rather h_ctl_pitch_setpoint is assigned in the main autopilot loop from nav_pitch, in general (in auto1, it is assigned directly from the pitch r/c input). The nav_pitch value is obtained in a few ways, depending on which control loop(s) are active. If auto throttle is active, nav_pitch is the sum of v_ctl_pitch_of_vz and a fixed setpoint defined using the pitch attribute in the flightplan. If AGR_CLIMB is set, nav_pitch is either the airframe file defined ascent and descent pitch setpoints, the standard sum, or a blend of each. If auto pitch is active, nav_pitch is defined directly from the output of that loop. If airspeed is active, nav_pitch is defined in the auto airspeed pitch loop.<br />
<br />
== Control loops using Airspeed Sensor ==<br />
<br />
Adding an airspeed sensor measures actual airspeed resulting in better throttle control and aircraft performance especially in windy conditions. The use of an airspeed sensor is described [[Airspeed_sensor|here]].<br />
<br />
[[Image:Diagram_auto_airspeed_loop.png|Auto Airspeed climb loop]]<br />
<br />
The auto airspeed cascaded control loops control both pitch and throttle. This control loop set replaces the Auto Throttle climb loop; it is engaged in the same manner in the flight plan. It is located in '''guidance_v.c'''.<br />
<br />
== Energy Control loops using Airspeed Sensor ==<br />
<br />
Total Energy (speed + height) control for fixed wing vehicles developed by the [http://www.mavlab.info MAVLab] of the Technical [http://www.tudelft.nl University] of Delft. An airspeed sensor is mandatory.<br />
The energy control loops control both pitch and throttle. This control loop set replaces the Auto Throttle climb loop and is located in '''energy_ctrl.c'''.<br />
<br />
[[Image:Energycontrol.png|Energy Control loop]]<br />
<br />
= Rotorcraft autopilot =<br />
<br />
The schemes of the multi-rotor autopilot were made with the drawing tool from Google docs. To edit the drawings, send an e-mail to microuav@gmail.com.<br />
<br />
== Overview ==<br />
<br />
[[Image:Booz_autopilot_globalview.png]]<br />
<br />
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.<br />
<br />
Since v5.0, the Supervision was replaced by [[Rotorcraft_Configuration|Motor mixing]]. Alternatively, the stabilization commands can also be directly used in the [[Airframe_Configuration#Servos|servo command laws]].<br />
<br />
== Vertical Control ==<br />
<br />
Depending on the general mode selected, one of the following vertical modes is used.<br />
<br />
=== mode: GUIDANCE_V_MODE_RC_CLIMB (speed control) ===<br />
[[File:Rc_climb.png]]<br />
<br />
=== mode: GUIDANCE_V_MODE_CLIMB (speed control) ===<br />
[[File:Climb.png]]<br />
<br />
=== mode: GUIDANCE_V_MODE_HOVER (altitude control) ===<br />
[[File:Z_hold.png]]<br />
<br />
=== mode: GUIDANCE_V_MODE_NAV ===<br />
<br />
== Reference generators ==<br />
<br />
z relates to altitude, zd to speed and zdd to acceleration<br />
<br />
=== from z set point (desired altitude) ===<br />
<br />
[[Image:Refgen_from_z_sp.png]]<br />
<br />
=== from z dot set point (desired speed) ===<br />
<br />
[[Image:Booz_refgen_zdot.png]]]<br />
<br />
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.<br />
<br />
The code for these reference generators is located in '''guidance/guidance_v_ref.c'''<br />
<br />
== Vertical loop ==<br />
[[File:vertical_loop_V40.png]]<br />
<br />
the source code is located in '''guidance\guidance_v.c'''<br />
<br />
NOMINAL_HOVER_THROTTLE is the nominal thrust when hovering. It's calculated by default by an adaptative controller, in '''guidance\guidance_v_adpt.h'''.<br />
<br />
Instead of the adaptative controller, NOMINAL_HOVER_TROTTLE can be set manually in the Airframe configuration file with:<br />
<br />
<define name="NOMINAL_HOVER_THROTTLE" value="0.5"/><br />
<br />
The value is found after flying manually in hover: NOMINAL_HOVER_THROTTLE= THRUST/MAX_PPRZ (THRUST:mean value of ROTORCRAFT_FP THRUST message in hover, MAX_PPRZ:9600) <br />
<br />
In most cases it makes more sense to not specify this explicitly and use the adaptive controller<br />
<br />
== Horizontal Control ==<br />
<br />
Depending on the general mode selected, one of the following horizontal modes is used.<br />
<br />
=== mode: GUIDANCE_H_MODE_RATE ===<br />
[[Image:GUIDANCE_H_MODE_RATE.png]]<br />
<br />
=== mode: GUIDANCE_H_MODE_ATTITUDE ===<br />
[[Image:GUIDANCE_H_MODE_ATTITUDE.png]]<br />
<br />
=== mode: GUIDANCE_H_MODE_HOVER ===<br />
<br />
When this mode is entered, the measured position at the instance of initiation is set as guidance_h_pos_sp. This means that the rotorcraft will hover on that position.<br />
<br />
[[Image:GUIDANCE_H_MODE_HOVER.png]]<br />
<br />
rotation to body:<br />
<br />
<math>\phi_{cmd_{body}}= -\sin \psi \cdot x_{cmd_{earth}} + \cos \psi \cdot y_{cmd_{earth}} </math><br />
<br />
<math>\theta_{cmd_{body}}= -\left( \cos \psi \cdot x_{cmd_{earth}} + \sin \psi \cdot y_{cmd_{earth}} \right) </math><br />
<br />
=== mode: GUIDANCE_H_MODE_NAV ===<br />
<br />
The set points guidance_h_pos_sp (x and y coordinates) are obtained from the navigation carrot after a 'NED of ENU' transformation:<br />
<br />
guidance_h_pos_sp.x = navigation_carrot.y<br />
<br />
guidance_h_pos_sp.y = navigation_carrot.x<br />
<br />
[[Image:GUIDANCE_H_MODE_NAV.png]]<br />
<br />
Rotation to body is the same as in GUIDANCE_H_MODE_HOVER.<br />
<br />
== Reference generators ==<br />
<br />
=== from euler attitude angle set point ===<br />
<br />
[[Image:Booz_refgen_att.png]]<br />
<br />
Acceleration is set to zero when rate reaches min or max value.<br />
<br />
The code for this reference generator is located in '''stabilization/stabilization_attitude_ref_euler_int.c'''.<br />
<br />
=== from angular rate set point ===<br />
<br />
[[Image:Booz_refgen_rate.png]]<br />
<br />
The code for this reference generator is located in '''stabilization/stabilization_rate.c'''.<br />
<br />
=== from pos set point ===<br />
<br />
[[Image:Booz_refgen_xy_sp.png]]<br />
<br />
Acceleration is set to zero when rate reaches min or max value.<br />
<br />
The code for this reference generator is located in '''guidance/guidance_h_ref.h'''.<br />
<br />
== Attitude loop ==<br />
<br />
[[Image:attitude_loop.png]]<br />
<br />
The code for this loop is located in '''stabilization/stabilization_attitude_euler_int.c'''.<br />
<br />
== Rate loop ==<br />
<br />
[[Image:rate_loop.png]]<br />
<br />
The code for this loop is located in '''stabilization/stabilization_rate.c'''.<br />
<br />
== Guidance horizontal hover loop ==<br />
<br />
[[Image:guidance_horizontal_hover.png]]<br />
<br />
The code for this loop is located in '''guidance/guidance_h.c'''. <br />
<br />
In v 5.14 (and probably even earlier), the integral action is implemented differently: the output of the PD controller is integrated, and the integral value thus represents the attitude trim.<br />
<br />
== Guidance horizontal navigation loop ==<br />
<br />
[[Image:Booz_horizontal_nav.png]]<br />
<br />
The code for this loop is located in '''guidance/guidance_h.c'''<br />
<br />
In v 5.14 (and probably even earlier), the integral action is implemented differently: the output of the PD controller is integrated, and the integral value thus represents the attitude trim.<br />
<br />
[[Category:Software]] [[Category:Developer_Documentation]]</div>MJhttp://wiki.paparazziuav.org/w/index.php?title=Contributing&diff=25081Contributing2020-08-01T07:26:28Z<p>MJ: /* Software development */</p>
<hr />
<div>== How to contribute ==<br />
There are lots of ways to contribute to Paparazzi and get involved. Contributions in the form of elaborating on and expanding documentation, wiki pages, tutorials and code fixes are always welcome and encouraged. <br />
<br />
This page will give you a head start on how you can contribute.<br />
<br />
=== Wiki ===<br />
<br />
If you don't have a Wiki account yet join the [https://gitter.im/paparazzi/discuss Gitter channel] (there is an open chat button in the right lower corner of the page too) and ask and we will Create an account for you. We had to disable normal account creation due to spam attacks.<br />
<br />
You can then immediately start adding information, cleaning up, or fixing typos. It is a tremendous contribution to the quality of the PaparazziUAV documentation when you do this! Just Do It:<br />
<br />
[[Image:Just_Do_It.gif|400px]]<br />
<br />
You do not need a lot of deep technical knowledge to be helpful. If you read something and it is not clear to you, ask for an explanation in the Gitter Chat and then do not forget to add that information to the Wiki.<br />
<br />
Some information and links on how to edit the wiki can be found at [[Help:Editing|Help with Editing]].<br />
<br />
Please be aware of past edits and page histories. Try not to remove this; if you are moving/renaming a page, use the '''move''' tab at the top of a page. This ensures the revision history is moved with the page.<br />
<br />
=== Software development ===<br />
<br />
[[File:AGoodCombinationSTM32ProgressnDebugging.jpg|300px|thumb|Left|Learning Tools]]<br />
<br />
We use the distributed version control system [http://git-scm.com/ git]. The [http://github.com/paparazzi/paparazzi/ Papaprazzi master repository is hosted on Github].<br />
<br />
Also see the [[Git|Git wiki page]] for more details about setting up Git and cloning the source-code and data repository.<br />
<br />
Please also have a look at the [http://docs.paparazziuav.org/latest/styleguide.html Coding Style Guide].<br />
<br />
Here is the short version if you already know git:<br />
# Create an account on [http://github.com/ github].<br />
# Fork the [http://github.com/paparazzi/paparazzi/ paparazzi repository] on github. (After logging in press the '''fork''' button).<br />
# If you want to clone with SSH: '''git clone git@github.com:<yourname>/paparazzi.git'''<br/>Or with HTTPS: '''git clone <nowiki>https://github.com/<yourname>/paparazzi.git</nowiki>'''<br/>[https://help.github.com/articles/which-remote-url-should-i-use Which remote URL should I use?]<br />
# '''git remote add upstream <nowiki>https://github.com/paparazzi/paparazzi.git</nowiki>'''<br />
# '''git fetch upstream'''<br />
# checkout a new branch based on the development branch (master):<br/>'''git checkout -b my_new_feature upstream/master'''<br />
# fix/code and commit in logical units (with a [http://bit.ly/goodcommitmessages good commit message])<br />
# push your feature/bugfix branch<br />
# Send us a [https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests pull request] on github. (Or send patches to the mailing list).<br />
<br />
=== Defects and Features ===<br />
To report a Paparazzi defect or issue. Submit a feature request using the simple [https://github.com/paparazzi/paparazzi/issues issue tracker on github].<br />
<br />
=== Continuous Integration Builds ===<br />
There are [[Builds|build servers]] running some [[Builds/Tests|Continuous Integration tests]].<br />
<br />
[[Category:Developer_Documentation]]</div>MJhttp://wiki.paparazziuav.org/w/index.php?title=Paparazzi_Center&diff=25080Paparazzi Center2020-08-01T01:02:37Z<p>MJ: /* Server */ typo</p>
<hr />
<div>__TOC__<br />
<br />
The Paparazzi Center is a graphical user interface which contains a notebook of three main pages:<br />
* A set of selection boxes to configure an aircraft with its flight plan and build the corresponding programs to be simulated and uploaded to the airborne device.<br />
* A Control Panel to launch the agents of the system and handle collection of programs as configurable sessions<br />
* A page where the [[GCS]] may be embedded.<br />
<br />
A log console is also diplayed in the configuration and control panel pages.<br />
<br />
'''Run the <tt>./paparazzi</tt> script at the root of your installation to start it.'''<br />
<br />
'''Options:'''<br />
* <tt>-fullscreen</tt><br />
<br />
[[Image:paparazzi_center.png|Paparazzi Center]]<br />
<br />
== Configuration ==<br />
<br />
The left part of the configuration page is an editor for the [[Conf.xml]] file. A new aircraft can be added from the A/C menu. The current aircraft can be deleted from the A/C menu.<br />
<br />
The editor for the configuration files is taken from the environment variable EDITOR or defaults to ''gedit'' for Linux and ''open'' for Darwin (i.e. uses the default program for .xml files).<br />
<br />
Note: Several setting files can be simultaneously selected for the '''Settings''' attribute (use the CRTL key in the file selector)<br />
<br />
== Compilation ==<br />
Compilation and flashing are done from the building panel. Targets can be added to the combo box with the New Target button. Compilation and flashing commands are shown as running agents so they can be interrupted if needed.<br />
<br />
Compiling code for stm with hard FPU needs gcc-arm-embedded (just drop it in main directory)<br />
<br />
== Execution ==<br />
<br />
In the Execution panel, a combo box provide a set of predefined and user ''sessions'' (collections of programs).<br />
<br />
The Simulation session runs a server, a GCS and a simulator for the aircraft selected in the configuration panel. Note that the '''sim''' target must have been built prior to the simulation.<br />
<br />
The launched programs can be stopped and restarted (Stop/Redo buttons). Options can also be edited (in the entry box). Automatic respawn is enabled by setting the check box (left side of the Stop/Redo button). The set of the current processes can be saved as a user ''session'' (actually in the <tt>conf/control_panel.xml</tt> configuration file) to<br />
be restarted later (from the Session menu).<br />
<br />
== Tools ==<br />
<br />
The Tools menu contains the most important programs to run everything (look also at the [[Overview]] of the system):<br />
<br />
=== App Server ===<br />
<br />
A server agent to connect an Android device using the application [[PPRZonDroid]]<br />
<br />
=== Attitude Visualizer ===<br />
<br />
A very specific tool for debugging a Quadshot aircraft.<br />
<br />
|[[Image:Pprz_attitude_visualizer_tool.jpg|top|Attitude vizualizer tool]]<br />
<br />
Before you start, install some needed software<br />
<br />
$ sudo apt-get install python-pygame<br />
<br />
Then you can start the Attitude Visualizer via:<br />
<br />
$ cd ~/paparazzi/sw/tools<br />
$ ./attitude_viz.py<br />
<br />
=== Data Link ===<br />
<br />
Connection to the [[Modems]].<br />
* set baud rate: -s 57600<br />
* set device: -d /dev/ttyUSB0 (replace ttyUSB0 with the USB port the actual modem is plugged in)<br />
<br />
=== Enviroment Simulator ===<br />
<br />
The [[Simulation#Change_the_environment|Environment Simulator agent, Gaia]]. Gaia is used for setting a time speed-up , set a windforce and wind direction and simulate GPS failure during simulation of a flightplan. [[Simulation#Change_the_environment|For more details and examples of command line options go here.]]<br />
<br />
=== Flight Plan Editor ===<br />
<br />
[[Flight_Plan_Editor]] for editing the flight plan xml.<br />
<br />
=== GCS ===<br />
<br />
The actual [[GCS]] with lots of [[GCS_Configuration#Configuration_Options| configuration options]].<br />
<br />
=== GPSd position display ===<br />
<br />
<br />
Link to connect a GPS Modem to your GCS.<br/><br />
Very helpful if you landed you micro UAV while testing in high gras or elsewhere opbscured, just walk or drive up there until your GCG red dot overlap you AC icon, you are standing on your MAV. Also handy if GCS is moving in e.g. a car, boat or train.<br />
<br />
'''TIP:'''<br />
[[GPSd_position| A whole page dedicated to explain the details, just go here]]<br />
<br />
=== Hardware in the Loop ===<br />
<br />
Connection to tha AP for [[HITL]] simulation.<br />
<br />
=== Ivy2NMEA ===<br />
<br />
A proxy converting ivy aircraft information to NMEA G and A messages onto a hardware port lke a serial bus. <br />
<br />
=== Joystick ===<br />
<br />
Tool to use a [[Joystick]] to send commands to the aircraft using [[Input2Ivy]].<br />
<br />
=== Link combiner ===<br />
<br />
To establish a [[Redundant_Communication| redundant datalink]] (multiple datalinks for redundancy / security).<br />
<br />
=== Log File Player ===<br />
<br />
To replay [[Logs| Log]] files.<br />
<br />
=== Log Plotter ===<br />
<br />
A [[Plotter|Log Plotter]].<br />
<br />
=== Messages ===<br />
<br />
Shows all messages from the datalink (messages bus observer).<br />
<br />
Command line options:<br />
-b <ivy bus> Default is 127.255.255.255:2010<br />
-c class name<br />
-help Display this list of options<br />
--help Display this list of options<br />
<br />
And example would be to show messages not from airframe but the ones from the groundstation to the aircraft<br />
<br />
$ ./messages -c ground<br />
<br />
=== Messages (Python) ===<br />
<br />
Shows all messages from the datalink (messages bus observer) with python.<br />
<br />
=== NatNet ===<br />
<br />
A proxy application to transform position, velicity and oher relevant data received over a network from an Optitrack sysem onto the ivy bus.<br />
<br />
=== Plot Meto Profile ===<br />
<br />
?<br />
<br />
=== Real-time Plotter ===<br />
<br />
The [[RTPlotter|Real Time Plotter]] can visualize received data from the [[Paparazzi_Center#Messages]] over time (just drag and drop from the messages).<br />
<br />
=== Server ===<br />
<br />
The [[Server]] is an agent that logs, distributes, and preprocesses messages for the [[GCS]] and other agents as described in the [[Overview#System_Architecture|system overview]].<br/><br />
turn off logging: -n<br />
<br />
=== Settings ===<br />
<br />
An important "form" where one can, in real time, adjust aircraft parameters. This is the standalone window version of what is embedded in the [[GCS]].<br />
<br />
=== Settings (Python) ===<br />
<br />
An alternative to the regular settings "form"<br />
<br />
=== Simulator ===<br />
<br />
Simulators. You can build with the [[Simulation|'''sim/jbsim/nps''']] as target in the control panel.<br />
<br />
=== Weather Station===<br />
<br />
A interface to a [[WeatherStationInterface| weather stations]]<br />
<br />
These different agents and tools are available from the Tools menu.<br />
<br />
The set of running agents can be saved as a new custom session (from the Session menu). The current session can also be deleted.<br />
<br />
== Evolutions ==<br />
[[Paparazzi_Center/Evolutions|Read more about the possible Paparazzi Center evolutions...]]<br />
<br />
[[Category:Software]] [[Category:User_Documentation]]</div>MJhttp://wiki.paparazziuav.org/w/index.php?title=Bixler&diff=24999Bixler2020-07-21T05:14:29Z<p>MJ: /* Buy */</p>
<hr />
<div>{|<br />
|-valign="top"<br />
|[[Image:Bixler Table.jpg|thumb|left|Bixler]]<br />
|<br />
The HobbyKing Bixler is a very inexpensive airframe with very easy flight characteristics and reasonable payload capacity. Its price and crash resistant EPO foam construction makes this a plane well suited for beginners.<br />
|}<br />
<br />
<br />
== Features ==<br />
<br />
* Kit price $37 USD<br />
* EPO Foam construction<br />
* Detachable canopy for access to internals<br />
* Easy access cockpit<br />
* Nice and stable slow flight especially for RC beginners<br />
<br />
== Specifications ==<br />
* Material: EPO Foam<br />
* Wingspan: 1400mm<br />
* Length: 925mm<br />
* Wing Area: 26dm2<br />
* Wing Loading: 25g/dm2<br />
* Flying Weight: 650g<br />
* Motor: 2620-1900kv Brushless Outrunner <br />
* ESC: 20A w/BEC <br />
* Servo: 4 x 9g<br />
* Propeller: 6x5.5 recommended.<br />
<br />
<br />
== Buy ==<br />
<br />
Can be bought directly at HobbyKing [https://hobbyking.com/en_us/catalogsearch/result/?q=%22bixler%22#q=%22bixler%22&idx=hbk_live_magento_en_us_products&dFR%5Bwarehouses%5D%5B0%5D=USA&dFR%5Bwarehouses%5D%5B1%5D=Global&dFR%5Bwarehouses_stock_data%5D%5B0%5D=USA%7C1&dFR%5Bwarehouses_stock_data%5D%5B1%5D=USA%7C2&dFR%5Bwarehouses_stock_data%5D%5B2%5D=USA%7C3&dFR%5Bwarehouses_stock_data%5D%5B3%5D=Global%7C1&dFR%5Bwarehouses_stock_data%5D%5B4%5D=Global%7C2&dFR%5Bwarehouses_stock_data%5D%5B5%5D=Global%7C3&hFR%5Bcategories.level0%5D%5B0%5D=Aircraft%20%2F%2F%2F%20Planes%20%2F%2F%2F%20All%20Planes&is_v=1]<br />
<br />
== Airframe configuration ==<br />
A simple, sample airframe configuration file can be found in conf/airframes/examples/bixler_lisa_m_2.xml [https://github.com/paparazzi/paparazzi/blob/v3.9/conf/airframes/examples/bixler_lisa_m_2.xml]<br />
<br />
Attention: No tuning values in this file yet! It is an untested setup.<br />
<br />
== Cockpit ==<br />
{|<br />
|-valign="top"<br />
|[[Image:Bixler Cockpit.jpg|thumb|left|Cockpit]]<br />
|HobbyKing also offers a very simple plywood FPV mount which can be used to mount the autopilot. [http://www.hobbyking.com/hobbyking/store/uh_viewItem.asp?idProduct=22731]<br />
<br />
Note the [[Lisa/M]] board is mounted at a right angle which is the natural orientation of the IMU. This layout also makes wiring much simpler.<br />
<br />
This way the IMU is far from the planes' centre of gravity. Mounting the IMU under the wings would be better, but much more complex.<br />
<br />
The camera mount for the keyhole camera seen here proved not to be crash resistant enough.<br />
|}<br />
<br />
== Mods ==<br />
The plane flies well out of the box. But some modifications are popular:<br />
<br />
* Rudder servo can be moved back into the rudder. The original long pushrod in tube setup is far from perfect. Moving the servo into the tail wing will increase accuracy but will also move the centre of gravity severely to the rear. A lot of counterweights in the front will be needed.<br />
* Increase rudder size either by gluing some strong paper or cardboard on the rudder to make it bigger or by cutting the tail fin at the whole length following the hinge and attaching a full height rudder.<br />
* Wings can be designed to be detachable. Just don't glue wings and carbon rod in, and hold wing halves together with Velcro. This makes the wings obviously much more fragile. The original carbon rod is not very strong, even if glued in.<br />
<br />
<br />
Plenty of space is available inside, but much of this space is not very easy to access.<br />
[[Image:Bixler Nose.jpg|thumb|left|Datalink antenna]]<br />
Here the 2.4Ghz XBee telemetry antenna can be seen pushed out to one side. Pointing down in flight.<br />
<br />
Large batteries can be fitted without problems.<br />
<br />
== Build Tips ==<br />
<br />
The foam hinges are very stiff and need to be exercised quite a bit by hand to make them move well.</div>MJhttp://wiki.paparazziuav.org/w/index.php?title=DevGuide/Server_GCS_com&diff=24998DevGuide/Server GCS com2020-07-15T06:58:27Z<p>MJ: </p>
<hr />
<div>The communication between the '''[[Server|server]]''' and the '''[[GCS]]''' is based on the [[Ivy]] middleware as described in the [[Overview#System_Architecture|system overview]].<br />
<br />
The mechanism described below apply mainly to the Ocaml library provided by paparazzi (sw/lib/ocaml/pprz.ml*), even if the basic send/bind functions of Ivy can be used directly in C programs.<br />
<br />
= How Ivy is used =<br />
<br />
== Normal bind/send mechanism ==<br />
<br />
[[Ivy]] is based on message subscription (based on [http://en.wikipedia.org/wiki/Regular_expression regular expression]):<br />
* the '''bind''' function takes two parameters: a regular expression and a callback function.<br />
* the '''send''' function sends strings and is used like the 'printf' C function.<br />
when someone has a message to send that is matching the regular expression of one or more '''bind''', it will trigger the associated callback with the string as a parameter.<br />
<br />
== Advanced request mechanism ==<br />
<br />
In order to let a agent ask for some information, a answer/request mechanism has been integrated using the normal bind/send mechanism.<br />
<br />
* the '''answerer''' function takes a message name (ex: MSG_NAME) and a callback function as parameters<br />
** it binds to MSG_NAME_REQ messages<br />
** it sends back a MSG_NAME message when the MSG_NAME_REQ callback is triggered<br />
* the '''request''' function takes a message name (ex: MSG_NAME), a callback function and some values as parameters<br />
** it binds to MSG_NAME message with the callback function given as parameter<br />
** it sends a MSG_NAME_REQ message with the values given as parameters<br />
** after receiving the reply from the answer and applying the callback function to the returned values, it unbinds from the message MSG_NAME<br />
<br />
= Format of messages =<br />
<br />
The messages used in paparazzi are described in the file ''conf/messages.xml''. Most of the messages used by the '''[[GCS]]''' or the '''server''' are from the class '''ground'''. Each message is composed of:<br />
* a unique name (among all the messages)<br />
* a unique ID (among its class)<br />
* a list of ''fields'' with a name and a type<br />
<br />
In the following subsections, ''anything'' means that a field can match any string that doesn't have whitespace, ''anything...'' means that the field can contain several or none ''anything'' separated by whitespace.<br />
<br />
== Normal format ==<br />
<br />
The normal format of the message when using the '''send''' function:<br />
[timestamp] sender_name msg_name ''anything...''<br />
timestamp is optional, default is false.<br />
<br />
The normal '''bind''' function looks for messages of the form:<br />
[timestamp or nothing] sender_name msg_name ''anything...'' when a sender name is given as a parameter<br />
[timestamp or nothing] ''anything'' msg_name ''anything...'' else<br />
This allow to receive the messages coming from a given sender or from anyone.<br />
<br />
== Advanced format ==<br />
<br />
When using the answer/request mechanism a unique request ID is added to the normal format. The format of this ID is '''pid_index'''. The Unix Process ID (pid) is unique for each running program, the index is incremented at each request. There is no timestamp.<br />
<br />
The '''request''' send format:<br />
sender_name request_id msg_name_REQ ''anything...''<br />
<br />
The '''request''' bind format:<br />
request_id ''anything'' msg_name ''anything...''<br />
<br />
The '''answerer''' send format:<br />
request_id sender_name msg_name ''anything...''<br />
<br />
The '''answerer''' bind format:<br />
''anything'' ''anything'' msg_name_REQ ''anything...''<br />
<br />
= Server <-> GCS communication =<br />
<br />
== Server ==<br />
<br />
The '''server''' sends synthetic messages based on the telemetry data received from the UAVs (normal period is 500ms, 1s for alarms, 5s for WIND):<br />
* NEW_AIRCRAFT (when a telemetry message ALIVE is received (and correct) for the first time)<br />
* FLIGHT_PARAM<br />
* NAV_STATUS<br />
* ENGINE_STATUS<br />
* AP_STATUS<br />
* FLY_BY_WIRE<br />
* DL_VALUES<br />
* WAYPOINT_MOVED<br />
* CAM_STATUS<br />
* CIRCLE_STATUS<br />
* SEGMENT_STATUS<br />
* SURVEY_STATUS<br />
* WIND<br />
* TELEMETRY_STATUS<br />
* TELEMETRY_ERROR<br />
* BAT_LOW (trigger alarm)<br />
* AIRPROX (alarm but not used anymore)<br />
It answer to some requests:<br />
* AIRCRAFTS (sends the list of all running aircraft known by the server)<br />
* CONFIG (sends the configuration of a given aircraft)<br />
It binds to:<br />
* MOVE_WAYPOINT<br />
* DL_SETTING<br />
* GET_DL_SETTING<br />
* JUMP_TO_BLOCK<br />
* RAW_DATALINK<br />
* WIND_CLEAR<br />
* all messages of the class telemetry<br />
<br />
== GCS ==<br />
<br />
The '''[[GCS]]''' binds to all the messages sent by the '''server''' (except AIRPROX). It also binds the the messages TCAS_TA, TCAS_RA and DC_SHOT, which are direct telemetry messages.<br />
<br />
It sends messages:<br />
* MOVE_WAYPOINT<br />
* DL_SETTING<br />
* GET_DL_SETTING<br />
* JUMP_TO_BLOCK<br />
* RAW_DATALINK<br />
<br />
It can request for CONFIG and AIRCRAFTS.<br />
<br />
== Initialization sequence ==<br />
<br />
When the '''server''' starts, the initialization is as follow:<br />
* bind to ALIVE message and send a NEW_AIRCRAFT message when the callback is triggered<br />
* bind to the messages sent by the GCS<br />
* set '''answerer''' for AIRCRAFTS and CONFIG<br />
<br />
When the '''[[GCS]]''' starts, the initialization is as follow:<br />
* send request for AIRCRAFTS<br />
** when the callback function is triggered with the list of working aircraft, send requests CONFIG for each of them<br />
* bind to NEW_AIRCRAFT<br />
** when the callback function is triggered with a new aircraft, send request CONFIG for it<br />
* bind to messages sent by the '''server''' + some extra messages<br />
<br />
The result is that the GCS asks for the aircraft already known by the server and then receives new aircraft as they appear.<br />
<br />
[[Category:Software]] [[Category:Developer_Documentation]]</div>MJ