From 7f0de1440f5c83416a3cbb5b5339dc83cbe12eff Mon Sep 17 00:00:00 2001 From: Ibrahima Date: Wed, 27 Dec 2023 00:51:30 -0500 Subject: [PATCH] black reformat --- flight/pygnc/common/zmq_messaging.py | 1 - flight/pygnc/tasks/orbit_estimator.py | 12 +++++------- test/flight_pygnc/configuration/messages.py | 1 - 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/flight/pygnc/common/zmq_messaging.py b/flight/pygnc/common/zmq_messaging.py index 05e00d9..c7de584 100644 --- a/flight/pygnc/common/zmq_messaging.py +++ b/flight/pygnc/common/zmq_messaging.py @@ -78,7 +78,6 @@ def __init__( self.subscriber.connect(f"tcp://localhost:{port}") def receive(self, block=True): - block_flag = 0 if block else zmq.NOBLOCK try: diff --git a/flight/pygnc/tasks/orbit_estimator.py b/flight/pygnc/tasks/orbit_estimator.py index 895c81b..d4eb3b7 100644 --- a/flight/pygnc/tasks/orbit_estimator.py +++ b/flight/pygnc/tasks/orbit_estimator.py @@ -9,9 +9,10 @@ from ..configuration import pygnc as pygnc_config from ..algorithms.OrbitEstimator import OrbitEKF + def predict_orbit_ekf(orbit_ekf, prev_epoch, dt=5.0): orbit_ekf.predict(dt) - new_epoch = prev_epoch + dt # addition of seconds is defined in brahe + new_epoch = prev_epoch + dt # addition of seconds is defined in brahe return new_epoch @@ -28,7 +29,7 @@ def update_orbit_ekf(orbit_ekf, gps_message, prev_epoch=None): state_measurement_eci = brahe.frames.sECEFtoECI( measurement_epoch, state_measurement_ecef ) - + if prev_epoch is None: # need to initialize ekf state with first measurement orbit_ekf.initialize_state(state_measurement_eci) @@ -40,7 +41,6 @@ def update_orbit_ekf(orbit_ekf, gps_message, prev_epoch=None): return measurement_epoch - def send_orbit_estimate_message( pub: zmqMessagePublisher, measurement_epoch, orbit_ekf, sensor_message ): @@ -68,9 +68,8 @@ def main(): batch_data = data_parsing.unpack_batch_sensor_gps_file_to_messages_iterable( pygnc_config.batch_sensor_gps_filepath ) - - # We predict the next state every 5 sec + # We predict the next state every 5 sec # Every 25 sec, we process the measurement packet with an EKF update packet_count = 0 prev_epoch = None @@ -85,13 +84,12 @@ def main(): packet_count += 1 estimates.append(orbit_ekf.x) - for i in range(in_between_prediction_dt-1): + for i in range(in_between_prediction_dt - 1): prev_epoch = predict_orbit_ekf(orbit_ekf, prev_epoch) estimates.append(orbit_ekf.x) # print("Batch orbit estimation completed") - # print("Final state estimate:") # print(f"\t{orbit_ekf.x}") # print(f"Final std dev:") diff --git a/test/flight_pygnc/configuration/messages.py b/test/flight_pygnc/configuration/messages.py index a572d49..725ee4d 100644 --- a/test/flight_pygnc/configuration/messages.py +++ b/test/flight_pygnc/configuration/messages.py @@ -7,7 +7,6 @@ class TestMessagesConfiguration(unittest.TestCase): def test_ports_unique(self): - # ensure port numbers are unique port_set = set() for message_name, message_port in message_port_dict.items():