Skip to content

Embedded software/controls pid refactor/stage#47

Merged
Shengw3n merged 22 commits into
embedded-software/stagefrom
embedded-software/controls-pid-refactor/stage
May 24, 2026
Merged

Embedded software/controls pid refactor/stage#47
Shengw3n merged 22 commits into
embedded-software/stagefrom
embedded-software/controls-pid-refactor/stage

Conversation

@lew1101
Copy link
Copy Markdown

@lew1101 lew1101 commented May 10, 2026

No description provided.

@lew1101 lew1101 requested a review from a team as a code owner May 10, 2026 22:53
@lew1101 lew1101 requested a review from Shengw3n May 10, 2026 22:54
@DennisY888 DennisY888 force-pushed the embedded-software/controls-pid-refactor/stage branch from b233788 to 6904ba8 Compare May 11, 2026 00:56
@lew1101 lew1101 force-pushed the embedded-software/controls-pid-refactor/stage branch from 814fa8d to 49d9f57 Compare May 14, 2026 01:27
@lew1101 lew1101 force-pushed the embedded-software/controls-pid-refactor/stage branch 2 times, most recently from 5641af8 to 9630d21 Compare May 14, 2026 19:57
@lew1101 lew1101 force-pushed the embedded-software/controls-pid-refactor/stage branch from 9630d21 to 2139eab Compare May 14, 2026 20:00
@J1m1-P J1m1-P force-pushed the embedded-software/controls-pid-refactor/stage branch from c0b7fd4 to ba3ab2d Compare May 24, 2026 21:54
us_f = (float)servo->us_mid + t * (float)(servo->us_max - servo->us_mid);
}
// float d = (cfg->reversed ? -degree : degree) + cfg->deg_bias;
// float d_clamped = clamp_float(degree, cfg->deg_min, cfg->deg_max);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reversed in servo_config_t is never applied
is it better to apply clamping to the mapping instead of the gimbal api?

Comment on lines +72 to +73
* @param x_deg Desired X-axis (roll) gimbal angle in degrees, clamped to ±SERVO_GIMBAL_HALF_RANGE_DEG.
* @param y_deg Desired Y-axis (pitch) gimbal angle in degrees, clamped to ±SERVO_GIMBAL_HALF_RANGE_DEG.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SERVO_GIMBAL_HALF_RANGE_DEG this does not exist

Comment on lines +249 to +250
float calibrated_theta_x_deg = (1/sqrtf(2.0f)) * theta_x_deg + (1/sqrtf(2.0f)) * theta_y_deg; // Calibrated to match physical gimbal direction
float calibrated_theta_y_deg = -(1/sqrtf(2.0f)) * theta_x_deg + (1/sqrtf(2.0f)) * theta_y_deg; // Calibrated to match physical gimbal direction
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are computing sqrtf(2) every 800 Hz here

Precompute const float k = 0.70710678f

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

osDelay in inside a 800 Hz controls task is questionable

Copy link
Copy Markdown
Member

@Shengw3n Shengw3n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Shengw3n Shengw3n merged commit 3f7ae35 into embedded-software/stage May 24, 2026
4 of 5 checks passed
@Shengw3n Shengw3n deleted the embedded-software/controls-pid-refactor/stage branch May 24, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants