Accessing individual orbits from WalkerConstellation

Hi,

I have been using Orekit via the Python Wrapper for a while, and it has been great. Thank you so much for keeping this community so active. I am currently trying to create a Walker Constellation and visualize all the orbits. I am having trouble accessing the orbit information from the list of WalkerConstellationSlot objects. I have attached my code below:

rE = Constants.WGS84_EARTH_EQUATORIAL_RADIUS   # Earth Radius [meters]
muE = Constants.WGS84_EARTH_MU                 # m3/s2
J2000 = FramesFactory.getEME2000()             # J2000 inertial frame
utc = TimeScalesFactory.getUTC()               # Universal Coordinate Time [UTC]

# Define Starlink Parameters
initialEpoch =  AbsoluteDate(2024, 9, 16, 10, 30, 00.000, utc)  # UTC

massSL       = 800.0                                            # kg
sma          = rE + 550*1e3                                     # meters
ecc          = 0.0                                              # unitless
inc          = radians(53)                                      # rad
argPeri      = radians(0.0)                                     # rad
RAAN         = radians(0.0)                                     # rad
trueAnom     = radians(0.0)                                     # rad 

# Define Initial State 
orbitSL = KeplerianOrbit(sma, ecc, inc, argPeri, RAAN, trueAnom, PositionAngleType.TRUE, J2000, initialEpoch, muE)
const = WalkerConstellation(30, 10, 1, WalkerConstellation.Pattern.DELTA)
refSlot = const.buildReferenceSlot(orbitSL)
regularSlots = const.buildRegularSlots(orbitSL)

# Extract the first plane of orbits
planeSlots = regularSlotsget(0)
firstSlot = planeSlot.get(0).getOrbit()

In this case, the regularSlots is a <List: [[org.orekit.orbits.WalkerConstellationSlot@75fc1992, org.orekit.orbits....]]> object. Thus, the planeSlots returns <Object: [org.orekit.orbits.WalkerConstellationSlot@129bd55d, org.orekit.orbits.WalkerConstellationSlot@7be7e15, org.orekit.orbits.WalkerConstellationSlot@3abfe845]> when I expected it to return a List of WalkerConstellationSlot objects.

Can anyone help me access individual orbits? Do I need to cast the variables into a Python type somewhere here? Thank you so much!

Hi there,

Upping your thread in case it’s not resolved.

Cheers,
Romain.

Hello @msudan2007 and welcome to the Orekit forum !

I did not see this thread earlier, thank you @Serrof for upping it.

The solution is the following :

from java.util import ArrayList
...

regularSlots = const.buildRegularSlots(orbitSL)

slot_list_list = list(ArrayList.cast_(regularSlots))
slot_list_list = [list(ArrayList.cast_(slot_list)) for slot_list in slot_list_list]
slot_list_list = [[WalkerConstellationSlot.cast_(slot) for slot in slot_list] for slot_list in slot_list_list]

planeSlots = slot_list_list[0]
firstSlot = planeSlots[0].getOrbit()

I decomposed the transformation because it would look ugly otherwise :sweat_smile: .

Note that your IDE might not like the ArrayList import but it should work regardless.

Cheers,
Vincent

That resolved it. Thank you so much!

1 Like