preloadIcrfFixed() does not appear to work

I am attempting to convert some INERTIAL position data to a Fixed reference frame. I have seen several similar questions, and tried to follow the examples, but to no avail.

Here is the code I am running:

// Establish time end points
var dateToCheck = Cesium.JulianDate.fromIso8601(‘2001-03-21T12:00:00Z’);
var date2 = new Cesium.JulianDate();
Cesium.JulianDate.addDays(dateToCheck, 1.0, date2);

// create time interval for
var timeInterval = new Cesium.TimeInterval({
start : dateToCheck,
stop : date2,
isStartTimeIncluded : true,
isStopTimeIncluded : false
});

console.log(timeInterval); // make sure we have a valid time interval

// preload transformation data
var promise = Cesium.Transforms.preloadIcrfFixed(timeInterval);
Cesium.when(promise, console.log(“finished”));

// try a sample conversion
var pointInFixed = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
var fixedToIcrf = Cesium.Transforms.computeIcrfToFixedMatrix(dateToCheck);
var pointInInertial = new Cesium.Cartesian3();
if (Cesium.defined(fixedToIcrf)) {
pointInInertial = Cesium.Matrix3.multiplyByVector(fixedToIcrf, pointInFixed, pointInInertial);
}
console.log(“fixed =”);
console.log(fixedToIcrf); // always prints “undefined”

``

I’ve tried different date/time ranges, but nothing works. Is there a way to check why the preloadIcrfFixed() function seems to be failing?`

Thanks,
Larry
`

Hello Larry,

You need to wait for the Transofmr.preloadIcrfFixed promise to resolve before making calls to get the matrix transform.

Here is a code sample:

var promise = Cesium.Transforms.preloadIcrfFixed(timeInterval);
promise.then(function() {
var pointInFixed = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
var fixedToIcrf = Cesium.Transforms.computeIcrfToFixedMatrix(dateToCheck);
var pointInInertial = new Cesium.Cartesian3();
if (Cesium.defined(fixedToIcrf)) {
pointInInertial = Cesium.Matrix3.multiplyByVector(fixedToIcrf, pointInFixed, pointInInertial);
}
});

``

Best,

Hannah

Great, that worked!

Thanks!
Larry