Radio Control

From PaparazziUAV
Revision as of 13:40, 2 August 2010 by Openuas (talk | contribs)
Jump to navigation Jump to search

Radio

This XML file, usually located in the conf/radios directory, contains a description of the radio control transmitter PPM signal. It should follow the grammar described in radio.dtd.

The contents are an ordered sequence of elements describing each channel with its name and its range:

<!DOCTYPE radio SYSTEM "radio.dtd">
 <radio name="cockpitMM" data_min="900" data_max="2100" sync_min ="5000" sync_max ="15000" pulse_type="POSITIVE">
 <channel ctl="D" function="ROLL"     min="2000" neutral="1498" max="1000" average="0"/>
 ...
 <channel ctl="E" function="MODE"     min="2000" neutral="1500" max="1000" average="1"/>
 ...
 </radio>

The order of the channels must be the order of the pulses in the PPM signal.

Among the top attributes, we find

  • name: used only in debug traces.
  • data_min (resp. _max): the minimum (resp. max) width (in microseconds) used to code one channel of the PPM signal.
  • sync_min (resp. _max): the minimum (resp. max) width (in microseconds) between two impulses set of the PPM signal.
  • pulse_type: the polarity of the PPM pulse. Can be either POSITIVE (FUTABA, Hitec, Multiplex etc) or NEGATIVE (JR, Graupner etc.).

Each channel is described with its transmitter name (ctl), its function name, its range in microseconds and its neutral value in microseconds. These values are used by the autopilot to compute a normalized input from the PPM signal (this file is preprocessed and the produced code is included in the airborne code). Note that the min and max attributes can be exchanged to reverse the direction of the command.

Wrong attributes of the "radio" element will prevent the decoder to recognize any PPM frame; same for a wrong number or channels.

Averaging

The average attribute must be set to 1..x for discrete channels for which a trivial averaging filter will be applied. The neutral of a discrete channel need to be halfway through the min and max values. Otherwise it won't be mapped properly by the filter. Note that averaging a channel gives the output an additional small delay.

Directions

The following signs have been used in the radio configuration files distributed in conf/radios:

  • ROLL: The min attribute value stands for the right position of the stick (turning right)
  • PITCH: The min attribute value stands for the down position of the stick (pitching down)

Example

Below an example of an radio file, in this case openuas_mx22.xml

<?xml version="1.0"?>
<!DOCTYPE radio SYSTEM "../radio.dtd">




<radio name="OpenUAS MX22" data_min="1000" data_max="2000" sync_min="5000" sync_max="15000" pulse_type="NEGATIVE">
  <channel ctl="LeftStickVertical"    function="THROTTLE" 	min="1100" neutral="1120" max="1900" average="0"/>
  <channel ctl="RightStickHorizontal" function="ROLL"     	min="1100" neutral="1500" max="1900" average="0"/>
  <channel ctl="RightStickVertical"   function="PITCH"    	min="1100" neutral="1500" max="1900" average="0"/>
  <channel ctl="LeftStickHorizontal"  function="YAW"      	min="1100" neutral="1500" max="1900" average="0"/>
  <channel ctl="CONTROL8"             function="MODE"     	min="1100" neutral="1500" max="1900" average="1"/>
  <channel ctl="CONTROL9"             function="CAMBER"   	min="1100" neutral="1500" max="1999" average="0"/>
  <channel ctl="CONTROL10"            function="AIRBRAKE"   	min="1100" neutral="1500" max="1900" average="0"/>
  <channel ctl="SW8"                  function="MANUALRELEASE"	min="1001" neutral="1999" max="1999" average="0"/>
</radio>


Measuring the PPM time values

R/C receiver timing diagram

There are two common ways to measure the time characteristics of the PPM signal:

  1. Using an oscilloscope: easy to achieve with a high level digital scope with capture and measure facilities.
  2. Using the telemetry of the autopilot: the PPM message (defined in conf/messages.xml) contains the sequence of a (recently) received PPM signal.

With the default telemetry configuration file (conf/telemetry/default.xml), this message is not sent in the default mode (numbered 0). This mode can be changed to debug (numbered 1) in the airframe file by setting the TELEMETRY_MODE_FBW constant:

 <define name="TELEMETRY_MODE_FBW" value="1"/>.  

Or it can be set within the makefile section by adding:

 ap.CFLAGS += -DTELEMETRY_MODE_FBW=1 

The time unit used in this PPM message is hardware dependent:

  • On the obsolete AVR hardware, 1 microsecond = 16 units (because the crystal is running at 16MHz)
  • on the LPC hardware, 1 microsecond = 15 units (because the cristal is running at 12MHz)
    (conf/autopilot/tiny.h), the CPU clock is 5 times more, the peripheral bus is 4 times less, and the timer is not prescaled (sw/airborne/arm7/sys_time_hw.h) !!!)

Tips

If one has a good servo tester the output values at the receiver side can be measured