diff --git a/chasemapper/config.py b/chasemapper/config.py index 6d15d36..f16843c 100644 --- a/chasemapper/config.py +++ b/chasemapper/config.py @@ -176,6 +176,11 @@ def parse_config_file(filename): logging.info("Missing turn rate gate setting, using default (4m/s)") chase_config["turn_rate_threshold"] = 4.0 + try: + chase_config["ascent_rate_averaging"] = config.getint("predictor", "ascent_rate_averaging") + except: + logging.info("Missing ascent_rate_averaging setting, using default (10)") + chase_config["ascent_rate_averaging"] = 10 # Telemetry Source Profiles diff --git a/chasemapper/geometry.py b/chasemapper/geometry.py index 33e7bf3..b91ef14 100644 --- a/chasemapper/geometry.py +++ b/chasemapper/geometry.py @@ -152,7 +152,18 @@ def calculate_ascent_rate(self): "Zero time-step encountered in ascent rate calculation - are multiple receivers reporting telemetry simultaneously?" ) continue + + # _mean2_time_delta = ( + # self.track_history[-1][0] - self.track_history[-1*_num_samples][0] + # ).total_seconds() + + # _mean2_altitude_delta = ( + # self.track_history[-1][3] - self.track_history[-1*_num_samples][3] + # ) + + # _asc_rate2 = _mean2_altitude_delta / _mean2_time_delta + #print(f"asc_rates: {_asc_rates}, Mean: {np.mean(_asc_rates)}") return np.mean(_asc_rates) def calculate_heading(self): diff --git a/horusmapper.cfg.example b/horusmapper.cfg.example index afadb99..b3a3d4b 100644 --- a/horusmapper.cfg.example +++ b/horusmapper.cfg.example @@ -134,6 +134,11 @@ predictor_enabled = True default_burst = 30000 default_descent_rate = 5.0 +# How many data points to average the payload's ascent rate over. +# Note that this is data points, not *seconds*, so you may need to tune this for your payload's +# position update rate. +# Longer averaging means a smoother ascent rate. ~10 seems ok for a typical Horus Binary payload. +ascent_rate_averaging = 10 # Offline Predictions # Use of the offline predictor requires installing the CUSF Predictor Python Wrapper from here: diff --git a/horusmapper.py b/horusmapper.py index 2b48985..e6c532f 100644 --- a/horusmapper.py +++ b/horusmapper.py @@ -236,7 +236,7 @@ def handle_new_payload_position(data, log_position=True): if _callsign not in current_payloads: # New callsign! Create entries in data stores. - current_payload_tracks[_callsign] = GenericTrack() + current_payload_tracks[_callsign] = GenericTrack(ascent_averaging=chasemapper_config["ascent_rate_averaging"]) current_payloads[_callsign] = { "telem": {