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.

Lambert method for in-plane transfer

See original GitHub issue

I’m trying to solve the transfer between a circular orbit with 200km radius and an orbit with 200km perigee and 8000km apogee.

The optimal transfer is hoffman, however, izzo.lambert gives different result.

My code:

from astropy import units as u
from poliastro.bodies import Earth
from poliastro.iod import izzo
from poliastro.core.elements import coe2rv
from poliastro.util import norm
import math
import time

Earth_k = Earth.k
Req = Earth.R.to(u.km).value

def keplerian2cartesian(kepler):

    a=(kepler[0]+kepler[1]+Req*2)*1000/2 * u.m
    e=(kepler[0]-kepler[1])/(kepler[0]+kepler[1]+Req*2)

    (R,V)=coe2rv(Earth.k,a,e,kepler[2],kepler[3],kepler[4],kepler[5])

    return [R * u.m] + [V * u.m/u.s]

# Checking different transfer times
def transfer_time(DV_min,vector0,vector,period):

    init_t=10
    t_value=init_t
    (r0,r,v0,v)=(vector0[0],vector[0],vector0[1],vector[1])

    while init_t<period:

        tof = init_t * u.min

        try:
            (f_v0, f_v), = izzo.lambert(Earth_k, r0, r, tof)
        except:
            init_t+=1
            continue

        DV0=norm(f_v0-v0).value*1000
        DV=norm(f_v-v).value*1000

        if(DV0+DV<DV_min):
            t_value=init_t
            DV0_value=DV0
            DV_value=DV
            DV_min=DV0+DV

        init_t+=1

    return (t_value,DV_value,DV0_value)


# Checking different initial and final true anomalies
def transfer_tetta(kepler0,kepler):
    DV_min=100000
    final_tetta=0

    a=(kepler[0]+kepler[1]+Req*2)*1000/2
    period=math.ceil(math.sqrt((a**3/Earth.k.value)*4*(math.pi)**2)/60)

    while final_tetta<360:
        init_tetta=0
        while init_tetta<360:
            vector0=keplerian2cartesian(kepler0 + [init_tetta*math.pi/180])
            vector =keplerian2cartesian(kepler  + [final_tetta*math.pi/180])
            try:
                (init_t,DV,DV0)=transfer_time(DV_min,vector0,vector,period)
            except:
                init_tetta+=5
                continue

            if DV+DV0<DV_min:
                DV_min=DV+DV0
                (t_value,DV0_value,DV_value,init_tetta_value,final_tetta_value)=(init_t,DV0,DV,init_tetta,final_tetta)

            init_tetta+=5
        final_tetta+=5

    print("t: ", t_value, "DV_init: ", DV0_value,"DV_final: ", DV_value)
    print("DV: ", DV_min)
    print("Init tetta: ", init_tetta_value, "Final tetta: ", final_tetta_value)

# 1->2
transfer_tetta([200,  200, 64.3*math.pi/180, 0, 300*math.pi/180],[8000, 200, 64.3*math.pi/180, 0, 300*math.pi/180])

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tmamedzadehcommented, Apr 12, 2020

Well, I’ve got the result 0 deg initial and 181 deg final with the Lambert solver. However, the DV is a little higher than with the Hoffman. Closing this ticket, thank you!

0reactions
tmamedzadehcommented, Apr 12, 2020

@astrojuanlu Thank you for the detailed answer! Indeed, I want to get the same result with Lambert solver, as it would be with the Hoffman transfer. Now it gives an optimal transfer starting from 0 deg true anomaly and finishing at 185 deg (which is close to Hoffman). I checked an interval of transfer times with 1 minute period.

I accepted your answer, however, if it’s possible, I would appreciate your time to check the code above to ensure, that the problem is in singularity.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lambert method for in-plane transfer - Space StackExchange
The Hohmann transfer is known to be the optimal two-impulse transfer between two coplanar, circular orbits. There are several proofs to this.
Read more >
Lambert's problem - Wikipedia
The transfer time of a body moving between two points on a conic trajectory is a function only of the sum of the...
Read more >
A Simple Lambert Algorithm
His method is based on a corollary to. Lambert's theorem [6], which states that the mean radius r0 depends on the same set...
Read more >
Lecture 10: Rendezvous and Targeting - Lambert's Problem
A Brief Note on Rendez-vous using Hohman transfer between circular orbits. • The transfer orbit can begin at any point in a circular...
Read more >
Enhancing Lambert Targeting Methods to Accommodate 180 ...
method for enhancing existing Lambert targeting methods by using the hodograph to compute velocity for any transfer angle, including multiples of 180 ....
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