Cleanup locationd msg building (#1972)

* cleanup locationd msg building

* remove that
pull/1973/head
Adeeb Shihadeh 5 years ago committed by GitHub
parent 629898eb93
commit 1208ac424d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 66
      selfdrive/locationd/locationd.py

@ -113,47 +113,31 @@ class Localizer():
#ned_vel_std = self.converter.ecef2ned(fix_ecef + vel_ecef + vel_ecef_std) - self.converter.ecef2ned(fix_ecef + vel_ecef) #ned_vel_std = self.converter.ecef2ned(fix_ecef + vel_ecef + vel_ecef_std) - self.converter.ecef2ned(fix_ecef + vel_ecef)
fix = messaging.log.LiveLocationKalman.new_message() fix = messaging.log.LiveLocationKalman.new_message()
fix.positionGeodetic.value = to_float(fix_pos_geo)
fix.positionGeodetic.std = to_float(np.nan*np.zeros(3)) # write measurements to msg
fix.positionGeodetic.valid = True measurements = [
fix.positionECEF.value = to_float(fix_ecef) # measurement field, value, std, valid
fix.positionECEF.std = to_float(fix_ecef_std) (fix.positionGeodetic, fix_pos_geo, np.nan*np.zeros(3), True),
fix.positionECEF.valid = True (fix.positionECEF, fix_ecef, fix_ecef_std, True),
fix.velocityECEF.value = to_float(vel_ecef) (fix.velocityECEF, vel_ecef, vel_ecef_std, True),
fix.velocityECEF.std = to_float(vel_ecef_std) (fix.velocityNED, ned_vel, np.nan*np.zeros(3), True),
fix.velocityECEF.valid = True (fix.velocityDevice, vel_device, vel_device_std, True),
fix.velocityNED.value = to_float(ned_vel) (fix.accelerationDevice, predicted_state[States.ACCELERATION], predicted_std[States.ACCELERATION_ERR], True),
fix.velocityNED.std = to_float(np.nan*np.zeros(3)) (fix.orientationECEF, orientation_ecef, orientation_ecef_std, True),
fix.velocityNED.valid = True (fix.calibratedOrientationECEF, calibrated_orientation_ecef, np.nan*np.zeros(3), True),
fix.velocityDevice.value = to_float(vel_device) (fix.orientationNED, orientation_ned, np.nan*np.zeros(3), True),
fix.velocityDevice.std = to_float(vel_device_std) (fix.angularVelocityDevice, predicted_state[States.ANGULAR_VELOCITY], predicted_std[States.ANGULAR_VELOCITY_ERR], True),
fix.velocityDevice.valid = True (fix.velocityCalibrated, vel_calib, vel_calib_std, True),
fix.accelerationDevice.value = to_float(predicted_state[States.ACCELERATION]) (fix.angularVelocityCalibrated, ang_vel_calib, ang_vel_calib_std, True),
fix.accelerationDevice.std = to_float(predicted_std[States.ACCELERATION_ERR]) (fix.accelerationCalibrated, acc_calib, acc_calib_std, True),
fix.accelerationDevice.valid = True ]
fix.orientationECEF.value = to_float(orientation_ecef) for field, value, std, valid in measurements:
fix.orientationECEF.std = to_float(orientation_ecef_std) # TODO: can we write the lists faster?
fix.orientationECEF.valid = True field.value = to_float(value)
fix.calibratedOrientationECEF.value = to_float(calibrated_orientation_ecef) field.std = to_float(std)
fix.calibratedOrientationECEF.std = to_float(np.nan*np.zeros(3)) field.valid = valid
fix.calibratedOrientationECEF.valid = True
fix.orientationNED.value = to_float(orientation_ned)
fix.orientationNED.std = to_float(np.nan*np.zeros(3))
fix.orientationNED.valid = True
fix.angularVelocityDevice.value = to_float(predicted_state[States.ANGULAR_VELOCITY])
fix.angularVelocityDevice.std = to_float(predicted_std[States.ANGULAR_VELOCITY_ERR])
fix.angularVelocityDevice.valid = True
fix.velocityCalibrated.value = to_float(vel_calib)
fix.velocityCalibrated.std = to_float(vel_calib_std)
fix.velocityCalibrated.valid = True
fix.angularVelocityCalibrated.value = to_float(ang_vel_calib)
fix.angularVelocityCalibrated.std = to_float(ang_vel_calib_std)
fix.angularVelocityCalibrated.valid = True
fix.accelerationCalibrated.value = to_float(acc_calib)
fix.accelerationCalibrated.std = to_float(acc_calib_std)
fix.accelerationCalibrated.valid = True
return fix return fix
def liveLocationMsg(self): def liveLocationMsg(self):

Loading…
Cancel
Save