Skip to content

Commit

Permalink
Add ascent rate averaging config setting, default this to 10 points
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Jessop authored and Mark Jessop committed May 5, 2024
1 parent e6e14c3 commit 583d141
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
5 changes: 5 additions & 0 deletions chasemapper/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 11 additions & 0 deletions chasemapper/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
5 changes: 5 additions & 0 deletions horusmapper.cfg.example
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion horusmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 583d141

Please sign in to comment.