[Top][All Lists]

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

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

From: Pascal Brisset
Subject: Re: [Paparazzi-devel] Flight plan - circle the closer of two waypoints?
Date: Mon, 29 Mar 2010 11:16:00 +0200
User-agent: Mozilla-Thunderbird (X11/20090706)


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"/>


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

reply via email to

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