Visualize Satellite Trajectory (Cesium)ΒΆ

import sys

!{sys.executable} -m pip install git+https://github.com/open-space-collective/cesiumpy.git#egg=cesiumpy
Collecting cesiumpy
  Cloning https://github.com/open-space-collective/cesiumpy.git to /tmp/pip-install-r1o_q9e7/cesiumpy_387352e4b3954e40babcf482a295ffc2
  Running command git clone --filter=blob:none --quiet https://github.com/open-space-collective/cesiumpy.git /tmp/pip-install-r1o_q9e7/cesiumpy_387352e4b3954e40babcf482a295ffc2
  Resolved https://github.com/open-space-collective/cesiumpy.git to commit 7b01ce8826db0a694c3f9b271832e77dcf171923
  Running command git submodule update --init --recursive -q
  Preparing metadata (setup.py) ... ?25l-
 done
?25hRequirement already satisfied: traitlets in /usr/local/lib/python3.11/dist-packages (from cesiumpy) (5.14.3)
Requirement already satisfied: geopy>=1.11.0 in /usr/local/lib/python3.11/dist-packages (from cesiumpy) (2.4.1)
Requirement already satisfied: geographiclib<3,>=1.52 in /usr/local/lib/python3.11/dist-packages (from geopy>=1.11.0->cesiumpy) (2.0)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.

[notice] A new release of pip is available: 25.0.1 -> 25.1.1
[notice] To update, run: python3.11 -m pip install --upgrade pip
import os

from ostk.physics import Environment
from ostk.physics.unit import Length
from ostk.physics.unit import Angle
from ostk.physics.time import Instant
from ostk.physics.time import Interval
from ostk.physics.time import Duration
from ostk.physics.time import DateTime
from ostk.physics.time import Time
from ostk.physics.time import Scale
from ostk.physics.unit import Length

from ostk.astrodynamics.trajectory import Orbit
from ostk.astrodynamics.flight import Profile
from ostk.astrodynamics.viewer import Viewer
from ostk.astrodynamics.viewer import ConicSensor
environment = Environment.default()
orbit = Orbit.sun_synchronous(
    epoch=Instant.date_time(DateTime(2023, 1, 1, 0, 0, 0), Scale.UTC),
    altitude=Length.kilometers(500.0),
    local_time_at_descending_node=Time(14, 0, 0),
    celestial_object=environment.access_celestial_object_with_name("Earth"),
)
interval = Interval.closed(
    start_instant=Instant.date_time(DateTime(2023, 1, 1, 0, 0, 0), Scale.UTC),
    end_instant=Instant.date_time(DateTime(2023, 1, 1, 3, 0, 0), Scale.UTC),
)
viewer = Viewer(
    interval=interval,
    cesium_token=os.environ.get("CESIUM_TOKEN"),  # Get a token from https://cesium.com/learn/ion/cesium-ion-access-tokens/
    zoom_to_entity=False,
    track_entity=False,
)
viewer.add_orbit(
    orbit=orbit,
    step=Duration.seconds(5.0),
    show_orbital_track=True,
)
/usr/local/lib/python3.11/dist-packages/cesiumpy/util/html.py:25: UserWarning: Unable to read specified path, be sure to the output HTML can read the path: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADJSURBVDhPnZHRDcMgEEMZjVEYpaNklIzSEfLfD4qNnXAJSFWfhO7w2Zc0Tf9QG2rXrEzSUeZLOGm47WoH95x3Hl3jEgilvDgsOQUTqsNl68ezEwn1vae6lceSEEYvvWNT/Rxc4CXQNGadho1NXoJ+9iaqc2xi2xbt23PJCDIB6TQjOC6Bho/sDy3fBQT8PrVhibU7yBFcEPaRxOoeTwbwByCOYf9VGp1BYI1BA+EeHhmfzKbBoJEQwn1yzUZtyspIQUha85MpkNIXB7GizqDEECsAAAAASUVORK5CYII=
  warnings.warn(msg.format(sourceUri))

If you have a known attitude profile and cesium asset id, you can visualize a more detailed satellite trajectory, including attitude.

profile = Profile.local_orbital_frame_pointing(
    orbit=orbit,
    orbital_frame_type=Orbit.FrameType.VVLH,
)
viewer = Viewer(
    interval=interval,
    cesium_token=os.environ.get("CESIUM_TOKEN"),  # Get a token from https://cesium.com/learn/ion/cesium-ion-access-tokens/
)
viewer.add_profile(
    profile=profile,
    step=Duration.seconds(5.0),
    show_orbital_track=True,
    cesium_asset_id=669199,
    sensors=[
        ConicSensor(
            name="Payload",
            direction=(0.0, 0.0, 1.0),
            half_angle=Angle.degrees(8.0),
            length=Length.meters(1.0),
            color="red",
        )
    ],
)
viewer