{"id":21736505,"url":"https://github.com/jorgepiloto/lamberthub","last_synced_at":"2025-04-06T15:12:14.159Z","repository":{"id":40464008,"uuid":"364482782","full_name":"jorgepiloto/lamberthub","owner":"jorgepiloto","description":"A set of Lambert's problem solvers","archived":false,"fork":false,"pushed_at":"2025-03-08T08:29:23.000Z","size":10053,"stargazers_count":56,"open_issues_count":17,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T14:09:53.159Z","etag":null,"topics":["astrodynamics","kepler","lambert","orbital-mechanics","simulation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jorgepiloto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-05T06:34:50.000Z","updated_at":"2025-03-30T05:32:07.000Z","dependencies_parsed_at":"2025-01-07T09:22:58.130Z","dependency_job_id":"3c0472f1-6179-4115-b411-c0a8de4c068a","html_url":"https://github.com/jorgepiloto/lamberthub","commit_stats":{"total_commits":234,"total_committers":3,"mean_commits":78.0,"dds":"0.41025641025641024","last_synced_commit":"cb3be07a1663d52a5748eb2b54b2d56fb1cc5d94"},"previous_names":["jorgepiloto/lamberthub"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorgepiloto%2Flamberthub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorgepiloto%2Flamberthub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorgepiloto%2Flamberthub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorgepiloto%2Flamberthub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jorgepiloto","download_url":"https://codeload.github.com/jorgepiloto/lamberthub/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247500468,"owners_count":20948880,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["astrodynamics","kepler","lambert","orbital-mechanics","simulation"],"created_at":"2024-11-26T05:19:35.479Z","updated_at":"2025-04-06T15:12:14.140Z","avatar_url":"https://github.com/jorgepiloto.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lamberthub: a hub of Lambert's problem solvers\n\n\u003cimg align=\"left\" width=350px src=\"https://github.com/jorgepiloto/lamberthub/raw/main/doc/source/_static/lamberts_problem_geometry.png\"/\u003e\n\nA Python library designed to provide solutions to Lambert's problem, a\nclassical problem in astrodynamics that involves determining the orbit of a\nspacecraft given two points in space and the time of flight between them. The\nproblem is essential for trajectory planning, particularly for interplanetary\nmissions.\n\nThis library implements multiple algorithms, each named after its author and\npublication year, for solving different variations of Lambert's problem. These\nalgorithms can handle different types of orbits, including multi-revolution\npaths and direct transfers.\n\n\u003cbr\u003e\n\n\u003c!-- vale off --\u003e\n[![Python](https://img.shields.io/pypi/pyversions/lamberthub?logo=pypi)](https://pypi.org/project/lamberthub/)\n[![PyPI](https://img.shields.io/pypi/v/lamberthub.svg?logo=python\u0026logoColor=white)](https://pypi.org/project/lamberthub/)\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n[![CI](https://github.com/jorgepiloto/lamberthub/actions/workflows/ci_cd.yml/badge.svg?branch=main)](https://github.com/jorgepiloto/lamberthub/actions/workflows/ci_cd.yml)\n[![Coverage](https://codecov.io/gh/jorgepiloto/lamberthub/branch/main/graph/badge.svg?token=3BY2J5AB8D)](https://codecov.io/gh/jorgepiloto/lamberthub)\n[![DOI](https://zenodo.org/badge/364482782.svg)](https://zenodo.org/badge/latestdoi/364482782)\n\u003c!-- vale on --\u003e\n\n## Installation\n\nMultiple installation methods are supported:\n\n|                             **Logo**                              | **Platform** |                                    **Command**                                    |\n|:-----------------------------------------------------------------:|:------------:|:---------------------------------------------------------------------------------:|\n|       ![PyPI logo](https://simpleicons.org/icons/pypi.svg)        |     PyPI     |                        ``python -m pip install lamberthub``                        |\n|     ![GitHub logo](https://simpleicons.org/icons/github.svg)      |    GitHub    | ``python -m pip install https://github.com/jorgepiloto/lamberthub/archive/main.zip`` |\n\n## Available solvers\n\n\u003c!-- vale off --\u003e\n\n| Algorithm     | Reference                                                                                                                                               |\n|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `gauss1809`   | C. F. Gauss, *Theoria motus corporum coelestium in sectionibus conicis solem ambientium*. 1809.                                                         |\n| `battin1984`  | R. H. Battin and R. M. Vaughan, “An elegant lambert algorithm,” *Journal of Guidance, Control, and Dynamics*, vol. 7, no. 6, pp. 662–670, 1984.         |\n| `gooding1990` | R. Gooding, “A procedure for the solution of lambert’s orbital boundary-value problem,” *Celestial Mechanics and Dynamical Astronomy*, vol. 48, no. 2, pp. 145–165, 1990. |\n| `avanzini2008`| G. Avanzini, “A simple lambert algorithm,” *Journal of Guidance, Control, and Dynamics*, vol. 31, no. 6, pp. 1587–1594, 2008.                          |\n| `arora2013`   | N. Arora and R. P. Russell, “A fast and robust multiple revolution lambert algorithm using a cosine transformation,” Paper AAS, vol. 13, p. 728, 2013.  |\n| `vallado2013` | D. A. Vallado, *Fundamentals of astrodynamics and applications*. Springer Science \u0026 Business Media, 2013, vol. 12.                                       |\n| `izzo2015`    | D. Izzo, “Revisiting lambert’s problem,” *Celestial Mechanics and Dynamical Astronomy*, vol. 121, no. 1, pp. 1–15, 2015.                                |\n\n\u003c!-- vale on --\u003e\n\n## Using a solver\n\nAny Lambert's problem algorithm implemented in `lamberthub` is a Python function\nwhich accepts the following parameters:\n\n```python\nfrom lamberthub import authorYYYY\n\n\nv1, v2 = authorYYYY(\n    mu, r1, r2, tof, M=0, prograde=True, low_path=True,  # Type of solution\n    maxiter=35, atol=1e-5, rtol=1e-7, full_output=False  # Iteration config\n)\n```\n\nwhere `author` is the name of the author which developed the solver and `YYYY`\nthe year of publication. Any of the solvers hosted by the `ALL_SOLVERS` list.\n\n### Parameters\n\n| Parameters    | Type      | Description |\n|---------------|-----------|-------------|\n| `mu`          | `float`   | The gravitational parameter, that is, the mass of the attracting body times the gravitational constant. |\n| `r1`          | `np.array`| Initial position vector. |\n| `r2`          | `np.array`| Final position vector. |\n| `tof`         | `float`   | Time of flight between initial and final vectors. |\n| `M`           | `int`     | The number of revolutions. If zero (default), direct transfer is assumed. |\n| `prograde`    | `bool`    | Controls the inclination of the final orbit. If `True`, inclination between 0 and 90 degrees. If `False`, inclination between 90 and 180 degrees. |\n| `low_path`    | `bool`    | Selects the type of path when more than two solutions are available. No specific advantage unless there are mission constraints. |\n| `maxiter`     | `int`     | Maximum number of iterations allowed when computing the solution. |\n| `atol`        | `float`   | Absolute tolerance for the iterative method. |\n| `rtol`        | `float`   | Relative tolerance for the iterative method. |\n| `full_output` | `bool`    | If `True`, returns additional information such as the number of iterations. |\n\n### Returns\n\n| Returns       | Type       | Description |\n|---------------|------------|-------------|\n| `v1`          | `np.array` | Initial velocity vector. |\n| `v2`          | `np.array` | Final velocity vector. |\n| `numiter`     | `int`      | Number of iterations (only if `full_output` is `True`). |\n| `tpi`         | `float`    | Time per iteration (only if `full_output` is `True`). |\n\n## Examples\n\n### Example: solving for a direct and prograde transfer orbit\n\n**Problem statement**\n\nSuppose you want to solve for the orbit of an interplanetary vehicle (that is\nSun is the main attractor) form which you know that the initial and final\npositions are given by:\n\n```math\n\\vec{r_1} = \\begin{bmatrix} 0.159321004 \\\\ 0.579266185 \\\\ 0.052359607 \\end{bmatrix} \\text{ [AU]} \\quad \\quad\n\\vec{r_2} = \\begin{bmatrix} 0.057594337 \\\\ 0.605750797 \\\\ 0.068345246 \\end{bmatrix} \\text{ [AU]} \\quad \\quad\n```\n\n\u003cbr\u003e\n\nThe time of flight is $\\Delta t = 0.010794065$ years. The orbit is\nprograde and direct, thus $M=0$. Remember that when $M=0$, there is only one\npossible solution, so the `low_path` flag does not play any role in this\nproblem.\n\n**Solution**\n\nFor this problem, `gooding1990` is used. Any other solver would work too. Next,\nthe parameters of the problem are instantiated. Finally, the initial and final\nvelocity vectors are computed.\n\n```python\nfrom lamberthub import gooding1990\nimport numpy as np\n\n\nmu_sun = 39.47692641\nr1 = np.array([0.159321004, 0.579266185, 0.052359607])\nr2 = np.array([0.057594337, 0.605750797, 0.068345246])\ntof = 0.010794065\n\nv1, v2 = gooding1990(mu_sun, r1, r2, tof, M=0, prograde=True)\nprint(f\"Initial velocity: {v1} [AU / years]\")\nprint(f\"Final velocity:   {v2} [AU / years]\")\n```\n\n**Result**\n\n```console\nInitial velocity: [-9.303608  3.01862016  1.53636008] [AU / years]\nFinal velocity:   [-9.511186  1.88884006  1.42137810] [AU / years]\n```\n\nDirectly taken from *An Introduction to the Mathematics and Methods of\nAstrodynamics, revised edition, by R.H. Battin, problem 7-12*.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjorgepiloto%2Flamberthub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjorgepiloto%2Flamberthub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjorgepiloto%2Flamberthub/lists"}