Keplerian元素的Python OrbitalPy追溯误差笛卡尔状态向量的位置和速度 [英] Python OrbitalPy Traceback error Cartesian State Vectors Position and Velocity from Keplerian Elements

查看:244
本文介绍了Keplerian元素的Python OrbitalPy追溯误差笛卡尔状态向量的位置和速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取我轨道上每个传播步骤的笛卡尔位置和速度矢量。我正在使用OrbitalPy http://pythonhosted.org/OrbitalPy/ 生成具有经典Keplerian元素的轨道。

I am trying to get the cartesian position and velocity vectors for each propagation step in my orbit. I am using OrbitalPy http://pythonhosted.org/OrbitalPy/ to generate the orbit with classical Keplerian elements.

根据文档,我应该能够从 class orbital.utilities.StateVector ,但出现类型错误: new ()恰好接受3个参数(给定2个)

According to the documentation I should be able to get the state vectors (both position and velocity) from class orbital.utilities.StateVector , but I get a Type Error: new() takes exactly 3 arguments (2 given)

这是代码:

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)


推荐答案

事实证明,问题出在OrbitalPy。使用原始轨道名称时,只能获得状态向量。

It turns out that the issue is with OrbitalPy. One can only get state vectors when using the original orbit name.

在这种情况下, orbitPineapple.r 将返回位置(x,y,z)和 orbitPineapple.v 会返回(Vx,Vy,Vy)。

In this case orbitPineapple.r would return position (x,y,z) and orbitPineapple.v would return (Vx,Vy,Vy).

每次使用操作后,位置和速度矢量都会更新与原始轨道名称 print(orbitPineapple.r,orbitPineapple.v)完全相同。

The position and velocity vectors are update after each maneuver is applied just use the exact same line with the original orbit name print(orbitPineapple.r, orbitPineapple.v).

这项超级有用的功能可以节省我很多时间,您只需输入变量或函数以及名称。并按 tab键 ,并显示所有选项。

Additionally, a super useful feature that would have saved me hours, is you can just type a variable or function and name. and hit the tab key and all the options are displayed.

这篇关于Keplerian元素的Python OrbitalPy追溯误差笛卡尔状态向量的位置和速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆