vallado.lambert fails for long way transfers
See original GitHub issueWhen trying to set up poliastro.iod.vallado.lambert, I receive the following error when I set short=False (long path transfer):
Traceback (most recent call last):
File "C:/Users/pawit/.PyCharmCE2019.3/config/scratches/scratch_4.py", line 11, in <module>
v = lambert_v(k, r0, rf, tof, short=short, numiter=numiter, rtol=rtol).__next__()
File "C:\Users\pawit\Documents\research_env\lib\site-packages\poliastro\iod\vallado.py", line 48, in lambert
v0, v = vallado_fast(k_, r0_, r_, tof_, short, numiter, rtol)
File "C:\Users\pawit\Documents\research_env\lib\site-packages\poliastro\core\iod.py", line 151, in vallado
raise RuntimeError("Maximum number of iterations reached")
RuntimeError: Maximum number of iterations reached
Here is my minimal (non)working example:
from astropy import units as u, constants as c
from poliastro.iod.vallado import lambert as lambert_v
k = c.GM_earth.to(u.km ** 3/ u.s ** 2)
r0 = [10000., 0, 0] * u.km
rf = [8000., -5000, 0] * u.km
tof = (2 * u.hour).to(u.s)
short = False
numiter = 1000
rtol = 1e-6
v = lambert_v(k, r0, rf, tof, short=short, numiter=numiter, rtol=rtol).__next__()
print('v1 = ')
print(v[0])
print('v2 = ')
print(v[1])
It has worked for all of the tests I gave it when short=True, and failed every time short=False.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Convergence Behavior of Series Solutions of the Lambert ...
Lambertfs theorem states that the orbital transfer time t! between two known positions in the 2#body orbital problem is dependent only on the...
Read more >Multiple revolutions on Lambert's problem - poliastro
There are two scenarios for solving Lambert's problem: Single revolution or direct-transfer arc.
Read more >Review of Lambert's Problem
The second conflictive zone is associated to θ < π (type I, short-way transfers) and TOF < π/8 in the hyperbolic orbits region,...
Read more >Lambert's Theorem—A Complete Series Solution
Lambert's theorem states that for the two-body orbit ... Two new series solutions are given for each boundary of the long-way orbital case, ......
Read more >Lambert's problem algorithms: a critical review - GitHub
Keywords: Lambert's problem, two-body problem, orbital boundary value prob- ... Notice now that the orbit path parameter is no longer.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Origin of this algorithm and possible errata ⚠️
This routine is based on “Algorithm 58” from “Fundamentals of Astrodynamics” book. After comparing poliastro’s implementation of the algorithm and the one stated in the book, I noticed there is a difference in the values for
psi_up
andpsi_low
:psi_up = 4.0 * pi
andpsi_low = -4.0 * pi
psi_up = 4.0 * pi ** 2
andpsi_low = -4.0 * pi ** 2
(refer to the algorithm script since it seems to be an errata in the book between de values)Proposed solution
By correcting the actual values for
psi
of ourvallado
implementation, it was possible to run the original issue code without any problem. Tests were also passing, thought an increase of iterations was required in one of them.Regarding the pull request #845, if a
numiter
argument is passed, theexception
for reached maximum number of iterations should be kept. Code modifications do not affect code workflow but force it to return the last value. I will let a review in the pull request.Fixed in #845! @paul-witsberger if you want to test with
master
you’re welcome to do so 😃 And if the issue was still not fixed, please comment here.