@@ -728,7 +728,7 @@ def event_max_drop(t: float, s: Any) -> np.floating: # Stop when y crosses down
728728 def event_min_velocity (t : float , s : Any ) -> np .floating : # Stop when velocity < _cMinimumVelocity
729729 v = np .linalg .norm (s [3 :6 ])
730730 return v - _cMinimumVelocity
731- #TODO: Either don't add this event, or always return 0 if _cMinimumVelocity<= 0.
731+ #TODO: If _cMinimumVelocity<=0 then: either don't add this event, or always return 0.
732732 traj_events : List [SciPyEvent ] = [event_max_range , event_max_drop , event_min_velocity ]
733733
734734 slant_sine = math .sin (props .look_angle_rad )
@@ -781,14 +781,14 @@ def make_row(t: float, state: np.ndarray, flag: Union[TrajFlag, int]) -> Traject
781781 """Helper function to create a TrajectoryData row."""
782782 position = Vector (* state [0 :3 ])
783783 velocity = Vector (* state [3 :6 ])
784- density_ratio , mach = props .get_density_and_mach_for_altitude (position [1 ])
784+ _ , mach = props .get_density_and_mach_for_altitude (position [1 ])
785785 return TrajectoryData .from_props (props , t , position , velocity , mach , flag )
786786
787787 if sol .t [- 1 ] == 0 :
788788 # If the last time is 0, we only have the initial state
789789 ranges .append (make_row (sol .t [0 ], sol .y [:, 0 ], TrajFlag .RANGE ))
790790 else :
791- # List of distances at which we want to record the trajectory data
791+ # List of distances at which we want to record the trajectory data, based on range_step
792792 desired_xs = np .arange (0 , range_limit_ft + range_step_ft , range_step_ft )
793793 # Get x and t arrays from the solution
794794 x_vals = sol .y [0 ]
@@ -838,7 +838,7 @@ def x_minus_target(t): # Function for root finding: x(t) - x_target
838838 states_at_x .append (sol .y [:, - 1 ]) # Last state at the end of integration
839839
840840 states_at_x_arr_t : np .ndarray [Any , np .dtype [np .float64 ]] = np .array (states_at_x ,
841- dtype = np .float64 ).T # shape: (state_dim, num_points)
841+ dtype = np .float64 ).T # shape: (state_dim, num_points)
842842 for i in range (states_at_x_arr_t .shape [1 ]):
843843 ranges .append (make_row (t_at_x [i ], states_at_x_arr_t [:, i ], TrajFlag .RANGE ))
844844 ranges .sort (key = lambda t : t .time ) # Sort by time
@@ -849,6 +849,7 @@ def x_minus_target(t): # Function for root finding: x(t) - x_target
849849 while ranges [next_record ].time - time_of_last_record > time_step + self .SEPARATE_ROW_TIME_DELTA :
850850 time_of_last_record += time_step
851851 ranges .append (make_row (time_of_last_record , sol .sol (time_of_last_record ), TrajFlag .RANGE ))
852+ time_of_last_record = ranges [next_record ].time
852853 ranges .sort (key = lambda t : t .time ) # Sort by time
853854
854855 # region Find TrajectoryData points requested by filter_flags
0 commit comments