Good Morning,
I am receiving undefined as the return value when executing the following code:
const processPoint = (
stkOutput,
trimmedLine,
tmpArr,
utcDt,
ptInx,
positionsOverTime,
enableECF
) => {
const offset = parseFloat(tmpArr[0]);
const x = parseFloat(tmpArr[1]);
const y = parseFloat(tmpArr[2]);
const z = parseFloat(tmpArr[3]);
const positionInECI = Cartesian3.fromElements(x, y, z);
const julianDate = JulianDate.fromDate(Moment.utc(utcDt).toDate());
const dtOffset = JulianDate.addSeconds(julianDate, offset, new JulianDate());
if (enableECF) {
// Compute the transformation matrix from the ICRF to the ECEF frame at the given time.
// This accounts for gmst.
const fixedFrameTransform = Transforms.computeIcrfToFixedMatrix(dtOffset);
//HERE is always undefined
Where dtOffset is
dtOffset: JulianDate
dayNumber: 2460215
secondsOfDay: 21818
// Wed Sep 27 2023 14:03:00 GMT-0400 (Eastern Daylight Time)
Lastly, after checking the chrome debugger, I am sure I am loading the IAU2006_XYS_18.js file.
I was wondering if someone here might see my mistake or suggest debugging methods?
Additional debugging:
function findSuccessfulMatrix(startJulianDate, numDays) {
// Get the day and seconds of day for the start Julian date
const startDay = startJulianDate.dayNumber;
const startSec = startJulianDate.secondsOfDay;
// Loop over the specified number of days
for (let i = 0; i <= numDays; i++) {
// Compute the current day and seconds of day
const currentDay = startDay + i;
const currentSec = startSec;
// Get the Julian date for the current day and seconds of day
const currentDate = getJulianDate(currentDay, currentSec);
// Compute the ICRF to Fixed matrix for the current date
const currentFixedFrameTransform = Transforms.computeIcrfToFixedMatrix(
currentDate
);
// Check if the ICRF to Fixed matrix is defined
if (currentFixedFrameTransform) {
debugDtOffset('First successful transform at: ', currentDate);
return;
}
}
console.log('No successful transform found in the specified number of days.');
}
To display text output:
function debugDtOffset(msg, cesiumJulianDate) {
// Convert the Cesium JulianDate to a JavaScript Date object
const gregorianDate = JulianDate.toDate(cesiumJulianDate);
// eslint-disable-next-line no-console
console.log(`${msg} ${gregorianDate}`);
return gregorianDate;
}
Called like:
findSuccessfulMatrix(dtOffset, 365);
where dtOffset is as above:
JulianDate:
dayNumber: 2460215
secondsOfDay: 21817
First successful transform at: Sun Mar 31 2024 14:03:37 GMT-0400 (Eastern Daylight Time)
My input file contains dates starting at:
Wed Sep 27 2023 14:03:00 GMT-0400 (Eastern Daylight Time)
Could I be missing some other IAU200? file?
Last addition.
const dummyOne = getJulianDate(2460405, 46837);
const dummyOneFixedFrameTransform = Transforms.computeIcrfToFixedMatrix(
dummyOne
);
const dummyTwo = getJulianDate(2460215, 21817);
const dummyTwoFixedFrameTransform = Transforms.computeIcrfToFixedMatrix(
dummyTwo
);
dummyOne works, while dummyTwo is undefined.
Thanks again.
sg