Satellite Module#

SPDX-FileCopyrightText: 2024 DESY and the Constellation authors SPDX-License-Identifier: EUPL-1.2

This module provides the class for a Constellation Satellite.

class core.satellite.Satellite(name: str, group: str, cmd_port: int, hb_port: int, mon_port: int, interface: list[str])#

Bases: CommandReceiver, CHIRPBroadcaster, MonitoringSender, HeartbeatSender, HeartbeatChecker

Base class for a Constellation Satellite.

do_initializing(config: Configuration) str#

Method for the device-specific code of ‘initializing’ transition.

This should set configuration variables.

do_interrupting() str#

Interrupt data acquisition and move to Safe state.

Defaults to calling the stop and land handlers.

do_landing() str#

Return Satellite to Initialized state.

do_launching() str#

Prepare Satellite for data acquisitions.

do_run(run_identifier: str) str#

The acquisition event loop.

This method will be started by the Satellite and run in a thread. It therefore needs to monitor the self.stop_running Event and close itself down if the Event is set.

NOTE: This method is not inherently thread-safe as it runs in the context of the Satellite and can modify data accessible to the main thread. However, the state machine can effectively act as a lock and prevent competing access to the same objects while in RUNNING state as long as care is taken in the implementation.

The state machine itself uses the RTC model by default (see https://python-statemachine.readthedocs.io/en/latest/processing_model.html?highlight=thread) which should make the transitions themselves safe.

do_starting(run_identifier: str) str#

Final preparation for acquisition.

do_stopping() str#

Stop the data acquisition.

fail_gracefully() str#

Method called when reaching ‘ERROR’ state.

get_config(_request: CSCP1Message | None = None) tuple[str, Any, dict[str, Any]]#

Get current satellite configuration.

No payload argument.

get_run_id(_request: CSCP1Message | None = None) tuple[str, Any, dict[str, Any]]#

Get current/last known run identifier.

No payload argument.

get_version(_request: CSCP1Message | None = None) tuple[str, Any, dict[str, Any]]#

Get Constellation version.

No payload argument.

Additional version information may be included in the meta map (final return value).

reentry() None#

Orderly shutdown and destroy the Satellite.

run_satellite() None#

Main Satellite event loop with task handler-routine.

This routine sequentially executes tasks queued by the CommandReceiver or the CHIRPBroadcaster. These tasks come in the form of callbacks to e.g. state transitions.

class core.satellite.SatelliteArgumentParser(*args: Any, **kwargs: Any)#

Bases: ConstellationArgumentParser

Customized Argument parser providing common Satellite options.