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: Initialize stack variables #28103

Closed

Conversation

muramura
Copy link
Contributor

Stack variables are not initialized.
If a value cannot be retrieved, it returns an invalid value.
Make it return 0.

@@ -516,7 +516,7 @@ void Mode::get_pilot_desired_lean_angles(float &roll_out_cd, float &pitch_out_cd
// transform pilot's roll or pitch input into a desired velocity
Vector2f Mode::get_pilot_desired_velocity(float vel_max) const
{
Vector2f vel;
Vector2f vel{0.0f, 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.

These variables are implicitly zero.

https://github.com/ardupilot/ardupilot/blob/master/libraries/AP_Math/vector2.h#L51

Simiarly for Location.

It's just a bit of Magic you have to know about.

Closing - thanks anyway!

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.

2 participants