Skip to content

Commit

Permalink
Released v2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Shiva-Iyer committed Aug 28, 2020
2 parents acd0b67 + 55e33fa commit 00be9c8
Show file tree
Hide file tree
Showing 23 changed files with 214 additions and 204 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ Installation
Examples
--------

1. `fit_radec.py` : Run OD with real angles measurements.
1. `fit_radec.py` : Run OD with real angles measurements. Also demonstrates
the Laplace IOD method for estimating an initial state vector.

2. `predict_passes.py` : Predict satellite passes for ground stations or
geographic regions using TLEs. Current elements may be obtained from
Expand Down Expand Up @@ -66,7 +67,7 @@ Development

`mvn -e package`

2. Download and extract <https://github.com/ut-astria/orbdetpy/releases/download/2.0.1/orekit-data.tar.gz>
2. Download and extract <https://github.com/ut-astria/orbdetpy/releases/download/2.0.2/orekit-data.tar.gz>
under the `orbdetpy/` sub-folder.

Known Issues
Expand Down
27 changes: 19 additions & 8 deletions examples/fit_radec.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from orbdetpy import configure, add_station, build_measurement, Filter, MeasurementType, Constant
from orbdetpy import configure, add_station, build_measurement, Filter, Frame, MeasurementType, Constant
from orbdetpy.conversion import get_J2000_epoch_offset, get_UTC_string
from orbdetpy.estimation import determine_orbit
from orbdetpy.estimation import determine_orbit, iod_laplace
from orbdetpy.plotting.estimation import plot

# "UTA-ASTRIA-NMSkies" ground station WGS-84 coordinates
lat, lon, alt = 0.5743, -1.8418, 2225.0

# Real measurements: UTC, RA (rad), dec (rad)
real_obs = [
["2020-07-24T03:19:36.035Z", 1.073579, 1.381180],
Expand Down Expand Up @@ -56,13 +59,21 @@
["2020-07-24T03:22:49.930Z", 5.673622, 0.376921]
]

# Use Laplace IOD to estimate an initial state from 3 RA/dec
times, ra, dec = [], [], []
for i in range(3):
times.append(get_J2000_epoch_offset(real_obs[i][0]))
ra.append(real_obs[i][1])
dec.append(real_obs[i][2])
initial_epoch = times[1]
initial_state = iod_laplace(Frame.EME2000, lat, lon, alt, times, ra, dec)

# Configure orbit determination
config = configure(prop_start=get_J2000_epoch_offset("2020-07-24T03:15:01.526Z"),
prop_initial_state=[-3150507.866, -3090624.805, 5330071.203, 3600.098, -6482.160, -1626.428],
config = configure(prop_start=initial_epoch, prop_initial_state=initial_state,
prop_end=get_J2000_epoch_offset(real_obs[-1][0]))

# Define ground station(s)
add_station(config, "UTA-ASTRIA-NMSkies", 0.5743, -1.8418, 2225.0)
add_station(config, "UTA-ASTRIA-NMSkies", lat, lon, alt)

# Define measurement types; RA/dec used here
config.measurements[MeasurementType.RIGHT_ASCENSION].error[:] = [2.0*Constant.ARC_SECOND_TO_RAD]
Expand All @@ -83,8 +94,8 @@
print(fit)
exit(1)

# Plot OD results
plot(config, meas_obj, fit, interactive=True, estim_param=False)
for f in fit:
# print(f) to dump pre-fits/post-fits/covariances
print(get_UTC_string(f.time), f.estimated_state)
print(get_UTC_string(f.time), f.station, f.estimated_state[:6])
# Plot OD results
plot(config, meas_obj, fit, interactive=True, estim_param=False)
11 changes: 4 additions & 7 deletions examples/propagate_tle.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
import sys
import argparse
from datetime import datetime, timedelta
from orbdetpy.conversion import get_UTC_string
from orbdetpy import configure
from orbdetpy.conversion import get_J2000_epoch_offset, get_UTC_string
from orbdetpy.propagation import propagate_orbits

day0 = datetime.today()
day1 = day0 + timedelta(days=1)
Expand All @@ -30,16 +32,11 @@
parser.add_argument("--end-time", help="Propagation end time",
default = datetime(day1.year, day1.month, day1.day).strftime(timefmt))
parser.add_argument("--step-size", help="Step size [sec.]", type=float, default=900.0)

if (len(sys.argv) == 1):
parser.print_help()
exit(1)
args = parser.parse_args()

from orbdetpy import configure
from orbdetpy.conversion import get_J2000_epoch_offset
from orbdetpy.propagation import propagate_orbits

args = parser.parse_args()
start = get_J2000_epoch_offset(args.start_time)
end = get_J2000_epoch_offset(args.end_time)
config, elements = [], [l for l in getattr(args, "tle-file").read().splitlines()
Expand Down
16 changes: 12 additions & 4 deletions examples/test_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from orbdetpy import (configure, add_facet, add_maneuver, add_station, AttitudeType,
Filter, ManeuverTrigger, ManeuverType, MeasurementType, Constant)
from orbdetpy.ccsds import export_OEM, export_TDM
from orbdetpy.conversion import get_J2000_epoch_offset
from orbdetpy.conversion import get_J2000_epoch_offset, get_UTC_string
from orbdetpy.estimation import determine_orbit
from orbdetpy.propagation import propagate_orbits
from orbdetpy.plotting.estimation import plot as estimation_plot
Expand Down Expand Up @@ -49,6 +49,11 @@
#add_maneuver(cfg, get_J2000_epoch_offset("2019-05-01T00:10:00Z"), ManeuverTrigger.DATE_TIME,
# None, ManeuverType.CONSTANT_THRUST, [*Constant.MINUS_J, 30, 100, 250])

# ManeuverType.*_CHANGE maneuvers take a single "delta" argument representing change in the
# corresponding element; values are in meters for distances and radians for angles
#add_maneuver(cfg, get_J2000_epoch_offset("2019-05-01T00:10:00Z"), ManeuverTrigger.DATE_TIME,
# None, ManeuverType.PERIGEE_CHANGE, [50000.0])

# Define ground stations
add_station(cfg, "Maui", 0.3614, -2.7272, 3059.0)
add_station(cfg, "Millstone", 0.7438, -1.2652, 100.0, fov_azimuth=-2.75,
Expand All @@ -67,16 +72,16 @@
#cfg.measurements[MeasurementType.RIGHT_ASCENSION].error[:] = [Constant.ARC_SECOND_TO_RAD]
#cfg.measurements[MeasurementType.DECLINATION].error[:] = [Constant.ARC_SECOND_TO_RAD]

# Inertial position as "measurements"
# Inertial position as measurement
#cfg.measurements[MeasurementType.POSITION].error[:] = [100.0, 200.0, 300.0]

# Inertial position/velocity as "measurements"
# Inertial position/velocity as measurement
#cfg.measurements[MeasurementType.POSITION_VELOCITY].error[:] = [100.0, 200.0, 300.0, 3.0, 2.0, 1.0]

# Propagate orbits and generate measurements
meas = propagate_orbits([cfg])[0].array

# Uncomment to plot orbital elements etc. from the simulation
# Uncomment to plot orbital elements from the simulation
#simulation_plot(meas, interactive=True)

# Uncomment to export simulated measurements to a CCSDS TDM file
Expand All @@ -96,6 +101,9 @@
print(fit)
exit(1)

for f in fit:
# print(f) to dump pre-fits/post-fits/covariances
print(get_UTC_string(f.time), f.station, f.estimated_state[:6])
# Plot OD results
estimation_plot(cfg, meas, fit, interactive=True, estim_param=False)

Expand Down
26 changes: 20 additions & 6 deletions orbdetpy/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ def transform_frame(src_frame: int, time: float, pva: List[float], dest_frame: i
State vector transformed to the destination frame.
"""

resp = _conversion_stub.transformFrame(TransformFrameInput(
src_frame=src_frame, time=time, pva=pva, dest_frame=dest_frame))
if (isinstance(time, float)):
resp = _conversion_stub.transformFrame(TransformFrameInput(
src_frame=src_frame, time=time, pva=pva, dest_frame=dest_frame))
else:
resp = _conversion_stub.transformFrame(TransformFrameInput(
src_frame=src_frame, UTC_time=time, pva=pva, dest_frame=dest_frame))
return(resp.array)

def azel_to_radec(time: float, az: float, el: float, lat: float,
Expand Down Expand Up @@ -101,7 +105,10 @@ def pos_to_lla(frame: int, time: float, pos: List[float])->List[float]:
WGS-84 latitude [rad], longitude [rad], altitude [m].
"""

resp = _conversion_stub.convertPosToLLA(TransformFrameInput(src_frame=frame, time=time, pva=pos))
if (isinstance(time, float)):
resp = _conversion_stub.convertPosToLLA(TransformFrameInput(src_frame=frame, time=time, pva=pos))
else:
resp = _conversion_stub.convertPosToLLA(TransformFrameInput(src_frame=frame, UTC_time=time, pva=pos))
return(resp.array)

def elem_to_pv(frame: int, time: float, sma: float, ecc: float, inc: float,
Expand All @@ -125,8 +132,12 @@ def elem_to_pv(frame: int, time: float, sma: float, ecc: float, inc: float,
Cartesian state vector.
"""

resp = _conversion_stub.convertElemToPv(TransformFrameInput(src_frame=frame, time=time,
pva=[sma,ecc,inc,raan,argp,anom,anom_type]))
if (isinstance(time, float)):
resp = _conversion_stub.convertElemToPv(TransformFrameInput(src_frame=frame, time=time,
pva=[sma,ecc,inc,raan,argp,anom,anom_type]))
else:
resp = _conversion_stub.convertElemToPv(TransformFrameInput(src_frame=frame, UTC_time=time,
pva=[sma,ecc,inc,raan,argp,anom,anom_type]))
return(resp.array)

def pv_to_elem(frame: int, time: float, pv: List[float])->List[float]:
Expand All @@ -144,7 +155,10 @@ def pv_to_elem(frame: int, time: float, pv: List[float])->List[float]:
mean anomaly, true anomaly, eccentric anomaly
"""

resp = _conversion_stub.convertPvToElem(TransformFrameInput(src_frame=frame, time=time, pva=pv))
if (isinstance(time, float)):
resp = _conversion_stub.convertPvToElem(TransformFrameInput(src_frame=frame, time=time, pva=pv))
else:
resp = _conversion_stub.convertPvToElem(TransformFrameInput(src_frame=frame, UTC_time=time, pva=pv))
return(resp.array)

def get_UTC_string(j2000_offset: float)->str:
Expand Down
6 changes: 3 additions & 3 deletions orbdetpy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.astria</groupId>
<artifactId>orbdetpy-server</artifactId>
<version>2.0.1</version>
<version>2.0.2</version>
<packaging>jar</packaging>

<properties>
<application.main.class>org.astria.rpc.RPCServer</application.main.class>
<os.detected.classifier>linux-x86_64</os.detected.classifier>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<grpc.version>1.30.2</grpc.version>
<grpc.version>1.31.1</grpc.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.javadoc.version>3.2.0</maven.javadoc.version>
<maven.shade.version>3.2.4</maven.shade.version>
<maven.surefire.version>2.22.2</maven.surefire.version>
<orekit.version>10.1</orekit.version>
<orekit.version>10.2</orekit.version>
<protobuf.maven.plugin.version>0.6.1</protobuf.maven.plugin.version>
</properties>

Expand Down
24 changes: 16 additions & 8 deletions orbdetpy/rpc/conversion_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def transformFrame(request,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
Expand All @@ -175,14 +176,15 @@ def transformFrame(request,
messages__pb2.TransformFrameInput.SerializeToString,
messages__pb2.DoubleArray.FromString,
options, channel_credentials,
call_credentials, compression, wait_for_ready, timeout, metadata)
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def convertAzElToRaDec(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
Expand All @@ -191,14 +193,15 @@ def convertAzElToRaDec(request,
messages__pb2.AnglesInput.SerializeToString,
messages__pb2.DoubleArray.FromString,
options, channel_credentials,
call_credentials, compression, wait_for_ready, timeout, metadata)
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def convertRaDecToAzEl(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
Expand All @@ -207,14 +210,15 @@ def convertRaDecToAzEl(request,
messages__pb2.AnglesInput.SerializeToString,
messages__pb2.DoubleArray.FromString,
options, channel_credentials,
call_credentials, compression, wait_for_ready, timeout, metadata)
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def convertPosToLLA(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
Expand All @@ -223,14 +227,15 @@ def convertPosToLLA(request,
messages__pb2.TransformFrameInput.SerializeToString,
messages__pb2.DoubleArray.FromString,
options, channel_credentials,
call_credentials, compression, wait_for_ready, timeout, metadata)
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def convertElemToPv(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
Expand All @@ -239,14 +244,15 @@ def convertElemToPv(request,
messages__pb2.TransformFrameInput.SerializeToString,
messages__pb2.DoubleArray.FromString,
options, channel_credentials,
call_credentials, compression, wait_for_ready, timeout, metadata)
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def convertPvToElem(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
Expand All @@ -255,14 +261,15 @@ def convertPvToElem(request,
messages__pb2.TransformFrameInput.SerializeToString,
messages__pb2.DoubleArray.FromString,
options, channel_credentials,
call_credentials, compression, wait_for_ready, timeout, metadata)
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def getUTCString(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
Expand All @@ -271,14 +278,15 @@ def getUTCString(request,
google_dot_protobuf_dot_wrappers__pb2.DoubleValue.SerializeToString,
google_dot_protobuf_dot_wrappers__pb2.StringValue.FromString,
options, channel_credentials,
call_credentials, compression, wait_for_ready, timeout, metadata)
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def getJ2000EpochOffset(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
Expand All @@ -287,4 +295,4 @@ def getJ2000EpochOffset(request,
google_dot_protobuf_dot_wrappers__pb2.StringValue.SerializeToString,
google_dot_protobuf_dot_wrappers__pb2.DoubleValue.FromString,
options, channel_credentials,
call_credentials, compression, wait_for_ready, timeout, metadata)
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
6 changes: 4 additions & 2 deletions orbdetpy/rpc/estimation_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def determineOrbit(request,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
Expand All @@ -78,14 +79,15 @@ def determineOrbit(request,
messages__pb2.DetermineOrbitInput.SerializeToString,
messages__pb2.EstimationOutputArray.FromString,
options, channel_credentials,
call_credentials, compression, wait_for_ready, timeout, metadata)
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def iodLaplace(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
Expand All @@ -94,4 +96,4 @@ def iodLaplace(request,
messages__pb2.AnglesInput.SerializeToString,
messages__pb2.DoubleArray.FromString,
options, channel_credentials,
call_credentials, compression, wait_for_ready, timeout, metadata)
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
Loading

0 comments on commit 00be9c8

Please sign in to comment.