From 6583a0dcf3accd0028126e2b1fad1e9276d9336c Mon Sep 17 00:00:00 2001 From: mjrand Date: Wed, 7 Jan 2026 21:50:37 +0000 Subject: [PATCH 1/5] Added in two_leg turnaround method --- socs/agents/acu/agent.py | 8 ++++++-- socs/agents/acu/drivers.py | 26 +++++++++++++++++++++----- socs/agents/acu/turnarounds.py | 8 ++++++-- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/socs/agents/acu/agent.py b/socs/agents/acu/agent.py index 02140ccf3..facc1d16b 100644 --- a/socs/agents/acu/agent.py +++ b/socs/agents/acu/agent.py @@ -1802,7 +1802,7 @@ def set_speed_mode(self, session, params): default=None) @ocs_agent.param('turnaround_method', type=str, default=None, choices=[None, 'standard', 'standard_gen', - 'three_leg']) + 'three_leg', 'two_leg']) @ocs_agent.param('reset', default=False, type=bool) @inlineCallbacks def set_scan_params(self, session, params): @@ -2060,7 +2060,7 @@ def line_batcher(ff_scan, t_shift=0., n=10): @ocs_agent.param('az_vel_ref', type=float, default=None) @ocs_agent.param('turnaround_method', default=None, choices=[None, 'standard', 'standard_gen', - 'three_leg']) + 'three_leg', 'two_leg']) @ocs_agent.param('scan_upload_length', type=float, default=None) @ocs_agent.param('type', default=None, choices=[1, 2, 3]) @inlineCallbacks @@ -2134,8 +2134,12 @@ def generate_scan(self, session, params): If None then the average of the endpoints is used. turnaround_method (str): The method used for generating turnaround. Default (None) generates the baseline minimal jerk trajectory. + 'standard' uses the acu standard turnaround generation (same as None). + 'standard_gen' generates a track_point list of points that mimics + the acu standard turnaround generation for use in type2/type3 scans. 'three_leg' generates a three-leg turnaround which attempts to minimize the acceleration at the midpoint of the turnaround. + 'two_leg' generates a three-leg turnaround with second_leg_time = 0. scan_upload_length (float): number of seconds for each set of uploaded points. If this is not specified, the track manager will try to use as short a time as is diff --git a/socs/agents/acu/drivers.py b/socs/agents/acu/drivers.py index 419a47d7f..b3287031c 100644 --- a/socs/agents/acu/drivers.py +++ b/socs/agents/acu/drivers.py @@ -21,6 +21,7 @@ 'standard': 0, 'standard_gen': 1, 'three_leg': 2, + 'two_leg': 3, } @@ -350,9 +351,12 @@ def generate_constant_velocity_scan(az_endpoint1, az_endpoint2, az_speed, scan endpoints in time. This can be used to better track celestial sources in targeted scans. turnaround_method (str): The method used for generating turnaround. - Default ('standard') generates the baseline minimal jerk trajectory. + (Default) 'standard' generates the baseline minimal jerk trajectory. + 'standard_gen' genetares a list of track_points throughout the turnaround + to mimic the standard acu turnaround. 'three_leg' generates a three-leg turnaround which attempts to minimize the acceleration at the midpoint of the turnaround. + 'two_leg' generates a "three_leg" turnaround with second_leg_time = 0. Yields: points (list): a list of TrackPoint objects. Raises @@ -538,7 +542,7 @@ def generate_type3_scan(az_endpoint1, az_endpoint2, az_speed, az_start='mid_inc', az_first_pos=None, az_drift=None, - turnaround_method='three_leg'): + turnaround_method='two_leg'): """Python generator to produce times, azimuth and elevation positions, azimuth and elevation velocities, azimuth and elevation flags for arbitrarily long type 3 scan. @@ -583,6 +587,13 @@ def generate_type3_scan(az_endpoint1, az_endpoint2, az_speed, az_drift (float): The rate (deg / s) at which to shift the scan endpoints in time. This can be used to better track celestial sources in targeted scans. + turnaround_method (str): The method used for generating turnaround. + 'standard' is unusable with type3 scans! + 'standard_gen' genetares a list of track_points throughout the turnaround + to mimic the standard acu turnaround and is usable for type3 scans. + 'three_leg' generates a three-leg turnaround which attempts to + minimize the acceleration at the midpoint of the turnaround. + (Default) 'two_leg' generates a "three_leg" turnaround with second_leg_time = 0. Yields: points (list): a list of TrackPoint objects. Raises @@ -714,7 +725,6 @@ def get_el(_t): turntime=tt[1], az_flag=az_flag, el_flag=el_flag, step_time=step_time, - second_leg_time=0., point_group_batch=point_group_batch) point_queue.extend(turnaround_track) @@ -749,7 +759,6 @@ def get_el(_t): turntime=tt[1], az_flag=az_flag, el_flag=el_flag, step_time=step_time, - second_leg_time=0., point_group_batch=point_group_batch) point_queue.extend(turnaround_track) @@ -799,7 +808,7 @@ def generate_type2_scan(az_endpoint1, az_endpoint2, az_speed, az_start='mid_inc', az_first_pos=None, az_drift=None, - turnaround_method='three_leg'): + turnaround_method='two_leg'): """Python generator to produce times, azimuth and elevation positions, azimuth and elevation velocities, azimuth and elevation flags for arbitrarily long type 2 scan. @@ -841,6 +850,13 @@ def generate_type2_scan(az_endpoint1, az_endpoint2, az_speed, az_drift (float): The rate (deg / s) at which to shift the scan endpoints in time. This can be used to better track celestial sources in targeted scans. + turnaround_method (str): The method used for generating turnaround. + 'standard' is unusable with type2 scans! + 'standard_gen' genetares a list of track_points throughout the turnaround + to mimic the standard acu turnaround and is usable for type2 scans. + 'three_leg' generates a three-leg turnaround which attempts to + minimize the acceleration at the midpoint of the turnaround. + 'two_leg' (Default) generates a "three_leg" turnaround with second_leg_time = 0. Yields: points (list): a list of TrackPoint objects. Raises diff --git a/socs/agents/acu/turnarounds.py b/socs/agents/acu/turnarounds.py index b40286169..c045aac44 100644 --- a/socs/agents/acu/turnarounds.py +++ b/socs/agents/acu/turnarounds.py @@ -2,7 +2,7 @@ def gen_turnaround(turnaround_method, t0, az0, el0, v0, turntime, az_flag, el_flag, - point_group_batch, second_leg_time=None, second_leg_velocity=0, + point_group_batch, second_leg_time=0, second_leg_velocity=0, step_time=0.05): from .drivers import TrackPoint """ @@ -45,6 +45,10 @@ def gen_turnaround(turnaround_method, t0, az0, el0, v0, turntime, az_flag, el_fl if turnaround_method == "standard_gen": ts, azs, vs = _gen_standard_turnaround(v0, turntime, step_time) + elif turnaround_method == "two_leg": + # Two leg turnarounds set second_leg_time = 0 + ts, azs, vs = _gen_three_leg_turnaround(v0, turntime, 0., second_leg_velocity, step_time) + elif turnaround_method == "three_leg": ts, azs, vs = _gen_three_leg_turnaround(v0, turntime, second_leg_time, second_leg_velocity, step_time) @@ -100,7 +104,7 @@ def _gen_standard_turnaround(v0, turntime, step_time=0.05): return ts, azs, vs -def _gen_three_leg_turnaround(v0, turntime, second_leg_time=None, second_leg_velocity=0, step_time=0.05): +def _gen_three_leg_turnaround(v0, turntime, second_leg_time=0, second_leg_velocity=0, step_time=0.05): """ Function for generating the times, azimuths, and velocities for a three_leg turnaround. This function generates a turnaround in three "legs": From 366f645be4291a61530a3b7836cc2855f62ae97f Mon Sep 17 00:00:00 2001 From: mjrand Date: Wed, 7 Jan 2026 21:59:02 +0000 Subject: [PATCH 2/5] Returned second_leg_time default values to None --- socs/agents/acu/turnarounds.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/socs/agents/acu/turnarounds.py b/socs/agents/acu/turnarounds.py index c045aac44..f0d1050a4 100644 --- a/socs/agents/acu/turnarounds.py +++ b/socs/agents/acu/turnarounds.py @@ -2,7 +2,7 @@ def gen_turnaround(turnaround_method, t0, az0, el0, v0, turntime, az_flag, el_flag, - point_group_batch, second_leg_time=0, second_leg_velocity=0, + point_group_batch, second_leg_time=None, second_leg_velocity=0, step_time=0.05): from .drivers import TrackPoint """ @@ -104,7 +104,7 @@ def _gen_standard_turnaround(v0, turntime, step_time=0.05): return ts, azs, vs -def _gen_three_leg_turnaround(v0, turntime, second_leg_time=0, second_leg_velocity=0, step_time=0.05): +def _gen_three_leg_turnaround(v0, turntime, second_leg_time=None, second_leg_velocity=0, step_time=0.05): """ Function for generating the times, azimuths, and velocities for a three_leg turnaround. This function generates a turnaround in three "legs": From bafb596b51ac9865934a10cd6e5e22fc0ecf8d8d Mon Sep 17 00:00:00 2001 From: mjrand Date: Wed, 14 Jan 2026 21:13:08 +0000 Subject: [PATCH 3/5] Fixed typos in docstrings --- socs/agents/acu/drivers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/socs/agents/acu/drivers.py b/socs/agents/acu/drivers.py index b3287031c..bd68dd9d9 100644 --- a/socs/agents/acu/drivers.py +++ b/socs/agents/acu/drivers.py @@ -352,7 +352,7 @@ def generate_constant_velocity_scan(az_endpoint1, az_endpoint2, az_speed, celestial sources in targeted scans. turnaround_method (str): The method used for generating turnaround. (Default) 'standard' generates the baseline minimal jerk trajectory. - 'standard_gen' genetares a list of track_points throughout the turnaround + 'standard_gen' generates a list of track_points throughout the turnaround to mimic the standard acu turnaround. 'three_leg' generates a three-leg turnaround which attempts to minimize the acceleration at the midpoint of the turnaround. @@ -589,7 +589,7 @@ def generate_type3_scan(az_endpoint1, az_endpoint2, az_speed, celestial sources in targeted scans. turnaround_method (str): The method used for generating turnaround. 'standard' is unusable with type3 scans! - 'standard_gen' genetares a list of track_points throughout the turnaround + 'standard_gen' generates a list of track_points throughout the turnaround to mimic the standard acu turnaround and is usable for type3 scans. 'three_leg' generates a three-leg turnaround which attempts to minimize the acceleration at the midpoint of the turnaround. @@ -852,7 +852,7 @@ def generate_type2_scan(az_endpoint1, az_endpoint2, az_speed, celestial sources in targeted scans. turnaround_method (str): The method used for generating turnaround. 'standard' is unusable with type2 scans! - 'standard_gen' genetares a list of track_points throughout the turnaround + 'standard_gen' generates a list of track_points throughout the turnaround to mimic the standard acu turnaround and is usable for type2 scans. 'three_leg' generates a three-leg turnaround which attempts to minimize the acceleration at the midpoint of the turnaround. From 399d81e26c4e30db55f856074087d9174a833d6f Mon Sep 17 00:00:00 2001 From: mjrand Date: Wed, 14 Jan 2026 22:43:34 +0000 Subject: [PATCH 4/5] Fixed typos --- socs/agents/acu/turnarounds.py | 1 + 1 file changed, 1 insertion(+) diff --git a/socs/agents/acu/turnarounds.py b/socs/agents/acu/turnarounds.py index f0d1050a4..fb60d97a3 100644 --- a/socs/agents/acu/turnarounds.py +++ b/socs/agents/acu/turnarounds.py @@ -18,6 +18,7 @@ def gen_turnaround(turnaround_method, t0, az0, el0, v0, turntime, az_flag, el_fl 2. "three_leg": Generates a special turnaround that splits the turnaround into three "legs" that attempt to minimize the acceleration at the midpoint of the turnaround. See the _gen_three_leg_turnaround() docstring for further documentation. + 3. "two_leg": Generates a "three_leg" turnaround with second_leg_time = 0. t0 (float): The initial time of the turnaround. az0 (float): The iniital azimuth position of the turnaround. Should be equal to the final azimuth position of the turnaround. el0 (float): The initial elevation of the turnaround. El velocity is forced to 0 here so this is only used for creating TrackPoints. From e6df8ea09a95210e8a5aecbee71a0996f88f0f72 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 14 Jan 2026 22:44:17 +0000 Subject: [PATCH 5/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- socs/agents/acu/turnarounds.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/socs/agents/acu/turnarounds.py b/socs/agents/acu/turnarounds.py index fb60d97a3..5b63baf77 100644 --- a/socs/agents/acu/turnarounds.py +++ b/socs/agents/acu/turnarounds.py @@ -18,7 +18,7 @@ def gen_turnaround(turnaround_method, t0, az0, el0, v0, turntime, az_flag, el_fl 2. "three_leg": Generates a special turnaround that splits the turnaround into three "legs" that attempt to minimize the acceleration at the midpoint of the turnaround. See the _gen_three_leg_turnaround() docstring for further documentation. - 3. "two_leg": Generates a "three_leg" turnaround with second_leg_time = 0. + 3. "two_leg": Generates a "three_leg" turnaround with second_leg_time = 0. t0 (float): The initial time of the turnaround. az0 (float): The iniital azimuth position of the turnaround. Should be equal to the final azimuth position of the turnaround. el0 (float): The initial elevation of the turnaround. El velocity is forced to 0 here so this is only used for creating TrackPoints.