def ecef2topo(r_ecef, lat, lon, alt): import numpy as np import numpy.linalg as la from util import r2, r3 #convert lat, lon, and alt to radians lat = np.deg2rad(lat) lon = np.deg2rad(lon) #find radius between station and center of earth for ecef #representation. station_r = alt + 6378.1363 #find the station's ecef coordinates station_ecef = np.matrix([ \ [station_r*np.cos(lat)*np.cos(lon)], \ [station_r*np.cos(lat)*np.sin(lon)], \ [station_r*np.sin(lat)] \ ]) #find slant-range vector rho_ecef = r_ecef - station_ecef #convert from ECEF to SEZ rho_sez = r2(np.pi / 2 - lat) * r3(lon) * rho_ecef #range is norm of the SEZ position vector rho = la.norm(rho_sez) #decompose rho_sez into S, E, and Z components. rho_s = rho_sez[0][0] rho_e = rho_sez[1][0] rho_z = rho_sez[2][0] #rho_s = -rho*cos(el)*cos(alt) #rho_e = rho*cos(el)*sin(alt) #rho_z = rho*sin(el) #From the above relations, we can derive these: #find el sin_el = rho_z / rho cos_el = np.sqrt(rho_s**2 + rho_e**2) / rho el = np.arctan2(sin_el, cos_el) #find az sin_az = rho_e / np.sqrt(rho_s**2 + rho_e**2) cos_az = -rho_s / np.sqrt(rho_s**2 + rho_e**2) az = np.arctan2(sin_az, cos_az) #convert az, and el to degrees for final reporting az = np.rad2deg(az) el = np.rad2deg(el) topo = { \ 'rho_sez' : rho_sez, \ 'az': az, \ 'el': el, \ 'range': rho \ } return topo
def ecef2eci(r_ecef, theta_GST): import numpy as np from util import r3 theta_GST = np.deg2rad(theta_GST) #r3 is the z rotation matrix. #this is exactly the same as eci2ecef except we pass in the #negative angle to r3() r_ijk = r3(-theta_GST) * r_ecef return r_ijk
def ecef2eci(r_ecef, theta_GST): import numpy as np from util import r3 theta_GST = np.deg2rad(theta_GST) #r3 is the z rotation matrix. #this is exactly the same as eci2ecef except we pass in the #negative angle to r3() r_ijk = r3(-theta_GST)*r_ecef return r_ijk
def eci2ecef(r_ijk, theta_GST): import numpy as np from util import r3 if r_ijk.shape == (1, 3): r_ijk = np.transpose(r_ijk) theta_GST = np.deg2rad(theta_GST) #r_z rotation matrix (aka r3) is defined in the function r3() r_ecef = r3(theta_GST) * r_ijk return r_ecef
def eci2ecef(r_ijk, theta_GST): import numpy as np from util import r3 if r_ijk.shape == (1,3): r_ijk = np.transpose(r_ijk) theta_GST = np.deg2rad(theta_GST) #r_z rotation matrix (aka r3) is defined in the function r3() r_ecef = r3(theta_GST)*r_ijk return r_ecef
def Euler321_2DCM(psi, theta, phi): from util import r1, r2, r3 return r1(phi).dot(r2(theta).dot(r3(psi)))
def ecef2topo(r_ecef, lat, lon, alt): import numpy as np import numpy.linalg as la from util import r2, r3 #convert lat, lon, and alt to radians lat = np.deg2rad(lat) lon = np.deg2rad(lon) #find radius between station and center of earth for ecef #representation. station_r = alt + 6378.1363 #find the station's ecef coordinates station_ecef = np.matrix([ \ [station_r*np.cos(lat)*np.cos(lon)], \ [station_r*np.cos(lat)*np.sin(lon)], \ [station_r*np.sin(lat)] \ ]) #find slant-range vector rho_ecef = r_ecef-station_ecef #convert from ECEF to SEZ rho_sez = r2(np.pi/2-lat)*r3(lon)*rho_ecef #range is norm of the SEZ position vector rho = la.norm(rho_sez) #decompose rho_sez into S, E, and Z components. rho_s = rho_sez[0][0] rho_e = rho_sez[1][0] rho_z = rho_sez[2][0] #rho_s = -rho*cos(el)*cos(alt) #rho_e = rho*cos(el)*sin(alt) #rho_z = rho*sin(el) #From the above relations, we can derive these: #find el sin_el = rho_z/rho cos_el = np.sqrt(rho_s**2+rho_e**2)/rho el = np.arctan2(sin_el,cos_el) #find az sin_az = rho_e/np.sqrt(rho_s**2+rho_e**2) cos_az = -rho_s/np.sqrt(rho_s**2+rho_e**2) az = np.arctan2(sin_az,cos_az) #convert az, and el to degrees for final reporting az = np.rad2deg(az) el = np.rad2deg(el) topo = { \ 'rho_sez' : rho_sez, \ 'az': az, \ 'el': el, \ 'range': rho \ } return topo
def Euler321_2DCM(psi,theta,phi): from util import r1, r2, r3 return r1(phi).dot(r2(theta).dot(r3(psi)))
ccwLeg = Y ccwLeg = -Z ############################################################ # # This portion builds one iteration of the central turn # and adds it to the initial leg. There is a discontinuity # between the two that I don't likem but I'm not ready to # figure out how to ficx it just yet. # ############################################################ alpha = 36 + 72 stack = vstack([-X, Y, -Z]) rotStack = r3(deg2rad(alpha)).dot(stack) theta = linspace(-5 * pi / 4, 2 * pi + deg2rad(alpha + 200), 100) phi = linspace(0, 2 * pi, 100) Xspiral = sqrt(0.08) * cos(theta) * (1 + 0.6 * sin(phi)**2) Yspiral = sqrt(0.08) * sin(theta) * (1 + 0.6 * sin(phi)**2) Zspiral = -0.66 + 0.01 * linspace(0, 66 * 2, 100) X = hstack([X, Xspiral]) Y = hstack([Y, Yspiral]) Z = hstack([Z, Zspiral]) theta = linspace(2 * pi + deg2rad(alpha + 200), -5 * pi / 4, 100) Xspiral = sqrt(0.08) * cos(theta) * (1 + 0.6 * sin(phi)**2) Yspiral = sqrt(0.08) * sin(theta) * (1 + 0.6 * sin(phi)**2) Zspiral = 0.66 - 0.01 * linspace(0, 66 * 2, 100)