Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copter: No unnecessary operations #26791

Closed

Conversation

muramura
Copy link
Contributor

I don't think the process of setting 1.0 at 1.0 is necessary.
The operation to calculate when the value is 0 should be set to 0.
I think it is more explicit to set 0.

Comment on lines -538 to +541
} else {
} else if (is_negative(velocity)) {
lean_angle = -brake.gain * velocity * (1.0f + 500.0f / (-velocity + 60.0f));
} else {
lean_angle = 0.0f;
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for this if velocity is zero the result will be lean_angle = 0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When velocity is 0, it is explicitly stated whether the operation is performed or not.

@rmackay9
Copy link
Contributor

I probably won't merge this for two reasons:

  1. I don't think it makes a difference to the result
  2. I'm uncomfortable changing PosHold mode unless absolutely necessary. Every time we touch the code it opens us up to having to test the mode thoroughly if users raise a support question even if that support call is a "red herring".

Thanks in any case.

@rmackay9 rmackay9 closed this Apr 15, 2024
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.

3 participants