I am trying to add covariances to
org.orekit.estimation.measurements.PV for sigmaPosition and sigmaPosition. however the PV input are in ECI and my measurements are in the ECEF. I am converting them to ECEF but I would also need to convert the Sigma that was measured in ECEF to ECI for the input.
Hi,
you can use CartesianCovarianceUtils.changeReferenceFrame to convert your ECI covariance into ECEF.
Cheers,
Romain.
1 Like
hey I figured that. however I am still bit confused that. I have measurments like [float(sigma_posX), float(sigma_posY), float(sigma_posZ)] measured in ECEF. so in that I should make a 6x6 covariance matrix with only diagonal elements of pos and vel sigmas. then convert that to 6x6 cov matrix in ECI. and extract the diagonal elements. however when I feed the whole 6x6 in org.orekit.estimation.measurements.PV class bls never converges. but I swap out that with a static value of sigma or extract the diagonal elements of 6x6 cov matrix after conversion it works. do you know what could be the case?
here is the code that does that
tmp_p = Vector3D(p)
tmp_v = Vector3D(v)
tmp_pvc = PVCoordinates(tmp_p, tmp_v)
PV_transform = ecef.getTransformTo(gcrf,datetime_to_absolutedate(timestamp))
PV_eci=PV_transform.transformPVCoordinates(tmp_pvc)
squared_numbers_vel = [x ** 2 for x in p_dev]
squared_numbers_pos = [x ** 2 for x in v_dev]
covariance_matrix = np.zeros((6, 6))
# Fill diagonal entries
covariance_matrix[0:3, 0:3] = np.diag(squared_numbers_pos)
covariance_matrix[3:6, 3:6] = np.diag(squared_numbers_vel)
from org.orekit.utils import CartesianCovarianceUtils
from org.hipparchus.linear import Array2DRowRealMatrix
from orekit import JArray_double
num_params = len(covariance_matrix)
covariance_matrix_java2 = Array2DRowRealMatrix(num_params, num_params)
for row in range(num_params):
for col in range(num_params):
covariance_matrix_java2.setEntry(row, col, float(covariance_matrix[row][col]))
xyz = CartesianCovarianceUtils.changeReferenceFrame(ecef, covariance_matrix_java2, datetime_to_absolutedate(train_time[0]), eci)
x = JArray_double.cast_(xyz.getData()[0])