Package: rocketpy
RocketPyRocketPy is the next-generation trajectory simulation solution for High-Power Rocketry. The code is written as aPythonlibrary and allows for a complete 6 degrees of freedom simulation of a rocket's flight trajectory, including high-fidelity variable mass effects as well as descent under parachutes. Weather conditions, such as wind profiles, can be imported from sophisticated datasets, allowing for realistic scenarios. Furthermore, the implementation facilitates complex simulations, such as multi-stage rockets, design and trajectory optimization and dispersion analysis.Main featuresNonlinear 6 Degrees of Freedom SimulationsRigorous treatment of mass variation effectsEfficiently solved using LSODA with adjustable error tolerancesHighly optimized for fast performanceAccurate Weather ModelingSupports International Standard Atmosphere (1976)Custom atmospheric profiles and Soundings (Wyoming, NOAARuc)Weather forecasts, reanalysis, and ensembles for realistic scenariosAerodynamic ModelsOptional Barrowman equations for lift coefficientsEasy import of drag coefficients from other sources (e.g., CFD simulations)Parachutes with External Trigger FunctionsTest the exact code that will flySensor data augmentation with noise for comprehensive parachute simulationsSolid, Hybrid, and Liquid Motors ModelsBurn rate and mass variation properties from the thrust curveDefine custom rocket tanks based on flux dataSupport for CSV and ENG file formatsMonte Carlo SimulationsConduct dispersion analysis and global sensitivity analysisFlexible and ModularPerform straightforward engineering analysis (e.g., apogee and lift-off speed as a function of mass)Handle non-standard flights (e.g., parachute drop test from a helicopter)Support multi-stage rockets and custom continuous/discrete control lawsEasily create new classes, such as other types of motorsIntegration with MATLAB®Effortlessly run RocketPy from MATLAB®Convert RocketPy results to MATLAB® variables for further processingThese powerful features make RocketPy an indispensable tool for high-power rocket trajectory simulation, catering to enthusiasts, researchers, and engineers in the field of rocketry.ValidationRocketPy's features have been validated in our latestresearch article published in the Journal of Aerospace Engineering.The table below shows a comparison between experimental data and the output from RocketPy.
Flight data and rocket parameters used in this comparison were kindly provided byEPFL Rocket TeamandNotre Dame Rocket Team.MissionResult ParameterRocketPyMeasuredRelative ErrorBella Lui KaltbrumnApogee altitude (m)461.03458.970.45 %Bella Lui KaltbrumnApogee time (s)10.6110.560.47 %Bella Lui KaltbrumnMaximum velocity (m/s)86.1890.00-4.24 %NDRT launch vehicleApogee altitude (m)1,310.441,320.37-0.75 %NDRT launch vehicleApogee time (s)16.7717.10-1.90 %NDRT launch vehicleMaximum velocity (m/s)172.86168.952.31 %DocumentationCheck out documentation details using the links below:User GuideCode DocumentationDevelopment GuideTechnical DocumentationFlight ExamplesJoin Our Community!RocketPy is growing fast! Many university groups and rocket hobbyists have already started using it. The number of stars and forks for this repository is skyrocketing. And this is all thanks to a great community of users, engineers, developers, marketing specialists, and everyone interested in helping.If you want to be a part of this and make RocketPy your own, join ourDiscordserver today!PreviewingYou can preview RocketPy's main functionalities by browsing through a sample notebook inGoogle Colab. No installation is required!When you are ready to run RocketPy locally, you can read theGetting Startedsection!Getting StartedQuick InstallationTo install RocketPy's latest stable version from PyPI, just open up your terminal and run:pipinstallrocketpyFor other installation options, visit ourInstallation Docs.
To learn more about RocketPy's requirements, visit ourRequirements Docs.Running Your First SimulationIn order to run your first rocket trajectory simulation using RocketPy, you can start a Jupyter Notebook and navigate to thedocs/notebooksfolder. Opengetting_started.ipynband you are ready to go. We recommend that you read theFirst Simulationpage to get a complete description.Otherwise, you may want to create your own script or your own notebook using RocketPy. To do this, let's see how to use RocketPy's four main classes:Environment- Keeps data related to weather.Motor- Subdivided intoSolidMotor,HybridMotorandLiquidMotor. Keeps data related to rocket motors.Rocket- Keeps data related to a rocket.Flight- Runs the simulation and keeps the results.The following image shows how the four main classes interact with each other:A typical workflow starts with importing these classes from RocketPy:fromrocketpyimportEnvironment,Rocket,SolidMotor,FlightAn optional step is to import datetime, which is used to define the date of the simulation:importdatetimeThen create an Environment object. To learn more about it, you can use:help(Environment)A sample code is:env=Environment(latitude=32.990254,longitude=-106.974998,elevation=1400,)tomorrow=datetime.date.today()+datetime.timedelta(days=1)env.set_date((tomorrow.year,tomorrow.month,tomorrow.day,12),timezone="America/Denver")# Tomorrow's date in year, month, day, hour UTC formatenv.set_atmospheric_model(type='Forecast',file='GFS')This can be followed up by starting a Solid Motor object. To get help on it, just use:help(SolidMotor)A sample Motor object can be created by the following code:Pro75M1670=SolidMotor(thrust_source="data/motors/Cesaroni_M1670.eng",dry_mass=1.815,dry_inertia=(0.125,0.125,0.002),center_of_dry_mass_position=0.317,grains_center_of_mass_position=0.397,burn_time=3.9,grain_number=5,grain_separation=0.005,grain_density=1815,grain_outer_radius=0.033,grain_initial_inner_radius=0.015,grain_initial_height=0.12,nozzle_radius=0.033,throat_radius=0.011,interpolation_method="linear",nozzle_position=0,coordinate_system_orientation="nozzle_to_combustion_chamber",)With a Solid Motor defined, you are ready to create your Rocket object. As you may have guessed, to get help on it, use:help(Rocket)A sample code to create a Rocket is:calisto=Rocket(radius=0.0635,mass=14.426,# without motorinertia=(6.321,6.321,0.034),power_off_drag="data/calisto/powerOffDragCurve.csv",power_on_drag="data/calisto/powerOnDragCurve.csv",center_of_mass_without_motor=0,coordinate_system_orientation="tail_to_nose",)buttons=calisto.set_rail_buttons(upper_button_position=0.0818,lower_button_position=-0.6182,angular_position=45,)calisto.add_motor(Pro75M1670,position=-1.255)nose=calisto.add_nose(length=0.55829,kind="vonKarman",position=1.278)fins=calisto.add_trapezoidal_fins(n=4,root_chord=0.120,tip_chord=0.040,span=0.100,sweep_length=None,cant_angle=0,position=-1.04956,)tail=calisto.add_tail(top_radius=0.0635,bottom_radius=0.0435,length=0.060,position=-1.194656)You may want to add parachutes to your rocket as well:main=calisto.add_parachute(name="main",cd_s=10.0,trigger=800,# ejection altitude in meterssampling_rate=105,lag=1.5,noise=(0,8.3,0.5),)drogue=calisto.add_parachute(name="drogue",cd_s=1.0,trigger="apogee",# ejection at apogeesampling_rate=105,lag=1.5,noise=(0,8.3,0.5),)Finally, you can create a Flight object to simulate your trajectory. To get help on the Flight class, use:help(Flight)To actually create a Flight object, use:test_flight=Flight(rocket=calisto,environment=env,rail_length=5.2,inclination=85,heading=0)Once the Flight object is created, your simulation is done! Use the following code to get a summary of the results:test_flight.info()To see all available results, use:test_flight.all_info()Here is just a quick taste of what RocketPy is able to calculate. There are hundreds of plots and data points computed by RocketPy to enhance your analyses.If you want to see the trajectory on Google Earth, RocketPy acn easily export a KML file for you:test_flight.export_kml(file_name="test_flight.kml")Authors and ContributorsThis package was originally created byGiovani Ceottoas part of his work atProjeto Jupiter.Rodrigo Schmittwas one of the first contributors. Later,Guilherme FernandesandLucas Azevedojoined the team to work on the expansion and sustainability of this project.Since then, theRocketPy Teamhas been growing fast and our contributors are what makes us special!Institutional ContributorsRocketPy extends its gratitude to the following institutions for their support and contributions:Individual ContributorsRocketPy is also indebted to a growing list of individual contributors who actively participate in its development. These include:See adetailed list of contributorswho are actively working on RocketPy.Supporting RocketPy and ContributingThe easiest way to help RocketPy is to demonstrate your support by starring our repository!You can also become asponsorand help us financially to keep the project going.If you are actively using RocketPy in one of your projects, reaching out to our core team viaDiscordand providing feedback can help improve RocketPy a lot!And if you are interested in going one step further, please readCONTRIBUTING.mdfor details on our code of conduct and learn more about how you can contribute to the development of this next-gen trajectory simulation solution for rocketry.LicenseThis project is licensed under the MIT License - see theLICENSE.mdfile for detailsRelease NotesWant to know which bugs have been fixed and the new features of each version? Check out therelease notes.