mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-25 09:16:01 +03:00
Added posDecelerationTime (controlled by Pos I) to control braking strength
This commit is contained in:
parent
b40df56f16
commit
fd28138535
4 changed files with 9 additions and 5 deletions
|
@ -163,7 +163,7 @@ static void resetPidProfile(pidProfile_t *pidProfile)
|
|||
pidProfile->I8[PIDALT] = 0; // not used
|
||||
pidProfile->D8[PIDALT] = 0; // not used
|
||||
pidProfile->P8[PIDPOS] = 15; // NAV_POS_XY_P * 100
|
||||
pidProfile->I8[PIDPOS] = 0; // not used
|
||||
pidProfile->I8[PIDPOS] = 100; // posDecelerationTime * 100
|
||||
pidProfile->D8[PIDPOS] = 0; // not used
|
||||
pidProfile->P8[PIDPOSR] = 90; // NAV_VEL_XY_P * 100
|
||||
pidProfile->I8[PIDPOSR] = 15; // NAV_VEL_XY_I * 100
|
||||
|
|
|
@ -1909,7 +1909,10 @@ void navigationUsePIDs(pidProfile_t *initialPidProfile)
|
|||
|
||||
posControl.pidProfile = initialPidProfile;
|
||||
|
||||
// Initialize position hold PI-controller
|
||||
// Brake time parameter
|
||||
posControl.posDecelerationTime = (float)posControl.pidProfile->I8[PIDPOS] / 100.0f;
|
||||
|
||||
// Initialize position hold P-controller
|
||||
for (axis = 0; axis < 2; axis++) {
|
||||
navPInit(&posControl.pids.pos[axis], (float)posControl.pidProfile->P8[PIDPOS] / 100.0f);
|
||||
|
||||
|
|
|
@ -474,8 +474,8 @@ void applyMulticopterEmergencyLandingController(uint32_t currentTime)
|
|||
*-----------------------------------------------------------*/
|
||||
void calculateMulticopterInitialHoldPosition(t_fp_vector * pos)
|
||||
{
|
||||
float stoppingDistanceX = posControl.actualState.vel.V.X / posControl.pids.pos[X].param.kP;
|
||||
float stoppingDistanceY = posControl.actualState.vel.V.Y / posControl.pids.pos[Y].param.kP;
|
||||
float stoppingDistanceX = posControl.actualState.vel.V.X * posControl.posDecelerationTime;
|
||||
float stoppingDistanceY = posControl.actualState.vel.V.Y * posControl.posDecelerationTime;
|
||||
|
||||
pos->V.X = posControl.actualState.pos.V.X + stoppingDistanceX;
|
||||
pos->V.Y = posControl.actualState.pos.V.Y + stoppingDistanceY;
|
||||
|
|
|
@ -223,8 +223,9 @@ typedef struct {
|
|||
bool enabled;
|
||||
navigationFlags_t flags;
|
||||
|
||||
/* Navigation PID controllers */
|
||||
/* Navigation PID controllers + pre-computed flight parameters */
|
||||
navigationPIDControllers_t pids;
|
||||
float posDecelerationTime;
|
||||
|
||||
/* Local system state, both actual (estimated) and desired (target setpoint)*/
|
||||
navigationEstimatedState_t actualState;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue