Skip to content

Bug/flight without rail buttons #383

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

Merged
merged 7 commits into from
Jun 27, 2023

Conversation

Gui-FernandesBR
Copy link
Member

@Gui-FernandesBR Gui-FernandesBR commented Jun 25, 2023

Pull request type

Please check the type of change your PR introduces:

  • Code base additions (bugfix, features)

Pull request checklist

Please check if your PR fulfills the following requirements, depending on the type of PR:

  • Code base additions (for bug fixes / features):

    • Tests for the changes have been added
    • Docs have been reviewed and added / updated if needed
    • Lint (black rocketpy) has passed locally and any fixes were made
    • All tests (pytest --runslow) have passed locally

What is the current behavior?

  • Try to create a flight using a rocket without rail buttons, and then try to access the rail button forces, you're going to have a bug since the class cannot access rail buttons positions (given that there's no rail button defined).

What is the new behavior?

  • I improved the conditions to capture errors when a "buttonless" rocket is being provided to the Flight Class.
  • Rail buttons forces are only calculated when there's a rail button phase and a rail button pair present.
  • In case you try to access rail buttons forces without properly defining rail buttons, you are going to know exactly the reasons of any error, and the forces will be equals to zero in some cases.

Does this introduce a breaking change?

  • No

Other information

@Gui-FernandesBR Gui-FernandesBR added Bug Something isn't working Flight Flight Class related features labels Jun 25, 2023
@Gui-FernandesBR Gui-FernandesBR added this to the Release v1.0.0 milestone Jun 25, 2023
@Gui-FernandesBR Gui-FernandesBR self-assigned this Jun 25, 2023
@Gui-FernandesBR
Copy link
Member Author

Just noticed something, in some cases the forces on the rail buttons could be exclusively negatives, thus the max force is ambiguos.
I think we should return the max of abs() value.

image

Comment on lines 2241 to 2253
@cached_property
def __rail_buttons_alpha_angle(self):
"""Alpha angle of the rail buttons, in radians. If there is no rail
button, the function returns 0. See the rail buttons documentation to
learn more about the alpha angle.
"""
try:
alpha = self.rocket.rail_buttons[0].component.angular_position * (
np.pi / 180
)
except IndexError:
alpha = 0 # there's no rail button defined, use any alpha value
return alpha
Copy link
Member

Choose a reason for hiding this comment

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

Alpha angle? What is this supposed to be?

Also this is not in the rail buttons documentation (I think....)

Copy link
Member Author

Choose a reason for hiding this comment

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

Alpha is the angular position of the rail buttons.

I agree this could be better described

Copy link
Member

Choose a reason for hiding this comment

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

Okay! I prefer if we just use angular_position as the name of this

@@ -2531,7 +2508,7 @@ def retrieve_temporary_values_arrays(self):
return temporary_values

@cached_property
def calculate_rail_button_forces(self):
def __calculate_rail_button_forces(self):
Copy link
Member

Choose a reason for hiding this comment

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

Any reason to make this private?

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. I just did not want to allow user to get the whole tuple of 4 Function objects.
  2. The return is a tuple of 4 elements describing the forces in the rocket coordinates system. This needs to be converted to "rail button" reference system. If we don't convert, we can't call it shear or normal force. I don't think it would be good if we set this "intermediate" result as public.

@MateusStano MateusStano merged commit f9012e2 into beta/v1.0.0 Jun 27, 2023
@Gui-FernandesBR Gui-FernandesBR deleted the bug/flight-without-rail-buttons branch June 27, 2023 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Flight Flight Class related features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants