How do values travel through the system?
Make sure you have a ready built system when trying to analyze the software. Some of the embedded code is generated from the xml configuration files at build time. You can find that in the var folder for the aircraft you are using.
The most important sensor. It gives stick movements from the safety pilot to the aircraft. The values are derived from the angle of the sticks or from position switches. The minimum configuration for a Paparazzi transmitter is two sticks and one three-position switch for manual, auto1 and auto2.
The angle is usually given from -100% to 100% for full sweep and 0% for the middle position. This are the min / max positions and values we use:
RC transmitters generate a pulse-pause-modulation PPM signal from the angles (proprietary PCM does not work with Paparazzi). The information is in the length of a pulse. Usually a 1.5ms pulse is middle position and 1ms equals -100% and 2ms 100%. The pulses are sent as a packet and repeat at about 15ms rate The following shows a 9 channel transmitter and a decoded servo #1:
RC transmitter use slightly different timings for the middle and 100% positions and have different directions. The conf/radio folder contains the descriptions for the different transmitters. Here, also no trim should be used. Give the repeat time of the PPM pulse and the number of channels (you have one pulse more than channels!). The switches can be filtered by a low pass filter through the "average" descriptor.
The PPM signal is transmitted as FM signal and demodulated in your receiver. The receiver demultiplexes the signals with a shift register chip like 4015 or 4017 and gives it to servos. Paparazzi needs the non-demultiplexed TTL level signal from the receiver. A good point to grab that is the input of the shift register of the receiver (e.g. pin 1 of a 4015). Some newer receiver have microcontrollers which make it tricky to get the signal.
The signal is low and goes high for the pulses in most cases, use -DRADIO_CONTROL_TYPE=RC_FUTABA in your aircraft description file for that. Some Graupner/JR receivers use inverted logic, use -DRADIO_CONTROL_TYPE=RC_JR for them.
A normalized value is used for servo values within the Paparazzi software. It ranges between MIN_PPRZ and MAX_PPRZ which is currently -9600 and 9600. That is more than 14 bits resolution and a lot more than what RC radios or servos can reproduce. Whenever a value is calculated it should be trimmed to MIN and MAX by TRIM_PPRZ() or TRIM_UPPRZ() for 0 and MAX bounds.
Analog voltages between 0 and 3.3V can be measured with the internal Analog/Digital converters (this refers to the LPC/ARM7 architecture). The values are sampled through a NB_SAMPLES stages long low pass filter. Every ADC pin has to be activated for ADC usage individually for flexible configuration.
The resolution of the ADCs is 10 bits and that gives an integer value between 0 and 1023 in the Paparazzi software. The values are converted to more useful numbers for some sensors.
The thermopiles give a voltage as a (nonlinear) function of the roll/tilt angle. The angle is calculated using the information given in the aircraft file (neutral value, sensor alignment relative to the aircraft axes, correction for diversitiy in sensitivity). Angles are used as radians (360° = 2 * pi) for calculations. Some flight plan values are given in degrees, though.
SPI / I2C
Byte values can be read from SPI or I2C devices, e.g. to read data from additional sensors.
At the end servos have to be moved. The PPRZ values are converted to -100% .. 100% servo movements. The aircraft configuration file describes the relation between the min/max actuation and the 1.0ms - 2.0ms long pulse.