-
-
Notifications
You must be signed in to change notification settings - Fork 170
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
ENH: RailButtons Class #344
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I started reviewing, I really liked the idea... but then I stumbled upon two issues:
- I don't see the relationship between rail buttons and the
AeroSurfaces
class. Rail buttons have no aerodynamic properties in RocketPy. Furthermore, the changes made to theAeroSurfaces
class in Enh/change aero surfaces class #341 seem strange to me... it can be two very different things now, and it is not clear when which is which. - The current implementation violates a key pillar of modularity in terms of rocket components. Just as we did with the new motor classes in ENH: Liquid Motors #233, we need to guarantee that a component, be it a motor, a nose cone or a rail button, will work the same irrespective of the rocket that we add it to. This is the reason that we had to create a motor coordinate system, to guarantee that a motor can be completely defined without making any assumptions about the rocket that it will be used in. Then, in the
addMotor
method, we specify the missing link that allows for the conversion of all information needed to the rocket system. Notice how theNoseCone
class has no position argument... it is specified only in theaddNoseCone
method. But in the case of rail buttons, its proposed class pretty much has 3 position arguments. It just doesn't seem like a promising idea to implement it as a separate entity like this, but I would love to be proven wrong.
To conclude, this PR adds 77 lines of code, while only removing 32. It seems it uses more lines of code to accomplish the same thing that was already implemented.
Okay, so the reason this change was made was to fit the new Dispersion Class. The way we handle aerodynamic surfaces in the monte carlo simulation is:
You can check this process in this notebook: https://github.com/RocketPy-Team/RocketPy/blob/6142519d26f8fccb70e0a1cea018395367a69709/docs/notebooks/dispersion_analysis/dispersion_class_usage.ipynb The old RailButton implementation was really hard to deal with in the dispersion class because it completely broke the pattern that worked for all the aerosurfaces. The solution was then to just make a RailButtons class, but to keep the implementation in the Rocket class exactly the same as it was with the named tuple. Writing the RailButton class inside |
I couldn't read all the thread yet, but I already can say that I agree with creating a class to Rail Buttons. I agree when Giovani complains about being rocket independent. In that case, I think the buttons probably should be treated in the same way as the motors (using 1 cys to the object and other for the rocket). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the change of RailButtons
from a namedtuple
to its own class
, since it gives more flexibility. The main issue that may be reconsidered to increase code parallelism is making the coordinate system of the rail buttons rocket independent.
There is a more general issue around the documentation of the position
parameter in the AeroSurfaces
class and its components, but this might be discussion for another PR.
…Team/RocketPy into enh/rail-buttons-class
Hey, with the new
The first topic would be an easy change. I would change the The second topic not so much.... |
I think it is worth it to have rail buttons being defined and treated the same way we are already doing with the other components. My suggestions is to just ask the In the Rocket class, the "position" that is requested when adding a new component would make the same job in the buttons case: you just ask what is the position of one button (for example, the lowest button in the rocket) and then calculate the position of the second one.
What do expect to add as "geometrical parameters"? In my opinion, we would have to require only the Cd and the frontal area of the rail button if we wanted to calculate its drag force. In the very particular case where the user do not know the Cd of the rail button, we could either assume a pre-defined Cd or estimate its values based on geometric parameters. But I have another question too:
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
necessary changes to all other files
All done! Ready for a quick re-review @Gui-FernandesBR @phmbressan |
rocketpy/AeroSurface.py
Outdated
def __repr__(self): | ||
rep = f"Rail buttons pair at positions {self.upper_button_position} m and {self.lower_button_position} m" | ||
return rep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be a commentary regarding __repr__
more generally for the AeroSurfaces PR. However, why to remove the __repr__
(and __str__
)? I understand that there is already plenty of info in allInfo
, however the __repr__
is quite important to make sense of the object in a compact way, for instance mentioning the self.name
attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hereby confirm that tests are working on my computer, @MateusStano , I just left a few comments to you regarding docstrings. That should be very easy to solve tho. Great one! |
Co-authored-by: Guilherme <guilherme_fernandes@usp.br>
Pull request type
Please check the type of change your PR introduces:
Pull request checklist
black rocketpy
) has passed locally and any fixes were madepytest --runslow
) have passed locallyChanges
AeroSurfaces.py
Rocket.railButtons
forRocket.rail_buttons
The only question I have here is, the class I created receives in the init the
upper_button_position
andlower_button_position
arguments. ThesetRailButtons
method receives aposition
argument that is a list. Should we change this to the upper and lower button arguments?The only advantage there is to using a list is that you don't need to specify an order, which can be more accessible in some cases given the rocket coordinate system.