paparazzi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Paparazzi-devel] How to use constants and variables in flight plans


From: Gautier Hattenberger
Subject: Re: [Paparazzi-devel] How to use constants and variables in flight plans?
Date: Mon, 17 Dec 2012 10:12:30 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.10) Gecko/20121027 Icedove/10.0.10

Hello,

You can try something like this:

   <block name="Loop1">
      <for var="i" from="1" to="5">
        <set name="WaypointX(WP_100)" value="WaypointX(WP_100)+100"/>
        <set name="WaypointY(WP_100)" value="WaypointY(WP_100)+100"/>
        ....
        <go from="100" wp="101" hmode="route"/>
        <go from="101" wp="102" hmode="route"/>
        <go from="102" wp="103" hmode="route"/>
        <go from="103" wp="104" hmode="route"/>
      </for>
    </block>

It will increment the waypoint position each times you enter the loop.

Gautier

Le 15/12/2012 23:41, Jorn Anke a écrit :
Hi,

I was reading the wiki about flight plans, and have a few questions about what is actually possible to do, with regard to variables and constants.

Copy-paste from the wiki:

"Expressions

Most of the numeric attributes in stages are analyzed as C expressions. The syntax of this C _expression_ is restricted to
  • numeric constants
  • some internal autopilot variables (not fully documented, see examples)
  • Some binary operators: <, >, <=, >=, <>, ==, +, -, /, *
  • Some utility functions"

Lets say I have these waypoints:

    <waypoint name="100" x="0" y="0"/>
    <waypoint name="101" x="200" y="0"/>
    <waypoint name="102" x="200" y="-100"/>
    <waypoint name="103" x="0" y="-100"/>
    <waypoint name="104" x="0" y="-20"/>

and this loop:
 
  <block name="Loop1">
      <for var="i" from="1" to="5">
        <go from="100" wp="101" hmode="route"/>
        <go from="101" wp="102" hmode="route"/>
        <go from="102" wp="103" hmode="route"/>
        <go from="103" wp="104" hmode="route"/>
      </for>
    </block>

Is it possible to define two constants; "delta_x" and "delta_y", and to offset the original waypoints by these values, times "i", for each turn of the loop?

If so, how?


Cheers,

Jorn 


_______________________________________________
Paparazzi-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]