Difference between revisions of "Rotorcraft Configuration"

From PaparazziUAV
Jump to: navigation, search
m
m (syntaxhighlight)
Line 7: Line 7:
 
This is one example of a pretty standard quadcopter firmware definition:
 
This is one example of a pretty standard quadcopter firmware definition:
 
{{Box Code|conf/airframes/myplane.xml|
 
{{Box Code|conf/airframes/myplane.xml|
<pre>
+
<source lang="xml">
 
   <firmware name="rotorcraft">
 
   <firmware name="rotorcraft">
 
     <target name="sim" board="pc">
 
     <target name="sim" board="pc">
Line 25: Line 25:
 
     <subsystem name="stabilization" type="euler"/>
 
     <subsystem name="stabilization" type="euler"/>
 
   </firmware>
 
   </firmware>
</pre>
+
</source>
 
}}
 
}}
 
=== Select your Board ===
 
=== Select your Board ===
Line 35: Line 35:
  
 
{{Box Code|conf/airframes/myplane.xml|
 
{{Box Code|conf/airframes/myplane.xml|
<pre>
+
<source lang="xml">
 
   <firmware name="rotorcraft">
 
   <firmware name="rotorcraft">
 
     <target name="sim" board="pc"/>
 
     <target name="sim" board="pc"/>
Line 41: Line 41:
 
     ...
 
     ...
 
   </firmware>
 
   </firmware>
</pre>
+
</source>
 
}}
 
}}
  
Line 47: Line 47:
 
You have to specify which ESCs you have by adding the appropriate [[Subsystem/actuators|actuators subsystem.]]
 
You have to specify which ESCs you have by adding the appropriate [[Subsystem/actuators|actuators subsystem.]]
 
{{Box Code|conf/airframes/myplane.xml|
 
{{Box Code|conf/airframes/myplane.xml|
<pre>
+
<source lang="xml">
 
   <firmware name="rotorcraft">
 
   <firmware name="rotorcraft">
 
     <target name="ap" board="booz_1.0"/>
 
     <target name="ap" board="booz_1.0"/>
Line 53: Line 53:
 
     <subsystem name="actuators" type="mkk"/>
 
     <subsystem name="actuators" type="mkk"/>
 
   </firmware>
 
   </firmware>
</pre>
+
</source>
 
}}
 
}}
 
=== INS ===
 
=== INS ===
 
The optional INS (Integrated Navigation System) subsystem contains estimations filter to e.g. fuse GPS and IMU data for better position and speed estimates.
 
The optional INS (Integrated Navigation System) subsystem contains estimations filter to e.g. fuse GPS and IMU data for better position and speed estimates.
 
{{Box Code|conf/airframes/myplane.xml|
 
{{Box Code|conf/airframes/myplane.xml|
<pre>
+
<source lang="xml">
 
   <firmware name="rotorcraft">
 
   <firmware name="rotorcraft">
 
     <target name="ap" board="booz_1.0"/>
 
     <target name="ap" board="booz_1.0"/>
Line 64: Line 64:
 
     <subsystem name="ins" type="hff"/>
 
     <subsystem name="ins" type="hff"/>
 
   </firmware>
 
   </firmware>
</pre>
+
</source>
 
}}
 
}}
 
You can also compensate for GPS lag in hff (horizontal filter float) if it is known (in seconds):
 
You can also compensate for GPS lag in hff (horizontal filter float) if it is known (in seconds):
 
{{Box Code|conf/airframes/myplane.xml|
 
{{Box Code|conf/airframes/myplane.xml|
<pre>
+
<source lang="xml">
 
   <firmware name="rotorcraft">
 
   <firmware name="rotorcraft">
 
     <target name="ap" board="booz_1.0"/>
 
     <target name="ap" board="booz_1.0"/>
Line 76: Line 76:
 
     </subsystem>
 
     </subsystem>
 
   </firmware>
 
   </firmware>
</pre>
+
</source>
 
}}
 
}}
  
Line 129: Line 129:
 
=== Mode ===
 
=== Mode ===
 
In the mode section you can set the autopilot modes associated with your 3-way mode switch on your RC.
 
In the mode section you can set the autopilot modes associated with your 3-way mode switch on your RC.
<tt><section name="MODE" prefix="MODE_">
+
<source lang="xml">
  <define name="MANUAL" value="AP_MODE_ATTITUDE_DIRECT" />
+
  <section name="MODE" prefix="MODE_">
  <define name="AUTO1" value="AP_MODE_ATTITUDE_Z_HOLD" />
+
    <define name="MANUAL" value="AP_MODE_ATTITUDE_DIRECT" />
  <define name="AUTO2" value="AP_MODE_HOVER_Z_HOLD" />
+
    <define name="AUTO1" value="AP_MODE_ATTITUDE_Z_HOLD" />
</section></tt>
+
    <define name="AUTO2" value="AP_MODE_HOVER_Z_HOLD" />
 +
  </section>
 +
</source>
  
 
=== Commands ===
 
=== Commands ===
  
 
The <b><tt>commands</tt></b> lists the abstract commands you need to control the aircraft. For most multicopter you just need:
 
The <b><tt>commands</tt></b> lists the abstract commands you need to control the aircraft. For most multicopter you just need:
<tt><commands>
+
<source lang="xml">
  <axis name="PITCH" failsafe_value="0"/>
+
  <commands>
  <axis name="ROLL" failsafe_value="0"/>
+
    <axis name="PITCH" failsafe_value="0"/>
  <axis name="YAW" failsafe_value="0 />
+
    <axis name="ROLL" failsafe_value="0"/>
  <axis name="THRUST" failsafe_value="0"/>
+
    <axis name="YAW" failsafe_value="0 />
</commands></tt>
+
    <axis name="THRUST" failsafe_value="0"/>
 +
  </commands>
 +
</source>
  
 
Each command is also associated with a failsafe value which will be used if no controller is active, for example during initialization of the autopilot board.
 
Each command is also associated with a failsafe value which will be used if no controller is active, for example during initialization of the autopilot board.
Line 151: Line 155:
 
This section describes the "mixing" used for your particular multirotor configuration. This section is needed for "mkk" (mikrokopter) and "asctecV2" controllers, as "asctecV1" do their mixing themselves.
 
This section describes the "mixing" used for your particular multirotor configuration. This section is needed for "mkk" (mikrokopter) and "asctecV2" controllers, as "asctecV1" do their mixing themselves.
  
<pre>
+
<source lang="xml">
  <section name="SUPERVISION" prefix="SUPERVISION_">
+
  <section name="SUPERVISION" prefix="SUPERVISION_">
 
     <define name="MIN_MOTOR" value="3"/>
 
     <define name="MIN_MOTOR" value="3"/>
 
     <define name="MAX_MOTOR" value="200"/>
 
     <define name="MAX_MOTOR" value="200"/>
Line 165: Line 169:
 
     <define name="THRUST_COEF" value="{  256,  256,  256,  256 }"/>
 
     <define name="THRUST_COEF" value="{  256,  256,  256,  256 }"/>
 
   </section>
 
   </section>
</pre>
+
</source>
  
 
Below are values for the common "plus cross", "time cross" quadrirotor configurations.
 
Below are values for the common "plus cross", "time cross" quadrirotor configurations.
Line 172: Line 176:
 
; Plus Cross : [[Image:cross_plus_simple.png|200px]]
 
; Plus Cross : [[Image:cross_plus_simple.png|200px]]
 
Assuming that the order of motors, described in the "servos" section is FRONT, BACK, LEFT, RIGHT.
 
Assuming that the order of motors, described in the "servos" section is FRONT, BACK, LEFT, RIGHT.
<pre>
+
<source lang="xml">
 
     <define name="ROLL_COEF"  value="{    0,    0,  256, -256 }"/>
 
     <define name="ROLL_COEF"  value="{    0,    0,  256, -256 }"/>
 
     <define name="PITCH_COEF"  value="{  256, -256,    0,    0 }"/>
 
     <define name="PITCH_COEF"  value="{  256, -256,    0,    0 }"/>
 
     <define name="YAW_COEF"    value="{  256,  256, -256, -256 }"/>
 
     <define name="YAW_COEF"    value="{  256,  256, -256, -256 }"/>
 
     <define name="THRUST_COEF" value="{  256,  256,  256,  256 }"/>
 
     <define name="THRUST_COEF" value="{  256,  256,  256,  256 }"/>
</pre>
+
</source>
  
  
 
; Time Cross : [[Image:cross_time_simple.png|200px]]
 
; Time Cross : [[Image:cross_time_simple.png|200px]]
 
Assuming that the order of motors, described in the "servos" section is NE, SE, SW, NW.
 
Assuming that the order of motors, described in the "servos" section is NE, SE, SW, NW.
<pre>
+
<source lang="xml">
 
     <define name="ROLL_COEF"  value="{ -256, -256,  256,  256 }"/>
 
     <define name="ROLL_COEF"  value="{ -256, -256,  256,  256 }"/>
 
     <define name="PITCH_COEF"  value="{  256, -256, -256,  256 }"/>
 
     <define name="PITCH_COEF"  value="{  256, -256, -256,  256 }"/>
 
     <define name="YAW_COEF"    value="{  256, -256,  256, -256 }"/>
 
     <define name="YAW_COEF"    value="{  256, -256,  256, -256 }"/>
 
     <define name="THRUST_COEF" value="{  256,  256,  256,  256 }"/>
 
     <define name="THRUST_COEF" value="{  256,  256,  256,  256 }"/>
</pre>
+
</source>
  
 
if your rotors are spinning opposite to the direction showed in the picture, just reverse signs in the YAW_COEF line.
 
if your rotors are spinning opposite to the direction showed in the picture, just reverse signs in the YAW_COEF line.
Line 196: Line 200:
 
Values from this section can be used to tweak the SITL simulation. The NPS (New Paparazzi Sim) currently uses JSBSim as for the flight dynamic modeling, but other FDMs are possible.
 
Values from this section can be used to tweak the SITL simulation. The NPS (New Paparazzi Sim) currently uses JSBSim as for the flight dynamic modeling, but other FDMs are possible.
  
<tt><section name="SIMULATOR" prefix="NPS_">
+
<source lang="xml">
  <define name="ACTUATOR_NAMES" value="{&quot;front_motor&quot;, &quot;back_motor&quot;, &quot;right_motor&quot;, &quot;left_motor&quot;}" />
+
  <section name="SIMULATOR" prefix="NPS_">
  <define name="INITIAL_CONDITITONS" value="&quot;reset00&quot;" />
+
    <define name="ACTUATOR_NAMES" value="{&quot;front_motor&quot;, &quot;back_motor&quot;, &quot;right_motor&quot;, &quot;left_motor&quot;}" />
  <define name="SENSORS_PARAMS" value="&quot;nps_sensors_params_booz2_a1.h&quot;" />
+
    <define name="INITIAL_CONDITITONS" value="&quot;reset00&quot;" />
</section></tt>
+
    <define name="SENSORS_PARAMS" value="&quot;nps_sensors_params_booz2_a1.h&quot;" />
 +
  </section>
 +
</source>
  
 
== Control Loops ==
 
== Control Loops ==

Revision as of 15:17, 4 March 2012

The airframe configuration file is located in conf/airframes and contains all the hardware and software settings for an aircraft. All gains, trims, and behavior settings are defined with standard XML elements. Optionally you can also add a raw Makefile section.

Firmware and Hardware definitions

This is one example of a pretty standard quadcopter firmware definition:

File: conf/airframes/myplane.xml
  <firmware name="rotorcraft">
    <target name="sim" board="pc">
      <subsystem name="fdm"   type="nps"/>
    </target>
    <target name="ap" board="booz_1.0"/>

    <define name="USE_ADAPT_HOVER"/>
    <define name="GUIDANCE_H_USE_REF"/>

    <subsystem name="radio_control" type="ppm"/>
    <subsystem name="telemetry"     type="transparent"/>
    <subsystem name="actuators"     type="mkk"/>
    <subsystem name="imu"           type="b2_v1.1"/>
    <subsystem name="gps"           type="ublox"/>
    <subsystem name="ahrs"          type="int_cmpl_quat"/>
    <subsystem name="stabilization" type="euler"/>
  </firmware>

Select your Board

The airframe file must include the description of the controller board and it's low-level settings. This is done in the firmware section by specifying the board attribute for the target "ap" (autopilot).

Select the appropriate board: "twog_1.0", "tiny_2.11", "tiny_2.1", "tiny_1.1", "tiny_0.99", "booz_1.0", "lisa_l_1.0", "lisa_l_1.1", "pc"


File: conf/airframes/myplane.xml
  <firmware name="rotorcraft">
    <target name="sim" 			board="pc"/>
    <target name="ap" 			board="booz_1.0"/>
     ...
  </firmware>

Actuators

You have to specify which ESCs you have by adding the appropriate actuators subsystem.

File: conf/airframes/myplane.xml
  <firmware name="rotorcraft">
    <target name="ap" board="booz_1.0"/>
     ...
    <subsystem name="actuators" type="mkk"/>
  </firmware>

INS

The optional INS (Integrated Navigation System) subsystem contains estimations filter to e.g. fuse GPS and IMU data for better position and speed estimates.

File: conf/airframes/myplane.xml
  <firmware name="rotorcraft">
    <target name="ap" board="booz_1.0"/>
     ...
    <subsystem name="ins" type="hff"/>
  </firmware>

You can also compensate for GPS lag in hff (horizontal filter float) if it is known (in seconds):

File: conf/airframes/myplane.xml
  <firmware name="rotorcraft">
    <target name="ap" board="booz_1.0"/>
     ...
    <subsystem name="ins" type="hff">
      <define name="GPS_LAG=0.2"/>
    </subsystem>
  </firmware>

Autopilot modes

For rotorcrafts we have a lot of different modes that can be mapped to your 3-position switch (Manual, Auto1, Auto2). The horizontal and vertical mode can be set differently as the following possible modes indicate:

AP_MODE_FAILSAFE 

This is a failsafe mode that gets triggered if:

  • RC signal is lost (and you are not in KILL or NAV mode)
  • GPS and RC is lost in NAV mode

The autopilot will level the rotorcraft out (setpoints to zero pitch and roll angles) and descend at 0.5m/s downwards.

AP_MODE_KILL 

Motors are simply switched off.

AP_MODE_RATE_DIRECT 

This is basically the "most" manual mode you can get. You control not the attitude (roll and pitch angles) but the rotation rate. You also set the throttle directly with your RC.

AP_MODE_ATTITUDE_DIRECT 

You control the attitude (roll, pitch and yaw angles), but the throttle directly proportional to your stick position.

AP_MODE_RATE_RC_CLIMB 

You control the rotation rate and the vertical speed according to your throttle stick position. If you have your throttle stick in the middle position, the altitude is keept, down goes down at a speed proportional to your stick position (same for up). In this mode it makes sense to mount the spring for your throttle stick so it recenter itself.

AP_MODE_ATTITUDE_RC_CLIMB 

You control the attitude (roll, pitch and yaw angles) and the vertical speed according to your throttle stick position. If you have your throttle stick in the middle position, the altitude is keept, down goes down at a speed proportional to your stick position (same for up). In this mode it makes sense to mount the spring for your throttle stick so it recenter itself.

AP_MODE_ATTITUDE_CLIMB 

You control the attitude (roll, pitch and yaw angles) and the vertical speed. The vertical speed is set via fms (e.g. joystick).

AP_MODE_RATE_Z_HOLD 

You control the rotation rate and it holds the altitude you were at when entering this mode. Your throttle stick position still limits the max throttle authority, so you should push your throttle stick up after entering this mode so the vertical controller has some "room" to stabilize the altitude. Should something weird happen you can limit the max thrust by taking throttle back.

AP_MODE_ATTITUDE_Z_HOLD 

You control the attitude (roll, pitch and yaw angles) and it holds the altitude you were at when entering this mode. Your throttle stick position still limits the max throttle authority, so you should push your throttle stick up after entering this mode so the vertical controller has some "room" to stabilize the altitude. Should something weird happen you can limit the max thrust by taking throttle back.

AP_MODE_HOVER_DIRECT 

The rotorcraft hovers at the horizontal position you were at when entering this mode (position control). You still set the throttle directly with your RC.

AP_MODE_HOVER_CLIMB 

The rotorcraft hovers at the position you were at when entering this mode (position control). The vertical speed is set via fms (e.g. joystick).

AP_MODE_HOVER_Z_HOLD 

The rotorcraft hovers at the 3D position you were at when entering this mode (position and altitude control). Your throttle stick position still limits the max throttle authority, so you should push your throttle stick up after entering this mode so the vertical controller has some "room" to stabilize the altitude. Should something weird happen you can limit the max thrust by taking throttle back.

AP_MODE_NAV 

Full navigation mode. The rotorcraft follows your flightplan.

XML Parameters

Mode

In the mode section you can set the autopilot modes associated with your 3-way mode switch on your RC.

  <section name="MODE" prefix="MODE_">
    <define name="MANUAL" value="AP_MODE_ATTITUDE_DIRECT" />
    <define name="AUTO1" value="AP_MODE_ATTITUDE_Z_HOLD" />
    <define name="AUTO2" value="AP_MODE_HOVER_Z_HOLD" />
  </section>

Commands

The commands lists the abstract commands you need to control the aircraft. For most multicopter you just need:

  <commands>
    <axis name="PITCH" failsafe_value="0"/>
    <axis name="ROLL" failsafe_value="0"/>
    <axis name="YAW" failsafe_value="0 />
    <axis name="THRUST" failsafe_value="0"/>
  </commands>

Each command is also associated with a failsafe value which will be used if no controller is active, for example during initialization of the autopilot board.

Supervision

This section describes the "mixing" used for your particular multirotor configuration. This section is needed for "mkk" (mikrokopter) and "asctecV2" controllers, as "asctecV1" do their mixing themselves.

  <section name="SUPERVISION" prefix="SUPERVISION_">
    <define name="MIN_MOTOR" value="3"/>
    <define name="MAX_MOTOR" value="200"/>
    <define name="TRIM_A" value="0"/>
    <define name="TRIM_E" value="0"/>
    <define name="TRIM_R" value="0"/>
    <define name="NB_MOTOR" value="4"/>
    <define name="SCALE" value="256"/>
    <define name="ROLL_COEF"   value="{  0  ,    0,  256, -256 }"/>
    <define name="PITCH_COEF"  value="{  256, -256,    0,    0 }"/>
    <define name="YAW_COEF"    value="{  256,  256, -256, -256 }"/>
    <define name="THRUST_COEF" value="{  256,  256,  256,  256 }"/>
  </section>

Below are values for the common "plus cross", "time cross" quadrirotor configurations.


Plus Cross 
Cross plus simple.png

Assuming that the order of motors, described in the "servos" section is FRONT, BACK, LEFT, RIGHT.

    <define name="ROLL_COEF"   value="{    0,    0,  256, -256 }"/>
    <define name="PITCH_COEF"  value="{  256, -256,    0,    0 }"/>
    <define name="YAW_COEF"    value="{  256,  256, -256, -256 }"/>
    <define name="THRUST_COEF" value="{  256,  256,  256,  256 }"/>


Time Cross 
Cross time simple.png

Assuming that the order of motors, described in the "servos" section is NE, SE, SW, NW.

    <define name="ROLL_COEF"   value="{ -256, -256,  256,  256 }"/>
    <define name="PITCH_COEF"  value="{  256, -256, -256,  256 }"/>
    <define name="YAW_COEF"    value="{  256, -256,  256, -256 }"/>
    <define name="THRUST_COEF" value="{  256,  256,  256,  256 }"/>

if your rotors are spinning opposite to the direction showed in the picture, just reverse signs in the YAW_COEF line.

If you want to compute mixing for a special configuration, please see the RotorcraftMixing page.

Simulation

Values from this section can be used to tweak the SITL simulation. The NPS (New Paparazzi Sim) currently uses JSBSim as for the flight dynamic modeling, but other FDMs are possible.

  <section name="SIMULATOR" prefix="NPS_">
    <define name="ACTUATOR_NAMES" value="{&quot;front_motor&quot;, &quot;back_motor&quot;, &quot;right_motor&quot;, &quot;left_motor&quot;}" />
    <define name="INITIAL_CONDITITONS" value="&quot;reset00&quot;" />
    <define name="SENSORS_PARAMS" value="&quot;nps_sensors_params_booz2_a1.h&quot;" />
  </section>

Control Loops

The control loops for rotorcraft can be found in Control Loops.