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