suboptimumg.loganalysis.derived#
Derived quantities computed from raw log data.
- suboptimumg.loganalysis.derived.compute_accelerations(df, vel_body='pcm.vnav.velocityBody.x', curvature_body='body.curvature', vel_track='track.velocity.x', curvature_track='track.curvature', out_body='body.accLat', out_track='track.accLat')[source]#
Compute lateral acceleration from v^2 * curvature.
Computes both body and track frames by default. All column name arguments have defaults matching upstream function outputs.
- Parameters:
df (DataFrame)
vel_body (str)
curvature_body (str)
vel_track (str)
curvature_track (str)
out_body (str)
out_track (str)
- Return type:
DataFrame
- suboptimumg.loganalysis.derived.compute_bicycle_steer_angle(df, irl_car, sw_col='ludwig.steeringWheel.angle', out_left='front.steerAngle.left', out_right='front.steerAngle.right', out_avg='front.steerAngle.bicycle')[source]#
Compute front tire steer angles from the steering wheel sensor.
Uses the Ackermann polynomial fit in irl_car to convert the steering wheel angle to individual left/right tire angles, then averages them for the bicycle-model front axle steer angle.
All outputs are in degrees.
- Parameters:
df (pd.DataFrame)
irl_car (IrlCar)
sw_col (str)
out_left (str)
out_right (str)
out_avg (str)
- Return type:
pd.DataFrame
- suboptimumg.loganalysis.derived.compute_body_slip_angle(df, track_heading_col='track.heading', yaw_col='pcm.vnav.yawPitchRoll.yaw', vel_body_col='pcm.vnav.velocityBody.x', low_speed_thresh=3.0, out_col='body.slipAngle')[source]#
Compute body slip angle (beta) from track heading and INS yaw.
Standard SAE sideslip: beta = track_heading - yaw, wrapped to +/-180. Positive beta = velocity vector to the right of the nose. Zeroed below low_speed_thresh where heading is unreliable.
- Parameters:
df (DataFrame)
track_heading_col (str)
yaw_col (str)
vel_body_col (str)
low_speed_thresh (float)
out_col (str)
- Return type:
DataFrame
- suboptimumg.loganalysis.derived.compute_cda(df, irl_car, vel_col='groundSpeed', time_col='time_s', rho=1.225, low_speed_thresh=5.0, out_col='aero.cda')[source]#
Estimate CDA from coastdown deceleration (free-rolling assumption).
F_drag = -m * a_x - F_rollingthenCDA = F_drag / (0.5 * rho * v^2)The user should trim the DataFrame to a coasting segment (no throttle, no braking) before calling this, or filter the output to regions where throttle and brake are zero.
- Parameters:
df (DataFrame) – Must contain a velocity column and time index.
irl_car (IrlCar) – Provides mass, frontal area, and rolling resistance coefficient.
vel_col (str) – Velocity source (m/s).
rho (float) – Air density in kg/m^3.
low_speed_thresh (float) – Below this speed (m/s) CDA is zeroed.
out_col (str) – Output column name.
time_col (str)
- Return type:
pd.DataFrame
- suboptimumg.loganalysis.derived.compute_cla(df, irl_car, ref_time_range, vel_col='groundSpeed', pot_fl='ludwig.shockpot.frontLeft', pot_fr='ludwig.shockpot.frontRight', pot_rl='ludwig.shockpot.rearLeft', pot_rr='ludwig.shockpot.rearRight', ax_col='pcm.vnav.linearAccelBody.x', rho=1.225, low_speed_thresh=5.0, out_cla='aero.cla', out_cop='aero.cop')[source]#
Estimate CLA and aero CoP from shock pot compression.
A reference time range defines the “zero-aero” baseline (e.g. car sitting still). At each timestep, the change in average axle pot compression is converted to vertical force via the
IrlCarsuspension math, and the aero contribution is isolated by subtracting longitudinal weight transfer through the springs.- Parameters:
df (DataFrame) – Must contain shock pot columns, a velocity column, and a longitudinal acceleration column.
irl_car (IrlCar) – Provides mass, frontal area, heave stiffness, motion ratios, and anti-dive/squat percentages.
ref_time_range ((t_start, t_end)) – Index (
time_s) window where the car is stationary or at a known-zero-aero condition.vel_col (str) – Velocity source for dynamic pressure.
rho (float) – Air density in kg/m^3.
low_speed_thresh (float) – Below this speed (m/s) CLA and CoP are zeroed.
out_cla (str) – Output column names.
out_cop (str) – Output column names.
pot_fl (str)
pot_fr (str)
pot_rl (str)
pot_rr (str)
ax_col (str)
- Return type:
pd.DataFrame
- suboptimumg.loganalysis.derived.compute_curvature(df, yaw_rate_col='pcm.vnav.compensatedAngularRate.z', vel_body_col='pcm.vnav.velocityBody.x', track_heading_col='track.heading', vel_track_col='track.velocity.x', time_col='time_s', low_speed_thresh=3.0, median_window=8, radius_clip=500.0, out_body_curv='body.curvature', out_body_radius='body.radius', out_track_curv='track.curvature', out_track_radius='track.radius')[source]#
Compute path curvature and radius in body and track frames.
Body frame uses the measured yaw rate directly. Track frame differentiates the track heading. Both apply a rolling median and radius clipping.
- Parameters:
df (DataFrame)
yaw_rate_col (str)
vel_body_col (str)
track_heading_col (str)
vel_track_col (str)
time_col (str)
low_speed_thresh (float)
median_window (int)
radius_clip (float)
out_body_curv (str)
out_body_radius (str)
out_track_curv (str)
out_track_radius (str)
- Return type:
DataFrame
- suboptimumg.loganalysis.derived.compute_groundspeed(df, fl_col='pcm.wheelSpeeds.frontLeft', fr_col='pcm.wheelSpeeds.frontRight', out_col='groundSpeed')[source]#
Average front wheel speeds to estimate ground speed.
Uses undriven (front) wheels to avoid slip contamination from the driven (rear) axle.
- Parameters:
df (DataFrame)
fl_col (str)
fr_col (str)
out_col (str)
- Return type:
DataFrame
- suboptimumg.loganalysis.derived.compute_kinematic_steer_angle(df, curvature_body='body.curvature', curvature_track='track.curvature', wheelbase=None, car_yaml='parameters/car.yaml', out_body='body.steerAngle', out_track='track.steerAngle')[source]#
Compute kinematic steer angle from curvature (bicycle model).
delta = atan(wheelbase * curvature)in degrees. Wheelbase is auto-loaded from car.yaml if not specified.- Parameters:
df (DataFrame)
curvature_body (str)
curvature_track (str)
wheelbase (float | None)
car_yaml (str)
out_body (str)
out_track (str)
- Return type:
DataFrame
- suboptimumg.loganalysis.derived.compute_rear_slip_ratio(df, wheel_speed_col='pcm.moc.motor.wheelSpeed', ground_speed_col='groundSpeed', out_col='rear.slipRatio', low_speed_thresh=1.0)[source]#
Compute rear axle longitudinal slip ratio.
slip = (v_wheel - v_ground) / v_groundPositive = driven wheels spinning faster (traction loss). Zeroed below low_speed_thresh to avoid division blow-up.
- Parameters:
df (DataFrame)
wheel_speed_col (str)
ground_speed_col (str)
out_col (str)
low_speed_thresh (float)
- Return type:
DataFrame
- suboptimumg.loganalysis.derived.compute_track_frame_velocities(df, vel_n_col='velN', vel_e_col='velE', yaw_col='pcm.vnav.yawPitchRoll.yaw', low_speed_thresh=3.0, out_vx='track.velocity.x', out_vy='track.velocity.y', out_heading='track.heading')[source]#
Compute track-frame (velocity-frame) velocities from NED components.
Track heading is the course angle (direction of travel), same convention as yaw (0 = North, 90 = East, wraps at +/-180). At low speed the heading falls back to INS yaw.
- Parameters:
df (DataFrame)
vel_n_col (str)
vel_e_col (str)
yaw_col (str)
low_speed_thresh (float)
out_vx (str)
out_vy (str)
out_heading (str)
- Return type:
DataFrame