方位角,仰角,范围和观测者纬度,经度,经度的ECEF [英] ECEF from Azimuth, Elevation, Range and Observer Lat,Lon,Alt

查看:243
本文介绍了方位角,仰角,范围和观测者纬度,经度,经度的ECEF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个基本的python脚本,该脚本将从给定位置跟踪由tle定义的给定卫星.我不是一个惯性/轨道的人,但是正在努力变得更聪明.

I'm trying to write a basic python script that will track a given satellite, defined with tle's, from a given location. I'm not a asto/orbital person but am trying to become smarter on it.

当我尝试将方位角,仰角,范围值转换为ECEF位置时遇到问题.我正在使用PyEphem来获取观测值,并使用spg4来获取要验证的真实位置.我也在使用网站 http://www.n2yo.com/?s=25544 ,验证值.

I am running into a problem when I try to convert the azimuth, elevation, range values to a ECEF position. I'm using PyEphem to get the observation values and spg4 to get the real location to verify. I'm also using the website, http://www.n2yo.com/?s=25544, the verify the values.

我得到的观察到的方位角,仰角和范围如下:

I'm getting the observed azimuth, elevation and range with:

def get_ob(epoch, sv, obsLoc):
    site = ephem.Observer()
    site.lon = str(obsLoc.lat)   # +E -104.77 here
    site.lat = str(obsLoc.lon)   # +N 38.95   here
    site.elevation = obsLoc.alt # meters    0 here
    #epoch = time.time()
    site.date = datetime.datetime.utcfromtimestamp(epoch)

    sat = ephem.readtle(sv.name,sv.tle1,sv.tle2)
    sat.compute(site)

    az       = degrees(sat.az)
    el       = degrees(sat.alt)
    #range in m
    range    = sat.range
    sat_lat  = degrees(sat.sublat)
    sat_long = degrees(sat.sublong)
    # elevation of sat in m
    sat_elev = sat.elevation

    x, y, z    = aer2ecef(az,el,range,38.95,-104.77,80 / 1000)

所报告的方位角,仰角和范围与网站匹配.我要通过以下方式转换为ECEF职位:

The reported azimuth, elevation and range match the website. I'm converting to ECEF positions with:

def aer2ecef(azimuthDeg, elevationDeg, slantRange, obs_lat, obs_long, obs_alt):

    #site ecef in meters
    sitex, sitey, sitez = llh2ecef(obs_lat,obs_long,obs_alt)

    #some needed calculations
    slat = sin(radians(obs_lat))
    slon = sin(radians(obs_long))
    clat = cos(radians(obs_lat))
    clon = cos(radians(obs_long))

    azRad = radians(azimuthDeg)
    elRad = radians(elevationDeg)

    # az,el,range to sez convertion
    south  = -slantRange * cos(elRad) * cos(azRad)
    east   =  slantRange * cos(elRad) * sin(azRad)
    zenith =  slantRange * sin(elRad)


    x = ( slat * clon * south) + (-slon * east) + (clat * clon * zenith) + sitex
    y = ( slat * slon * south) + ( clon * east) + (clat * slon * zenith) + sitey
    z = (-clat *        south) + ( slat * zenith) + sitez

    return x, y, z

但是,当我绘制该图时,该位置偏离了(地球的反面).我从网站和spg4获得的排名匹配,因此我认为这些是正确的.

When I plot that though, the position is way off (wrong side of globe). The position I get from the website and from spg4 match so I believe those to be the correct.

我不确定该错误是否出在我的转换方法中,还是我使用了错误的数据进行转换.我在以下答案中找到了该方法:获取ECEF XYZ给定起始坐标,范围,方位角和海拔高度

I'm not sure if the error is in my conversion method or I'm using the wrong data for the conversion. I found the method in a answer here: Get ECEF XYZ given starting coordinates, range, azimuth, and elevation

对于我要去哪里的任何建议或建议,我们将不胜感激.以下是测试输入/输出:

Any advice or suggestions for where I'm getting off would be very appreciated. Below is test input/outputs:

我正在测试的卫星是ISS和directv10(一颗固定的一颗正在移动,可通过互联网跟踪进行验证)

The satellites I'm testing with are the ISS and directv10 (one fixed, one moving- with internet tracking available for verification):

0 Direct10
1 31862U 07032A   13099.15996183 -.00000126  00000-0  10000-3 0  1194
2 31862 000.0489 046.9646 0000388 001.7833 103.5813 01.00271667 21104
0 ISS
1 25544U 98067A   13112.50724749  .00016717  00000-0  10270-3 0  9148
2 25544  51.6465  24.5919 0009906 171.1474 188.9854 15.52429950 26067

观察者站点lla:

[38.95 -104.77 0.0]

结果:

sv: ISS ephem observed response(km)              @ epoch: 1365630559.000000 : [344.067992722211, -72.38297754053431, 12587.123][degrees(sat.az), degrees(sat.alt), sat.range]
sv: ISS ephem reported llh location(km)          @ epoch: 1365630559.000000 : [-41.678271938092195, -129.16682754513502, 421.06290625][degrees(sat.sublat0, degrees(sat.sublong), sat.elevation]
sv: ISS ephem calculated xyz location(km)        @ epoch: 1365630559.000000 : [688.24385373837845, 6712.2004971137103, -704.83633267710866][aer2ecef(az,el,range,obsLoc.lat,obsLoc.lon,obsLoc.alt)]
sv: ISS ephem llh from calc xyz location(km)     @ epoch: 1365630559.000000 : [-6.001014287867631, 84.1455657632957, 12587.123][ecef2llh()]
sv: ISS ephem xyz from reported llh location(km) @ epoch: 1365630559.000000 :[-3211.7910504146325, -3942.7032969856118, -4498.9656030253745][llh2ecef(lat,long,elev)]
sv: ISS spg84 ecef position(m) @ epoch: 1365630559.000000 : [-3207667.3380003194, -3936704.823960199, -4521293.5388663234]
sv: ISS spg84 ecef2llh(m)      @ epoch: 1365630559.000000 : [-41.68067424524357, -129.17349987675482, 6792812.8704163525]
sv: Direct10 ephem observed response(km)              @ epoch: 1365630559.000000 : [320.8276456938389, -19.703680198781303, 43887.572][degrees(sat.az), degrees(sat.alt), sat.range]
sv: Direct10 ephem reported llh location(km)          @ epoch: 1365630559.000000 : [0.004647324660923812, -102.8070784813048, 35784.688][degrees(sat.sublat0, degrees(sat.sublong), sat.elevation]
sv: Direct10 ephem calculated xyz location(km)        @ epoch: 1365630559.000000 : [-18435.237655222769, 32449.238763035213, 19596.893001978762][aer2ecef(az,el,range,obsLoc.lat,obsLoc.lon,obsLoc.alt)]
sv: Direct10 ephem llh from calc xyz location(km)     @ epoch: 1365630559.000000 : [27.727834453026748, 119.60200825103102, 43887.572][ecef2llh()]
sv: Direct10 ephem xyz from reported llh location(km) @ epoch: 1365630559.000000 :[-9346.1899009219123, -41113.897098582587, 3.4164105611003754][llh2ecef(lat,long,elev)]
sv: Direct10 spg84 ecef position(m) @ epoch: 1365630559.000000 : [-9348605.9260040354, -41113193.982686974, -14060.29781505302]
sv: Direct10 spg84 ecef2llh(m)      @ epoch: 1365630559.000000 : [-0.019106864351793953, -102.81049179145006, 42156299.077687651]

推荐答案

我真的很傻,但是发现了问题...

I feel really dumb but found the issue...

我正在将站点的纬度和经度转换为PyEphem模型(请参阅第3-4行)...转换当前有效.

I was transposing the the latitude and longitude from the site into the PyEphem model (look at line 3-4)...The conversion works currently.

让孩子们上一堂课.使用好的变量名...不要像我这样懒惰,不要浪费时间去寻找一个不存在的数学错误....

Let that be a lesson kids. USE GOOD VARIABLE NAMES...don't be lazy like me and lose time trying to find a nonexistent math bug....

这篇关于方位角,仰角,范围和观测者纬度,经度,经度的ECEF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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