Difference between revisions of "Module/Airspeed ETS"

From PaparazziUAV
Jump to navigation Jump to search
(added additional info; reformatted the page a bit)
m (added warnings (pitfalls); fixed a type)
Line 56: Line 56:
|}
|}


Please refer to your boards documentation to find out the correct pinout on your board (which cable to connect which pin).  
Please refer to your boards documentation to find out the correct pinout on your board (which cable to connect to which pin).  
Below an example for the TWOG v1.0 is given.
Below an example for the TWOG v1.0 is given.


Line 179: Line 179:
This does not have any bearing on the AIRSPEED message (if both SENSOR_SYNC_SEND and USE_AIRSPEED are defined, then both messages are sent).  
This does not have any bearing on the AIRSPEED message (if both SENSOR_SYNC_SEND and USE_AIRSPEED are defined, then both messages are sent).  


''Please note: if you are using the master branch and have merged commits on or later than July 16, 2013, please replace SENSOR_SYNC_SEND with AIRSPEED_ETS_SYNC_SEND''
<span style="color:#FF0000">'''Caution!'''</span> ''Please note: if you are using the master branch and have merged commits on or later than July 16, 2013, please replace SENSOR_SYNC_SEND with AIRSPEED_ETS_SYNC_SEND''


{{Box Code|conf/airframes/myplane.xml|
{{Box Code|conf/airframes/myplane.xml|
Line 221: Line 221:
</source>
</source>
}}
}}
<span style="color:#FF0000">'''Caution!'''</span> ''Please note: if you are using the master branch and have merged commits on or later than July 16, 2013, please replace SENSOR_SYNC_SEND with AIRSPEED_ETS_SYNC_SEND''


===Result message===
===Result message===

Revision as of 07:00, 16 September 2013

Eagletree Airspeed v3

Overview

The EagleTree Airspeed Sensor is a low cost module and comes with a good pitot tube (Prandtl style, pitot-static tube) that includes static and dynamic ports. It has an 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).

Module name sensors/airspeed_ets
Sensor type air speed
Range 4m/s .. 150m/s
Resolution 0.3m/s
Refresh rate 10Hz
I2C address 0xEA

Product data sheet

Hardware

The sensor directly interfaces to the 3.3V I2C port of the autopilots and is supplied by +5V.

When you buy the airspeed sensor it is set to operate in the default mode.

Caution! Make sure you did not set it somehow to 3rd party mode.

Wiring

The ETS Airspeed sensor has an I2C cable with the following layout:

Autopilot I2C ETS Airspeed wire colour
GND white
+5V red
SDA yellow
SCL brown

Please refer to your boards documentation to find out the correct pinout on your board (which cable to connect to which pin). Below an example for the TWOG v1.0 is given.

Example: TWOG v1.0

This is the wiring for the TWOG v1.0 and the Eagle Tree Airspeed sensor on/for the I2C connector and serves as an example.

Autopilot I2C pin Autopilot I2C ETS Airspeed wire colour
1 GND white
2 +5V red
3 +3.3V do not connect
4 SDA yellow
5 SCL brown


Usage

To use it load the airspeed_ets module:

File: conf/airframes/myplane.xml
  <modules>
    ...
    <load name="airspeed_ets.xml" />
    ...
  </modules>

Depending on your board and the I2C interface you are using, you may need to enable I2CX, where X is 0,1,2,etc., if you are not using it already:

File: conf/airframes/myplane.xml
  <firmware>
    ...
    <define name="USE_I2C0" /> <!-- In case you attached the ETS module to I2C0 -->
    <define name="USE_I2C1" /> <!-- In case you attached the ETS module to I2C1 -->
    <define name="USE_I2C2" /> <!-- In case you attached the ETS module to I2C2 -->
    <define name="USE_I2C3" /> <!-- In case you attached the ETS module to I2C3 -->
  </firmware>


Configuration

You can also set some optional parameters to change the default configuration. For example to use I2C1 instead of I2C0, a scale of 2 (default is 1.8) and offset of 50 (default is 0) is needed:

File: conf/airframes/myplane.xml
  <modules>
    <load name="airspeed_ets.xml">
      <!-- Applies if another I2C interface than IC20 is used -->
      <define name="AIRSPEED_ETS_SCALE"   value="2"/> 
      <define name="AIRSPEED_ETS_OFFSET"  value="50"/>
      <define name="AIRSPEED_ETS_I2C_DEV" value="i2c1"/> 
    </load>
  </modules>


Usage as sensor for speed control

To use the sensor to control the speed of your aircraft add the aggressive climb flag, define which I2C device you are enabling and enable airspeed control:

File: conf/airframes/myplane.xml
  <target name="ap" board="twog_1.0">
    <define name="AGR_CLIMB"/>
    <define name="USE_I2C0"/>     <!-- Details: see above -->
    <define name="USE_AIRSPEED"/> <!-- Use the airspeed sensor in the control loop -->
  </target>

Airframe configuration

Now to use real airspeed values for adjusting your aircrafts autopilot behavior, add the following to the end of the "VERTICAL CONTROL" section of your airframe file:

File: conf/airframes/myplane.xml
  <section name="VERTICAL_CONTROL" prefix="V_CTL_">
    ....
    <!-- auto airspeed and altitude inner loop (for airspeed sensor) -->
    <define name="AUTO_AIRSPEED_SETPOINT" value="13.0"  unit="m/s" /> <!-- SETPOINT values may need to be adjusted to suit your aircraft -->
    <define name="AUTO_AIRSPEED_PGAIN"    value="0.060" />
    <define name="AUTO_AIRSPEED_IGAIN"    value="0.050" /> 
  
    <define name="AUTO_GROUNDSPEED_SETPOINT" value="7.0"  unit="m/s" /> <!-- SETPOINT values may need to be adjusted to suit your aircraft -->
    <define name="AUTO_GROUNDSPEED_PGAIN"    value="0.75" />
    <define name="AUTO_GROUNDSPEED_IGAIN"    value="0.25" />
  </section>

Note that the SETPOINT values may need to be adjusted to suit your aircraft.

Note that depending on whether you set the AIRSPEED setpoint or the GROUNDSPEED setpoint higher, either constant airspeed or constant groundspeed, respectively, will be the goal of the controller.

See paparazzi/conf/airframes/easystar_ets_example.xml for an example airframe configuration.

Debugging and logging the airspeed values

To debug or log the raw values from the ETS airspeed sensor define SENSOR_SYNC_SEND in your airframe file to send the message AIRSPEED_ETS on every sensor reading. Note that defining this sends the AIRSPEED_ETS message at the sensor read rate as defined in conf/modules/airspeed_ets.xml. This does not have any bearing on the AIRSPEED message (if both SENSOR_SYNC_SEND and USE_AIRSPEED are defined, then both messages are sent).

Caution! Please note: if you are using the master branch and have merged commits on or later than July 16, 2013, please replace SENSOR_SYNC_SEND with AIRSPEED_ETS_SYNC_SEND


File: conf/airframes/myplane.xml
  <modules>
    <load name="airspeed_ets.xml">
      <define name="SENSOR_SYNC_SEND"/>
    </load>
  </modules>

The general airspeed can be displayed in the Messages tool by adding the AIRSPEED message to the telemetry file as follows:

File: conf/telemetry/default.xml
  <process name="Ap">
    <mode name="default">
      <message name="AIRSPEED" period="1.0"/>
      ...

The AIRSPEED_ETS message does NOT need to be added to the telemetry configuration since it is sent directly by the module if SENSOR_SYNC_SEND is defined.

NOTES

  1. In the GCS, the strip displays ground speed and not airspeed by default. In order to display airspeed, drag-and-drop the airspeed message field from the Messages tool onto the 2D map of the GCS.
  2. The telemetry name AIRSPEED" should actually be called SPEED and contains Groundspeed and airspeed return values.

Measurement only

To use the sensor for airspeed measurement is also possible. This Measurement only mode does thus not imput to the control loops to have effect to the aircraft behaviour.

To see the sensors data in the log file set the SENSOR_SYNC_SEND in your airframe file. Every time new data is available it will be sent directly.

File: conf/airframes/myplane.xml
  <modules>
    <load name="airspeed_ets.xml">
      <define name="SENSOR_SYNC_SEND"/>
    </load>
  </modules>

Caution! Please note: if you are using the master branch and have merged commits on or later than July 16, 2013, please replace SENSOR_SYNC_SEND with AIRSPEED_ETS_SYNC_SEND

Result message

The raw data (adc), estimated offset at init time (offset) and the converted result (scaled) is written to the log file.

File: conf/messages.xml
 <message name="AIRSPEED_ETS" id="57">
   <field name="adc"    type="uint16" />
   <field name="offset" type="uint16" />
   <field name="scaled" type="float"  />
 </message>


Sample log file lines

149.529 123 AIRSPEED_ETS 1626 1606 8.024844
149.633 123 AIRSPEED_ETS 1626 1606 8.024844
149.730 123 AIRSPEED_ETS 1627 1606 7.942226
149.841 123 AIRSPEED_ETS 1628 1606 7.942226