paparazzi-devel
[Top][All Lists]

## Re: [Paparazzi-devel] Flight plan - circle the closer of two waypoints?

 From: Jeremy Reinertsen Subject: Re: [Paparazzi-devel] Flight plan - circle the closer of two waypoints? Date: Mon, 29 Mar 2010 22:05:41 +1000

```Thank's Pascal. Works perfectly!

```
----- Original Message ----- From: "Pascal Brisset" <address@hidden>
```To: <address@hidden>
Sent: Monday, March 29, 2010 7:16 PM
```
Subject: Re: [Paparazzi-devel] Flight plan - circle the closer of two waypoints?
```

```
```Hi,

for example, from basic.xml, by moving the MOB waypoint to the closest
among 1 and 2:

#define DistanceSquareToWP(_wp) { DistanceSquare(estimator_x,
estimator_y, WaypointX(_wp), WaypointY(_wp)); }
#define ChooseClosestWP(wp_1, wp_2, wp_closer) ({ uint8_t tmp =
LessThan(DistanceSquareToWP(wp_1), DistanceSquareToWP(wp_2)) ? wp_1 :
wp_2; waypoints[wp_closer] = waypoints[tmp]; FALSE; })

and a new block:

<block name="Goto closer (1 or 2)">
<call fun="ChooseClosestWP(WP_1, WP_2, WP_MOB)"/>
</block>

--Pascal

Jeremy Reinertsen wrote:
```
```Hi folks,

I am currently learning how to write flight plans and would like to
create a block which will cause the aircraft to travel to the closer
of two waypoints and circle it. Can anyone suggest some sample flight
plan code to determine which waypoint is the closest?

Cheers

Jeremy

```
```

_______________________________________________
Paparazzi-devel mailing list
http://lists.nongnu.org/mailman/listinfo/paparazzi-devel

```
```

--------------------------------------------------------------------------------

No virus found in this incoming message.
Checked by AVG - www.avg.com
```
Version: 9.0.791 / Virus Database: 271.1.1/2776 - Release Date: 03/29/10 04:32:00
```

```