I’m still having trouble trying to get a smooth animation of my satellite in Cesium. Some direction would be appreciated. I did contact AGI since we pay for the support and upgrades on our licenses but I guess they don’t do support for Cesium but they suggested I messed with the forwardExtrapolation but that doesn’t seem to work either. *I can’t seem to highlight the CZML packet code syntax - sorry.
I’m streaming CZML packets to Cesium that I collect from STK when (STK) animation is also running. Since the multiplier is not really one-to-one with Cesium’s multiplier and I don’t want to sit there forever at a multiplier of x1, I increase the multiplier on STK and in the CZML packet, I obtain the current time from STK and send it across via in the CZML packet with other data such as position and quaternions.
As you can see from the video attachment, time is updating kind of okay I guess, but the satellite in question has some jerky motion that is driving me nuts. I tried various interpolation algorithms and degrees, set the current time a little bit in the future and less for the position and quaternion data but to no avail, still jerky. I’m also using Gabby’s suggestion code here and my CZML packet data is also listed below. Let me know if you all see something wrong/stupid that I did and let me know if you have questions or more code. Thank you!
var clock = viewer.clock;
var lastUpdated = clock.currentTime;
clock.onTick.addEventListener(function() {
var dt = Cesium.JulianDate.secondsDifference(clock.currentTime, lastUpdated);
if (dt >= 1.0) {
// Add a new sample position
lastUpdated = clock.currentTime;
}
});
///////////////////////////////////////////////////////////////
// FIRST CZML PACKET GENERATION
///////////////////////////////////////////////////////////////
public static void CZML_Packet_1()
{
RootObject1 JsonRoot1 = new RootObject1();
JsonRoot1.id = “document”;
JsonRoot1.name = “CesiumTest”;
JsonRoot1.version = “1.0”;
Clock JsonClock = new Clock();
JsonClock.interval = “2018-08-30T18:00:00Z/2018-09-06T18:00:00Z”;
string startInterval = “2018-08-30T18:00:00Z”;
JsonClock.currentTime = currentSTKtime;
JsonClock.multiplier = 3.2;
JsonClock.range = “LOOP_STOP”;
JsonClock.step = “SYSTEM_CLOCK_MULTIPLIER”;
JsonRoot1.clock = JsonClock;
CZML_JSON_1 = JsonConvert.SerializeObject(JsonRoot1);
///////////////////////////////////////////////////////////////
}
///////////////////////////////////////////////////////////////
// SECOND CZML PACKET GENERATION
///////////////////////////////////////////////////////////////
public static void CZML_Packet_2()
{
// SECOND CZML PACKET
RootObject JsonRoot = new RootObject();
JsonRoot.id = “Satellite/ButtSat”;
JsonRoot.availability = “2018-08-30T18:00:00Z/2018-09-06T18:00:00Z”;
JsonRoot.name = “ButtSat”;
Orientation JsonOrientation = new Orientation();
JsonOrientation.interpolationAlgorithm = “HERMITE”;
JsonOrientation.interpolationDegree = 2;
JsonOrientation.extrapolationType = "HOLD ";
JsonOrientation.forwardExtrapolationType = “HOLD”;
JsonOrientation.forwardExtrapolationDuration = 0;
JsonOrientation.backwardExtrapolationDuration = 0;
JsonOrientation.backwardExtrapolationType = “HOLD”;
string startInterval = “2018-08-30T18:00:00Z”;
JsonOrientation.epoch = startInterval;
// SECOND CZML PACKET WITH QUATERNION DATA
if (FlagStop2 == 0)
{
dbQuat.Add(secSincEpoch);
dbQuat.Add(ATD_QEST_CBI2BDY0);
dbQuat.Add(ATD_QEST_CBI2BDY1);
dbQuat.Add(ATD_QEST_CBI2BDY2);
dbQuat.Add(ATD_QEST_CBI2BDY3);
//Console.WriteLine(flagCZMLquat);
FlagStop2 = 1;
}
JsonOrientation.unitQuaternion = dbQuat;
JsonRoot.orientation = JsonOrientation;
// SECOND CZML PACKET WITH POSITION DATA
Position JsonPosition = new Position();
JsonPosition.interpolationAlgorithm = “LAGRANGE”;
JsonPosition.interpolationDegree = 7;
JsonPosition.forwardExtrapolationDuration = 0;
JsonPosition.extrapolationType = “HOLD”;
JsonPosition.referenceFrame = “FIXED”;
JsonPosition.forwardExtrapolationType = “HOLD”;
JsonPosition.backwardExtrapolationDuration = 0;
JsonPosition.backwardExtrapolationType = “HOLD”;
JsonPosition.epoch = startInterval;
if (FlagStop3 == 0)
{
dbPos.Add(secSincEpoch);
dbPos.Add(EPH_POS_CBIX);
dbPos.Add(EPH_POS_CBIY);
dbPos.Add(EPH_POS_CBIZ);
FlagStop3 = 1;
}
JsonPosition.cartesian = dbPos;
JsonRoot.position = JsonPosition;
// SECOND CZML PACKET WITH SHOW DATA
SOLIS_CMD_TLM.Show JsonShow = new SOLIS_CMD_TLM.Show();
JsonShow.interval = “2018-08-30T18:00:00Z/2018-09-06T18:00:00Z”;
JsonShow.boolean = true;
// SECOND CZML PACKET WITH LEADTIME DATA
SOLIS_CMD_TLM.LeadTime JsonLeadTime = new SOLIS_CMD_TLM.LeadTime();
JsonLeadTime.interval = “2018-08-30T18:00:00Z/2018-09-06T18:00:00Z”;
JsonLeadTime.epoch = startInterval;
List dbNumber = new List();
dbNumber.Add(10);
dbNumber.Add(10);
dbNumber.Add(10);
dbNumber.Add(10);
JsonLeadTime.number = dbNumber;
// SECOND CZML PACKET WITH TRAILTIME DATA
SOLIS_CMD_TLM.TrailTime JsonTrailTime = new SOLIS_CMD_TLM.TrailTime();
JsonTrailTime.interval = “2018-08-30T18:00:00Z/2018-09-06T18:00:00Z”;
JsonTrailTime.epoch = startInterval;
//JsonTrailTime.epoch = Ces_rt;
List dbNumber1 = new List();
dbNumber1.Add(10);
dbNumber1.Add(10);
dbNumber1.Add(10);
dbNumber1.Add(10);
JsonTrailTime.number = dbNumber1;
// SECOND CZML PACKET WITH COLOR2 DATA
SOLIS_CMD_TLM.Color2 JsonColor2 = new SOLIS_CMD_TLM.Color2();
List lstRGBA = new List();
lstRGBA.Add(0);
lstRGBA.Add(255);
lstRGBA.Add(255);
lstRGBA.Add(255);
JsonColor2.rgba = lstRGBA;
// SECOND CZML PACKET WITH SOLID COLOR DATA
SOLIS_CMD_TLM.SolidColor JsonSolidColor = new SOLIS_CMD_TLM.SolidColor();
JsonSolidColor.color = JsonColor2;
// SECOND CZML PACKET WITH MATERIAL DATA
SOLIS_CMD_TLM.Material JsonMaterial = new SOLIS_CMD_TLM.Material();
JsonMaterial.solidColor = JsonSolidColor;
// SECOND CZML PACKET WITH PATH DATA
SOLIS_CMD_TLM.Path JsonPath = new SOLIS_CMD_TLM.Path();
List lstShow = new List();
lstShow.Add(JsonShow);
JsonPath.show = lstShow;
JsonPath.width = 2;
JsonPath.material = JsonMaterial;
//JsonPath.resolution = 1200;
JsonPath.resolution = 3;
List lstLeadTime = new List();
lstLeadTime.Add(JsonLeadTime);
List lstTrailTime = new List();
lstTrailTime.Add(JsonTrailTime);
JsonPath.leadTime = lstLeadTime;
JsonPath.trailTime = lstTrailTime;
// MODEL DATA
SOLIS_CMD_TLM.Model JsonModel = new SOLIS_CMD_TLM.Model();
JsonModel.gltf = “https://assets.agi.com/models/ikonos.gltf”;
//JsonModel.gltf = “…/…/SampleData/models/CesiumSpace/ikonos.gltf”;
JsonModel.scale = 1;
JsonModel.runAnimations = false;
JsonModel.show = true;
// COLOR DATA
SOLIS_CMD_TLM.Color JsonColor = new SOLIS_CMD_TLM.Color();
List lstRGBA1 = new List();
lstRGBA1.Add(255);
lstRGBA1.Add(0);
lstRGBA1.Add(0);
lstRGBA1.Add(255);
JsonColor.rgba = lstRGBA1;
// EYEOFFSET DATA
SOLIS_CMD_TLM.EyeOffset JsonEyeOffset = new SOLIS_CMD_TLM.EyeOffset();
List lstCartesian = new List();
lstCartesian.Add(0);
lstCartesian.Add(0);
lstCartesian.Add(0);
JsonEyeOffset.cartesian = lstCartesian;
// PIXEL OFFSET
SOLIS_CMD_TLM.PixelOffset JsonPixelOffset = new SOLIS_CMD_TLM.PixelOffset();
List lstCartesian1 = new List();
lstCartesian1.Add(0);
lstCartesian1.Add(0);
JsonPixelOffset.cartesian2 = lstCartesian1;
// BILLBOARD DATA
SOLIS_CMD_TLM.Billboard JsonBillboard = new SOLIS_CMD_TLM.Billboard();
JsonBillboard.color = JsonColor;
JsonBillboard.eyeOffset = JsonEyeOffset;
JsonBillboard.horizontalOrigin = “CENTER”;
JsonBillboard.image = “data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAjSURBVChTYyAa/EcDUGEIgIphAKg0XRSAAFQMDqDChAADAwDC13+BJ+0oDwAAAABJRU5ErkJgggAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==”;
JsonBillboard.pixelOffset = JsonPixelOffset;
JsonBillboard.scale = 1;
JsonBillboard.show = true;
JsonBillboard.verticalOrigin = “CENTER”;
// FILL COLOR DATA
SOLIS_CMD_TLM.FillColor JsonFillColor = new SOLIS_CMD_TLM.FillColor();
List lstRGBA_FillColor = new List();
lstRGBA_FillColor.Add(0);
lstRGBA_FillColor.Add(255);
lstRGBA_FillColor.Add(255);
lstRGBA_FillColor.Add(255);
JsonFillColor.rgba = lstRGBA_FillColor;
// OUTLINE COLOR DATA
SOLIS_CMD_TLM.OutlineColor JsonOutlineColor = new SOLIS_CMD_TLM.OutlineColor();
List lstRGBA_OutlineColor = new List();
lstRGBA_OutlineColor.Add(0);
lstRGBA_OutlineColor.Add(0);
lstRGBA_OutlineColor.Add(0);
lstRGBA_OutlineColor.Add(255);
JsonOutlineColor.rgba = lstRGBA_OutlineColor;
// PIXELOFFSET2 DATA
SOLIS_CMD_TLM.PixelOffset2 JsonPixelOffset2 = new SOLIS_CMD_TLM.PixelOffset2();
List lstRGBA_PixelOffset2 = new List();
lstRGBA_PixelOffset2.Add(5);
lstRGBA_PixelOffset2.Add(-4);
JsonPixelOffset2.cartesian2 = lstRGBA_PixelOffset2;
// LABEL DATA
SOLIS_CMD_TLM.Label JsonLabel = new SOLIS_CMD_TLM.Label();
JsonLabel.fillColor = JsonFillColor;
JsonLabel.font = “21pt Lucida Console”;
JsonLabel.horizontalOrigin = “LEFT”;
JsonLabel.outlineColor = JsonOutlineColor;
JsonLabel.outlineWidth = 2;
JsonLabel.pixelOffset = JsonPixelOffset2;
JsonLabel.scale = 0.5;
JsonLabel.show = true;
JsonLabel.style = “FILL_AND_OUTLINE”;
JsonLabel.text = “BLAHSat”;
JsonLabel.verticalOrigin = “CENTER”;
TLMvalue tlmval = new TLMvalue();
tlmval.value = OPW_BATTPWR;
// CUSTOM TELEMETRY
//BatteryTLM btrTLM = new BatteryTLM();
//btrTLM.mnemonic = “OPW_BATTPWR”;
//btrTLM.tlmval = tlmval;
// ADDING MORE TO THE ROOTOBJECT
JsonRoot.label = JsonLabel;
JsonRoot.billboard = JsonBillboard;
JsonRoot.model = JsonModel;
JsonRoot.path = JsonPath;
CZML_JSON_2 = JsonConvert.SerializeObject(JsonRoot);
FlagStop2 = 0;
FlagStop3 = 0;
flagCZMLquat = flagCZMLquat + 1;
flagCZMLpos = flagCZMLpos + 1;
flagCZML = flagCZML + 5;
}
}
Test.mp4 (1.53 MB)