Skip to content

Commit

Permalink
CR47
Browse files Browse the repository at this point in the history
  • Loading branch information
breadoven committed Dec 5, 2023
1 parent 9b54157 commit d980ad9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 0 additions & 2 deletions src/main/fc/fc_msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3712,8 +3712,6 @@ bool mspFCProcessInOutCommand(uint16_t cmdMSP, sbuf_t *dst, sbuf_t *src, mspResu
randNumOld = randNum;
}

DEBUG_SET(DEBUG_ALWAYS, 0, counter);
DEBUG_SET(DEBUG_ALWAYS, 1, randNum);
DEBUG_SET(DEBUG_ALWAYS, 5, gpsSol.llh.alt);
gpsSol.llh.alt += (20 * signChanger * randNum * counter); // in cm
DEBUG_SET(DEBUG_ALWAYS, 6, gpsSol.llh.alt);
Expand Down
4 changes: 2 additions & 2 deletions src/main/fc/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2060,13 +2060,13 @@ groups:
# CR47
- name: nav_mc_vel_xy_dterm_attenuation_start
description: "Horizontal velocity where nav_mc_vel_xy_dterm_attenuation begins [m/s]"
default_value: 10
default_value: 5
field: navVelXyDtermAttenuationStart
min: 0
max: 100
- name: nav_mc_vel_xy_dterm_attenuation_end
description: "Horizontal velocity where nav_mc_vel_xy_dterm_attenuation reaches maximum [m/s]"
default_value: 20
default_value: 10
field: navVelXyDtermAttenuationEnd
min: 0
max: 100
Expand Down
2 changes: 1 addition & 1 deletion src/main/navigation/navigation.c
Original file line number Diff line number Diff line change
Expand Up @@ -4407,7 +4407,7 @@ void navigationUsePIDs(void)
* Set coefficients used in MC VEL_XY
*/
// CR47
multicopterPosXyCoefficients.dTermAttenuation = pidProfile()->navVelXyDtermAttenuation * 100.0f;
multicopterPosXyCoefficients.dTermAttenuation = pidProfile()->navVelXyDtermAttenuation / 100.0f;
multicopterPosXyCoefficients.dTermAttenuationStart = pidProfile()->navVelXyDtermAttenuationStart * 100.0f;
multicopterPosXyCoefficients.dTermAttenuationEnd = pidProfile()->navVelXyDtermAttenuationEnd * 100.0f;
// multicopterPosXyCoefficients.dTermAttenuation = pidProfile()->navVelXyDtermAttenuation / 100.0f;
Expand Down
14 changes: 8 additions & 6 deletions src/main/navigation/navigation_multicopter.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,19 +570,21 @@ static float computeNormalizedVelocity(const float value, const float maxValue)
}

static float computeVelocityScale(
float value, // CR47
// const float maxValue, // CR47
// CR47
float value,
// const float maxValue,
const float attenuationFactor,
const float attenuationStart,
const float attenuationEnd
const float attenuationStartVel,
const float attenuationEndVel
// CR47
)
{
// CR47
value -= attenuationStart;
value -= attenuationStartVel;
if (value <= 0.0f) {
return 0.0f;
}
const float normalized = computeNormalizedVelocity(value, attenuationEnd);
const float normalized = computeNormalizedVelocity(value, attenuationEndVel);
float scale = scaleRangef(normalized, 0.0f, 1.0f, 0.0f, attenuationFactor);
return constrainf(scale, 0.0f, attenuationFactor);

Expand Down

0 comments on commit d980ad9

Please sign in to comment.