1
0
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:
Corvus Corax 2014-11-08 12:56:17 +01:00
parent c21d3d8a67
commit 7d2ca3d92f
8 changed files with 79 additions and 60 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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:

View File

@ -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:

View File

@ -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();

View File

@ -165,22 +165,23 @@ const LedSequence_t notifications[] = {
// List of background sequences attached to each flight mode
const LedSequence_t *flightModeMap[] = {
[FLIGHTSTATUS_FLIGHTMODE_MANUAL] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_MANUAL],
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED1] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED1],
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED2] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED2],
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED3] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED3],
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED4] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED4],
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED5] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED5],
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED6] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED6],
[FLIGHTSTATUS_FLIGHTMODE_PATHPLANNER] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_AUTO],
[FLIGHTSTATUS_FLIGHTMODE_AUTOTUNE] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_AUTOTUNE],
[FLIGHTSTATUS_FLIGHTMODE_POSITIONHOLD] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
[FLIGHTSTATUS_FLIGHTMODE_POSITIONVARIOFPV] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
[FLIGHTSTATUS_FLIGHTMODE_POSITIONVARIOLOS] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
[FLIGHTSTATUS_FLIGHTMODE_POSITIONVARIONSEW] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
[FLIGHTSTATUS_FLIGHTMODE_RETURNTOBASE] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_RTH],
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED1] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED1],
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED2] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED2],
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED3] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED3],
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED4] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED4],
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED5] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED5],
[FLIGHTSTATUS_FLIGHTMODE_STABILIZED6] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED6],
[FLIGHTSTATUS_FLIGHTMODE_PATHPLANNER] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_AUTO],
[FLIGHTSTATUS_FLIGHTMODE_AUTOTUNE] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_AUTOTUNE],
[FLIGHTSTATUS_FLIGHTMODE_POSITIONHOLD] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
[FLIGHTSTATUS_FLIGHTMODE_COURSELOCK] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
[FLIGHTSTATUS_FLIGHTMODE_MAGICROAM] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
[FLIGHTSTATUS_FLIGHTMODE_MAGICLEASH] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
[FLIGHTSTATUS_FLIGHTMODE_ABSOLUTEPOSITION] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
[FLIGHTSTATUS_FLIGHTMODE_RETURNTOBASE] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_RTH],
[FLIGHTSTATUS_FLIGHTMODE_LAND] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_LAND],
[FLIGHTSTATUS_FLIGHTMODE_POI] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
[FLIGHTSTATUS_FLIGHTMODE_AUTOCRUISE] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
[FLIGHTSTATUS_FLIGHTMODE_AUTOCRUISE] = &notifications[NOTIFY_SEQUENCE_ARMED_FM_GPS],
};
// List of alarms to show with attached sequences for each status

View File

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

View File

@ -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>