paparazzi-devel
[Top][All Lists]
Advanced

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

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:

In the <header> section:

#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)"/>
     <set value="DEFAULT_CIRCLE_RADIUS" var="nav_radius"/>
     <circle radius="nav_radius" 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
address@hidden
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





reply via email to

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