1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-25 09:16:01 +03:00

Good behaviour in simulator mode

Disabled servo and level trim on simulator mode
This commit is contained in:
Sergey 2022-04-16 17:03:06 +03:00
parent 78c2060093
commit 3c9844edce
No known key found for this signature in database
GPG key ID: 4A7AC190CD92FE01
6 changed files with 8 additions and 14 deletions

View file

@ -3279,9 +3279,6 @@ bool mspFCProcessInOutCommand(uint16_t cmdMSP, sbuf_t *dst, sbuf_t *src, mspResu
attitude.values.roll = sbufReadU16(src)-1800; attitude.values.roll = sbufReadU16(src)-1800;
attitude.values.pitch = sbufReadU16(src)-1800; attitude.values.pitch = sbufReadU16(src)-1800;
attitude.values.yaw = sbufReadU16(src); attitude.values.yaw = sbufReadU16(src);
// posEstimator.est.pos.x = attitude.values.roll;
// posEstimator.est.pos.y = attitude.values.pitch;
// posEstimator.est.pos.z = gpsSol.llh.alt;
acc.accADCf[X] = (float)sbufReadU16(src) / 1000 - 32;// / GRAVITY_CMSS; acc.accADCf[X] = (float)sbufReadU16(src) / 1000 - 32;// / GRAVITY_CMSS;
acc.accADCf[Y] = (float)sbufReadU16(src) / 1000 - 32;// / GRAVITY_CMSS; acc.accADCf[Y] = (float)sbufReadU16(src) / 1000 - 32;// / GRAVITY_CMSS;
@ -3296,12 +3293,6 @@ bool mspFCProcessInOutCommand(uint16_t cmdMSP, sbuf_t *dst, sbuf_t *src, mspResu
DISABLE_STATE(GPS_FIX); DISABLE_STATE(GPS_FIX);
} }
// sbufWriteU16(dst, motor[0]);
// sbufWriteU16(dst, servo[1]);
// sbufWriteU16(dst, servo[2]);
// sbufWriteU16(dst, servo[3]);
// sbufWriteU16(dst, servo[4]);
sbufWriteU16(dst, input[INPUT_STABILIZED_ROLL] + 500); sbufWriteU16(dst, input[INPUT_STABILIZED_ROLL] + 500);
sbufWriteU16(dst, input[INPUT_STABILIZED_PITCH] + 500); sbufWriteU16(dst, input[INPUT_STABILIZED_PITCH] + 500);
sbufWriteU16(dst, input[INPUT_STABILIZED_YAW] + 500); sbufWriteU16(dst, input[INPUT_STABILIZED_YAW] + 500);

View file

@ -312,7 +312,9 @@ void taskUpdateAux(timeUs_t currentTimeUs)
{ {
updatePIDCoefficients(); updatePIDCoefficients();
dynamicLpfGyroTask(); dynamicLpfGyroTask();
updateFixedWingLevelTrim(currentTimeUs); if (! ARMING_FLAG(SIMULATOR_MODE)) {
updateFixedWingLevelTrim(currentTimeUs);
}
} }
void fcTasksInit(void) void fcTasksInit(void)

View file

@ -2482,7 +2482,7 @@ groups:
description: "Vertical descent velocity under nav_land_slowdown_minalt during the RTH landing phase. [cm/s]" description: "Vertical descent velocity under nav_land_slowdown_minalt during the RTH landing phase. [cm/s]"
default_value: 50 default_value: 50
field: general.land_minalt_vspd field: general.land_minalt_vspd
min: 50 min: 0
max: 500 max: 500
- name: nav_land_maxalt_vspd - name: nav_land_maxalt_vspd
description: "Vertical descent velocity above nav_land_slowdown_maxalt during the RTH landing phase. [cm/s]" description: "Vertical descent velocity above nav_land_slowdown_maxalt during the RTH landing phase. [cm/s]"

View file

@ -564,6 +564,9 @@ void processContinuousServoAutotrim(const float dT)
} }
void processServoAutotrim(const float dT) { void processServoAutotrim(const float dT) {
if (ARMING_FLAG(SIMULATOR_MODE)) {
return;
}
if (feature(FEATURE_FW_AUTOTRIM)) { if (feature(FEATURE_FW_AUTOTRIM)) {
processContinuousServoAutotrim(dT); processContinuousServoAutotrim(dT);
} else { } else {

View file

@ -536,6 +536,7 @@ void applyFixedWingPitchRollThrottleController(navigationFSMStateFlags_t navStat
if (navStateFlags & NAV_CTL_LAND) { if (navStateFlags & NAV_CTL_LAND) {
// During LAND we do not allow to raise THROTTLE when nose is up to reduce speed // During LAND we do not allow to raise THROTTLE when nose is up to reduce speed
throttleCorrection = constrain(throttleCorrection, minThrottleCorrection, 0); throttleCorrection = constrain(throttleCorrection, minThrottleCorrection, 0);
throttleCorrection = minThrottleCorrection;
} else { } else {
#endif #endif
throttleCorrection = constrain(throttleCorrection, minThrottleCorrection, maxThrottleCorrection); throttleCorrection = constrain(throttleCorrection, minThrottleCorrection, maxThrottleCorrection);

View file

@ -526,9 +526,6 @@ static uint32_t calculateCurrentValidityFlags(timeUs_t currentTimeUs)
static void estimationPredict(estimationContext_t * ctx) static void estimationPredict(estimationContext_t * ctx)
{ {
if (ARMING_FLAG(SIMULATOR_MODE)) {
//return; // posEstimator.est.* was set into fc_msp
}
const float accWeight = navGetAccelerometerWeight(); const float accWeight = navGetAccelerometerWeight();
/* Prediction step: Z-axis */ /* Prediction step: Z-axis */