mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-04 05:42:49 +08:00
[fixedwing] snav 'smooth navigation' as a module
This commit is contained in:
committed by
Felix Ruess
parent
ebccc37a06
commit
e2ccf1b6a3
@@ -197,6 +197,7 @@
|
||||
<load name="nav_survey_poly_adv.xml"/>
|
||||
<load name="nav_border_line.xml"/>
|
||||
<load name="nav_line.xml"/>
|
||||
<load name="nav_smooth.xml"/>
|
||||
<load name="infrared_adc.xml"/>
|
||||
<load name="digital_cam_servo.xml">
|
||||
<define name="DC_SHUTTER_SERVO" value="COMMAND_SHUTTER" />
|
||||
|
||||
@@ -12,5 +12,4 @@ $(TARGET).srcs += $(SRC_SUBSYSTEMS)/navigation/traffic_info.c
|
||||
$(TARGET).srcs += $(SRC_SUBSYSTEMS)/navigation/nav_survey_rectangle.c
|
||||
|
||||
$(TARGET).srcs += $(SRC_SUBSYSTEMS)/navigation/OSAMNav.c
|
||||
$(TARGET).srcs += $(SRC_SUBSYSTEMS)/navigation/snav.c
|
||||
|
||||
|
||||
@@ -80,6 +80,16 @@
|
||||
<call fun="border_line_init()"/>
|
||||
<call fun="border_line(WP_1, WP_2, nav_radius)"/>
|
||||
</block>
|
||||
<block name="Smooth nav">
|
||||
<set var="snav_desired_tow" value="gps.tow / 1000. + 200."/>
|
||||
<call fun="snav_init(WP_1, M_PI_2-atan2(WaypointY(WP_2)-WaypointY(WP_1),WaypointX(WP_2)-WaypointX(WP_1)), DEFAULT_CIRCLE_RADIUS/2.)"/>
|
||||
<call fun="snav_circle1()"/>
|
||||
<call fun="snav_route()"/>
|
||||
<call fun="snav_circle2()"/>
|
||||
<call fun="snav_on_time(DEFAULT_CIRCLE_RADIUS)"/>
|
||||
<go from="1" hmode="route" wp="2"/>
|
||||
<deroute block="Standby"/>
|
||||
</block>
|
||||
|
||||
<block group="land" name="Land Right AF-TD" strip_button="Land right (wp AF-TD)" strip_icon="land-right.png">
|
||||
<set value="DEFAULT_CIRCLE_RADIUS" var="nav_radius"/>
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
<!DOCTYPE flight_plan SYSTEM "flight_plan.dtd">
|
||||
|
||||
<flight_plan alt="75" ground_alt="0" lat0="43.46223" lon0="1.27289" max_dist_from_home="1500" name="Basic" security_height="25">
|
||||
<header>
|
||||
#include "subsystems/datalink/datalink.h"
|
||||
#include "subsystems/navigation/snav.h"
|
||||
</header>
|
||||
<waypoints>
|
||||
<waypoint name="HOME" x="0" y="0"/>
|
||||
<waypoint name="STDBY" x="49.5" y="100.1"/>
|
||||
<waypoint name="1" x="226.7" y="92.4"/>
|
||||
<waypoint name="2" x="236.0" y="214.7"/>
|
||||
<waypoint name="MOB" x="137.0" y="-11.6"/>
|
||||
<waypoint name="S1" x="-119.2" y="69.6"/>
|
||||
<waypoint name="S2" x="274.4" y="209.5"/>
|
||||
<waypoint alt="30.0" name="AF" x="177.4" y="45.1"/>
|
||||
<waypoint alt="0.0" name="TD" x="28.8" y="57.0"/>
|
||||
<waypoint name="_BASELEG" x="168.8" y="-13.8"/>
|
||||
<waypoint name="CLIMB" x="-114.5" y="162.3"/>
|
||||
</waypoints>
|
||||
<exceptions/>
|
||||
<blocks>
|
||||
<block name="Wait GPS">
|
||||
<set value="1" var="kill_throttle"/>
|
||||
<while cond="!GpsFixValid()"/>
|
||||
</block>
|
||||
<block name="Geo init">
|
||||
<while cond="LessThan(NavBlockTime(), 10)"/>
|
||||
<call fun="NavSetGroundReferenceHere()"/>
|
||||
</block>
|
||||
<block name="Holding point">
|
||||
<set value="1" var="kill_throttle"/>
|
||||
<attitude roll="0" throttle="0" vmode="throttle"/>
|
||||
</block>
|
||||
<block name="Takeoff" strip_button="Takeoff (wp CLIMB)" strip_icon="takeoff.png">
|
||||
<exception cond="GetPosAlt() > ground_alt+25" deroute="Standby"/>
|
||||
<set value="0" var="kill_throttle"/>
|
||||
<set value="0" var="autopilot_flight_time"/>
|
||||
<go from="HOME" throttle="1.0" vmode="throttle" wp="CLIMB"/>
|
||||
</block>
|
||||
<block name="Standby" strip_button="Standby" strip_icon="home.png">
|
||||
<circle radius="nav_radius" wp="STDBY"/>
|
||||
</block>
|
||||
<block name="Smooth nav">
|
||||
<set var="snav_desired_tow" value="gps_itow / 1000. + 200."/>
|
||||
<call fun="snav_init(WP_1, M_PI_2-atan2(WaypointY(WP_2)-WaypointY(WP_1),WaypointX(WP_2)-WaypointX(WP_1)), DEFAULT_CIRCLE_RADIUS/2.)"/>
|
||||
<call fun="snav_circle1()"/>
|
||||
<call fun="snav_route()"/>
|
||||
<call fun="snav_circle2()"/>
|
||||
<call fun="snav_on_time(DEFAULT_CIRCLE_RADIUS)"/>
|
||||
<go from="1" hmode="route" wp="2"/>
|
||||
<deroute block="Standby"/>
|
||||
</block>
|
||||
<block name="land">
|
||||
<call fun="nav_compute_baseleg(WP_AF, WP_TD, WP__BASELEG, nav_radius)"/>
|
||||
<circle radius="nav_radius" until="NavCircleCount() > 0.5" wp="_BASELEG"/>
|
||||
<circle radius="nav_radius" until="NavQdrCloseTo(DegOfRad(baseleg_out_qdr)-(nav_radius/fabs(nav_radius))*10) && 10 > fabs(GetPosAlt() - WaypointAlt(WP__BASELEG))" wp="_BASELEG"/>
|
||||
</block>
|
||||
<block name="final">
|
||||
<exception cond="ground_alt + 10 > GetPosAlt()" deroute="flare"/>
|
||||
<go from="AF" hmode="route" vmode="glide" wp="TD"/>
|
||||
</block>
|
||||
<block name="flare">
|
||||
<go approaching_time="0" from="AF" hmode="route" throttle="0.0" vmode="throttle" wp="TD"/>
|
||||
<attitude roll="0.0" throttle="0.0" until="FALSE" vmode="throttle"/>
|
||||
</block>
|
||||
</blocks>
|
||||
</flight_plan>
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<module name="nav_line" dir="nav">
|
||||
<module name="nav_smooth" dir="nav">
|
||||
<doc>
|
||||
<description>
|
||||
Fixedwing navigation along a line with nice U-turns.
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<module name="nav_smooth" dir="nav">
|
||||
<doc>
|
||||
<description>
|
||||
Smooth navigation to wp_a along an arc (around wp_cd), a segment (from wp_rd to wp_ta) and a second arc (around wp_ca).
|
||||
</description>
|
||||
</doc>
|
||||
<header>
|
||||
<file name="nav_smooth.h"/>
|
||||
</header>
|
||||
<makefile>
|
||||
<file name="nav_smooth.c"/>
|
||||
</makefile>
|
||||
</module>
|
||||
@@ -20,13 +20,13 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file subsystems/navigation/nav_line.c
|
||||
* @file modules/nav/nav_line.c
|
||||
*
|
||||
* Fixedwing navigation along a line with nice U-turns.
|
||||
*/
|
||||
|
||||
#include "generated/airframe.h"
|
||||
#include "subsystems/navigation/nav_line.h"
|
||||
#include "modules/nav/nav_line.h"
|
||||
#include "subsystems/nav.h"
|
||||
|
||||
/** Status along the pattern */
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file subsystems/navigation/nav_line.h
|
||||
* @file modules/nav/nav_line.h
|
||||
*
|
||||
* Fixedwing navigation along a line with nice U-turns.
|
||||
*/
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file subsystems/navigation/snav.c
|
||||
* @file modules/nav/nav_smooth.c
|
||||
*
|
||||
* Smooth navigation to wp_a along an arc (around wp_cd),
|
||||
* a segment (from wp_rd to wp_ta) and a second arc (around wp_ca).
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#include <math.h>
|
||||
#include "generated/airframe.h"
|
||||
#include "subsystems/navigation/snav.h"
|
||||
#include "modules/nav/nav_smooth.h"
|
||||
#include "state.h"
|
||||
#include "subsystems/nav.h"
|
||||
#include "subsystems/gps.h"
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file subsystems/navigation/snav.h
|
||||
* @file modules/nav/nav_smooth.h
|
||||
*
|
||||
* Smooth navigation to wp_a along an arc (around wp_cd),
|
||||
* a segment (from wp_rd to wp_ta) and a second arc (around wp_ca).
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "std.h"
|
||||
|
||||
|
||||
extern float snav_desired_tow; /* time of week, s */
|
||||
|
||||
bool_t snav_init(uint8_t wp_a, float desired_course_rad, float radius);
|
||||
@@ -40,5 +41,3 @@ bool_t snav_circle2(void);
|
||||
bool_t snav_on_time(float radius);
|
||||
|
||||
#endif // SNAV_H
|
||||
|
||||
|
||||
Reference in New Issue
Block a user