Need fixed trajectory with turning Earth

Using the satellite-js Simple General Perturbations (SGP) model, this demo propagates orbital debris from Irridium 33.
http://daoneil.github.io/spacemission/Apps/Cesium_with_SGP.html

The problem is the trajectories of the orbital debris are moving with the rotation of the Earth.

If you set the time-widget multiplier to zero, you can see how the how the debris ought to orbit the Earth.

This code snippet instantiates an array of points with the FIXED reference frame. I have also tried INERTIAL but it does not make a difference.

var thing = ;

for (debrisID = 0; debrisID < irridiumDebris.length; debrisID++) {

thing[debrisID] = viewer.entities.add({

position : { value : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883) ,

        referenceFrame : Cesium.ReferenceFrame.FIXED

},

point : {

color : Cesium.Color.YELLOW,

pixelSize : 6

}

});

}// next debrisID

``

This code snippet puts the camera into the ICRF so the Earth rotates.
function icrf(scene, time) {

if (scene.mode !== Cesium.SceneMode.SCENE3D) { // may not be necessary

return;

}

var icrfToFixed = Cesium.Transforms.computeIcrfToFixedMatrix(time);

if (Cesium.defined(icrfToFixed)) {

var offset = Cesium.Cartesian3.clone(camera.position);

var transform = Cesium.Matrix4.fromRotationTranslation(icrfToFixed);

camera.lookAtTransform(transform, offset);

}

};

clock.multiplier = 2000 ; // speed of the simulation

scene.preRender.addEventListener(icrf); // enable Earth rotation

``

After propagating the orbits, this code snippet updates the positions of the entities in the thing array.

I tried scene.preRender.removeEventListener(icrf) before this snippet and adding the event listener after the loop but that did not work.

var km = 1000 ;

var debrisPos = new Cesium.Cartesian3(0,0,0) ;

for (i=0; i < datasetSize; i++) {

if (posVel[i] != undefined) {

debrisPos.x = posVel[i].position.x * km;

debrisPos.y = posVel[i].position.y * km ;

debrisPos.z = posVel[i].position.z * km;

thing[i].position = debrisPos ;

} //endif

}//next i

``

The source code is located in this GitHub repository, https://github.com/daoneil/spacemission, the file is named Cesium_with_SGP.html.

How can I get the Earth to rotate without having the points rotate with the Earth?

Dan,
with regards to your entities being treated as FIXED vs INERTIAL referenced ones, first, it looks like your snippet
Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883)

``

is missing a height, so I’m not sure what you want Cesium to “guess” for the height there.

Second, defining a Cartesian3 using the .fromDegrees(lon.lat,height) will return a Cartesian representation of that Cartographic location in FIXED, but if you don’t specify a time then it’s a little hard to ensure that the INERTIAL representation is located where you want it. Any time you move from INERTIAL to FIXED (or vice-versa) you kinda need to know the time (or specify it explicitly), otherwise it’s ambiguous.

That said, assuming that {somehow} Cesium returns you the right Cartesian3 [x,y,z] that you want to be treated as the position in an INERTIAL frame, you need to change your code to form the position of the about-to-be-added entity BEFORE you set it in the .add call, like this:

var thing = ;
for (debrisID = 0; debrisID < irridiumDebris.length; debrisID++) {
var pos = new Cesium.ConstantPositionProperty(Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883,0.0), Cesium.ReferenceFrame.INERTIAL);
//this defines the right kind of object that you will pass in the .add {position} property below.

thing[debrisID] = viewer.entities.add({
position : pos, // now the newly added debris piece has it’s location specified in INERTIAL
point : {
color : Cesium.Color.YELLOW,
pixelSize : 6
}
});
}// next debrisID

``

That should get you going with your entities’ positions being defined in INERTIAL, rather than the default FIXED.

The rest of the questions you look to have gotten help from Hannah elsewhere, and reported that you successfully got the camera to be locked to INERTIAL.

Cheers,

-f