suboptimumg.log_analysis.kinematics#

suboptimumg.log_analysis.kinematics.add_accelerations(data, vel_body_col='pcm.vnav.velocityBody.x')[source]#

Add lateral acceleration as v^2 * curvature in body and track frames and stores results in body.accLat and track.accLat, accessible via the constants BODY_LAT_ACC and TRACK_LAT_ACC.

Requires add_curvature and add_track_frame_velocities.

Parameters:
  • data (SingleRunData)

  • vel_body_col (str)

Return type:

SingleRunData

suboptimumg.log_analysis.kinematics.add_body_slip_angle(data, yaw_col='pcm.vnav.yawPitchRoll.yaw', vel_body_col='pcm.vnav.velocityBody.x', low_speed_thresh=3.0)[source]#

Add body slip angle (beta) using SAE convention: beta = track_heading - yaw and stores it in the variable body.slipAngle, accessible via the constant BODY_SLIP_ANGLE.

Zeroed below low_speed_thresh where course heading is unreliable. Requires add_track_frame_velocities.

Parameters:
  • low_speed_thresh (float) – Speed (m/s) below which slip angle is forced to zero.

  • data (SingleRunData)

  • yaw_col (str)

  • vel_body_col (str)

Return type:

SingleRunData

suboptimumg.log_analysis.kinematics.add_cumulative_distance(data)[source]#

Add cumulative arc-length distance to the data. Uses the same distance calculation as track_factory.from_perda_logs, to ensure consistency when comparing laps against a track generated from GPS data.

Stores the cumulative distance in the variable lapDist, accessible via the constant CUMULATIVE_DISTANCE.

Parameters:

data (SingleRunData) – Input data containing position information.

Return type:

SingleRunData

suboptimumg.log_analysis.kinematics.add_curvature(data, yaw_rate_col='pcm.vnav.compensatedAngularRate.z', vel_body_col='pcm.vnav.velocityBody.x', low_speed_thresh=3.0, median_window=8, radius_clip=500.0)[source]#

Add path curvature and radius in body and track frames and stores results in body.curvature, body.radius, track.curvature, and track.radius, accessible via the constants CURVATURE_BODY, RADIUS_BODY, CURVATURE_TRACK, and RADIUS_TRACK.

Body-frame curvature uses yaw rate / forward speed. Track-frame curvature differentiates the track heading. Both are smoothed with a rolling median. Requires add_track_frame_velocities.

Parameters:
  • low_speed_thresh (float) – Speed (m/s) below which curvature is forced to zero.

  • median_window (int) – Rolling median half-window for noise suppression.

  • radius_clip (float) – Maximum absolute radius (m) before clipping.

  • data (SingleRunData)

  • yaw_rate_col (str)

  • vel_body_col (str)

Return type:

SingleRunData

suboptimumg.log_analysis.kinematics.add_groundspeed(data, fl_col='pcm.wheelSpeeds.frontLeft', fr_col='pcm.wheelSpeeds.frontRight')[source]#

Add ground speed as the average of the two front (undriven) wheel speeds. Stores it in the variable groundSpeed, accessible via the constant GROUND_SPEED.

Requires the convert_wheelspeeds_to_m_per_s preprocessing step. Stores groundSpeed.

Parameters:
  • data (SingleRunData)

  • fl_col (str) – Column name for front left wheel speed in m/s.

  • fr_col (str) – Column name for front right wheel speed in m/s.

Return type:

SingleRunData

suboptimumg.log_analysis.kinematics.add_ned_velocities(data, vel_x_col='pcm.vnav.velocityBody.x', vel_y_col='pcm.vnav.velocityBody.y', vel_z_col='pcm.vnav.velocityBody.z', yaw_col='pcm.vnav.yawPitchRoll.yaw')[source]#
Add NED velocity components by using body-frame velocity (FRD) and yaw rotation.

velN = v_fwd * cos(yaw) - v_right * sin(yaw) velE = v_fwd * sin(yaw) + v_right * cos(yaw) velD = v_down (unchanged)

Stores results in velN, velE, and velD, accessible via the constants VEL_N, VEL_E, and VEL_D.

Parameters:
  • data (SingleRunData) – Input data containing position information.

  • vel_x_col (str)

  • vel_y_col (str)

  • vel_z_col (str)

  • yaw_col (str)

Return type:

SingleRunData

Notes

In older data, the VectorNav was configured such that velocityBody columns contained NED velocities. Such data can be patched with the patch_ned_velocity preprocessing step from PERDA. In that case, this function is unnecessary and roughly a no-op. This function intentionally follows PERDA’s naming convention of velN, velE, and velD for NED velocity components.

suboptimumg.log_analysis.kinematics.add_track_frame_velocities(data, vel_n_col='velN', vel_e_col='velE', yaw_col='pcm.vnav.yawPitchRoll.yaw', low_speed_thresh=3.0)[source]#

Add track-frame speed and course heading from NED velocity components.

Track heading uses the direction of travel (0 = North, 90 = East, wraps +/-180°). Below low_speed_thresh heading falls back to INS yaw to avoid noise.

Stores results in track.velocity.x, track.velocity.y, and track.heading, accesible via the constants TRACK_VELOCITY_X, TRACK_VELOCITY_Y, and TRACK_HEADING.

Parameters:
  • low_speed_thresh (float) – Speed (m/s) below which heading is replaced with INS yaw.

  • data (SingleRunData)

  • vel_n_col (str)

  • vel_e_col (str)

  • yaw_col (str)

Return type:

SingleRunData