Difference between revisions of "Module/FlightBenchmark"

From PaparazziUAV
Jump to navigation Jump to search
m
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Description==
<categorytree style="float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;" mode=pages>Modules</categorytree>
[[Image:SumOfSquaredErrorOfAltitude.jpg|float|600px|Example plot: sum of squared error of altitude ]]
 
This module allows a quantitative assessment of the flight. It calculates the sum of squared error of the two-dimensional course (x / y), the altitude and true airspeed. The sum of squared error of the course and altitude were separated, because they are regulated separately, and so they dependent on various parameters. The module was written to optimize the control parameters and has already been used successfully.
This module allows a quantitative assessment of the flight. It calculates the sum of squared error of the two-dimensional course (x / y), the altitude and true airspeed. The sum of squared error of the course and altitude were separated, because they are regulated separately, and so they dependent on various parameters. The module was written to optimize the control parameters and has already been used successfully.


Line 5: Line 7:


The sum of squared error can by reseted by changing the boolean variable benchm_reset to zero (will turn back to 1 automatically after it has done the reset). This can also be used in a flight plan, which allows a flight plan with auto-reset. So it is possible to fly an oval or a eight figure with a sum of squared error that will be reseted at the very same point of the figure.
The sum of squared error can by reseted by changing the boolean variable benchm_reset to zero (will turn back to 1 automatically after it has done the reset). This can also be used in a flight plan, which allows a flight plan with auto-reset. So it is possible to fly an oval or a eight figure with a sum of squared error that will be reseted at the very same point of the figure.
[[Image:Fehlerquadratsumme_Altitude.jpg]]


==Module Infos==
==Module Infos==
Line 17: Line 17:


==Airframe Adjustments==
==Airframe Adjustments==
The code is aviable to download in the ?? branch at: -ToDo-
The code is aviable in the master git branch.
 
*(1) Insert the software module in the airframe:
 
        <modules>
                <load name="flight_benchmark.xml">
                        <define name="BENCHMARK_AIRSPEED"/>   
                        <define name="BENCHMARK_ALTITUDE"/>   
                        <define name="BENCHMARK_POSITION"/> 
                        <define name="BENCHMARK_TOLERANCE_AIRSPEED" value="0."/>
                        <define name="BENCHMARK_TOLERANCE_ALTITUDE" value="0."/>
                        <define name="BENCHMARK_TOLERANCE_POSITION" value="0."/>
                </load>
        </modules>


**Legend:  
<ol>
***Define BENCHMARK_AIRSPEED to enable airspeed benchmarking (only with airspeed module)
<li>Insert the software module in the airframe:
***Define BENCHMARK_ALTITUDE to enable altitude benchmarking.
<source lang="xml">
***Define BENCHMARK_POSITION to enable position (x/y) benchmarking. (shortest error to the path)
  <modules>
***BENCHMARK_TOLERANCE_... define the tolerated value where the sum of squared error won't change. Set to zero to have no tolerance.
    <load name="flight_benchmark.xml">
      <define name="BENCHMARK_AIRSPEED"/>   
      <define name="BENCHMARK_ALTITUDE"/>   
      <define name="BENCHMARK_POSITION"/
      <define name="BENCHMARK_TOLERANCE_AIRSPEED" value="0."/>
      <define name="BENCHMARK_TOLERANCE_ALTITUDE" value="0."/>
      <define name="BENCHMARK_TOLERANCE_POSITION" value="0."/>
    </load>
  </modules>
</source>


*(2) Add the settings XML to the settings list: benchmark.xml


*(3) Now you can turn on the calculations by setting the benchm_go to 1 (in GCS under benchamrk)
where the defines enable the respective benchmarks:
;BENCHMARK_AIRSPEED : enable airspeed benchmarking (only with airspeed module)
;BENCHMARK_ALTITUDE : enable altitude benchmarking.
;Define BENCHMARK_POSITION : enable position (x/y) benchmarking. (shortest error to the path)
;BENCHMARK_TOLERANCE_x : define the tolerated value where the sum of squared error won't change. Set to zero to have no tolerance.
</li>
<li>Add the settings XML to the settings list: benchmark.xml</li>
<li>Now you can turn on the calculations by setting the benchm_go to 1 (in GCS under benchamrk)</li>
</ol>


==Example configurations in flightplan for auto-reset==
==Example configurations in flightplan for auto-reset==
*(1) Add this to your flightplan:
A example flightplan can be downloaded [https://github.com/Bruzzlee/paparazzi/blob/master/conf/flight_plans/Mentor_FP_04.xml here] but beware: This file contains extras you probably won't need.


<flight_plan alt="............your configurations.............">
*(1) Add this #include to your flightplan in the header:
<source lang="xml">
  <flight_plan alt="............your configurations.............">
         <header>
         <header>
                 #include "modules/benchmark/flight_benchmark.h"
                 #include "modules/benchmark/flight_benchmark.h"
         </header>
         </header>
</flight_plan>
        ...
 
        <blocks>
 
        ...
*(2) Add this block to the blocks section:
        ...
        </blocks>
        ...
  </flight_plan>
</source>


*(2.1) Add this block to the blocks section (Figure Oval):
<source lang="xml">
         <block group="base_pattern" name="Oval Bench" strip_button="Oval Bench(wp 1-2)" strip_icon="oval.png">
         <block group="base_pattern" name="Oval Bench" strip_button="Oval Bench(wp 1-2)" strip_icon="oval.png">
                 <oval p1="Ov1" p2="Ov2" radius="nav_radius" until="nav_oval_count > 0"/>
                 <oval p1="Ov1" p2="Ov2" radius="nav_radius" until="nav_oval_count > 0"/>
Line 59: Line 70:
                 <deroute block="Oval Bench"/>
                 <deroute block="Oval Bench"/>
         </block>
         </block>
</source>


 
*(2.2) You can also use this block in the flightplan (Figure Eight):
*(3) Make shure that you've named your points right.
<source lang="xml">
 
==Modify figure eight to use the until function in flightplan==
 
If you want to use the figure eight with auto-reset you have to modify the flight plan generator to activate the until function.
 
Or download and replace it from:
https://github.com/Bruzzlee/paparazzi/blob/master/sw/tools/gen_flight_plan.ml
 
*(1) Open the flight plan generator in a text editor:
/sw/tools/gen_flight_plan.ml
 
 
*(2) Now you have to replace this part (line 429)
 
    | "eight" ->
    stage ();
    lprintf "nav_eight_init();\n";
    lprintf "NextStageAndBreak();\n";
    left ();
    stage ();
    let center = get_index_waypoint (ExtXml.attrib x "center") index_of_waypoints
    and turn_about = get_index_waypoint (ExtXml.attrib x "turn_around") index_of_waypoints in
    let r = parsed_attrib  x "radius" in
    let _vmode = output_vmode x center "" in
    lprintf "Eight(%s, %s, %s);\n" center turn_about r;
 
 
*(3) with this part
 
    | "eight" ->
    stage ();
    lprintf "nav_eight_init();\n";
    lprintf "NextStageAndBreak();\n";
    left ();
    stage ();
    let center = get_index_waypoint (ExtXml.attrib x "center") index_of_waypoints
    and turn_about = get_index_waypoint (ExtXml.attrib x "turn_around") index_of_waypoints in
    let r = parsed_attrib  x "radius" in
    let _vmode = output_vmode x center "" in
    lprintf "Eight(%s, %s, %s);\n" center turn_about r;
    begin
      try
        let c = parsed_attrib x "until" in
        lprintf "if (%s) NextStageAndBreak();\n" c
      with
        ExtXml.Error _ -> ()
    end;
 
*(4) Now you can use this block in the flightplan:
 
         <block key="F7" name="Eight Bench" strip_button="Figure 8 (wp 1-2)" strip_icon="eight.png" group="base_pattern">
         <block key="F7" name="Eight Bench" strip_button="Figure 8 (wp 1-2)" strip_icon="eight.png" group="base_pattern">
                 <eight center="8C" radius="nav_radius" turn_around="8T" until="nav_oval_count > 0"/>
                 <eight center="8C" radius="nav_radius" turn_around="8T" until="nav_oval_count > 0"/>
Line 117: Line 79:
                 <deroute block="Eight Bench"/>
                 <deroute block="Eight Bench"/>
         </block>
         </block>
</source>
*(4) Make sure that you've named your points right.
[[Category:Modules]]

Latest revision as of 14:57, 7 March 2012

Example plot: sum of squared error of altitude

This module allows a quantitative assessment of the flight. It calculates the sum of squared error of the two-dimensional course (x / y), the altitude and true airspeed. The sum of squared error of the course and altitude were separated, because they are regulated separately, and so they dependent on various parameters. The module was written to optimize the control parameters and has already been used successfully.

The measurement is not started until about the variable benchm_go is set to 1.

The sum of squared error can by reseted by changing the boolean variable benchm_reset to zero (will turn back to 1 automatically after it has done the reset). This can also be used in a flight plan, which allows a flight plan with auto-reset. So it is possible to fly an oval or a eight figure with a sum of squared error that will be reseted at the very same point of the figure.

Module Infos

ModuleXML

  • flight_benchmark.xml

Code- and headerfile

  • sw/airborne/modules/benchmark

Settings file

  • benchmark.xml

Airframe Adjustments

The code is aviable in the master git branch.

  1. Insert the software module in the airframe:
      <modules>
        <load name="flight_benchmark.xml">
          <define name="BENCHMARK_AIRSPEED"/>    
          <define name="BENCHMARK_ALTITUDE"/>    
          <define name="BENCHMARK_POSITION"/>  
          <define name="BENCHMARK_TOLERANCE_AIRSPEED" value="0."/> 
          <define name="BENCHMARK_TOLERANCE_ALTITUDE" value="0."/> 
          <define name="BENCHMARK_TOLERANCE_POSITION" value="0."/> 
        </load> 
      </modules>
    


    where the defines enable the respective benchmarks:

    BENCHMARK_AIRSPEED
    enable airspeed benchmarking (only with airspeed module)
    BENCHMARK_ALTITUDE
    enable altitude benchmarking.
    Define BENCHMARK_POSITION
    enable position (x/y) benchmarking. (shortest error to the path)
    BENCHMARK_TOLERANCE_x
    define the tolerated value where the sum of squared error won't change. Set to zero to have no tolerance.
  2. Add the settings XML to the settings list: benchmark.xml
  3. Now you can turn on the calculations by setting the benchm_go to 1 (in GCS under benchamrk)

Example configurations in flightplan for auto-reset

A example flightplan can be downloaded here but beware: This file contains extras you probably won't need.

  • (1) Add this #include to your flightplan in the header:
  <flight_plan alt="............your configurations.............">
        <header>
                #include "modules/benchmark/flight_benchmark.h"
        </header>
        ...
        <blocks>
        ...
        ...
        </blocks>
        ...
  </flight_plan>
  • (2.1) Add this block to the blocks section (Figure Oval):
        <block group="base_pattern" name="Oval Bench" strip_button="Oval Bench(wp 1-2)" strip_icon="oval.png">
                <oval p1="Ov1" p2="Ov2" radius="nav_radius" until="nav_oval_count > 0"/>
                <set value="1" var="benchm_reset"/>
                <deroute block="Oval Bench"/>
        </block>
  • (2.2) You can also use this block in the flightplan (Figure Eight):
        <block key="F7" name="Eight Bench" strip_button="Figure 8 (wp 1-2)" strip_icon="eight.png" group="base_pattern">
                <eight center="8C" radius="nav_radius" turn_around="8T" until="nav_oval_count > 0"/>
                <set value="1" var="benchm_reset"/>
                <deroute block="Eight Bench"/>
        </block>
  • (4) Make sure that you've named your points right.