mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-18 08:54:15 +01:00
OP-1599 added course lock mode, renamed other position vario modes
This commit is contained in:
parent
c21d3d8a67
commit
7d2ca3d92f
@ -70,16 +70,18 @@ void plan_run_land();
|
||||
/**
|
||||
* @brief setup pathfollower for positionvario
|
||||
*/
|
||||
void plan_setup_PositionVarioFPV();
|
||||
void plan_setup_PositionVarioLOS();
|
||||
void plan_setup_PositionVarioNSEW();
|
||||
void plan_setup_CourseLock();
|
||||
void plan_setup_MagicRoam();
|
||||
void plan_setup_MagicLeash();
|
||||
void plan_setup_AbsolutePosition();
|
||||
|
||||
/**
|
||||
* @brief run for positionvario
|
||||
*/
|
||||
void plan_run_PositionVarioFPV();
|
||||
void plan_run_PositionVarioLOS();
|
||||
void plan_run_PositionVarioNSEW();
|
||||
void plan_run_CourseLock();
|
||||
void plan_run_MagicRoam();
|
||||
void plan_run_MagicLeash();
|
||||
void plan_run_AbsolutePosition();
|
||||
|
||||
/**
|
||||
* @brief setup pathplanner/pathfollower for AutoCruise
|
||||
|
@ -165,26 +165,33 @@ void plan_run_land()
|
||||
/**
|
||||
* @brief positionvario functionality
|
||||
*/
|
||||
static bool vario_hold = true;
|
||||
static bool vario_hold = true;
|
||||
static float hold_position[3];
|
||||
static float vario_course = 0;
|
||||
|
||||
static void plan_setup_PositionVario()
|
||||
{
|
||||
vario_hold = true;
|
||||
AttitudeStateYawGet(&vario_course);
|
||||
plan_setup_positionHold();
|
||||
}
|
||||
|
||||
void plan_setup_PositionVarioFPV()
|
||||
void plan_setup_CourseLock()
|
||||
{
|
||||
plan_setup_PositionVario();
|
||||
}
|
||||
|
||||
void plan_setup_PositionVarioLOS()
|
||||
void plan_setup_MagicRoam()
|
||||
{
|
||||
plan_setup_PositionVario();
|
||||
}
|
||||
|
||||
void plan_setup_PositionVarioNSEW()
|
||||
void plan_setup_MagicLeash()
|
||||
{
|
||||
plan_setup_PositionVario();
|
||||
}
|
||||
|
||||
void plan_setup_AbsolutePosition()
|
||||
{
|
||||
plan_setup_PositionVario();
|
||||
}
|
||||
@ -218,7 +225,7 @@ static bool normalizeDeadband(float controlVector[4])
|
||||
return moving;
|
||||
}
|
||||
|
||||
typedef enum { FPV, LOS, NSEW } vario_type;
|
||||
typedef enum { COURSE, FPV, LOS, NSEW } vario_type;
|
||||
|
||||
static void getVector(float controlVector[4], vario_type type)
|
||||
{
|
||||
@ -249,6 +256,9 @@ static void getVector(float controlVector[4], vario_type type)
|
||||
// rotate north and east - rotation angle based on type
|
||||
float angle;
|
||||
switch (type) {
|
||||
case COURSE:
|
||||
angle = vario_course;
|
||||
break;
|
||||
case NSEW:
|
||||
angle = 0.0f;
|
||||
// NSEW no rotation takes place
|
||||
@ -349,17 +359,23 @@ static void plan_run_PositionVario(vario_type type)
|
||||
PathDesiredSet(&pathDesired);
|
||||
}
|
||||
}
|
||||
void plan_run_PositionVarioFPV()
|
||||
|
||||
void plan_run_CourseLock()
|
||||
{
|
||||
plan_run_PositionVario(COURSE);
|
||||
}
|
||||
|
||||
void plan_run_MagicRoam()
|
||||
{
|
||||
plan_run_PositionVario(FPV);
|
||||
}
|
||||
|
||||
void plan_run_PositionVarioLOS()
|
||||
void plan_run_MagicLeash()
|
||||
{
|
||||
plan_run_PositionVario(LOS);
|
||||
}
|
||||
|
||||
void plan_run_PositionVarioNSEW()
|
||||
void plan_run_AbsolutePosition()
|
||||
{
|
||||
plan_run_PositionVario(NSEW);
|
||||
}
|
||||
|
@ -141,9 +141,9 @@ int32_t configuration_check()
|
||||
}
|
||||
// intentionally no break as this also needs pathfollower
|
||||
case FLIGHTMODESETTINGS_FLIGHTMODEPOSITION_POSITIONHOLD:
|
||||
case FLIGHTMODESETTINGS_FLIGHTMODEPOSITION_POSITIONVARIOFPV:
|
||||
case FLIGHTMODESETTINGS_FLIGHTMODEPOSITION_POSITIONVARIOLOS:
|
||||
case FLIGHTMODESETTINGS_FLIGHTMODEPOSITION_POSITIONVARIONSEW:
|
||||
case FLIGHTMODESETTINGS_FLIGHTMODEPOSITION_MAGICROAM:
|
||||
case FLIGHTMODESETTINGS_FLIGHTMODEPOSITION_MAGICLEASH:
|
||||
case FLIGHTMODESETTINGS_FLIGHTMODEPOSITION_ABSOLUTEPOSITION:
|
||||
case FLIGHTMODESETTINGS_FLIGHTMODEPOSITION_LAND:
|
||||
case FLIGHTMODESETTINGS_FLIGHTMODEPOSITION_POI:
|
||||
case FLIGHTMODESETTINGS_FLIGHTMODEPOSITION_RETURNTOBASE:
|
||||
|
@ -205,9 +205,9 @@ static void manualControlTask(void)
|
||||
break;
|
||||
#ifndef PIOS_EXCLUDE_ADVANCED_FEATURES
|
||||
case FLIGHTSTATUS_FLIGHTMODE_POSITIONHOLD:
|
||||
case FLIGHTSTATUS_FLIGHTMODE_POSITIONVARIOFPV:
|
||||
case FLIGHTSTATUS_FLIGHTMODE_POSITIONVARIOLOS:
|
||||
case FLIGHTSTATUS_FLIGHTMODE_POSITIONVARIONSEW:
|
||||
case FLIGHTSTATUS_FLIGHTMODE_MAGICROAM:
|
||||
case FLIGHTSTATUS_FLIGHTMODE_MAGICLEASH:
|
||||
case FLIGHTSTATUS_FLIGHTMODE_ABSOLUTEPOSITION:
|
||||
case FLIGHTSTATUS_FLIGHTMODE_RETURNTOBASE:
|
||||
case FLIGHTSTATUS_FLIGHTMODE_LAND:
|
||||
case FLIGHTSTATUS_FLIGHTMODE_POI:
|
||||
|
@ -68,14 +68,14 @@ void pathFollowerHandler(bool newinit)
|
||||
case FLIGHTSTATUS_FLIGHTMODE_POSITIONHOLD:
|
||||
plan_setup_positionHold();
|
||||
break;
|
||||
case FLIGHTSTATUS_FLIGHTMODE_POSITIONVARIOFPV:
|
||||
plan_setup_PositionVarioFPV();
|
||||
case FLIGHTSTATUS_FLIGHTMODE_MAGICROAM:
|
||||
plan_setup_MagicRoam();
|
||||
break;
|
||||
case FLIGHTSTATUS_FLIGHTMODE_POSITIONVARIOLOS:
|
||||
plan_setup_PositionVarioLOS();
|
||||
case FLIGHTSTATUS_FLIGHTMODE_MAGICLEASH:
|
||||
plan_setup_MagicLeash();
|
||||
break;
|
||||
case FLIGHTSTATUS_FLIGHTMODE_POSITIONVARIONSEW:
|
||||
plan_setup_PositionVarioNSEW();
|
||||
case FLIGHTSTATUS_FLIGHTMODE_ABSOLUTEPOSITION:
|
||||
plan_setup_AbsolutePosition();
|
||||
break;
|
||||
|
||||
case FLIGHTSTATUS_FLIGHTMODE_LAND:
|
||||
@ -92,14 +92,14 @@ void pathFollowerHandler(bool newinit)
|
||||
}
|
||||
|
||||
switch (flightMode) {
|
||||
case FLIGHTSTATUS_FLIGHTMODE_POSITIONVARIOFPV:
|
||||
plan_run_PositionVarioFPV();
|
||||
case FLIGHTSTATUS_FLIGHTMODE_MAGICROAM:
|
||||
plan_run_MagicRoam();
|
||||
break;
|
||||
case FLIGHTSTATUS_FLIGHTMODE_POSITIONVARIOLOS:
|
||||
plan_run_PositionVarioLOS();
|
||||
case FLIGHTSTATUS_FLIGHTMODE_MAGICLEASH:
|
||||
plan_run_MagicLeash();
|
||||
break;
|
||||
case FLIGHTSTATUS_FLIGHTMODE_POSITIONVARIONSEW:
|
||||
plan_run_PositionVarioNSEW();
|
||||
case FLIGHTSTATUS_FLIGHTMODE_ABSOLUTEPOSITION:
|
||||
plan_run_AbsolutePosition();
|
||||
break;
|
||||
case FLIGHTSTATUS_FLIGHTMODE_LAND:
|
||||
plan_run_land();
|
||||
|
@ -165,22 +165,23 @@ const LedSequence_t notifications[] = {
|
||||
// List of background sequences attached to each flight mode
|
||||
const LedSequence_t *flightModeMap[] = {
|
||||
[FLIGHTSTATUS_FLIGHTMODE_MANUAL] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_MANUAL],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED1] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED1],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED2] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED2],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED3] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED3],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED4] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED4],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED5] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED5],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED6] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED6],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_PATHPLANNER] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_AUTO],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_AUTOTUNE] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_AUTOTUNE],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_POSITIONHOLD] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_POSITIONVARIOFPV] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_POSITIONVARIOLOS] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_POSITIONVARIONSEW] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_RETURNTOBASE] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_RTH],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED1] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED1],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED2] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED2],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED3] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED3],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED4] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED4],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED5] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED5],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED6] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED6],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_PATHPLANNER] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_AUTO],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_AUTOTUNE] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_AUTOTUNE],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_POSITIONHOLD] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_COURSELOCK] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_MAGICROAM] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_MAGICLEASH] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_ABSOLUTEPOSITION] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_RETURNTOBASE] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_RTH],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_LAND] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_LAND],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_POI] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_AUTOCRUISE] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
|
||||
[FLIGHTSTATUS_FLIGHTMODE_AUTOCRUISE] = ¬ifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
|
||||
};
|
||||
|
||||
// List of alarms to show with attached sequences for each status
|
||||
|
@ -78,31 +78,31 @@
|
||||
units=""
|
||||
type="enum"
|
||||
elements="6"
|
||||
options="Manual,Stabilized1,Stabilized2,Stabilized3,Stabilized4,Stabilized5,Stabilized6,Autotune,PositionHold,PositionVarioFPV,PositionVarioLOS,PositionVarioNSEW,ReturnToBase,Land,PathPlanner,POI,AutoCruise"
|
||||
options="Manual,Stabilized1,Stabilized2,Stabilized3,Stabilized4,Stabilized5,Stabilized6,Autotune,PositionHold,CourseLock,MagicRoam,MagicLeash,AbsolutePosition,ReturnToBase,Land,PathPlanner,POI,AutoCruise"
|
||||
defaultvalue="Stabilized1,Stabilized2,Stabilized3,Stabilized4,Stabilized5,Stabilized6"
|
||||
limits="\
|
||||
%0401NE:Autotune:PositionHold:PositionVarioFPV:PositionVarioLOS:PositionVarioNSEW:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0402NE:Autotune:PositionHold:PositionVarioFPV:PositionVarioLOS:PositionVarioNSEW:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0401NE:Autotune:PositionHold:CourseLock:MagicRoam:MagicLeash:AbsolutePosition:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0402NE:Autotune:PositionHold:CourseLock:MagicRoam:MagicLeash:AbsolutePosition:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0903NE:POI:PathPlanner:Autotune:AutoCruise:Land;\
|
||||
\
|
||||
%0401NE:Autotune:PositionHold:PositionVarioFPV:PositionVarioLOS:PositionVarioNSEW:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0402NE:Autotune:PositionHold:PositionVarioFPV:PositionVarioLOS:PositionVarioNSEW:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0401NE:Autotune:PositionHold:CourseLock:MagicRoam:MagicLeash:AbsolutePosition:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0402NE:Autotune:PositionHold:CourseLock:MagicRoam:MagicLeash:AbsolutePosition:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0903NE:POI:PathPlanner:Autotune:AutoCruise:Land;\
|
||||
\
|
||||
%0401NE:Autotune:PositionHold:PositionVarioFPV:PositionVarioLOS:PositionVarioNSEW:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0402NE:Autotune:PositionHold:PositionVarioFPV:PositionVarioLOS:PositionVarioNSEW:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0401NE:Autotune:PositionHold:CourseLock:MagicRoam:MagicLeash:AbsolutePosition:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0402NE:Autotune:PositionHold:CourseLock:MagicRoam:MagicLeash:AbsolutePosition:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0903NE:POI:PathPlanner:Autotune:AutoCruise:Land;\
|
||||
\
|
||||
%0401NE:Autotune:PositionHold:PositionVarioFPV:PositionVarioLOS:PositionVarioNSEW:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0402NE:Autotune:PositionHold:PositionVarioFPV:PositionVarioLOS:PositionVarioNSEW:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0401NE:Autotune:PositionHold:CourseLock:MagicRoam:MagicLeash:AbsolutePosition:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0402NE:Autotune:PositionHold:CourseLock:MagicRoam:MagicLeash:AbsolutePosition:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0903NE:POI:PathPlanner:Autotune:AutoCruise:Land;\
|
||||
\
|
||||
%0401NE:Autotune:PositionHold:PositionVarioFPV:PositionVarioLOS:PositionVarioNSEW:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0402NE:Autotune:PositionHold:PositionVarioFPV:PositionVarioLOS:PositionVarioNSEW:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0401NE:Autotune:PositionHold:CourseLock:MagicRoam:MagicLeash:AbsolutePosition:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0402NE:Autotune:PositionHold:CourseLock:MagicRoam:MagicLeash:AbsolutePosition:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0903NE:POI:PathPlanner:Autotune:AutoCruise:Land;\
|
||||
\
|
||||
%0401NE:Autotune:PositionHold:PositionVarioFPV:PositionVarioLOS:PositionVarioNSEW:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0402NE:Autotune:PositionHold:PositionVarioFPV:PositionVarioLOS:PositionVarioNSEW:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0401NE:Autotune:PositionHold:CourseLock:MagicRoam:MagicLeash:AbsolutePosition:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0402NE:Autotune:PositionHold:CourseLock:MagicRoam:MagicLeash:AbsolutePosition:ReturnToBase:Land:PathPlanner:POI:AutoCruise,\
|
||||
%0903NE:POI:PathPlanner:Autotune:AutoCruise:Land;"/>
|
||||
|
||||
<field name="ArmedTimeout" units="ms" type="uint16" elements="1" defaultvalue="30000"/>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<field name="Armed" units="" type="enum" elements="1" options="Disarmed,Arming,Armed" defaultvalue="Disarmed"/>
|
||||
|
||||
<!-- Note these enumerated values should be the same as ManualControlSettings -->
|
||||
<field name="FlightMode" units="" type="enum" elements="1" options="Manual,Stabilized1,Stabilized2,Stabilized3,Stabilized4,Stabilized5,Stabilized6,Autotune,PositionHold,PositionVarioFPV,PositionVarioLOS,PositionVarioNSEW,ReturnToBase,Land,PathPlanner,POI,AutoCruise"/>
|
||||
<field name="FlightMode" units="" type="enum" elements="1" options="Manual,Stabilized1,Stabilized2,Stabilized3,Stabilized4,Stabilized5,Stabilized6,Autotune,PositionHold,CourseLock,MagicRoam,MagicLeash,AbsolutePosition,ReturnToBase,Land,PathPlanner,POI,AutoCruise"/>
|
||||
|
||||
<field name="ControlChain" units="bool" type="enum" options="false,true">
|
||||
<elementnames>
|
||||
|
Loading…
x
Reference in New Issue
Block a user