question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

vallado.lambert fails for long way transfers

See original GitHub issue

When 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:closed
  • Created 4 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
jorgepilotocommented, Feb 26, 2020

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 and psi_low:

  • poliastro: psi_up = 4.0 * pi and psi_low = -4.0 * pi
  • vallado58: psi_up = 4.0 * pi ** 2 and psi_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 psiof our vallado 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, the exception 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.

0reactions
astrojuanlucommented, Feb 27, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found