@ -52,14 +52,14 @@ class ParamsLearner:
device_pose = Pose . from_live_pose ( msg )
device_pose = Pose . from_live_pose ( msg )
calibrated_pose = self . calibrator . build_calibrated_pose ( device_pose )
calibrated_pose = self . calibrator . build_calibrated_pose ( device_pose )
yaw_rate_valid = msg . angularVelocityDevice . valid and self . calibrator . calib_valid
yaw_rate_valid = msg . angularVelocityDevice . valid
yaw_rate_valid = yaw_rate_valid and 0 < self . yaw_rate_std < 10 # rad/s
yaw_rate_valid = yaw_rate_valid and 0 < self . yaw_rate_std < 10 # rad/s
yaw_rate_valid = yaw_rate_valid and abs ( self . yaw_rate ) < 1 # rad/s
yaw_rate_valid = yaw_rate_valid and abs ( self . yaw_rate ) < 1 # rad/s
if yaw_rate_valid :
if yaw_rate_valid :
self . yaw_rate , self . yaw_rate_std = calibrated_pose . angular_velocity . z , calibrated_pose . angular_velocity . z_std
self . yaw_rate , self . yaw_rate_std = calibrated_pose . angular_velocity . z , calibrated_pose . angular_velocity . z_std
else :
else :
# This is done to bound the yaw rate estimate when localizer values are invalid or calibrating
# This is done to bound the yaw rate estimate when localizer values are invalid or calibrating
self . yaw_rate , self . yaw_rate_std = 0.0 , np . radians ( 1 )
self . yaw_rate , self . yaw_rate_std = 0.0 , np . radians ( 10.0 )
localizer_roll , localizer_roll_std = device_pose . orientation . x , device_pose . orientation . x_std
localizer_roll , localizer_roll_std = device_pose . orientation . x , device_pose . orientation . x_std
localizer_roll_std = np . radians ( 1 ) if np . isnan ( localizer_roll_std ) else localizer_roll_std
localizer_roll_std = np . radians ( 1 ) if np . isnan ( localizer_roll_std ) else localizer_roll_std
@ -225,13 +225,13 @@ def main():
liveParameters . posenetValid = True
liveParameters . posenetValid = True
liveParameters . sensorValid = sensors_valid
liveParameters . sensorValid = sensors_valid
liveParameters . steerRatio = float ( x [ States . STEER_RATIO ] . item ( ) )
liveParameters . steerRatio = float ( x [ States . STEER_RATIO ] . item ( ) )
liveParameters . steerRatioValid = min_sr < = liveParameters . steerRatio < = max_sr
liveParameters . stiffnessFactor = float ( x [ States . STIFFNESS ] . item ( ) )
liveParameters . stiffnessFactor = float ( x [ States . STIFFNESS ] . item ( ) )
liveParameters . stiffnessFactorValid = 0.2 < = liveParameters . stiffnessFactor < = 5.0
liveParameters . roll = float ( roll )
liveParameters . roll = float ( roll )
liveParameters . angleOffsetAverageDeg = float ( angle_offset_average )
liveParameters . angleOffsetAverageDeg = float ( angle_offset_average )
liveParameters . angleOffsetAverageValid = bool ( avg_offset_valid )
liveParameters . angleOffsetDeg = float ( angle_offset )
liveParameters . angleOffsetDeg = float ( angle_offset )
liveParameters . steerRatioValid = min_sr < = liveParameters . steerRatio < = max_sr
liveParameters . stiffnessFactorValid = 0.2 < = liveParameters . stiffnessFactor < = 5.0
liveParameters . angleOffsetAverageValid = bool ( avg_offset_valid )
liveParameters . angleOffsetValid = bool ( total_offset_valid )
liveParameters . angleOffsetValid = bool ( total_offset_valid )
liveParameters . valid = all ( (
liveParameters . valid = all ( (
liveParameters . angleOffsetAverageValid ,
liveParameters . angleOffsetAverageValid ,