mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-04 13:55:40 +08:00
[fixedwing] convert Osam navigation routines to a module. Common naming for start and run functions
This commit is contained in:
committed by
Felix Ruess
parent
e2ccf1b6a3
commit
e04af9bbfb
@@ -198,6 +198,7 @@
|
|||||||
<load name="nav_border_line.xml"/>
|
<load name="nav_border_line.xml"/>
|
||||||
<load name="nav_line.xml"/>
|
<load name="nav_line.xml"/>
|
||||||
<load name="nav_smooth.xml"/>
|
<load name="nav_smooth.xml"/>
|
||||||
|
<load name="nav_osam.xml"/>
|
||||||
<load name="infrared_adc.xml"/>
|
<load name="infrared_adc.xml"/>
|
||||||
<load name="digital_cam_servo.xml">
|
<load name="digital_cam_servo.xml">
|
||||||
<define name="DC_SHUTTER_SERVO" value="COMMAND_SHUTTER" />
|
<define name="DC_SHUTTER_SERVO" value="COMMAND_SHUTTER" />
|
||||||
|
|||||||
@@ -11,5 +11,3 @@ $(TARGET).srcs += $(SRC_SUBSYSTEMS)/navigation/common_flight_plan.c
|
|||||||
$(TARGET).srcs += $(SRC_SUBSYSTEMS)/navigation/traffic_info.c
|
$(TARGET).srcs += $(SRC_SUBSYSTEMS)/navigation/traffic_info.c
|
||||||
$(TARGET).srcs += $(SRC_SUBSYSTEMS)/navigation/nav_survey_rectangle.c
|
$(TARGET).srcs += $(SRC_SUBSYSTEMS)/navigation/nav_survey_rectangle.c
|
||||||
|
|
||||||
$(TARGET).srcs += $(SRC_SUBSYSTEMS)/navigation/OSAMNav.c
|
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,7 @@
|
|||||||
<block group="extra_pattern" name="Survey S1-S2" strip_button="Survey (wp S1-S2)" strip_icon="survey.png">
|
<block group="extra_pattern" name="Survey S1-S2" strip_button="Survey (wp S1-S2)" strip_icon="survey.png">
|
||||||
<survey_rectangle grid="150" wp1="S1" wp2="S2"/>
|
<survey_rectangle grid="150" wp1="S1" wp2="S2"/>
|
||||||
</block>
|
</block>
|
||||||
|
<!--===================== Nav modules example blocks =================================-->
|
||||||
<block name="Poly Survey S1-S2" strip_button="Poly Survey">
|
<block name="Poly Survey S1-S2" strip_button="Poly Survey">
|
||||||
<call fun="init_poly_survey_adv(WP_S1,5,0,30,10,50,100)"/>
|
<call fun="init_poly_survey_adv(WP_S1,5,0,30,10,50,100)"/>
|
||||||
<call fun="poly_survey_adv()"/>
|
<call fun="poly_survey_adv()"/>
|
||||||
@@ -80,7 +81,7 @@
|
|||||||
<call fun="border_line_init()"/>
|
<call fun="border_line_init()"/>
|
||||||
<call fun="border_line(WP_1, WP_2, nav_radius)"/>
|
<call fun="border_line(WP_1, WP_2, nav_radius)"/>
|
||||||
</block>
|
</block>
|
||||||
<block name="Smooth nav">
|
<block name="Smooth nav" strip_button="Smooth nav (wp 1-2)">
|
||||||
<set var="snav_desired_tow" value="gps.tow / 1000. + 200."/>
|
<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_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_circle1()"/>
|
||||||
@@ -90,6 +91,36 @@
|
|||||||
<go from="1" hmode="route" wp="2"/>
|
<go from="1" hmode="route" wp="2"/>
|
||||||
<deroute block="Standby"/>
|
<deroute block="Standby"/>
|
||||||
</block>
|
</block>
|
||||||
|
<!-- ===================== OSAM Nav modules example blocks =========================-->
|
||||||
|
|
||||||
|
<block name="Flower" strip_button="Flower (wp 1-2)">
|
||||||
|
<call fun="flower_start(WP_1, WP_2)"/>
|
||||||
|
<call fun="flower_run()"/>
|
||||||
|
</block>
|
||||||
|
<block name="Bungee take-off">
|
||||||
|
<call fun="bungee_takeoff_start(WP_HOME)"/>
|
||||||
|
<call fun="bungee_takeoff_run()"/>
|
||||||
|
</block>
|
||||||
|
<block name="Skid Landing">
|
||||||
|
<call fun="skid_landing_start(WP_AF,WP_TD,nav_radius)"/>
|
||||||
|
<call fun="skid_landing_run()"/>
|
||||||
|
</block>
|
||||||
|
<block name="Poly survey">
|
||||||
|
<call fun="osam_poly_survey_start(WP_S1, 5, 50, 45)"/>
|
||||||
|
<call fun="osam_poly_survey_run()"/>
|
||||||
|
</block>
|
||||||
|
<block name="Flight Line block">
|
||||||
|
<call fun="osam_flight_line_block_run(WP_S1, WP_S5, nav_radius, 30, 10)"/>
|
||||||
|
</block>
|
||||||
|
<block name="Vertical Raster">
|
||||||
|
<call fun="vertical_raster_start()"/>
|
||||||
|
<call fun="vertical_raster_run(WP_S1, WP_S2, nav_radius, 50)"/>
|
||||||
|
</block>
|
||||||
|
<block name="Vertical Raster">
|
||||||
|
<call fun="vertical_raster_start()"/>
|
||||||
|
<call fun="vertical_raster_run(WP_S1, WP_S2, nav_radius, 50)"/>
|
||||||
|
</block>
|
||||||
|
<!--====================================================================================-->
|
||||||
|
|
||||||
<block group="land" name="Land Right AF-TD" strip_button="Land right (wp AF-TD)" strip_icon="land-right.png">
|
<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"/>
|
<set value="DEFAULT_CIRCLE_RADIUS" var="nav_radius"/>
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<!DOCTYPE module SYSTEM "module.dtd">
|
||||||
|
|
||||||
|
<module name="nav_osam" dir="nav">
|
||||||
|
<doc>
|
||||||
|
<description>
|
||||||
|
OSAM collection of advanced navigation routines.
|
||||||
|
-Flower
|
||||||
|
-Bungee take-off
|
||||||
|
-Polygon survey
|
||||||
|
-Vertical raster
|
||||||
|
-Skid landing
|
||||||
|
</description>
|
||||||
|
</doc>
|
||||||
|
<header>
|
||||||
|
<file name="nav_osam.h"/>
|
||||||
|
</header>
|
||||||
|
<makefile>
|
||||||
|
<file name="nav_osam.c"/>
|
||||||
|
</makefile>
|
||||||
|
</module>
|
||||||
@@ -20,11 +20,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file subsystems/navigation/OSAMNav.c
|
* @file modules/nav/nav_osam.c
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "subsystems/navigation/OSAMNav.h"
|
#include "modules/nav/nav_osam.h"
|
||||||
|
|
||||||
#include "subsystems/nav.h"
|
#include "subsystems/nav.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
@@ -63,7 +63,7 @@ static uint8_t Edge;
|
|||||||
#define LINE_STOP_FUNCTION {}
|
#define LINE_STOP_FUNCTION {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool_t InitializeFlower(uint8_t CenterWP, uint8_t EdgeWP)
|
bool_t flower_start(uint8_t CenterWP, uint8_t EdgeWP)
|
||||||
{
|
{
|
||||||
Center = CenterWP;
|
Center = CenterWP;
|
||||||
Edge = EdgeWP;
|
Edge = EdgeWP;
|
||||||
@@ -93,7 +93,7 @@ bool_t InitializeFlower(uint8_t CenterWP, uint8_t EdgeWP)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t FlowerNav(void)
|
bool_t flower_run(void)
|
||||||
{
|
{
|
||||||
TransCurrentX = stateGetPositionEnu_f()->x - WaypointX(Center);
|
TransCurrentX = stateGetPositionEnu_f()->x - WaypointX(Center);
|
||||||
TransCurrentY = stateGetPositionEnu_f()->y - WaypointY(Center);
|
TransCurrentY = stateGetPositionEnu_f()->y - WaypointY(Center);
|
||||||
@@ -203,7 +203,7 @@ static float BungeeAlt;
|
|||||||
static float TDistance;
|
static float TDistance;
|
||||||
static uint8_t BungeeWaypoint;
|
static uint8_t BungeeWaypoint;
|
||||||
|
|
||||||
bool_t InitializeBungeeTakeoff(uint8_t BungeeWP)
|
bool_t bungee_takeoff_start(uint8_t BungeeWP)
|
||||||
{
|
{
|
||||||
float ThrottleB;
|
float ThrottleB;
|
||||||
|
|
||||||
@@ -257,7 +257,7 @@ bool_t InitializeBungeeTakeoff(uint8_t BungeeWP)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t BungeeTakeoff(void)
|
bool_t bungee_takeoff_run(void)
|
||||||
{
|
{
|
||||||
//Translate current position so Throttle point is (0,0)
|
//Translate current position so Throttle point is (0,0)
|
||||||
float Currentx = stateGetPositionEnu_f()->x-throttlePx;
|
float Currentx = stateGetPositionEnu_f()->x-throttlePx;
|
||||||
@@ -375,7 +375,7 @@ static float MaxY;
|
|||||||
uint16_t PolySurveySweepNum;
|
uint16_t PolySurveySweepNum;
|
||||||
uint16_t PolySurveySweepBackNum;
|
uint16_t PolySurveySweepBackNum;
|
||||||
|
|
||||||
bool_t InitializePolygonSurvey(uint8_t EntryWP, uint8_t Size, float sw, float Orientation)
|
bool_t osam_poly_survey_start(uint8_t EntryWP, uint8_t Size, float sw, float Orientation)
|
||||||
{
|
{
|
||||||
SmallestCorner.x = 0;
|
SmallestCorner.x = 0;
|
||||||
SmallestCorner.y = 0;
|
SmallestCorner.y = 0;
|
||||||
@@ -571,7 +571,7 @@ bool_t InitializePolygonSurvey(uint8_t EntryWP, uint8_t Size, float sw, float Or
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t PolygonSurvey(void)
|
bool_t osam_poly_survey_run(void)
|
||||||
{
|
{
|
||||||
struct Point2D C;
|
struct Point2D C;
|
||||||
struct Point2D ToP;
|
struct Point2D ToP;
|
||||||
@@ -768,12 +768,12 @@ bool_t PolygonSurvey(void)
|
|||||||
enum line_status { LR12, LQC21, LTC2, LQC22, LR21, LQC12, LTC1, LQC11 };
|
enum line_status { LR12, LQC21, LTC2, LQC22, LR21, LQC12, LTC1, LQC11 };
|
||||||
static enum line_status line_status;
|
static enum line_status line_status;
|
||||||
|
|
||||||
bool_t InitializeVerticalRaster( void ) {
|
bool_t vertical_raster_start( void ) {
|
||||||
line_status = LR12;
|
line_status = LR12;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t VerticalRaster(uint8_t l1, uint8_t l2, float radius, float AltSweep) {
|
bool_t vertical_raster_run(uint8_t l1, uint8_t l2, float radius, float AltSweep) {
|
||||||
radius = fabs(radius);
|
radius = fabs(radius);
|
||||||
float alt = waypoints[l1].a;
|
float alt = waypoints[l1].a;
|
||||||
waypoints[l2].a = alt;
|
waypoints[l2].a = alt;
|
||||||
@@ -914,7 +914,7 @@ static float ApproachQDR;
|
|||||||
static float FinalLandAltitude;
|
static float FinalLandAltitude;
|
||||||
static uint8_t FinalLandCount;
|
static uint8_t FinalLandCount;
|
||||||
|
|
||||||
bool_t InitializeSkidLanding(uint8_t AFWP, uint8_t TDWP, float radius)
|
bool_t skid_landing_start(uint8_t AFWP, uint8_t TDWP, float radius)
|
||||||
{
|
{
|
||||||
AFWaypoint = AFWP;
|
AFWaypoint = AFWP;
|
||||||
TDWaypoint = TDWP;
|
TDWaypoint = TDWP;
|
||||||
@@ -953,7 +953,7 @@ bool_t InitializeSkidLanding(uint8_t AFWP, uint8_t TDWP, float radius)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t SkidLanding(void)
|
bool_t skid_landing_run(void)
|
||||||
{
|
{
|
||||||
switch(CLandingStatus)
|
switch(CLandingStatus)
|
||||||
{
|
{
|
||||||
@@ -1029,7 +1029,7 @@ static struct Point2D FLTOWP;
|
|||||||
static float FLQDR;
|
static float FLQDR;
|
||||||
static float FLRadius;
|
static float FLRadius;
|
||||||
|
|
||||||
bool_t FlightLine(uint8_t From_WP, uint8_t To_WP, float radius, float Space_Before, float Space_After)
|
bool_t osam_flight_line_run(uint8_t From_WP, uint8_t To_WP, float radius, float Space_Before, float Space_After)
|
||||||
{
|
{
|
||||||
struct Point2D V;
|
struct Point2D V;
|
||||||
struct Point2D P;
|
struct Point2D P;
|
||||||
@@ -1136,11 +1136,11 @@ bool_t FlightLine(uint8_t From_WP, uint8_t To_WP, float radius, float Space_Befo
|
|||||||
|
|
||||||
static uint8_t FLBlockCount = 0;
|
static uint8_t FLBlockCount = 0;
|
||||||
|
|
||||||
bool_t FlightLineBlock(uint8_t First_WP, uint8_t Last_WP, float radius, float Space_Before, float Space_After)
|
bool_t osam_flight_line_block_run(uint8_t First_WP, uint8_t Last_WP, float radius, float Space_Before, float Space_After)
|
||||||
{
|
{
|
||||||
if(First_WP < Last_WP)
|
if(First_WP < Last_WP)
|
||||||
{
|
{
|
||||||
FlightLine(First_WP+FLBlockCount, First_WP+FLBlockCount+1, radius, Space_Before, Space_After);
|
osam_flight_line_run(First_WP+FLBlockCount, First_WP+FLBlockCount+1, radius, Space_Before, Space_After);
|
||||||
|
|
||||||
if(CFLStatus == FLInitialize)
|
if(CFLStatus == FLInitialize)
|
||||||
{
|
{
|
||||||
@@ -1154,7 +1154,7 @@ bool_t FlightLineBlock(uint8_t First_WP, uint8_t Last_WP, float radius, float Sp
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FlightLine(First_WP-FLBlockCount, First_WP-FLBlockCount-1, radius, Space_Before, Space_After);
|
osam_flight_line_run(First_WP-FLBlockCount, First_WP-FLBlockCount-1, radius, Space_Before, Space_After);
|
||||||
|
|
||||||
if(CFLStatus == FLInitialize)
|
if(CFLStatus == FLInitialize)
|
||||||
{
|
{
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file subsystems/navigation/OSAMNav.h
|
* @file modules/nav/nav_osam.h
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -33,29 +33,29 @@
|
|||||||
struct Point2D {float x; float y;};
|
struct Point2D {float x; float y;};
|
||||||
struct Line {float m;float b;float x;};
|
struct Line {float m;float b;float x;};
|
||||||
|
|
||||||
extern bool_t FlowerNav(void);
|
extern bool_t flower_run(void);
|
||||||
extern bool_t InitializeFlower(uint8_t CenterWP, uint8_t EdgeWP);
|
extern bool_t flower_start(uint8_t CenterWP, uint8_t EdgeWP);
|
||||||
|
|
||||||
extern bool_t InitializeBungeeTakeoff(uint8_t BungeeWP);
|
extern bool_t bungee_takeoff_start(uint8_t BungeeWP);
|
||||||
extern bool_t BungeeTakeoff(void);
|
extern bool_t bungee_takeoff_run(void);
|
||||||
|
|
||||||
extern bool_t InitializeSkidLanding(uint8_t AFWP, uint8_t TDWP, float radius);
|
extern bool_t skid_landing_start(uint8_t AFWP, uint8_t TDWP, float radius);
|
||||||
extern bool_t SkidLanding(void);
|
extern bool_t skid_landing_run(void);
|
||||||
|
|
||||||
#define PolygonSize 10
|
#define PolygonSize 10
|
||||||
#define MaxFloat 1000000000
|
#define MaxFloat 1000000000
|
||||||
#define MinFloat -1000000000
|
#define MinFloat -1000000000
|
||||||
|
|
||||||
extern bool_t InitializePolygonSurvey(uint8_t FirstWP, uint8_t Size, float Sweep, float Orientation);
|
extern bool_t osam_poly_survey_start(uint8_t FirstWP, uint8_t Size, float Sweep, float Orientation);
|
||||||
extern bool_t PolygonSurvey(void);
|
extern bool_t osam_poly_survey_run(void);
|
||||||
extern uint16_t PolySurveySweepNum;
|
extern uint16_t PolySurveySweepNum;
|
||||||
extern uint16_t PolySurveySweepBackNum;
|
extern uint16_t PolySurveySweepBackNum;
|
||||||
|
|
||||||
extern bool_t InitializeVerticalRaster( void );
|
extern bool_t vertical_raster_start( void );
|
||||||
extern bool_t VerticalRaster(uint8_t wp1, uint8_t wp2, float radius, float AltSweep);
|
extern bool_t vertical_raster_run(uint8_t wp1, uint8_t wp2, float radius, float AltSweep);
|
||||||
|
|
||||||
extern bool_t FlightLine(uint8_t From_WP, uint8_t To_WP, float radius, float Space_Before, float Space_After);
|
extern bool_t osam_flight_line_run(uint8_t From_WP, uint8_t To_WP, float radius, float Space_Before, float Space_After);
|
||||||
extern bool_t FlightLineBlock(uint8_t First_WP, uint8_t Last_WP, float radius, float Space_Before, float Space_After);
|
extern bool_t osam_flight_line_block_run(uint8_t First_WP, uint8_t Last_WP, float radius, float Space_Before, float Space_After);
|
||||||
|
|
||||||
void TranslateAndRotateFromWorld(struct Point2D *p, float Zrot, float transX, float transY);
|
void TranslateAndRotateFromWorld(struct Point2D *p, float Zrot, float transX, float transY);
|
||||||
void RotateAndTranslateToWorld(struct Point2D *p, float Zrot, float transX, float transY);
|
void RotateAndTranslateToWorld(struct Point2D *p, float Zrot, float transX, float transY);
|
||||||
Reference in New Issue
Block a user