我正在尝试为我的轨道中的每个传播步骤获取笛卡尔位置和速度向量。我正在使用 OrbitalPy http://pythonhosted.org/OrbitalPy/使用经典的开普勒元素生成轨道。
根据文档,我应该能够从中获取状态向量(位置和速度)class orbital.utilities.StateVector
,但我得到一个类型错误:new () 恰好需要 3 个参数(给定 2 个)
这是代码:
from scipy.constants import kilo
import orbital
from orbital import earth, KeplerianElements, Maneuver, plot, utilities
from orbital.utilities import Position, Velocity
import matplotlib.pyplot as plt
import numpy as np
#Orbit Setup
orbitPineapple = KeplerianElements.with_period(96 * 60, body=earth, i=(np.deg2rad(51.6)))
plot(orbitPineapple)
plt.show()
orbitPineapple
Out[23]: KeplerianElements(a=6945033.343911132,
e=0,
i=0.90058989402907408,
raan=0,
arg_pe=0,
M0=0.0,
body=orbital.bodies.earth,
ref_epoch=<Time object: scale='utc' format='jyear_str' value=J2000.000>)
prop1 = orbital.maneuver.PropagateAnomalyTo(M=1.00)
orbitX = orbitPineapple.apply_maneuver(prop1)
plot(orbitPineapple, title='Go Pineapple!')
plt.show()
orbital.utilities.StateVector(orbitPineapple)
TypeError Traceback (most recent call last)
<ipython-input-53-91fb5303082b> in <module>()
4 #print(orbital.utilities.StateVector.velocity(orbitPineapple))
5
----> 6 orbital.utilities.StateVector(orbitPineapple)
7 #orbital.utilities.StateVector.position(orbitPineapple())
8
TypeError: __new__() takes exactly 3 arguments (2 given)