Skip to content

[Bug Fix] Separate PID error and target between fine and coarse trickler #81

@eamars

Description

@eamars

The below code exhibits a problem that the error is shared between fine and coarse trickler. This is no good as the fine and coarse trickler are sharing the same trickling target, which is not what the stop condition is designed.

The desire is to separate the target point, including the error between fine and coarse trickler. The coarse trickler should have the target set to target - stop_condition. This way the user can truely tune the coarse trickler.

// Update coarse trickler speed
if (should_coarse_trickler_move) {
    new_p = current_profile->coarse_kp * error;
    new_i = current_profile->coarse_ki * integral;
    new_d = current_profile->coarse_kd * derivative;

    new_speed = fmax(coarse_trickler_min_speed, fmin(new_p + new_i + new_d, coarse_trickler_max_speed));

    motor_set_speed(SELECT_COARSE_TRICKLER_MOTOR, new_speed);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions