spaceteams.SC_Compute_Server.SimGlobals
¶
AddEntityFromConfig
¶
AddEntityFromConfig(template_name: str, entity_name: str, system_nametags: Sequence[str], add_param_operations: Callable[[ParamMap], None]) -> spaceteams.SC_Compute_Server.Entity
Adds a new entity using the EntityConfig file at template_path (can preload in sim config) as a starting point. All parameters added to the GenParamMap in the add_param_operations lambda will be used to either overwrite the original parameter value (from the EntityConfig) or add a new parameter. Core/ template_path is relative to the Platform root directory (one above the Compute_Server or SharedData directories). NOTE: Only use AddParam or AddNestedParam functions in the lambda; the EntityConfigs's parameters are not already in the given GenParamMap.
AddEntityFromTemplate
¶
AddEntityFromTemplate(template_name: str, entity_name: str, system_nametags: Sequence[str], add_param_operations: Callable[[ParamMap], None]) -> spaceteams.SC_Compute_Server.Entity
Deprecated; use identical AddEntityFromConfig instead. Adds a new entity using the entity config file at template_path as a starting point. All parameters added to the GenParamMap in the add_param_operations lambda will be used to either overwrite the original parameter value (from the entity template) or add a new parameter. Core/ template_path is relative to the Platform root directory (one above the Compute_Server or SharedData directories). NOTE: Only use AddParam or AddNestedParam functions in the lambda; the template's parameters are not already in the given GenParamMap.
AddEventListener
¶
AddEventListener(topic: str, delegateFn: Callable[[ParamMap, timestamp], None]) -> None
Deprecated; use Subscribe instead.
CanTransmit
¶
CanTransmit() -> bool
Whether this process can transmit anything to other processes in the sim.
DispatchEvent
¶
DispatchEvent(topic: str, payload: ParamMap) -> None
Deprecated; use Publish instead. Publishes a message to a topic with a ParamMap payload. Immediately runs local subscribed delegate functions and also optionally also publishes across the network.
GetSimEntity
¶
GetSimEntity() -> spaceteams.SC_Compute_Server.Entity
Get the SimEntity, which is the singleton Entity_Base that exists in any sim. We recommend that you only keep truly sim-wide data on the SimEntity, and not use it as an easy place to dump random parameters.
GetSimState
¶
GetSimState() -> spaceteams.SC_Compute_Server.SimState
Get the current enumerated SimState of the sim.
GetWallTime_SimStarted
¶
GetWallTime_SimStarted() -> datetime.timedelta
Get IRL ("Wall") time that this simulation started.
MandateSimStateChange
¶
MandateSimStateChange(newState: SimState, retransmit: bool = True) -> None
Exception on failure. - retransmit: Whether this request should be retransmitted
Publish
¶
Publish(topic: str, payload: ParamMap) -> None
Publishes a message to a topic with a ParamMap payload. Immediately runs local subscribed delegate functions and also publishes across the network.
RemoveResponder
¶
RemoveResponder(handle: ResponderHandle) -> None
Removes a responder from the lists on this application.
ReportSimCrash
¶
ReportSimCrash(crash_info: str) -> None
Typically you should call this in situations where you are immediately following up with exiting the sim or terminating the process. We ALREADY set this up to be called on st.logger_fatal() calls. A reason to use this instead of st.logger_fatal() is if you want to wait and handle other stuff before actually terminating the process. - crash_info: Send out this message and report it as the reason for the crash. Typically includes stack trace, etc.
Request
¶
Request(topic: str, payload: ParamMap, entityId: UUID = ..., timeout: timedelta = ..., transmit: bool = True) -> spaceteams.SC_Compute_Server.ParamMap | None
Send a request that is meant to be responded to. Blocking wait for response. Returns the response payload, or a python None object. If there was no response within the timeout, the return will be None.
RequestSimStateChange
¶
RequestSimStateChange(newState: SimState, retransmit: bool = True) -> bool
Returns success. - retransmit: Whether this request should be retransmitted
Respond
¶
Respond(topic: str, delegateFn: Callable[[ParamMap], ParamMap], entityId: UUID = ...) -> spaceteams.SC_Compute_Server.ResponderHandle
Register a responder delegate function that can respond to a request. The responder must always return a valid response payload param map, but depending on user code, that payload may contain information to communicate a failure. If independentThread is true, the delegate function gets its own thread to execute in, so it can do blocking waits without taking up space in the main thread pool. Returns a ResponderHandle, which can be used to withdraw this responder with a call to SimGlobals.RemoveResponder().
ResponderExists
¶
ResponderExists(topic: str, entityId: UUID = ...) -> bool
Check local records for a responder existing. May not be always correct in the face of dynamically changing responders.
SampleEphemeris
¶
SampleEphemeris(body: str, bodyFrame: str, observer: str, observerFrame: str, aberration_correction: str = 'NONE', time: timestamp = ...) -> spaceteams.SC_Compute_Server.EphemerisResult
Sample ephemeris of a body wrt an observer in a SPICE-compatible way. See: - https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkezr_c.html - https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/sxform_c.html - https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/xf2rav_c.html
"body">Body being observed. spkezr "targ" "bodyFrame">Frame definition of the body-fixed-frame of the body being observed. sxform "to" "observer">Body that the observer location is taken from. spkezr "obs" "observerFrame">Coordinate basis frame for the output state vector. spkezr "ref" and sxform "from" "aberration_correction">Light time correction. spkezr "abcorr" "time">Time in TAI, adjusted for the observer. spkezr "et" Returns EphemerisResult, the Loc/Vel/Acc and Rot/Angvel/AngAcc of body wrt observer.
SampleMatrix3x3Field
¶
SampleMatrix3x3Field(FieldName: str, state: FramedLocVelAcc) -> spaceteams.SC_Compute_Server.frames.FramedMatrix3x3
Sample the value of a Matrix3x3 Field at a certain state. Computes the component-wise sum of contributions from all Matrix3x3 FieldEffects with this field name.
SampleScalarField
¶
SampleScalarField(FieldName: str, state: FramedLocVelAcc) -> float
Sample the value of a Scalar Field at a certain state. Computes the sum of contributions from all Scalar FieldEffects with this field name.
SampleVectorField
¶
SampleVectorField(FieldName: str, state: FramedLocVelAcc) -> spaceteams.SC_Compute_Server.frames.FramedVector
Sample the value of a Vector Field at a certain state. Computes the sum of contributions from all Vector FieldEffects with this field name.
Subscribe
¶
Subscribe(topic: str, delegateFn: Callable[[ParamMap, timestamp], None], entityId: UUID = ..., independentThread: bool = True) -> None
Subscribe to a topic and set a delegate function which fires when received a message on that topic. Typically, the delegate is easiest to define as a lambda function. If independentThread is true, the delegate function gets its own thread to execute in, so it can do blocking waits without taking up space in the main thread pool.
SubscribeOnce
¶
SubscribeOnce(topic: str, delegateFn: Callable[[ParamMap, timestamp], bool], entityId: UUID = ..., independentThread: bool = True) -> None
Subscribe to a topic and set a delegate function which fires when received a message on that topic. Removed from the subscription list if delegateFn returns true. Typically, the delegate is easiest to define as a lambda function. If independentThread is true, the delegate function gets its own thread to execute in, so it can do blocking waits without taking up space in the main thread pool.
Unsubscribe
¶
Unsubscribe(handle: SubscriptionHandle) -> None
Unsubscribe from a topic for one particular SubscriptionHandle, which was returned from a Subscribe call.