Compare commits
200 Commits
Author | SHA1 | Date | |
---|---|---|---|
7721a57a67 | |||
d1f92f7aed | |||
6e85b1add8 | |||
73a7c6ec14 | |||
28161059ca | |||
52d434630b | |||
55a357b52c | |||
2d6e9f826c | |||
20489a02d2 | |||
652f3bf66f | |||
8419a4edd7 | |||
673c8b2cf2 | |||
e23b39e652 | |||
9a55686a26 | |||
067a016040 | |||
dccbf89da1 | |||
5cf76c07e9 | |||
bc53f7e81a | |||
d6b879da67 | |||
9a06c64dfa | |||
cc7837a55b | |||
9cc4fa702c | |||
ada099cab1 | |||
376f94b167 | |||
86a68e25f7 | |||
5e1b12fa52 | |||
de34952df5 | |||
5da55c3c99 | |||
3b903e5639 | |||
da35c7fdf1 | |||
8c7cbd1bd6 | |||
ba0a3e35d2 | |||
fc2667c150 | |||
f9041f215a | |||
a59aceda75 | |||
c50f8c2ce2 | |||
dfa45dbdba | |||
36d9323b57 | |||
e04b5bf9d7 | |||
3c0ac91227 | |||
f61c485979 | |||
2ebbf750bd | |||
847fccbe66 | |||
c8292f4ee1 | |||
3700769e46 | |||
69fda96d7a | |||
0c51cad813 | |||
05d5955236 | |||
18860ec2c6 | |||
fc5fb0eed3 | |||
d5bb6fe6c5 | |||
37eafb722b | |||
1cafdc817f | |||
5967dede97 | |||
a8d0143b1e | |||
a0ad5f8948 | |||
20ecef5838 | |||
6d97841cbf | |||
512f0e4530 | |||
e2f0221681 | |||
e9eb45c088 | |||
ea72087d87 | |||
d48c029b85 | |||
b5f4f2ddab | |||
64dd19bd12 | |||
102821fc71 | |||
24f3abdd5a | |||
a880db5655 | |||
4e0cbb1034 | |||
96636d59e9 | |||
7dfdd40963 | |||
6282686f2f | |||
b160f079b1 | |||
11d7ad0f8d | |||
5af69eb14e | |||
5a0edbefa8 | |||
5bdba2dbad | |||
3ae6ccfb77 | |||
de84bf112b | |||
d182a9d5ec | |||
c72a04b262 | |||
492d364246 | |||
33cf7b1613 | |||
d8c49aed80 | |||
97afd24e52 | |||
4704616ca7 | |||
92c0172b59 | |||
344f16099e | |||
49b55f01e3 | |||
f87095bf68 | |||
928759d1bc | |||
dc17919108 | |||
5f71f27f0e | |||
f8d63e56cb | |||
c843356c8a | |||
49a614db10 | |||
c90dd92162 | |||
bcb6a8b34e | |||
ed15bcaf35 | |||
89202f2cfe | |||
40c2a4b1f3 | |||
811786fd78 | |||
baf1b44d23 | |||
73a4260f33 | |||
3358de3e3e | |||
211e79c83e | |||
7f10e5c777 | |||
aab35c26c2 | |||
6ade001d3d | |||
098bdcf82b | |||
b131415ea7 | |||
b1dd5aa7d0 | |||
0201eb27c4 | |||
c070f18c5d | |||
00876ed0e0 | |||
68ea889d0f | |||
771199e542 | |||
588d7a8079 | |||
83aff8bea5 | |||
1d982785e6 | |||
d062a22a7a | |||
f8c3172e7a | |||
7a56c604a6 | |||
bbde4b5b20 | |||
85fc106a9b | |||
d35bc01397 | |||
d811735b8d | |||
265077a758 | |||
1cd566a94c | |||
9aa891ef78 | |||
329aa76fbf | |||
4633e0cb13 | |||
a5ebac6266 | |||
f3c6b509ec | |||
5aefa436f4 | |||
b0b8118dd5 | |||
db384f8e9c | |||
e5fe0ab95a | |||
248df1d4df | |||
f93f713b0e | |||
c6b2edf688 | |||
5e3b60b3af | |||
d69d16c3af | |||
6376585c4e | |||
5b4a789c4b | |||
813f92f3d4 | |||
f3eecfa8ac | |||
b94c20dab1 | |||
84aeaa4b65 | |||
bcdd12caf0 | |||
6440048235 | |||
c5dcc0b77d | |||
ebd9792fb9 | |||
9f1d61c3ef | |||
38eb43cf8d | |||
3d007c32a3 | |||
202a824d31 | |||
79b3c269e6 | |||
839da7a224 | |||
3a6abe1b62 | |||
db70b33bd6 | |||
d53e9d61b0 | |||
bac4473aa7 | |||
342a3bbcc9 | |||
7c3a72f85b | |||
4e25e2e6ca | |||
eb302e5cf1 | |||
3da1c2c262 | |||
1660e27ec1 | |||
6f86e72042 | |||
507c3e3ff3 | |||
bca2deae61 | |||
35e25bf6d0 | |||
d4147d8402 | |||
3cf312073a | |||
76fee820e9 | |||
d2fc53c1fa | |||
947bcf57f5 | |||
77c2c91539 | |||
756944cae3 | |||
2bb917eab7 | |||
f756df43a2 | |||
688602e486 | |||
21a38ae76a | |||
af02c106b9 | |||
ae239031ed | |||
d640d547bd | |||
02d9d6adfc | |||
ba24faefa9 | |||
b3920524ab | |||
7cb5766a7a | |||
6e87a0249c | |||
c0ab3351c9 | |||
2259d269dd | |||
57a225f926 | |||
d9e4ff6973 | |||
02dc6174bf | |||
ce363e3785 | |||
b3c3363591 | |||
3fe51b08a6 |
5
.gitignore
vendored
5
.gitignore
vendored
@ -6,6 +6,7 @@ log
|
||||
/gps_log.txt
|
||||
/config/*.json
|
||||
|
||||
/.tmtc-history.txt
|
||||
/scex_conf.json
|
||||
/tmtc_conf.json
|
||||
/seqcnt*.txt
|
||||
@ -27,3 +28,7 @@ log
|
||||
/.installed.cfg
|
||||
/*.egg
|
||||
/MANIFEST
|
||||
|
||||
# Telemetry database.
|
||||
/tm.db
|
||||
|
||||
|
68
CHANGELOG.md
68
CHANGELOG.md
@ -10,10 +10,78 @@ list yields a list of all related PRs for each release.
|
||||
|
||||
# [unreleased]
|
||||
|
||||
# [v7.1.1] 2025-02-10
|
||||
|
||||
- Bumped `tmtccmd` to v8.2.0
|
||||
|
||||
# [v7.1.0] 2025-01-17
|
||||
|
||||
- Bumped `tmtccmd` to v8.1.0
|
||||
|
||||
## Fixed
|
||||
|
||||
- Use new mode TM API.
|
||||
|
||||
# [v7.0.0] 2024-05-06
|
||||
|
||||
- Reworked PLOC MPSoC commanding to be inline with OBSW update.
|
||||
|
||||
## Fixed
|
||||
|
||||
- GNSS commands working again (again).
|
||||
|
||||
## Added
|
||||
|
||||
- Added handling for new clock events.
|
||||
|
||||
# [v6.2.0] 2024-04-10
|
||||
|
||||
## Added
|
||||
|
||||
- Added version set for STR.
|
||||
- Command for relative timeshift.
|
||||
- Health commands for payload components.
|
||||
|
||||
## Fixed
|
||||
|
||||
- EPS power commands working again.
|
||||
- GNSS commands working again.
|
||||
|
||||
## Changed
|
||||
|
||||
- Fixed PLOC commanding
|
||||
|
||||
# [v6.1.1] 2024-03-06
|
||||
|
||||
## Added
|
||||
|
||||
- Added Core Ctrl cmd to update leap seconds.
|
||||
|
||||
# [v6.1.0] 2024-02-29
|
||||
|
||||
## Added
|
||||
|
||||
- Added commands to unlock and use STR secondary firmware slot.
|
||||
- STR BlobStats TM handling
|
||||
- New ACS CTRL commands.
|
||||
|
||||
## Fixed
|
||||
|
||||
- RW commanding
|
||||
|
||||
# [v6.0.0] 2024-02-08
|
||||
|
||||
## Changed
|
||||
|
||||
- Bumped `tmccmd` to `v8.0.0rc1` to introduce new command tree handling.
|
||||
- Added new PLOC SUPV commands to test sets, cleaned up PLOC SUPV commanding.
|
||||
|
||||
# [v5.13.0] 2024-01-30
|
||||
|
||||
## Added
|
||||
|
||||
- First variant of TM handling with a DB which might serve as a foundation for better TM
|
||||
handling with an ORM in the future.
|
||||
- Added new parameter commands for PLOC MPSoC to skip SUPV commanding.
|
||||
|
||||
# [v5.12.1] 2023-12-13
|
||||
|
@ -1,20 +1,28 @@
|
||||
import logging
|
||||
|
||||
from spacepackets.cfdp import ConditionCode
|
||||
from tmtccmd.cfdp.mib import DefaultFaultHandlerBase
|
||||
from spacepackets.cfdp import ConditionCode, TransactionId
|
||||
from cfdppy.mib import DefaultFaultHandlerBase
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class EiveCfdpFaultHandler(DefaultFaultHandlerBase):
|
||||
def notice_of_suspension_cb(self, cond: ConditionCode):
|
||||
def notice_of_suspension_cb(
|
||||
self, transaction_id: TransactionId, cond: ConditionCode, progress: int
|
||||
):
|
||||
_LOGGER.info(f"Received notice of suspension: {cond!r}")
|
||||
|
||||
def notice_of_cancellation_cb(self, cond: ConditionCode):
|
||||
def notice_of_cancellation_cb(
|
||||
self, transaction_id: TransactionId, cond: ConditionCode, progress: int
|
||||
):
|
||||
_LOGGER.info(f"Received notice of cancellation: {cond!r}")
|
||||
|
||||
def abandoned_cb(self, cond: ConditionCode):
|
||||
def abandoned_cb(
|
||||
self, transaction_id: TransactionId, cond: ConditionCode, progress: int
|
||||
):
|
||||
_LOGGER.info(f"Abandoned transaction: {cond!r}")
|
||||
|
||||
def ignore_cb(self, cond: ConditionCode):
|
||||
def ignore_cb(
|
||||
self, transaction_id: TransactionId, cond: ConditionCode, progress: int
|
||||
):
|
||||
_LOGGER.info(f"Ignored transaction: {cond!r}")
|
||||
|
@ -5,22 +5,22 @@ import deprecation
|
||||
from spacepackets import PacketType, SpacePacket, SpacePacketHeader
|
||||
from spacepackets.cfdp import GenericPduPacket, PduFactory
|
||||
from spacepackets.cfdp.pdu import PduHolder
|
||||
from tmtccmd.cfdp import (
|
||||
from cfdppy import (
|
||||
CfdpUserBase,
|
||||
LocalEntityCfg,
|
||||
RemoteEntityCfgTable,
|
||||
)
|
||||
from tmtccmd.cfdp.defs import CfdpState
|
||||
from tmtccmd.cfdp.handler import (
|
||||
from cfdppy.defs import CfdpState
|
||||
from cfdppy.handler import (
|
||||
DestHandler,
|
||||
DestStateWrapper,
|
||||
SourceHandler,
|
||||
SourceStateWrapper,
|
||||
)
|
||||
from tmtccmd.cfdp.handler.common import PacketDestination, get_packet_destination
|
||||
from tmtccmd.cfdp.mib import CheckTimerProvider
|
||||
from tmtccmd.cfdp.request import PutRequest
|
||||
from tmtccmd.util import ProvidesSeqCount
|
||||
from cfdppy.handler.common import PacketDestination, get_packet_destination
|
||||
from cfdppy.mib import CheckTimerProvider
|
||||
from cfdppy.request import PutRequest
|
||||
from spacepackets.seqcount import ProvidesSeqCount
|
||||
from tmtccmd.version import get_version
|
||||
|
||||
|
||||
@ -62,13 +62,7 @@ class CfdpHandler:
|
||||
)
|
||||
|
||||
def put_request(self, request: PutRequest):
|
||||
if not self.remote_cfg_table.get_cfg(request.destination_id):
|
||||
raise ValueError(
|
||||
f"No remote CFDP config found for entity ID {request.destination_id}"
|
||||
)
|
||||
self.source_handler.put_request(
|
||||
request, self.remote_cfg_table.get_cfg(request.destination_id) # type: ignore
|
||||
)
|
||||
self.source_handler.put_request(request)
|
||||
|
||||
def pull_next_source_packet(self) -> Optional[PduHolder]:
|
||||
res = self.source_handler.state_machine()
|
||||
|
@ -4,7 +4,7 @@ from typing import Any
|
||||
from eive_tmtc.config.definitions import CFDP_APID
|
||||
from spacepackets.ccsds import SPACE_PACKET_HEADER_SIZE
|
||||
from spacepackets.cfdp import PduFactory, PduType
|
||||
from tmtccmd.cfdp.handler import CfdpInCcsdsHandler
|
||||
from eive_tmtc.cfdp.handler import CfdpInCcsdsHandler
|
||||
from tmtccmd.tmtc import SpecificApidHandlerBase
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -3,12 +3,14 @@ import logging
|
||||
|
||||
from spacepackets.cfdp import ConditionCode
|
||||
from spacepackets.util import UnsignedByteField
|
||||
from tmtccmd.cfdp import CfdpUserBase, TransactionId
|
||||
from tmtccmd.cfdp.mib import CheckTimerProvider, Countdown, EntityType
|
||||
from tmtccmd.cfdp.user import (
|
||||
from cfdppy import CfdpUserBase, TransactionId
|
||||
from cfdppy.mib import CheckTimerProvider, EntityType
|
||||
from spacepackets.countdown import Countdown
|
||||
from cfdppy.user import (
|
||||
TransactionFinishedParams,
|
||||
MetadataRecvParams,
|
||||
FileSegmentRecvdParams,
|
||||
TransactionParams,
|
||||
)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -25,17 +27,22 @@ class EiveCheckTimerProvider(CheckTimerProvider):
|
||||
|
||||
|
||||
class EiveCfdpUser(CfdpUserBase):
|
||||
def transaction_indication(self, transaction_id: TransactionId):
|
||||
_LOGGER.info(f"CFDP User: Start of File {transaction_id}")
|
||||
def transaction_indication(
|
||||
self,
|
||||
transaction_indication_params: TransactionParams,
|
||||
):
|
||||
_LOGGER.info(
|
||||
f"CFDP User: Start of File {transaction_indication_params.transaction_id}"
|
||||
)
|
||||
|
||||
def eof_sent_indication(self, transaction_id: TransactionId):
|
||||
_LOGGER.info(f"CFDP User: EOF sent for {transaction_id}")
|
||||
|
||||
def transaction_finished_indication(self, params: TransactionFinishedParams):
|
||||
_LOGGER.info(f"CFDP User: {params.transaction_id} finished")
|
||||
_LOGGER.info(f"Delivery Code: {params.delivery_code!r}")
|
||||
_LOGGER.info(f"Condition code: {params.condition_code!r}")
|
||||
_LOGGER.info(f"File delivery status: {params.delivery_code!r}")
|
||||
_LOGGER.info(f"Delivery Code: {params.finished_params.delivery_code!r}")
|
||||
_LOGGER.info(f"Condition code: {params.finished_params.condition_code!r}")
|
||||
_LOGGER.info(f"File delivery status: {params.finished_params.delivery_code!r}")
|
||||
|
||||
def metadata_recv_indication(self, params: MetadataRecvParams):
|
||||
pass
|
||||
|
@ -0,0 +1 @@
|
||||
from .definitions import * # noqa
|
@ -3,6 +3,7 @@
|
||||
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
|
||||
it to your needs.
|
||||
"""
|
||||
|
||||
import enum
|
||||
|
||||
from tmtccmd import CcsdsTmtcBackend
|
||||
|
@ -11,6 +11,15 @@ from spacepackets.ccsds import PacketId
|
||||
from spacepackets.util import UnsignedByteField
|
||||
|
||||
|
||||
TM_DB_PATH = "tm.db"
|
||||
# Separate DB or not? Not sure..
|
||||
# RAW_TM_PATH = "raw_tm.db"
|
||||
|
||||
# TODO: The cleanest way would be to load those from the config file..
|
||||
PRINT_RAW_HK_B64_STR = False
|
||||
PRINT_RAW_ACTION_DATA_REPLY_B64_STR = True
|
||||
PRINT_RAW_EVENTS_B64_STR = False
|
||||
|
||||
PUS_APID = 0x65
|
||||
CFDP_APID = 0x66
|
||||
PUS_PACKET_ID = PacketId(PacketType.TM, True, PUS_APID)
|
||||
|
@ -75,9 +75,12 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
7902;0x1ede;BIT_LOCK;INFO;A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
7903;0x1edf;BIT_LOCK_LOST;INFO;A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
7905;0x1ee1;FRAME_PROCESSING_FAILED;LOW;The CCSDS Board could not interpret a TC;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
8900;0x22c4;CLOCK_SET;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8901;0x22c5;CLOCK_DUMP;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8902;0x22c6;CLOCK_SET_FAILURE;LOW;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8900;0x22c4;CLOCK_SET;INFO;Clock has been set. P1: old timeval seconds. P2: new timeval seconds.;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8901;0x22c5;CLOCK_DUMP_LEGACY;INFO;Clock dump event. P1: timeval seconds P2: timeval milliseconds.;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8902;0x22c6;CLOCK_SET_FAILURE;LOW;Clock could not be set. P1: Returncode.;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8903;0x22c7;CLOCK_DUMP;INFO;Clock dump event. P1: timeval seconds P2: timeval microseconds.;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8904;0x22c8;CLOCK_DUMP_BEFORE_SETTING_TIME;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8905;0x22c9;CLOCK_DUMP_AFTER_SETTING_TIME;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
9100;0x238c;TC_DELETION_FAILED;MEDIUM;Deletion of a TC from the map failed. P1: First 32 bit of request ID, P2. Last 32 bit of Request ID;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
|
||||
9700;0x25e4;TEST;INFO;No description;fsfw/src/fsfw/pus/Service17Test.h
|
||||
10600;0x2968;CHANGE_OF_SETUP_PARAMETER;LOW;No description;fsfw/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h
|
||||
@ -98,6 +101,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
11208;0x2bc8;TLE_TOO_OLD;INFO;The TLE for the SGP4 Propagator has become too old.;mission/acs/defs.h
|
||||
11209;0x2bc9;TLE_FILE_READ_FAILED;LOW;The TLE could not be read from the filesystem.;mission/acs/defs.h
|
||||
11210;0x2bca;PTG_RATE_VIOLATION;MEDIUM;The limits for the rotation in pointing mode were violated.;mission/acs/defs.h
|
||||
11211;0x2bcb;DETUMBLE_TRANSITION_FAILED;HIGH;The detumble transition has failed. //! P1: Last detumble state before failure.;mission/acs/defs.h
|
||||
11300;0x2c24;SWITCH_CMD_SENT;INFO;Indicates that a FSFW object requested setting a switch P1: 1 if on was requested, 0 for off | P2: Switch Index;mission/power/defs.h
|
||||
11301;0x2c25;SWITCH_HAS_CHANGED;INFO;Indicated that a switch state has changed P1: New switch state, 1 for on, 0 for off | P2: Switch Index;mission/power/defs.h
|
||||
11302;0x2c26;SWITCHING_Q7S_DENIED;MEDIUM;No description;mission/power/defs.h
|
||||
@ -124,14 +128,15 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
11506;0x2cf2;DEPL_SA1_GPIO_SWTICH_OFF_FAILED;HIGH;No description;mission/SolarArrayDeploymentHandler.h
|
||||
11507;0x2cf3;DEPL_SA2_GPIO_SWTICH_OFF_FAILED;HIGH;No description;mission/SolarArrayDeploymentHandler.h
|
||||
11508;0x2cf4;AUTONOMOUS_DEPLOYMENT_COMPLETED;INFO;No description;mission/SolarArrayDeploymentHandler.h
|
||||
11601;0x2d51;MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC crc failure in telemetry packet;linux/payload/PlocMpsocHandler.h
|
||||
11602;0x2d52;ACK_FAILURE;LOW;PLOC receive acknowledgment failure report P1: Command Id which leads the acknowledgment failure report P2: The status field inserted by the MPSoC into the data field;linux/payload/PlocMpsocHandler.h
|
||||
11603;0x2d53;EXE_FAILURE;LOW;PLOC receive execution failure report P1: Command Id which leads the execution failure report P2: The status field inserted by the MPSoC into the data field;linux/payload/PlocMpsocHandler.h
|
||||
11604;0x2d54;MPSOC_HANDLER_CRC_FAILURE;LOW;PLOC reply has invalid crc;linux/payload/PlocMpsocHandler.h
|
||||
11605;0x2d55;MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH;LOW;Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count;linux/payload/PlocMpsocHandler.h
|
||||
11606;0x2d56;MPSOC_SHUTDOWN_FAILED;HIGH;Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor.;linux/payload/PlocMpsocHandler.h
|
||||
11607;0x2d57;SUPV_NOT_ON;LOW;SUPV not on for boot or shutdown process. P1: 0 for OFF transition, 1 for ON transition.;linux/payload/PlocMpsocHandler.h
|
||||
11608;0x2d58;SUPV_REPLY_TIMEOUT;LOW;No description;linux/payload/PlocMpsocHandler.h
|
||||
11601;0x2d51;MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC crc failure in telemetry packet;linux/payload/plocMpsocHelpers.h
|
||||
11602;0x2d52;ACK_FAILURE;LOW;PLOC receive acknowledgment failure report P1: Command Id which leads the acknowledgment failure report P2: The status field inserted by the MPSoC into the data field;linux/payload/plocMpsocHelpers.h
|
||||
11603;0x2d53;EXE_FAILURE;LOW;PLOC receive execution failure report P1: Command Id which leads the execution failure report P2: The status field inserted by the MPSoC into the data field;linux/payload/plocMpsocHelpers.h
|
||||
11604;0x2d54;MPSOC_HANDLER_CRC_FAILURE;LOW;PLOC reply has invalid crc;linux/payload/plocMpsocHelpers.h
|
||||
11605;0x2d55;MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH;LOW;Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count;linux/payload/plocMpsocHelpers.h
|
||||
11606;0x2d56;MPSOC_SHUTDOWN_FAILED;HIGH;Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor.;linux/payload/plocMpsocHelpers.h
|
||||
11607;0x2d57;SUPV_NOT_ON;LOW;SUPV not on for boot or shutdown process. P1: 0 for OFF transition, 1 for ON transition.;linux/payload/plocMpsocHelpers.h
|
||||
11608;0x2d58;SUPV_REPLY_TIMEOUT;LOW;SUPV reply timeout.;linux/payload/plocMpsocHelpers.h
|
||||
11609;0x2d59;CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE;LOW;Camera must be commanded on first.;linux/payload/plocMpsocHelpers.h
|
||||
11701;0x2db5;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
|
||||
11702;0x2db6;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
|
||||
11703;0x2db7;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
|
||||
@ -232,8 +237,9 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
12902;0x3266;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;No description;mission/system/acs/SusAssembly.h
|
||||
12903;0x3267;SIDE_SWITCH_TRANSITION_NOT_ALLOWED;LOW;Not implemented, would increase already high complexity. Operator should instead command the assembly off first and then command the assembly on into the desired mode/submode combination;mission/system/acs/SusAssembly.h
|
||||
13000;0x32c8;CHILDREN_LOST_MODE;MEDIUM;No description;mission/system/tcs/TcsBoardAssembly.h
|
||||
13100;0x332c;GPS_FIX_CHANGE;INFO;Fix has changed. P1: Old fix. P2: New fix 0: Not seen, 1: No Fix, 2: 2D-Fix, 3: 3D-Fix;mission/acs/archive/GPSDefinitions.h
|
||||
13101;0x332d;CANT_GET_FIX;LOW;Could not get fix in maximum allowed time. P1: Maximum allowed time to get a fix after the GPS was switched on.;mission/acs/archive/GPSDefinitions.h
|
||||
13100;0x332c;GPS_FIX_CHANGE;INFO;Fix has changed. P1: New fix. P2: Missed fix changes 0: Not seen, 1: No Fix, 2: 2D-Fix, 3: 3D-Fix;linux/acs/GPSDefinitions.h
|
||||
13101;0x332d;CANT_GET_FIX;MEDIUM;Could not get fix in maximum allowed time. Trying to reset both GNSS devices. P1: Maximum allowed time to get a fix after the GPS was switched on.;linux/acs/GPSDefinitions.h
|
||||
13102;0x332e;RESET_FAIL;HIGH;Failed to reset an GNNS Device. P1: Board-Side.;linux/acs/GPSDefinitions.h
|
||||
13200;0x3390;P60_BOOT_COUNT;INFO;P60 boot count is broadcasted once at SW startup. P1: Boot count;mission/power/P60DockHandler.h
|
||||
13201;0x3391;BATT_MODE;INFO;Battery mode is broadcasted at startup. P1: Mode;mission/power/P60DockHandler.h
|
||||
13202;0x3392;BATT_MODE_CHANGED;MEDIUM;Battery mode has changed. P1: Old mode. P2: New mode;mission/power/P60DockHandler.h
|
||||
|
|
@ -1,33 +1,147 @@
|
||||
from typing import Optional
|
||||
|
||||
from eive_tmtc.config.definitions import SPACE_PACKET_IDS
|
||||
from tmtccmd import HookBase, CcsdsTmtcBackend
|
||||
from prompt_toolkit.history import FileHistory
|
||||
from tmtccmd import CcsdsTmtcBackend, HookBase
|
||||
from tmtccmd.com import ComInterface
|
||||
from tmtccmd.config import TmtcDefinitionWrapper
|
||||
|
||||
from eive_tmtc.config.retvals import get_retval_dict
|
||||
from eive_tmtc.pus_tc.cmd_definitions import get_eive_service_op_code_dict
|
||||
from tmtccmd.config import CmdTreeNode
|
||||
from tmtccmd.config.hook import History
|
||||
from tmtccmd.util import ObjectIdDictT, RetvalDictT
|
||||
|
||||
from eive_tmtc.config.definitions import SPACE_PACKET_IDS
|
||||
from eive_tmtc.config.retvals import get_retval_dict
|
||||
from eive_tmtc.tmtc.acs.acs_board import create_acs_board_node
|
||||
from eive_tmtc.tmtc.acs.acs_ctrl import create_acs_ctrl_node
|
||||
from eive_tmtc.tmtc.acs.gps import create_gnss_node
|
||||
from eive_tmtc.tmtc.acs.gyros import create_gyros_node
|
||||
from eive_tmtc.tmtc.acs.imtq import create_mgt_node
|
||||
from eive_tmtc.tmtc.acs.mgms import create_mgms_node
|
||||
from eive_tmtc.tmtc.acs.reaction_wheels import (
|
||||
create_reaction_wheel_assembly_node,
|
||||
create_reaction_wheels_nodes,
|
||||
)
|
||||
from eive_tmtc.tmtc.acs.star_tracker import create_str_node
|
||||
from eive_tmtc.tmtc.acs.subsystem import create_acs_subsystem_node
|
||||
from eive_tmtc.tmtc.com.ccsds_handler import create_ccsds_node
|
||||
from eive_tmtc.tmtc.com.subsystem import create_com_subsystem_node
|
||||
from eive_tmtc.tmtc.com.syrlinks_handler import create_syrlinks_node
|
||||
from eive_tmtc.tmtc.core import create_core_node
|
||||
from eive_tmtc.tmtc.health import create_global_health_node
|
||||
from eive_tmtc.tmtc.payload.ploc_mpsoc import create_ploc_mpsoc_node
|
||||
from eive_tmtc.tmtc.payload.ploc_supervisor import create_ploc_supv_node
|
||||
from eive_tmtc.tmtc.payload.plpcdu import create_pl_pcdu_node
|
||||
from eive_tmtc.tmtc.payload.scex import create_scex_node
|
||||
from eive_tmtc.tmtc.payload.subsystem import create_payload_subsystem_node
|
||||
from eive_tmtc.tmtc.power.acu import create_acu_node
|
||||
from eive_tmtc.tmtc.power.bpx_batt import create_bpx_batt_node
|
||||
from eive_tmtc.tmtc.power.p60dock import create_p60_dock_node
|
||||
from eive_tmtc.tmtc.power.pdu1 import create_pdu1_node
|
||||
from eive_tmtc.tmtc.power.pdu2 import create_pdu2_node
|
||||
from eive_tmtc.tmtc.power.power import create_power_node
|
||||
from eive_tmtc.tmtc.power.pwr_ctrl import create_pwr_ctrl_node
|
||||
from eive_tmtc.tmtc.power.subsystem import create_eps_subsystem_node
|
||||
from eive_tmtc.tmtc.system import create_system_node
|
||||
from eive_tmtc.tmtc.tcs.ctrl import create_tcs_ctrl_node
|
||||
from eive_tmtc.tmtc.tcs.heater import create_heater_node
|
||||
from eive_tmtc.tmtc.tcs.rtd import create_rtd_node
|
||||
from eive_tmtc.tmtc.tcs.tmp1075 import create_tmp_sens_node
|
||||
from eive_tmtc.tmtc.test import create_test_node
|
||||
from eive_tmtc.tmtc.time import create_time_node
|
||||
from eive_tmtc.tmtc.tm_store import create_persistent_tm_store_node
|
||||
from eive_tmtc.tmtc.wdt import create_wdt_node
|
||||
|
||||
|
||||
class EiveHookObject(HookBase):
|
||||
def __init__(self, json_cfg_path: str):
|
||||
super().__init__(json_cfg_path=json_cfg_path)
|
||||
super().__init__(json_cfg_path)
|
||||
|
||||
def get_tmtc_definitions(self) -> TmtcDefinitionWrapper:
|
||||
return get_eive_service_op_code_dict()
|
||||
|
||||
def assign_communication_interface(self, com_if_key: str) -> Optional[ComInterface]:
|
||||
from tmtccmd.config.com import (
|
||||
create_com_interface_default,
|
||||
create_com_interface_cfg_default,
|
||||
def get_command_definitions(self) -> CmdTreeNode:
|
||||
root_node = CmdTreeNode.root_node()
|
||||
acs_node = create_acs_subsystem_node()
|
||||
acs_brd_assy_node = create_acs_board_node()
|
||||
acs_brd_assy_node.add_child(create_mgms_node())
|
||||
acs_brd_assy_node.add_child(create_gyros_node())
|
||||
acs_ctrl = create_acs_ctrl_node()
|
||||
rw_list = create_reaction_wheels_nodes()
|
||||
rws = CmdTreeNode("rws", "Reaction Wheel Devices")
|
||||
for rw in rw_list:
|
||||
rws.add_child(rw)
|
||||
rws.add_child(create_reaction_wheel_assembly_node())
|
||||
star_tracker = create_str_node()
|
||||
star_tracker_img_helper = CmdTreeNode(
|
||||
"str_img_helper", "Star Tracker Image Helper"
|
||||
)
|
||||
star_tracker.add_child(star_tracker_img_helper)
|
||||
gnss_devs = create_gnss_node()
|
||||
|
||||
acs_node.add_child(acs_brd_assy_node)
|
||||
acs_node.add_child(acs_ctrl)
|
||||
acs_node.add_child(rws)
|
||||
acs_node.add_child(create_mgt_node())
|
||||
acs_node.add_child(star_tracker)
|
||||
acs_node.add_child(gnss_devs)
|
||||
|
||||
tcs_node = CmdTreeNode("tcs", "TCS Subsystem")
|
||||
tmp_1075_node = create_tmp_sens_node()
|
||||
rtds_node = create_rtd_node()
|
||||
heaters_node = create_heater_node()
|
||||
tcs_ctrl = create_tcs_ctrl_node()
|
||||
tcs_node.add_child(rtds_node)
|
||||
tcs_node.add_child(tmp_1075_node)
|
||||
tcs_node.add_child(tcs_ctrl)
|
||||
tcs_node.add_child(heaters_node)
|
||||
tcs_brd_assy = CmdTreeNode("tcs_brd_assy", "TCS Board Assembly")
|
||||
tcs_node.add_child(tcs_brd_assy)
|
||||
|
||||
com_node = create_com_subsystem_node()
|
||||
com_node.add_child(create_syrlinks_node())
|
||||
com_node.add_child(create_ccsds_node())
|
||||
|
||||
eps_node = create_eps_subsystem_node()
|
||||
eps_node.add_child(create_pwr_ctrl_node())
|
||||
eps_node.add_child(create_power_node())
|
||||
eps_node.add_child(create_acu_node())
|
||||
eps_node.add_child(create_pdu1_node())
|
||||
eps_node.add_child(create_pdu2_node())
|
||||
eps_node.add_child(create_p60_dock_node())
|
||||
eps_node.add_child(create_bpx_batt_node())
|
||||
|
||||
payload_node = create_payload_subsystem_node()
|
||||
payload_node.add_child(create_pl_pcdu_node())
|
||||
payload_node.add_child(create_scex_node())
|
||||
payload_node.add_child(create_ploc_mpsoc_node())
|
||||
payload_node.add_child(create_ploc_supv_node())
|
||||
|
||||
obdh_node = CmdTreeNode("obdh", "OBDH Subsystem")
|
||||
obdh_node.add_child(create_wdt_node())
|
||||
obdh_node.add_child(create_core_node())
|
||||
obdh_node.add_child(create_time_node())
|
||||
obdh_node.add_child(create_persistent_tm_store_node())
|
||||
|
||||
root_node.add_child(create_test_node())
|
||||
root_node.add_child(create_system_node())
|
||||
root_node.add_child(create_global_health_node())
|
||||
root_node.add_child(acs_node)
|
||||
root_node.add_child(tcs_node)
|
||||
root_node.add_child(com_node)
|
||||
root_node.add_child(eps_node)
|
||||
root_node.add_child(payload_node)
|
||||
root_node.add_child(obdh_node)
|
||||
return root_node
|
||||
|
||||
def get_communication_interface(self, com_if_key: str) -> Optional[ComInterface]:
|
||||
from tmtccmd.config.com import (
|
||||
create_com_interface_cfg_default,
|
||||
create_com_interface_default,
|
||||
)
|
||||
|
||||
assert self.cfg_path is not None
|
||||
|
||||
cfg = create_com_interface_cfg_default(
|
||||
com_if_key=com_if_key,
|
||||
json_cfg_path=self.cfg_path,
|
||||
space_packet_ids=SPACE_PACKET_IDS,
|
||||
)
|
||||
assert cfg is not None
|
||||
return create_com_interface_default(cfg)
|
||||
|
||||
def perform_mode_operation(self, tmtc_backend: CcsdsTmtcBackend, mode: int):
|
||||
@ -42,3 +156,6 @@ class EiveHookObject(HookBase):
|
||||
|
||||
def get_retval_dict(self) -> RetvalDictT:
|
||||
return get_retval_dict()
|
||||
|
||||
def get_cmd_history(self) -> Optional[History]:
|
||||
return FileHistory(".tmtc-history.txt")
|
||||
|
@ -3,6 +3,7 @@
|
||||
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
|
||||
it to your needs.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os.path
|
||||
from typing import Dict
|
||||
|
@ -56,6 +56,7 @@
|
||||
0x44330015;PLOC_MPSOC_HANDLER
|
||||
0x44330016;PLOC_SUPERVISOR_HANDLER
|
||||
0x44330017;PLOC_SUPERVISOR_HELPER
|
||||
0x44330018;PLOC_MPSOC_COMMUNICATION
|
||||
0x44330032;SCEX
|
||||
0x444100A2;SOLAR_ARRAY_DEPL_HANDLER
|
||||
0x444100A4;HEATER_HANDLER
|
||||
|
|
@ -561,16 +561,17 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
|
||||
0x67a2;SADPL_MainSwitchTimeoutFailure;No description;162;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h
|
||||
0x67a3;SADPL_SwitchingDeplSa1Failed;No description;163;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h
|
||||
0x67a4;SADPL_SwitchingDeplSa2Failed;No description;164;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h
|
||||
0x68a0;MPSOCRTVIF_CrcFailure;Space Packet received from PLOC has invalid CRC;160;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
|
||||
0x68a1;MPSOCRTVIF_ReceivedAckFailure;Received ACK failure reply from PLOC;161;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
|
||||
0x68a2;MPSOCRTVIF_ReceivedExeFailure;Received execution failure reply from PLOC;162;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
|
||||
0x68a3;MPSOCRTVIF_InvalidApid;Received space packet with invalid APID from PLOC;163;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
|
||||
0x68a4;MPSOCRTVIF_InvalidLength;Received command with invalid length;164;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
|
||||
0x68a5;MPSOCRTVIF_FilenameTooLong;Filename of file in OBC filesystem is too long;165;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
|
||||
0x68a6;MPSOCRTVIF_MpsocHelperExecuting;MPSoC helper is currently executing a command;166;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
|
||||
0x68a7;MPSOCRTVIF_MpsocFilenameTooLong;Filename of MPSoC file is to long (max. 256 bytes);167;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
|
||||
0x68a8;MPSOCRTVIF_InvalidParameter;Command has invalid parameter;168;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
|
||||
0x68a9;MPSOCRTVIF_NameTooLong;Received command has file string with invalid length;169;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
|
||||
0x6810;MPSOCRTVIF_CommandTimeout;Command has timed out.;16;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
|
||||
0x68a0;MPSOCRTVIF_CrcFailure;Space Packet received from PLOC has invalid CRC;160;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
|
||||
0x68a1;MPSOCRTVIF_ReceivedAckFailure;Received ACK failure reply from PLOC;161;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
|
||||
0x68a2;MPSOCRTVIF_ReceivedExeFailure;Received execution failure reply from PLOC;162;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
|
||||
0x68a3;MPSOCRTVIF_InvalidApid;Received space packet with invalid APID from PLOC;163;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
|
||||
0x68a4;MPSOCRTVIF_InvalidLength;Received command with invalid length;164;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
|
||||
0x68a5;MPSOCRTVIF_FilenameTooLong;Filename of file in OBC filesystem is too long;165;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
|
||||
0x68a6;MPSOCRTVIF_MpsocHelperExecuting;MPSoC helper is currently executing a command;166;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
|
||||
0x68a7;MPSOCRTVIF_MpsocFilenameTooLong;Filename of MPSoC file is to long (max. 256 bytes);167;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
|
||||
0x68a8;MPSOCRTVIF_InvalidParameter;Command has invalid parameter;168;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
|
||||
0x68a9;MPSOCRTVIF_NameTooLong;Received command has file string with invalid length;169;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
|
||||
0x69a0;SPVRTVIF_CrcFailure;Space Packet received from PLOC supervisor has invalid CRC;160;SUPV_RETURN_VALUES_IF;linux/payload/plocSupvDefs.h
|
||||
0x69a1;SPVRTVIF_InvalidServiceId;No description;161;SUPV_RETURN_VALUES_IF;linux/payload/plocSupvDefs.h
|
||||
0x69a2;SPVRTVIF_ReceivedAckFailure;Received ACK failure reply from PLOC supervisor;162;SUPV_RETURN_VALUES_IF;linux/payload/plocSupvDefs.h
|
||||
@ -626,4 +627,7 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
|
||||
0x6f02;TMS_NoWriteActive;No description;2;TM_SINK;mission/tmtc/DirectTmSinkIF.h
|
||||
0x6f03;TMS_Timeout;No description;3;TM_SINK;mission/tmtc/DirectTmSinkIF.h
|
||||
0x7000;VCS_ChannelDoesNotExist;No description;0;VIRTUAL_CHANNEL;mission/com/VirtualChannel.h
|
||||
0x7200;SCBU_KeyNotFound;No description;0;SCRATCH_BUFFER;bsp_q7s/memory/scratchApi.h
|
||||
0x7100;PLMPCOM_PacketReceived;No description;0;PLOC_MPSOC_COM;linux/payload/MpsocCommunication.h
|
||||
0x7101;PLMPCOM_FaultyPacketSize;No description;1;PLOC_MPSOC_COM;linux/payload/MpsocCommunication.h
|
||||
0x7102;PLMPCOM_CrcCheckFailed;No description;2;PLOC_MPSOC_COM;linux/payload/MpsocCommunication.h
|
||||
0x7300;SCBU_KeyNotFound;No description;0;SCRATCH_BUFFER;bsp_q7s/memory/scratchApi.h
|
||||
|
|
@ -1,21 +0,0 @@
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry, CoreServiceList
|
||||
from tmtccmd.config.tmtc import (
|
||||
call_all_definitions_providers,
|
||||
)
|
||||
from tmtccmd.config.globals import get_default_tmtc_defs
|
||||
|
||||
|
||||
def get_eive_service_op_code_dict() -> TmtcDefinitionWrapper:
|
||||
"""Call all registered TMTC definition providers. They were registered using
|
||||
the :py:func:`tmtc_definitions_provider` decorator.
|
||||
"""
|
||||
def_wrapper = get_default_tmtc_defs()
|
||||
srv_5 = OpCodeEntry()
|
||||
srv_5.add("0", "Event Test")
|
||||
def_wrapper.add_service(
|
||||
name=CoreServiceList.SERVICE_5.value,
|
||||
info="PUS Service 5 Event",
|
||||
op_code_entry=srv_5,
|
||||
)
|
||||
call_all_definitions_providers(def_wrapper)
|
||||
return def_wrapper
|
309
eive_tmtc/pus_tc/cmd_demux.py
Normal file
309
eive_tmtc/pus_tc/cmd_demux.py
Normal file
@ -0,0 +1,309 @@
|
||||
"""Hook function which packs telecommands based on service and operation code string
|
||||
"""
|
||||
|
||||
import logging
|
||||
from typing import List, cast
|
||||
|
||||
from tmtccmd import TreeCommandingProcedure
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
import eive_tmtc.config.object_ids as oids
|
||||
from eive_tmtc.config.object_ids import (
|
||||
ACU_HANDLER_ID,
|
||||
CCSDS_HANDLER_ID,
|
||||
HEATER_CONTROLLER_ID,
|
||||
IMTQ_HANDLER_ID,
|
||||
P60_DOCK_HANDLER,
|
||||
PDEC_HANDLER_ID,
|
||||
PDU_1_HANDLER_ID,
|
||||
PDU_2_HANDLER_ID,
|
||||
RAD_SENSOR_ID,
|
||||
RW1_ID,
|
||||
RW2_ID,
|
||||
RW3_ID,
|
||||
RW4_ID,
|
||||
RW_ASSEMBLY,
|
||||
STAR_TRACKER_ID,
|
||||
STR_IMG_HELPER_ID,
|
||||
SYRLINKS_HANDLER_ID,
|
||||
TMP1075_HANDLER_IF_BRD_ID,
|
||||
TMP1075_HANDLER_PLPCDU_0_ID,
|
||||
TMP1075_HANDLER_TCS_BRD_0_ID,
|
||||
TMP1075_HANDLER_TCS_BRD_1_ID,
|
||||
get_object_ids,
|
||||
)
|
||||
from eive_tmtc.tmtc.acs.acs_board import pack_acs_board_command
|
||||
from eive_tmtc.tmtc.acs.acs_ctrl import pack_acs_ctrl_command
|
||||
from eive_tmtc.tmtc.acs.gps import pack_gps_command
|
||||
from eive_tmtc.tmtc.acs.gyros import handle_gyr_cmd
|
||||
from eive_tmtc.tmtc.acs.imtq import create_imtq_command
|
||||
from eive_tmtc.tmtc.acs.mgms import handle_mgm_cmd
|
||||
from eive_tmtc.tmtc.acs.reaction_wheels import (
|
||||
create_single_rw_cmd,
|
||||
pack_rw_ass_cmds,
|
||||
)
|
||||
from eive_tmtc.tmtc.acs.star_tracker import pack_star_tracker_commands
|
||||
from eive_tmtc.tmtc.acs.str_img_helper import pack_str_img_helper_command
|
||||
from eive_tmtc.tmtc.acs.subsystem import build_acs_subsystem_cmd
|
||||
from eive_tmtc.tmtc.com.ccsds_handler import pack_ccsds_handler_command
|
||||
from eive_tmtc.tmtc.com.pdec_handler import pack_pdec_handler_commands
|
||||
from eive_tmtc.tmtc.com.subsystem import build_com_subsystem_procedure
|
||||
from eive_tmtc.tmtc.com.syrlinks_handler import pack_syrlinks_command
|
||||
from eive_tmtc.tmtc.core import pack_core_commands
|
||||
from eive_tmtc.tmtc.health import build_health_cmds
|
||||
from eive_tmtc.tmtc.payload.subsystem import create_payload_subsystem_cmd
|
||||
from eive_tmtc.tmtc.payload.ploc_mpsoc import pack_ploc_mpsoc_commands
|
||||
from eive_tmtc.tmtc.payload.ploc_supervisor import pack_ploc_supv_commands
|
||||
from eive_tmtc.tmtc.payload.plpcdu import pack_pl_pcdu_commands
|
||||
from eive_tmtc.tmtc.payload.rad_sensor import create_rad_sensor_cmd
|
||||
from eive_tmtc.tmtc.payload.scex import pack_scex_cmds
|
||||
from eive_tmtc.tmtc.power.acu import pack_acu_commands
|
||||
from eive_tmtc.tmtc.power.p60dock import pack_p60dock_cmds
|
||||
from eive_tmtc.tmtc.power.pdu1 import pack_pdu1_commands
|
||||
from eive_tmtc.tmtc.power.pdu2 import pack_pdu2_commands
|
||||
from eive_tmtc.tmtc.power.power import pack_power_commands
|
||||
from eive_tmtc.tmtc.power.pwr_ctrl import pack_power_ctrl_command
|
||||
from eive_tmtc.tmtc.system import build_system_cmds
|
||||
from eive_tmtc.tmtc.tcs.ctrl import pack_tcs_ctrl_commands
|
||||
from eive_tmtc.tmtc.tcs.heater import pack_heater_cmds
|
||||
from eive_tmtc.tmtc.tcs.rtd import pack_rtd_commands
|
||||
from eive_tmtc.tmtc.tcs.subsystem import pack_tcs_sys_commands
|
||||
from eive_tmtc.tmtc.tcs.tmp1075 import pack_tmp1075_test_into
|
||||
from eive_tmtc.tmtc.test import build_test_commands
|
||||
from eive_tmtc.tmtc.time import pack_time_management_cmd
|
||||
from eive_tmtc.tmtc.tm_store import pack_tm_store_commands
|
||||
from eive_tmtc.tmtc.wdt import pack_wdt_commands
|
||||
from eive_tmtc.utility.input_helper import InputHelper
|
||||
|
||||
|
||||
def handle_pus_procedure(
|
||||
info: TreeCommandingProcedure,
|
||||
queue_helper: DefaultPusQueueHelper,
|
||||
):
|
||||
cmd_path = info.cmd_path
|
||||
assert cmd_path is not None
|
||||
cmd_path_list = cmd_path.split("/")
|
||||
if cmd_path_list[0] == "":
|
||||
cmd_path_list = cmd_path_list[1:]
|
||||
if len(cmd_path_list) == 0:
|
||||
raise ValueError(
|
||||
"command path list empty. Full command path {cmd_path} might have invalid format"
|
||||
)
|
||||
if cmd_path_list[0] == "system":
|
||||
assert len(cmd_path_list) >= 1
|
||||
return build_system_cmds(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "health":
|
||||
assert len(cmd_path_list) >= 1
|
||||
return build_health_cmds(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "eps":
|
||||
return handle_eps_procedure(queue_helper, cmd_path_list[1:])
|
||||
if cmd_path_list[0] == "tcs":
|
||||
return handle_tcs_procedure(queue_helper, cmd_path_list[1:])
|
||||
if cmd_path_list[0] == "acs":
|
||||
return handle_acs_procedure(queue_helper, cmd_path_list[1:])
|
||||
if cmd_path_list[0] == "payload":
|
||||
return handle_payload_procedure(queue_helper, cmd_path_list[1:])
|
||||
if cmd_path_list[0] == "obdh":
|
||||
return handle_obdh_procedure(queue_helper, cmd_path_list[1:])
|
||||
if cmd_path_list[0] == "test":
|
||||
assert len(cmd_path_list) >= 1
|
||||
return build_test_commands(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "com":
|
||||
return handle_com_procedure(queue_helper, cmd_path_list[1:])
|
||||
logging.getLogger(__name__).warning(
|
||||
f"invalid or unimplemented command path {cmd_path}"
|
||||
)
|
||||
|
||||
|
||||
def handle_eps_procedure(queue_helper: DefaultPusQueueHelper, cmd_path_list: List[str]):
|
||||
obj_id_man = get_object_ids()
|
||||
assert len(cmd_path_list) >= 1
|
||||
if cmd_path_list[0] == "power":
|
||||
return pack_power_commands(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "pwr_ctrl":
|
||||
return pack_power_ctrl_command(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "p60_dock":
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(P60_DOCK_HANDLER))
|
||||
return pack_p60dock_cmds(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
if cmd_path_list[0] == "pdu1":
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(PDU_1_HANDLER_ID))
|
||||
return pack_pdu1_commands(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
if cmd_path_list[0] == "pdu2":
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(PDU_2_HANDLER_ID))
|
||||
return pack_pdu2_commands(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
if cmd_path_list[0] == "acu":
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(ACU_HANDLER_ID))
|
||||
return pack_acu_commands(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
|
||||
|
||||
def handle_tcs_procedure(queue_helper: DefaultPusQueueHelper, cmd_path_list: List[str]):
|
||||
obj_id_man = get_object_ids()
|
||||
if len(cmd_path_list) == 1:
|
||||
return pack_tcs_sys_commands(q=queue_helper, cmd_str=cmd_path_list[0])
|
||||
assert len(cmd_path_list) >= 2
|
||||
if cmd_path_list[0] == "tcs_brd_assy":
|
||||
return pack_tcs_sys_commands(q=queue_helper, cmd_str=cmd_path_list[1])
|
||||
if cmd_path_list[0] == "rtd_devs":
|
||||
assert len(cmd_path_list) >= 2
|
||||
return pack_rtd_commands(
|
||||
object_id=None, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
if cmd_path_list[0] == "tcs_ctrl":
|
||||
assert len(cmd_path_list) >= 2
|
||||
return pack_tcs_ctrl_commands(q=queue_helper, cmd_str=cmd_path_list[2])
|
||||
if cmd_path_list[0] == "tmp1075_devs":
|
||||
menu_dict = {
|
||||
"0": ("TMP1075 TCS Board 0", TMP1075_HANDLER_TCS_BRD_0_ID),
|
||||
"1": ("TMP1075 TCS Board 1", TMP1075_HANDLER_TCS_BRD_1_ID),
|
||||
"2": ("TMP1075 PL PCDU 0", TMP1075_HANDLER_PLPCDU_0_ID),
|
||||
"3": ("TMP1075 PL PCDU 1", oids.TMP1075_HANDLER_PLPCDU_1_ID),
|
||||
"4": ("TMP1075 IF Board", TMP1075_HANDLER_IF_BRD_ID),
|
||||
}
|
||||
input_helper = InputHelper(menu_dict)
|
||||
tmp_select = input_helper.get_key()
|
||||
assert len(cmd_path_list) >= 2
|
||||
object_id = obj_id_man.get(menu_dict[tmp_select][1])
|
||||
assert object_id is not None
|
||||
return pack_tmp1075_test_into(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
if cmd_path_list[0] == "heaters":
|
||||
object_id = HEATER_CONTROLLER_ID
|
||||
return pack_heater_cmds(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
|
||||
|
||||
def handle_acs_procedure(queue_helper: DefaultPusQueueHelper, cmd_path_list: List[str]):
|
||||
obj_id_man = get_object_ids()
|
||||
if len(cmd_path_list) == 1:
|
||||
return build_acs_subsystem_cmd(queue_helper, cmd_path_list[0])
|
||||
assert len(cmd_path_list) >= 2
|
||||
if cmd_path_list[0] == "mgt":
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(IMTQ_HANDLER_ID))
|
||||
return create_imtq_command(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
if cmd_path_list[0] == "str":
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(STAR_TRACKER_ID))
|
||||
return pack_star_tracker_commands(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
|
||||
if cmd_path_list[0] == "rws":
|
||||
assert len(cmd_path_list) >= 2
|
||||
if cmd_path_list[1] == "rw_assy":
|
||||
assert len(cmd_path_list) >= 3
|
||||
return pack_rw_ass_cmds(
|
||||
q=queue_helper, object_id=RW_ASSEMBLY, cmd_str=cmd_path_list[2]
|
||||
)
|
||||
if cmd_path_list[1] == "rw_1":
|
||||
assert len(cmd_path_list) >= 3
|
||||
return create_single_rw_cmd(
|
||||
object_id=RW1_ID, rw_idx=1, q=queue_helper, cmd_str=cmd_path_list[2]
|
||||
)
|
||||
if cmd_path_list[1] == "rw_2":
|
||||
assert len(cmd_path_list) >= 3
|
||||
return create_single_rw_cmd(
|
||||
object_id=RW2_ID, rw_idx=2, q=queue_helper, cmd_str=cmd_path_list[2]
|
||||
)
|
||||
if cmd_path_list[1] == "rw_3":
|
||||
assert len(cmd_path_list) >= 3
|
||||
return create_single_rw_cmd(
|
||||
object_id=RW3_ID, rw_idx=3, q=queue_helper, cmd_str=cmd_path_list[2]
|
||||
)
|
||||
if cmd_path_list[1] == "rw_4":
|
||||
assert len(cmd_path_list) >= 3
|
||||
return create_single_rw_cmd(
|
||||
object_id=RW4_ID, rw_idx=4, q=queue_helper, cmd_str=cmd_path_list[2]
|
||||
)
|
||||
|
||||
if cmd_path_list[0] == "gnss_ctrl":
|
||||
return pack_gps_command(
|
||||
object_id=oids.GPS_CONTROLLER, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
if cmd_path_list[0] == "acs_brd_assy":
|
||||
if len(cmd_path_list) == 2:
|
||||
return pack_acs_board_command(q=queue_helper, cmd_str=cmd_path_list[1])
|
||||
else:
|
||||
if cmd_path_list[1] == "mgm_devs":
|
||||
return handle_mgm_cmd(q=queue_helper, cmd_str=cmd_path_list[2])
|
||||
if cmd_path_list[1] == "gyro_devs":
|
||||
assert len(cmd_path_list) >= 3
|
||||
return handle_gyr_cmd(q=queue_helper, cmd_str=cmd_path_list[2])
|
||||
if cmd_path_list[0] == "str_img_helper":
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(STR_IMG_HELPER_ID))
|
||||
return pack_str_img_helper_command(
|
||||
object_id=object_id, q=queue_helper, op_code=cmd_path_list[1]
|
||||
)
|
||||
if cmd_path_list[0] == "acs_ctrl":
|
||||
return pack_acs_ctrl_command(queue_helper, cmd_path_list[1])
|
||||
|
||||
|
||||
def handle_payload_procedure(
|
||||
queue_helper: DefaultPusQueueHelper, cmd_path_list: List[str]
|
||||
):
|
||||
obj_id_man = get_object_ids()
|
||||
if cmd_path_list[0] == "subsystem":
|
||||
return create_payload_subsystem_cmd(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "ploc_mpsoc":
|
||||
return pack_ploc_mpsoc_commands(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "ploc_supv":
|
||||
return pack_ploc_supv_commands(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "rad_sensor":
|
||||
assert len(cmd_path_list) >= 3
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(RAD_SENSOR_ID))
|
||||
return create_rad_sensor_cmd(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||
)
|
||||
if cmd_path_list[0] == "pl_pcdu":
|
||||
return pack_pl_pcdu_commands(q=queue_helper, cmd_str=cmd_path_list[1])
|
||||
if cmd_path_list[0] == "scex":
|
||||
return pack_scex_cmds(
|
||||
cmd_str=cmd_path_list[1],
|
||||
q=queue_helper,
|
||||
)
|
||||
|
||||
|
||||
def handle_obdh_procedure(
|
||||
queue_helper: DefaultPusQueueHelper, cmd_path_list: List[str]
|
||||
):
|
||||
assert len(cmd_path_list) >= 2
|
||||
if cmd_path_list[0] == "core":
|
||||
return pack_core_commands(q=queue_helper, cmd_str=cmd_path_list[1])
|
||||
if cmd_path_list[0] == "xiphos_wdt":
|
||||
return pack_wdt_commands(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "time":
|
||||
return pack_time_management_cmd(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "tm_store":
|
||||
return pack_tm_store_commands(queue_helper, cmd_path_list[1])
|
||||
|
||||
|
||||
def handle_com_procedure(queue_helper: DefaultPusQueueHelper, cmd_path_list: List[str]):
|
||||
obj_id_man = get_object_ids()
|
||||
if len(cmd_path_list) == 1:
|
||||
return build_com_subsystem_procedure(queue_helper, cmd_path_list[0])
|
||||
assert len(cmd_path_list) >= 2
|
||||
if cmd_path_list[0] == "ccsds":
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(CCSDS_HANDLER_ID))
|
||||
return pack_ccsds_handler_command(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[2]
|
||||
)
|
||||
if cmd_path_list[0] == "pdec":
|
||||
return pack_pdec_handler_commands(
|
||||
object_id=PDEC_HANDLER_ID, q=queue_helper, cmd_str=cmd_path_list[2]
|
||||
)
|
||||
if cmd_path_list[0] == "syrlinks":
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(SYRLINKS_HANDLER_ID))
|
||||
return pack_syrlinks_command(
|
||||
object_id=object_id, q=queue_helper, cmd_str=cmd_path_list[2]
|
||||
)
|
@ -1,220 +0,0 @@
|
||||
"""Hook function which packs telecommands based on service and operation code string
|
||||
"""
|
||||
import logging
|
||||
from typing import cast
|
||||
|
||||
from eive_tmtc.tmtc.acs.gyros import handle_gyr_cmd
|
||||
from eive_tmtc.tmtc.acs.mgms import handle_mgm_cmd
|
||||
from eive_tmtc.tmtc.power.power import pack_power_commands
|
||||
from eive_tmtc.tmtc.tcs.ctrl import pack_tcs_ctrl_commands
|
||||
from eive_tmtc.tmtc.tcs.rtd import pack_rtd_commands
|
||||
from eive_tmtc.tmtc.payload.scex import pack_scex_cmds
|
||||
from eive_tmtc.tmtc.tcs.subsystem import pack_tcs_sys_commands
|
||||
from tmtccmd import DefaultProcedureInfo, TcHandlerBase
|
||||
from tmtccmd.config import CoreServiceList
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.tmtc.decorator import (
|
||||
route_to_registered_service_handlers,
|
||||
ServiceProviderParams,
|
||||
)
|
||||
|
||||
from eive_tmtc.tmtc.misc.s200_test import pack_service_200_test_into
|
||||
from eive_tmtc.tmtc.power.p60dock import pack_p60dock_cmds
|
||||
from eive_tmtc.tmtc.power.pdu2 import pack_pdu2_commands
|
||||
from eive_tmtc.tmtc.power.pdu1 import pack_pdu1_commands
|
||||
from eive_tmtc.tmtc.power.acu import pack_acu_commands
|
||||
from eive_tmtc.tmtc.acs.imtq import pack_imtq_test_into
|
||||
from eive_tmtc.tmtc.tcs.heater import pack_heater_cmds
|
||||
from eive_tmtc.tmtc.acs.reaction_wheels import (
|
||||
pack_single_rw_test_into,
|
||||
pack_rw_ass_cmds,
|
||||
)
|
||||
from eive_tmtc.tmtc.payload.ploc_memory_dumper import pack_ploc_memory_dumper_cmd
|
||||
from eive_tmtc.tmtc.com.ccsds_handler import pack_ccsds_handler_command
|
||||
from eive_tmtc.tmtc.core import pack_core_commands
|
||||
from eive_tmtc.tmtc.acs.star_tracker import pack_star_tracker_commands
|
||||
from eive_tmtc.tmtc.com.syrlinks_handler import pack_syrlinks_command
|
||||
from eive_tmtc.tmtc.com.pdec_handler import pack_pdec_handler_test
|
||||
from eive_tmtc.tmtc.wdt import pack_wdt_commands
|
||||
from eive_tmtc.tmtc.acs.acs_board import pack_acs_command
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import (
|
||||
P60_DOCK_HANDLER,
|
||||
PDU_1_HANDLER_ID,
|
||||
PDU_2_HANDLER_ID,
|
||||
ACU_HANDLER_ID,
|
||||
TMP1075_HANDLER_TCS_BRD_0_ID,
|
||||
TMP1075_HANDLER_TCS_BRD_1_ID,
|
||||
TMP1075_HANDLER_PLPCDU_0_ID,
|
||||
TMP1075_HANDLER_IF_BRD_ID,
|
||||
HEATER_CONTROLLER_ID,
|
||||
IMTQ_HANDLER_ID,
|
||||
RW1_ID,
|
||||
RW2_ID,
|
||||
RW3_ID,
|
||||
RW4_ID,
|
||||
RAD_SENSOR_ID,
|
||||
STAR_TRACKER_ID,
|
||||
PLOC_MEMORY_DUMPER_ID,
|
||||
CCSDS_HANDLER_ID,
|
||||
PDEC_HANDLER_ID,
|
||||
STR_IMG_HELPER_ID,
|
||||
SYRLINKS_HANDLER_ID,
|
||||
RW_ASSEMBLY,
|
||||
get_object_ids,
|
||||
)
|
||||
|
||||
from eive_tmtc.tmtc.tcs.tmp1075 import pack_tmp1075_test_into
|
||||
from eive_tmtc.tmtc.acs.gps import pack_gps_command
|
||||
from eive_tmtc.tmtc.payload.rad_sensor import pack_rad_sensor_test_into
|
||||
from eive_tmtc.tmtc.payload.plpcdu import pack_pl_pcdu_commands
|
||||
from eive_tmtc.tmtc.acs.str_img_helper import pack_str_img_helper_command
|
||||
from eive_tmtc.pus_tc.system.proc import pack_proc_commands
|
||||
|
||||
import eive_tmtc.config.object_ids as oids
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
from eive_tmtc.utility.input_helper import InputHelper
|
||||
|
||||
|
||||
def handle_default_procedure( # noqa C901: Complexity okay here.
|
||||
tc_base: TcHandlerBase,
|
||||
info: DefaultProcedureInfo,
|
||||
queue_helper: DefaultPusQueueHelper,
|
||||
):
|
||||
service = info.service
|
||||
op_code = info.op_code
|
||||
obj_id_man = get_object_ids()
|
||||
if service == CoreServiceList.SERVICE_200.value:
|
||||
return pack_service_200_test_into(q=queue_helper)
|
||||
if service == CustomServiceList.P60DOCK.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(P60_DOCK_HANDLER))
|
||||
return pack_p60dock_cmds(object_id=object_id, q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.RTD.value:
|
||||
return pack_rtd_commands(object_id=None, q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.PDU1.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(PDU_1_HANDLER_ID))
|
||||
return pack_pdu1_commands(object_id=object_id, q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.PDU2.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(PDU_2_HANDLER_ID))
|
||||
return pack_pdu2_commands(object_id=object_id, q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.ACU.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(ACU_HANDLER_ID))
|
||||
return pack_acu_commands(object_id=object_id, q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.TCS_SS.value:
|
||||
return pack_tcs_sys_commands(q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.TCS_CTRL.value:
|
||||
return pack_tcs_ctrl_commands(q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.TMP1075.value:
|
||||
menu_dict = {
|
||||
"0": ("TMP1075 TCS Board 0", TMP1075_HANDLER_TCS_BRD_0_ID),
|
||||
"1": ("TMP1075 TCS Board 1", TMP1075_HANDLER_TCS_BRD_1_ID),
|
||||
"2": ("TMP1075 PL PCDU 0", TMP1075_HANDLER_PLPCDU_0_ID),
|
||||
"3": ("TMP1075 PL PCDU 1", oids.TMP1075_HANDLER_PLPCDU_1_ID),
|
||||
"4": ("TMP1075 IF Board", TMP1075_HANDLER_IF_BRD_ID),
|
||||
}
|
||||
input_helper = InputHelper(menu_dict)
|
||||
tmp_select = input_helper.get_key()
|
||||
object_id = obj_id_man.get(menu_dict[tmp_select][1])
|
||||
return pack_tmp1075_test_into(
|
||||
object_id=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.HEATER.value:
|
||||
object_id = HEATER_CONTROLLER_ID
|
||||
return pack_heater_cmds(object_id=object_id, q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.IMTQ.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(IMTQ_HANDLER_ID))
|
||||
return pack_imtq_test_into(object_id=object_id, q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.REACTION_WHEEL_1.value:
|
||||
return pack_single_rw_test_into(
|
||||
object_id=RW1_ID, rw_idx=1, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.REACTION_WHEEL_2.value:
|
||||
return pack_single_rw_test_into(
|
||||
object_id=RW2_ID, rw_idx=2, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.REACTION_WHEEL_3.value:
|
||||
return pack_single_rw_test_into(
|
||||
object_id=RW3_ID, rw_idx=3, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.REACTION_WHEEL_4.value:
|
||||
return pack_single_rw_test_into(
|
||||
object_id=RW4_ID, rw_idx=4, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.MGMS.value:
|
||||
return handle_mgm_cmd(q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.RAD_SENSOR.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(RAD_SENSOR_ID))
|
||||
return pack_rad_sensor_test_into(
|
||||
object_id=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.STAR_TRACKER.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(STAR_TRACKER_ID))
|
||||
return pack_star_tracker_commands(
|
||||
object_id=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.STR_IMG_HELPER.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(STR_IMG_HELPER_ID))
|
||||
return pack_str_img_helper_command(
|
||||
object_id=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.CORE.value:
|
||||
return pack_core_commands(q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.PLOC_MEMORY_DUMPER.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(PLOC_MEMORY_DUMPER_ID))
|
||||
return pack_ploc_memory_dumper_cmd(
|
||||
object_id=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.POWER.value:
|
||||
return pack_power_commands(queue_helper, op_code)
|
||||
if service == CustomServiceList.ACS.value:
|
||||
return pack_acs_command(q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.GPS_CTRL.value:
|
||||
return pack_gps_command(
|
||||
object_id=oids.GPS_CONTROLLER, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.CCSDS_HANDLER.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(CCSDS_HANDLER_ID))
|
||||
return pack_ccsds_handler_command(
|
||||
object_id=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.PDEC_HANDLER.value:
|
||||
return pack_pdec_handler_test(
|
||||
object_id=PDEC_HANDLER_ID, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.SYRLINKS.value:
|
||||
object_id = cast(ObjectIdU32, obj_id_man.get(SYRLINKS_HANDLER_ID))
|
||||
return pack_syrlinks_command(
|
||||
object_id=object_id, q=queue_helper, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.GYRO.value:
|
||||
return handle_gyr_cmd(q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.PROCEDURE.value:
|
||||
return pack_proc_commands(q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.PL_PCDU.value:
|
||||
return pack_pl_pcdu_commands(q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.TCS_ASS.value:
|
||||
return pack_tcs_sys_commands(q=queue_helper, op_code=op_code)
|
||||
if service == CustomServiceList.RW_ASSEMBLY.value:
|
||||
return pack_rw_ass_cmds(q=queue_helper, object_id=RW_ASSEMBLY, op_code=op_code)
|
||||
if service == CustomServiceList.SCEX.value:
|
||||
return pack_scex_cmds(
|
||||
ServiceProviderParams(
|
||||
handler_base=tc_base,
|
||||
op_code=op_code,
|
||||
info=info,
|
||||
queue_helper=queue_helper,
|
||||
)
|
||||
)
|
||||
if service == CustomServiceList.XIPHOS_WDT.value:
|
||||
return pack_wdt_commands(queue_helper, op_code)
|
||||
if not route_to_registered_service_handlers(
|
||||
service,
|
||||
ServiceProviderParams(
|
||||
handler_base=tc_base,
|
||||
op_code=op_code,
|
||||
info=info,
|
||||
queue_helper=queue_helper,
|
||||
),
|
||||
):
|
||||
logging.getLogger(__name__).warning(f"Invalid Service {service}")
|
@ -34,9 +34,9 @@ from eive_tmtc.pus_tc.system.controllers import (
|
||||
pack_cmd_ctrl_to_off,
|
||||
pack_cmd_ctrl_to_nml,
|
||||
)
|
||||
from eive_tmtc.tmtc.acs.acs_board import pack_acs_command
|
||||
from eive_tmtc.tmtc.acs.acs_board import pack_acs_board_command
|
||||
from eive_tmtc.tmtc.acs.sus_board import pack_sus_cmds
|
||||
from eive_tmtc.tmtc.acs.imtq import pack_imtq_test_into, pack_dipole_command
|
||||
from eive_tmtc.tmtc.acs.imtq import create_imtq_command, pack_dipole_command
|
||||
from eive_tmtc.tmtc.acs.star_tracker import pack_star_tracker_commands
|
||||
from eive_tmtc.tmtc.acs.reaction_wheels import pack_rw_ass_cmds, pack_set_speed_command
|
||||
|
||||
@ -312,7 +312,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
# Enable scheduling
|
||||
q.add_pus_tc(create_enable_tc_sched_cmd())
|
||||
# check whether tcs_assembly also has to be commanded to NORMAL Mode
|
||||
pack_tcs_sys_commands(q=q, op_code=TcsOpCodes.TCS_BOARD_ASS_NORMAL[0])
|
||||
pack_tcs_sys_commands(q=q, cmd_str=TcsOpCodes.TCS_BOARD_ASS_NORMAL[0])
|
||||
pack_cmd_ctrl_to_nml(q=q, object_id=obj_id_dict.get(oids.THERMAL_CONTROLLER_ID))
|
||||
|
||||
if op_code in OpCode.TV_TEARDOWN_TCS_FT_OFF:
|
||||
@ -337,7 +337,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
]
|
||||
d_side_pairs = a_side_pairs + b_side_pairs
|
||||
diag_list = [False, False, True, False, False]
|
||||
pack_acs_command(q=q, op_code="acs-a")
|
||||
pack_acs_board_command(q=q, cmd_str="acs-a")
|
||||
|
||||
for a_side_dev in a_side_pairs:
|
||||
oid = a_side_dev[0]
|
||||
@ -351,9 +351,9 @@ def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_acs_command(q=q, op_code="acs-off")
|
||||
pack_acs_board_command(q=q, cmd_str="acs-off")
|
||||
q.add_wait_seconds(5.0)
|
||||
pack_acs_command(q=q, op_code="acs-b")
|
||||
pack_acs_board_command(q=q, cmd_str="acs-b")
|
||||
|
||||
sid_list.clear()
|
||||
diag_list = [False, False, True, False, False]
|
||||
@ -370,9 +370,9 @@ def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_acs_command(q=q, op_code="acs-off")
|
||||
pack_acs_board_command(q=q, cmd_str="acs-off")
|
||||
q.add_wait_seconds(5.0)
|
||||
pack_acs_command(q=q, op_code="acs-d")
|
||||
pack_acs_board_command(q=q, cmd_str="acs-d")
|
||||
|
||||
sid_list.clear()
|
||||
|
||||
@ -400,7 +400,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_acs_command(q=q, op_code="acs-off")
|
||||
pack_acs_board_command(q=q, cmd_str="acs-off")
|
||||
|
||||
if op_code in OpCode.MGT_FT:
|
||||
key = KAI.MGT_FT[0]
|
||||
@ -416,10 +416,10 @@ def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
]
|
||||
|
||||
# Command MGT to mode on
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="1")
|
||||
create_imtq_command(oids.IMTQ_HANDLER_ID, q=q, cmd_str="1")
|
||||
q.add_wait_seconds(5.0)
|
||||
# Command MGT to normal mode
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="2")
|
||||
create_imtq_command(oids.IMTQ_HANDLER_ID, q=q, cmd_str="2")
|
||||
|
||||
for imtq_dev in imtq_pairs:
|
||||
oid = imtq_dev[0]
|
||||
@ -433,7 +433,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="0")
|
||||
create_imtq_command(oids.IMTQ_HANDLER_ID, q=q, cmd_str="0")
|
||||
|
||||
if op_code in OpCode.MGT_FT_DP:
|
||||
key = KAI.MGT_FT_DP[0]
|
||||
@ -472,12 +472,12 @@ def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
True,
|
||||
True,
|
||||
]
|
||||
pack_acs_command(q=q, op_code="acs-d")
|
||||
pack_acs_board_command(q=q, cmd_str="acs-d")
|
||||
# Command MGT to mode on
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="1")
|
||||
create_imtq_command(oids.IMTQ_HANDLER_ID, q=q, cmd_str="1")
|
||||
q.add_wait_seconds(20.0)
|
||||
# Command MGT to normal mode
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="2")
|
||||
create_imtq_command(oids.IMTQ_HANDLER_ID, q=q, cmd_str="2")
|
||||
|
||||
for d_side_and_imtq_dev in d_side_and_imtq_pairs:
|
||||
oid = d_side_and_imtq_dev[0]
|
||||
@ -494,8 +494,8 @@ def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
cfg=cfg,
|
||||
)
|
||||
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="0")
|
||||
pack_acs_command(q=q, op_code="acs-off")
|
||||
create_imtq_command(oids.IMTQ_HANDLER_ID, q=q, cmd_str="0")
|
||||
pack_acs_board_command(q=q, cmd_str="acs-off")
|
||||
|
||||
if op_code in OpCode.SUS_FT:
|
||||
key = KAI.SUS_FT[0]
|
||||
@ -538,7 +538,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_acs_command(q=q, op_code="sus-off")
|
||||
pack_acs_board_command(q=q, cmd_str="sus-off")
|
||||
q.add_wait_seconds(5.0)
|
||||
pack_sus_cmds(q=q, op_code="sus-red")
|
||||
|
||||
@ -562,7 +562,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_acs_command(q=q, op_code="sus-off")
|
||||
pack_acs_board_command(q=q, cmd_str="sus-off")
|
||||
q.add_wait_seconds(5.0)
|
||||
pack_sus_cmds(q=q, op_code="sus-d")
|
||||
|
||||
@ -593,7 +593,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_acs_command(q=q, op_code="sus-off")
|
||||
pack_acs_board_command(q=q, cmd_str="sus-off")
|
||||
|
||||
if op_code in OpCode.SYRLINKS_FT:
|
||||
key = KAI.SYRLINKS_FT[0]
|
||||
@ -612,7 +612,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
if op_code in OpCode.STR_FT:
|
||||
key = KAI.STR_FT[0]
|
||||
|
||||
pack_star_tracker_commands(object_id=oids.STAR_TRACKER_ID, q=q, op_code="2")
|
||||
pack_star_tracker_commands(object_id=oids.STAR_TRACKER_ID, q=q, cmd_str="2")
|
||||
|
||||
# STR
|
||||
sid_list.append(make_sid(oids.STAR_TRACKER_ID, StrSetIds.TEMPERATURE))
|
||||
@ -625,7 +625,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_star_tracker_commands(object_id=oids.STAR_TRACKER_ID, q=q, op_code="3")
|
||||
pack_star_tracker_commands(object_id=oids.STAR_TRACKER_ID, q=q, cmd_str="3")
|
||||
|
||||
if op_code in OpCode.RW_FT_ONE_RW:
|
||||
key = KAI.RW_FT_ONE_RW[0]
|
||||
@ -658,7 +658,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
False,
|
||||
]
|
||||
# RW NORMAL
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, op_code="nml")
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, cmd_str="nml")
|
||||
|
||||
# RW HK für alle RWs nur einzeln
|
||||
for rw_dev in rw_pairs:
|
||||
@ -673,7 +673,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
cfg=GenericHkListeningCfg(mgt=False, one_rw=True, two_rws=False),
|
||||
)
|
||||
# RW OFF
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, op_code="off")
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, cmd_str="off")
|
||||
|
||||
# ass command with 2 rws to speed
|
||||
if op_code in OpCode.RW_FT_TWO_RWS:
|
||||
@ -715,7 +715,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
False,
|
||||
]
|
||||
# RW NORMAL
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, op_code="nml")
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, cmd_str="nml")
|
||||
|
||||
# RW
|
||||
for rw_dev in rw_pairs:
|
||||
@ -730,7 +730,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||
cfg=GenericHkListeningCfg(mgt=False, one_rw=False, two_rws=True),
|
||||
)
|
||||
# RW OFF
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, op_code="off")
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, cmd_str="off")
|
||||
|
||||
|
||||
def enable_listen_to_hk_for_x_seconds(
|
||||
|
@ -6,10 +6,10 @@ from eive_tmtc.config.definitions import (
|
||||
PUS_APID,
|
||||
CFDP_LOCAL_ENTITY_ID,
|
||||
)
|
||||
from eive_tmtc.pus_tc.procedure_packer import handle_default_procedure
|
||||
from eive_tmtc.pus_tc.cmd_demux import handle_pus_procedure
|
||||
from eive_tmtc.cfdp.handler import CfdpInCcsdsHandler
|
||||
from tmtccmd import TcHandlerBase, ProcedureWrapper
|
||||
from tmtccmd.cfdp.defs import CfdpRequestType
|
||||
from tmtccmd.cfdp.handler import CfdpInCcsdsHandler
|
||||
from cfdppy.defs import CfdpRequestType
|
||||
from tmtccmd.logging import get_current_time_string
|
||||
from tmtccmd.logging.pus import RawTmtcTimedLogWrapper
|
||||
from tmtccmd.tmtc import (
|
||||
@ -22,7 +22,7 @@ from tmtccmd.tmtc import (
|
||||
)
|
||||
from tmtccmd.config.cfdp import generic_cfdp_params_to_put_request
|
||||
from spacepackets.ecss import PusVerificator
|
||||
from tmtccmd.util import FileSeqCountProvider
|
||||
from spacepackets.seqcount import FileSeqCountProvider
|
||||
from spacepackets.cfdp import PduHolder, DirectiveType
|
||||
|
||||
|
||||
@ -68,8 +68,8 @@ class TcHandler(TcHandlerBase):
|
||||
|
||||
def feed_cb(self, info: ProcedureWrapper, wrapper: FeedWrapper):
|
||||
self.queue_helper.queue_wrapper = wrapper.queue_wrapper
|
||||
if info.proc_type == TcProcedureType.DEFAULT:
|
||||
handle_default_procedure(self, info.to_def_procedure(), self.queue_helper)
|
||||
if info.proc_type == TcProcedureType.TREE_COMMANDING:
|
||||
handle_pus_procedure(info.to_tree_commanding_procedure(), self.queue_helper)
|
||||
elif info.proc_type == TcProcedureType.CFDP:
|
||||
self.handle_cfdp_procedure(info)
|
||||
|
||||
@ -124,40 +124,38 @@ class TcHandler(TcHandlerBase):
|
||||
_LOGGER.info(
|
||||
f"CFDP: Starting file put request with parameters:\n{put_req}"
|
||||
)
|
||||
assert put_req is not None
|
||||
self.cfdp_in_ccsds_handler.cfdp_handler.put_request(put_req)
|
||||
self.cfdp_handler_started = True
|
||||
|
||||
for source_pair, dest_pair in self.cfdp_in_ccsds_handler:
|
||||
pdu, sp = source_pair
|
||||
pdu = cast(PduHolder, pdu)
|
||||
if pdu.is_file_directive:
|
||||
if pdu.pdu_directive_type == DirectiveType.METADATA_PDU:
|
||||
metadata = pdu.to_metadata_pdu()
|
||||
for source_pair, _ in self.cfdp_in_ccsds_handler:
|
||||
if source_pair is not None:
|
||||
pdu, sp = source_pair
|
||||
pdu = cast(PduHolder, pdu)
|
||||
if pdu.is_file_directive:
|
||||
if pdu.pdu_directive_type == DirectiveType.METADATA_PDU:
|
||||
metadata = pdu.to_metadata_pdu()
|
||||
self.queue_helper.add_log_cmd(
|
||||
"CFDP Source: Sending Metadata PDU for file with size "
|
||||
f"{metadata.file_size}"
|
||||
)
|
||||
elif pdu.pdu_directive_type == DirectiveType.EOF_PDU:
|
||||
self.queue_helper.add_log_cmd(
|
||||
"CFDP Source: Sending EOF PDU"
|
||||
)
|
||||
else:
|
||||
fd_pdu = pdu.to_file_data_pdu()
|
||||
self.queue_helper.add_log_cmd(
|
||||
"CFDP Source: Sending Metadata PDU for file with size "
|
||||
f"{metadata.file_size}"
|
||||
"CFDP Source: Sending File Data PDU for segment at offset "
|
||||
f"{fd_pdu.offset} with length {len(fd_pdu.file_data)}"
|
||||
)
|
||||
elif pdu.pdu_directive_type == DirectiveType.EOF_PDU:
|
||||
self.queue_helper.add_log_cmd(
|
||||
"CFDP Source: Sending EOF PDU"
|
||||
)
|
||||
else:
|
||||
fd_pdu = pdu.to_file_data_pdu()
|
||||
self.queue_helper.add_log_cmd(
|
||||
"CFDP Source: Sending File Data PDU for segment at offset "
|
||||
f"{fd_pdu.offset} with length {len(fd_pdu.file_data)}"
|
||||
)
|
||||
self.queue_helper.add_ccsds_tc(sp)
|
||||
self.cfdp_in_ccsds_handler.confirm_source_packet_sent()
|
||||
self.queue_helper.add_ccsds_tc(sp)
|
||||
self.cfdp_in_ccsds_handler.source_handler.state_machine()
|
||||
|
||||
def queue_finished_cb(self, info: ProcedureWrapper):
|
||||
if info is not None:
|
||||
if info.proc_type == TcQueueEntryType.PUS_TC:
|
||||
def_proc = info.to_def_procedure()
|
||||
_LOGGER.info(
|
||||
f"Finished queue for service {def_proc.service} and op code"
|
||||
f" {def_proc.op_code}"
|
||||
)
|
||||
def_proc = info.to_tree_commanding_procedure()
|
||||
_LOGGER.info(f"Finished queue for command {def_proc.cmd_path}")
|
||||
elif info.proc_type == TcProcedureType.CFDP:
|
||||
_LOGGER.info("Finished CFDP queue")
|
||||
|
@ -1,5 +1,10 @@
|
||||
import base64
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from spacepackets.ecss import PusTm
|
||||
from tmtccmd.pus.s8_fsfw_action_defs import CustomSubservice
|
||||
from eive_tmtc.config.definitions import PRINT_RAW_ACTION_DATA_REPLY_B64_STR
|
||||
from eive_tmtc.config.object_ids import (
|
||||
ACU_HANDLER_ID,
|
||||
PDU_1_HANDLER_ID,
|
||||
@ -20,56 +25,76 @@ from eive_tmtc.tmtc.payload.ploc_supervisor import SupvActionId
|
||||
from eive_tmtc.tmtc.acs.star_tracker import handle_star_tracker_action_replies
|
||||
from eive_tmtc.tmtc.acs.acs_ctrl import handle_acs_ctrl_action_replies
|
||||
from eive_tmtc.tmtc.power.tm import handle_get_param_data_reply
|
||||
from tmtccmd.pus.s8_fsfw_action import Service8FsfwTm
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
from spacepackets.ccsds.time import CdsShortTimestamp
|
||||
from tmtccmd.util import ObjectIdDictT
|
||||
from tmtccmd.util import ObjectIdBase, ObjectIdDictT, ObjectIdU32
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def handle_action_reply(
|
||||
raw_tm: bytes, printer: FsfwTmTcPrinter, obj_id_dict: ObjectIdDictT
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def handle_action_service_tm(
|
||||
raw_tm: bytes, pw: PrintWrapper, obj_id_dict: ObjectIdDictT
|
||||
):
|
||||
"""Core Action reply handler
|
||||
:return:
|
||||
"""
|
||||
tm_packet = Service8FsfwTm.unpack(
|
||||
raw_telemetry=raw_tm, time_reader=CdsShortTimestamp.empty()
|
||||
)
|
||||
object_id = obj_id_dict.get(tm_packet.source_object_id_as_bytes)
|
||||
pw = PrintWrapper(printer.file_logger)
|
||||
custom_data = tm_packet.custom_data
|
||||
action_id = tm_packet.action_id
|
||||
generic_print_str = printer.generic_action_packet_tm_print(
|
||||
packet=tm_packet, obj_id=object_id
|
||||
)
|
||||
pw.dlog(generic_print_str)
|
||||
if object_id.as_bytes == IMTQ_HANDLER_ID:
|
||||
return handle_imtq_replies(action_id, pw, custom_data)
|
||||
elif object_id.as_bytes == PLOC_MPSOC_ID:
|
||||
return handle_mpsoc_data_reply(action_id, pw, custom_data)
|
||||
elif object_id.as_bytes == PLOC_SUPV_ID:
|
||||
return handle_supervisor_replies(action_id, pw, custom_data)
|
||||
elif object_id.as_bytes == CORE_CONTROLLER_ID:
|
||||
return handle_core_ctrl_action_replies(action_id, pw, custom_data)
|
||||
elif object_id.as_bytes == STAR_TRACKER_ID:
|
||||
return handle_star_tracker_action_replies(action_id, pw, custom_data)
|
||||
elif object_id.as_bytes == ACS_CONTROLLER:
|
||||
return handle_acs_ctrl_action_replies(action_id, pw, custom_data)
|
||||
elif object_id.as_bytes in [
|
||||
ACU_HANDLER_ID,
|
||||
PDU_1_HANDLER_ID,
|
||||
PDU_2_HANDLER_ID,
|
||||
P60_DOCK_HANDLER,
|
||||
]:
|
||||
return handle_get_param_data_reply(object_id, action_id, pw, custom_data)
|
||||
tm_packet = PusTm.unpack(raw_tm, timestamp_len=CdsShortTimestamp.TIMESTAMP_SIZE)
|
||||
if len(tm_packet.source_data) < 8:
|
||||
_LOGGER.warning(
|
||||
"received action service reply with source data smaller than 8 bytes"
|
||||
)
|
||||
return
|
||||
object_id_raw = struct.unpack("!I", tm_packet.source_data[0:4])[0]
|
||||
action_id = struct.unpack("!I", tm_packet.source_data[4:8])[0]
|
||||
object_id = obj_id_dict.get(object_id_raw)
|
||||
custom_data = tm_packet.source_data[8:]
|
||||
if object_id is None:
|
||||
object_id = ObjectIdU32(object_id_raw, "Unknown ID")
|
||||
if tm_packet.subservice == CustomSubservice.TM_DATA_REPLY:
|
||||
if PRINT_RAW_ACTION_DATA_REPLY_B64_STR:
|
||||
print(f"PUS TM Base64: {base64.b64encode(raw_tm)}")
|
||||
if object_id.as_bytes == IMTQ_HANDLER_ID:
|
||||
return handle_imtq_replies(action_id, pw, custom_data)
|
||||
elif object_id.as_bytes == PLOC_MPSOC_ID:
|
||||
return handle_mpsoc_data_reply(action_id, pw, custom_data)
|
||||
elif object_id.as_bytes == PLOC_SUPV_ID:
|
||||
return handle_supervisor_replies(action_id, pw, custom_data)
|
||||
elif object_id.as_bytes == CORE_CONTROLLER_ID:
|
||||
return handle_core_ctrl_action_replies(action_id, pw, custom_data)
|
||||
elif object_id.as_bytes == STAR_TRACKER_ID:
|
||||
return handle_star_tracker_action_replies(action_id, pw, custom_data)
|
||||
elif object_id.as_bytes == ACS_CONTROLLER:
|
||||
return handle_acs_ctrl_action_replies(action_id, pw, custom_data)
|
||||
elif object_id.as_bytes in [
|
||||
ACU_HANDLER_ID,
|
||||
PDU_1_HANDLER_ID,
|
||||
PDU_2_HANDLER_ID,
|
||||
P60_DOCK_HANDLER,
|
||||
]:
|
||||
return handle_get_param_data_reply(object_id, action_id, pw, custom_data)
|
||||
else:
|
||||
# TODO: Could add a handler here depending on action ID and object ID.
|
||||
handle_action_data_reply(tm_packet, object_id, action_id, pw)
|
||||
else:
|
||||
pw.dlog(f"No dedicated action reply handler found for reply from {object_id}")
|
||||
pw.dlog(f"Raw Data: {tm_packet.custom_data.hex(sep=',')}")
|
||||
pw.dlog(
|
||||
f"service 8 packet from {object_id} with action ID {action_id} "
|
||||
f"and unknown subservice {tm_packet.subservice}"
|
||||
)
|
||||
|
||||
|
||||
def handle_imtq_replies(action_id: int, pw: PrintWrapper, custom_data: bytearray):
|
||||
def handle_action_data_reply(
|
||||
tm_packet: PusTm, named_obj_id: ObjectIdBase, action_id: int, printer: PrintWrapper
|
||||
):
|
||||
print_string = (
|
||||
f"service 8 data reply from {named_obj_id} with action ID {action_id} "
|
||||
f"and data size {len(tm_packet.tm_data[8:])}"
|
||||
)
|
||||
printer.dlog(print_string)
|
||||
|
||||
|
||||
def handle_imtq_replies(action_id: int, pw: PrintWrapper, custom_data: bytes):
|
||||
if action_id == struct.unpack("!I", ImtqActionId.get_commanded_dipole)[0]:
|
||||
header_list = [
|
||||
"Commanded X-Dipole",
|
||||
@ -82,7 +107,7 @@ def handle_imtq_replies(action_id: int, pw: PrintWrapper, custom_data: bytearray
|
||||
pw.dlog(f"{content_list}")
|
||||
|
||||
|
||||
def handle_supervisor_replies(action_id: int, pw: PrintWrapper, custom_data: bytearray):
|
||||
def handle_supervisor_replies(action_id: int, pw: PrintWrapper, custom_data: bytes):
|
||||
if action_id == SupvActionId.DUMP_MRAM:
|
||||
header_list = ["MRAM Dump"]
|
||||
content_list = [custom_data[: len(custom_data)]]
|
||||
|
@ -1,7 +1,9 @@
|
||||
import logging
|
||||
import datetime
|
||||
import sys
|
||||
import base64
|
||||
|
||||
from eive_tmtc.config.definitions import PRINT_RAW_EVENTS_B64_STR
|
||||
from eive_tmtc.config.events import get_event_dict
|
||||
from eive_tmtc.config.object_ids import get_object_ids
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
@ -21,7 +23,9 @@ _LOGGER = logging.getLogger(__name__)
|
||||
def handle_event_packet( # noqa C901: Complexity okay here
|
||||
raw_tm: bytes, pw: PrintWrapper
|
||||
): # noqa C901: Complexity okay here
|
||||
tm = Service5Tm.unpack(data=raw_tm, time_reader=CdsShortTimestamp.empty())
|
||||
if PRINT_RAW_EVENTS_B64_STR:
|
||||
print(f"PUS Event TM Base64: {base64.b64encode(raw_tm)}")
|
||||
tm = Service5Tm.unpack(data=raw_tm, timestamp_len=CdsShortTimestamp.TIMESTAMP_SIZE)
|
||||
event_dict = get_event_dict()
|
||||
event_def = tm.event_definition
|
||||
info = event_dict.get(event_def.event_id)
|
||||
@ -36,9 +40,10 @@ def handle_event_packet( # noqa C901: Complexity okay here
|
||||
obj_name = event_def.reporter_id.hex(sep=",")
|
||||
else:
|
||||
obj_name = obj_id_obj.name
|
||||
timestamp = CdsShortTimestamp.unpack(tm.timestamp)
|
||||
generic_event_string = (
|
||||
f"Object {obj_name} generated Event {info.name} (ID: {event_def.event_id:#04x})"
|
||||
f" at {tm.time_provider.as_date_time()}"
|
||||
f" at {timestamp.as_date_time()}"
|
||||
)
|
||||
_LOGGER.info(generic_event_string)
|
||||
pw.file_logger.info(
|
||||
@ -122,12 +127,22 @@ def handle_event_packet( # noqa C901: Complexity okay here
|
||||
new_time_dt = datetime.datetime.fromtimestamp(new_time, datetime.timezone.utc)
|
||||
pw.dlog(f"Old time (UTC): {old_time_dt}")
|
||||
pw.dlog(f"New time (UTC): {new_time_dt}")
|
||||
if info.name == "CLOCK_DUMP":
|
||||
if info.name == "CLOCK_DUMP_LEGACY":
|
||||
specific_handler = True
|
||||
# param 1 is timeval seconds, param 2 is timeval subsecond milliseconds
|
||||
time = event_def.param1 + event_def.param2 / 1000.0
|
||||
time_dt = datetime.datetime.fromtimestamp(time, datetime.timezone.utc)
|
||||
pw.dlog(f"Current time: {time_dt}")
|
||||
if (
|
||||
info.name == "CLOCK_DUMP"
|
||||
or info.name == "CLOCK_DUMP_BEFORE_SETTING_TIME"
|
||||
or info.name == "CLOCK_DUMP_AFTER_SETTING_TIME"
|
||||
):
|
||||
specific_handler = True
|
||||
# param 1 is timeval seconds, param 2 is timeval subsecond microseconds
|
||||
time = event_def.param1 + event_def.param2 / 1000000.0
|
||||
time_dt = datetime.datetime.fromtimestamp(time, datetime.timezone.utc)
|
||||
pw.dlog(f"Clock dump event {info.name}. Current time: {time_dt}")
|
||||
if info.name == "ACTIVE_SD_INFO":
|
||||
sd_0_state = (event_def.param2 >> 16) & 0xFFFF
|
||||
sd_1_state = event_def.param2 & 0xFFFF
|
||||
|
18
eive_tmtc/pus_tm/hk.py
Normal file
18
eive_tmtc/pus_tm/hk.py
Normal file
@ -0,0 +1,18 @@
|
||||
import uuid
|
||||
import dataclasses
|
||||
import datetime
|
||||
import sqlite3
|
||||
from spacepackets.ecss.tm import CdsShortTimestamp, PusTm
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class HkTmInfo:
|
||||
packet_uuid: uuid.UUID
|
||||
hk_packet: PusTm
|
||||
set_id: int
|
||||
db_con: sqlite3.Connection
|
||||
hk_data: bytes
|
||||
|
||||
@property
|
||||
def packet_datetime(self) -> datetime.datetime:
|
||||
return CdsShortTimestamp.unpack(self.hk_packet.timestamp).as_datetime()
|
@ -1,7 +1,17 @@
|
||||
"""HK Handling for EIVE OBSW"""
|
||||
|
||||
import dataclasses
|
||||
import logging
|
||||
from typing import List
|
||||
import base64
|
||||
import sqlite3
|
||||
import struct
|
||||
from typing import List, cast
|
||||
from uuid import UUID
|
||||
|
||||
from spacepackets.ccsds.time import CdsShortTimestamp
|
||||
from spacepackets.ecss import PusTm
|
||||
from eive_tmtc.config.definitions import PRINT_RAW_HK_B64_STR
|
||||
from eive_tmtc.pus_tm.hk import HkTmInfo
|
||||
|
||||
from eive_tmtc.tmtc.acs.acs_ctrl import handle_acs_ctrl_hk_data
|
||||
from eive_tmtc.tmtc.internal_err_reporter import handle_ier_hk_data
|
||||
@ -17,12 +27,7 @@ from eive_tmtc.tmtc.power.pwr_ctrl import handle_pwr_ctrl_hk_data
|
||||
from eive_tmtc.tmtc.com.syrlinks_handler import handle_syrlinks_hk_data
|
||||
from eive_tmtc.tmtc.tcs import handle_thermal_controller_hk_data
|
||||
from eive_tmtc.tmtc.tcs.tmp1075 import handle_tmp_1075_hk_data
|
||||
from spacepackets.ecss import PusTelemetry
|
||||
from tmtccmd.pus.tm.s3_fsfw_hk import (
|
||||
Service3Base,
|
||||
HkContentType,
|
||||
Service3FsfwTm,
|
||||
)
|
||||
from tmtccmd.pus.tm.s3_hk_base import HkContentType
|
||||
from tmtccmd.util.obj_id import ObjectIdU32, ObjectIdDictT
|
||||
|
||||
from eive_tmtc.tmtc.power.bpx_batt import handle_bpx_hk_data
|
||||
@ -51,45 +56,54 @@ FORWARD_SENSOR_TEMPS = False
|
||||
|
||||
@dataclasses.dataclass
|
||||
class HkFilter:
|
||||
object_ids: List[ObjectIdU32]
|
||||
object_ids: List[bytes]
|
||||
set_ids: List[int]
|
||||
|
||||
|
||||
def handle_hk_packet(
|
||||
raw_tm: bytes,
|
||||
packet_uuid: UUID,
|
||||
obj_id_dict: ObjectIdDictT,
|
||||
printer: FsfwTmTcPrinter,
|
||||
hk_filter: HkFilter,
|
||||
hk_level: int,
|
||||
db_con: sqlite3.Connection,
|
||||
):
|
||||
tm_packet = Service3FsfwTm.unpack(raw_telemetry=raw_tm, custom_hk_handling=False)
|
||||
named_obj_id = obj_id_dict.get(tm_packet.object_id.as_bytes)
|
||||
tm_packet = PusTm.unpack(raw_tm, CdsShortTimestamp.TIMESTAMP_SIZE)
|
||||
obj_id_raw = struct.unpack("!I", tm_packet.tm_data[0:4])[0]
|
||||
named_obj_id = cast(ObjectIdU32, obj_id_dict.get(obj_id_raw))
|
||||
if named_obj_id is None:
|
||||
named_obj_id = tm_packet.object_id
|
||||
named_obj_id = ObjectIdU32(obj_id_raw, "Unknown ID")
|
||||
if tm_packet.subservice == 25 or tm_packet.subservice == 26:
|
||||
set_id = struct.unpack("!I", tm_packet.tm_data[4:8])[0]
|
||||
hk_data = tm_packet.tm_data[8:]
|
||||
|
||||
if named_obj_id in hk_filter.object_ids:
|
||||
if named_obj_id.as_bytes in hk_filter.object_ids:
|
||||
if PRINT_RAW_HK_B64_STR:
|
||||
print(f"PUS TM Base64: {base64.b64encode(raw_tm)}")
|
||||
handle_regular_hk_print(
|
||||
printer=printer,
|
||||
set_id=set_id,
|
||||
packet_uuid=packet_uuid,
|
||||
object_id=named_obj_id,
|
||||
hk_packet=tm_packet,
|
||||
tm=tm_packet.pus_tm,
|
||||
hk_data=hk_data,
|
||||
db=db_con,
|
||||
)
|
||||
return
|
||||
try:
|
||||
if hk_level >= 1:
|
||||
printer.generic_hk_tm_print(
|
||||
HkContentType.HK, named_obj_id, tm_packet.set_id, hk_data
|
||||
HkContentType.HK, named_obj_id, set_id, hk_data
|
||||
)
|
||||
if hk_level >= 1:
|
||||
handle_regular_hk_print(
|
||||
printer=printer,
|
||||
set_id=set_id,
|
||||
packet_uuid=packet_uuid,
|
||||
object_id=named_obj_id,
|
||||
hk_packet=tm_packet,
|
||||
tm=tm_packet.pus_tm,
|
||||
hk_data=hk_data,
|
||||
db=db_con,
|
||||
)
|
||||
except ValueError as e:
|
||||
_LOGGER.exception(
|
||||
@ -100,26 +114,41 @@ def handle_hk_packet(
|
||||
|
||||
|
||||
def handle_regular_hk_print( # noqa C901: Complexity okay here
|
||||
printer: FsfwTmTcPrinter,
|
||||
object_id: ObjectIdU32,
|
||||
hk_packet: Service3Base,
|
||||
tm: PusTelemetry,
|
||||
hk_packet: PusTm,
|
||||
set_id: int,
|
||||
packet_uuid: UUID,
|
||||
hk_data: bytes,
|
||||
db: sqlite3.Connection,
|
||||
object_id: ObjectIdU32,
|
||||
printer: FsfwTmTcPrinter,
|
||||
):
|
||||
objb = object_id.as_bytes
|
||||
set_id = hk_packet.set_id
|
||||
packet_dt = tm.time_provider.as_date_time()
|
||||
hk_info = HkTmInfo(
|
||||
packet_uuid=packet_uuid,
|
||||
hk_packet=hk_packet,
|
||||
db_con=db,
|
||||
hk_data=hk_data,
|
||||
set_id=set_id,
|
||||
)
|
||||
timestamp = CdsShortTimestamp.unpack(hk_packet.timestamp)
|
||||
packet_dt = timestamp.as_datetime()
|
||||
pw = PrintWrapper(printer.file_logger)
|
||||
"""This function is called when a Service 3 Housekeeping packet is received."""
|
||||
if objb in [obj_ids.RW1_ID, obj_ids.RW2_ID, obj_ids.RW3_ID, obj_ids.RW4_ID]:
|
||||
return handle_rw_hk_data(pw, object_id, set_id, hk_data)
|
||||
elif objb == obj_ids.SYRLINKS_HANDLER_ID:
|
||||
return handle_syrlinks_hk_data(pw=pw, hk_data=hk_data, set_id=set_id)
|
||||
return handle_syrlinks_hk_data(
|
||||
hk_info=hk_info,
|
||||
pw=pw,
|
||||
)
|
||||
elif objb == obj_ids.IMTQ_HANDLER_ID:
|
||||
return handle_imtq_hk(pw=pw, hk_data=hk_data, set_id=set_id)
|
||||
elif objb == obj_ids.GPS_CONTROLLER:
|
||||
return handle_gps_data(
|
||||
pw=pw, set_id=set_id, hk_data=hk_data, packet_time=packet_dt
|
||||
pw=pw,
|
||||
set_id=set_id,
|
||||
hk_data=hk_data,
|
||||
packet_time=timestamp.as_datetime(),
|
||||
)
|
||||
elif objb == obj_ids.PCDU_HANDLER_ID:
|
||||
return handle_pcdu_hk(pw=pw, set_id=set_id, hk_data=hk_data)
|
||||
@ -128,9 +157,21 @@ def handle_regular_hk_print( # noqa C901: Complexity okay here
|
||||
elif objb == obj_ids.CORE_CONTROLLER_ID:
|
||||
return handle_core_hk_data(pw=pw, hk_data=hk_data, set_id=set_id)
|
||||
elif objb == obj_ids.PDU_1_HANDLER_ID:
|
||||
return handle_pdu_data(pw=pw, pdu_idx=1, set_id=set_id, hk_data=hk_data)
|
||||
return handle_pdu_data(
|
||||
hk_info=hk_info,
|
||||
pw=pw,
|
||||
pdu_idx=1,
|
||||
set_id=set_id,
|
||||
hk_data=hk_data,
|
||||
)
|
||||
elif objb == obj_ids.PDU_2_HANDLER_ID:
|
||||
return handle_pdu_data(pw=pw, pdu_idx=2, set_id=set_id, hk_data=hk_data)
|
||||
return handle_pdu_data(
|
||||
hk_info=hk_info,
|
||||
pw=pw,
|
||||
pdu_idx=2,
|
||||
set_id=set_id,
|
||||
hk_data=hk_data,
|
||||
)
|
||||
elif objb == obj_ids.PLOC_MPSOC_ID:
|
||||
return handle_ploc_mpsoc_hk_data(pw=pw, hk_data=hk_data, set_id=set_id)
|
||||
elif objb == obj_ids.ACU_HANDLER_ID:
|
||||
|
@ -1,126 +0,0 @@
|
||||
"""Core EIVE TM handler module
|
||||
"""
|
||||
import logging
|
||||
|
||||
from spacepackets.ccsds.time import CdsShortTimestamp
|
||||
from spacepackets.ecss import PusTelemetry
|
||||
from spacepackets.ecss.pus_17_test import Service17Tm
|
||||
from spacepackets.util import PrintFormats
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.logging.pus import RawTmtcTimedLogWrapper
|
||||
from tmtccmd.pus import VerificationWrapper
|
||||
from tmtccmd.pus.s20_fsfw_param import Service20FsfwTm, Service20ParamDumpWrapper
|
||||
from tmtccmd.pus.s20_fsfw_param_defs import CustomSubservice as ParamSubservice
|
||||
from tmtccmd.pus.s200_fsfw_mode import Service200FsfwTm
|
||||
from tmtccmd.pus.s200_fsfw_mode import Subservice as ModeSubservice
|
||||
|
||||
from eive_tmtc.config.object_ids import get_object_ids
|
||||
|
||||
from .action_reply_handler import handle_action_reply
|
||||
from .defs import PrintWrapper
|
||||
from .event_handler import handle_event_packet
|
||||
from .hk_handler import HkFilter, handle_hk_packet
|
||||
from .verification_handler import generic_retval_printout, handle_service_1_fsfw_packet
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def pus_factory_hook( # noqa C901 : Complexity okay here
|
||||
packet: bytes,
|
||||
verif_wrapper: VerificationWrapper,
|
||||
printer: FsfwTmTcPrinter,
|
||||
raw_logger: RawTmtcTimedLogWrapper,
|
||||
hk_level: int,
|
||||
hk_filter: HkFilter,
|
||||
):
|
||||
if len(packet) < 8:
|
||||
_LOGGER.warning("Detected packet shorter than 8 bytes!")
|
||||
return
|
||||
try:
|
||||
tm_packet = PusTelemetry.unpack(packet, CdsShortTimestamp.empty())
|
||||
# _LOGGER.info(f"Sequence count: {tm_packet.seq_count}")
|
||||
except ValueError as value_error:
|
||||
_LOGGER.warning(f"{value_error}")
|
||||
_LOGGER.warning("Could not generate PUS TM object from raw data")
|
||||
_LOGGER.warning(f"Raw Packet: [{packet.hex(sep=',')}], REPR: {packet!r}")
|
||||
return
|
||||
service = tm_packet.service
|
||||
obj_id_dict = get_object_ids()
|
||||
pw = PrintWrapper(printer.file_logger)
|
||||
dedicated_handler = True
|
||||
if service == 1:
|
||||
handle_service_1_fsfw_packet(wrapper=verif_wrapper, raw_tm=packet)
|
||||
elif service == 3:
|
||||
handle_hk_packet(
|
||||
printer=printer,
|
||||
raw_tm=packet,
|
||||
obj_id_dict=obj_id_dict,
|
||||
hk_level=hk_level,
|
||||
hk_filter=hk_filter,
|
||||
)
|
||||
elif service == 5:
|
||||
handle_event_packet(raw_tm=packet, pw=pw)
|
||||
elif service == 8:
|
||||
handle_action_reply(raw_tm=packet, printer=printer, obj_id_dict=obj_id_dict)
|
||||
elif service == 17:
|
||||
tm_packet = Service17Tm.unpack(
|
||||
data=packet, time_reader=CdsShortTimestamp.empty()
|
||||
)
|
||||
if tm_packet.subservice == 2:
|
||||
verif_wrapper.dlog("Received Ping Reply TM[17,2]")
|
||||
dedicated_handler = True
|
||||
elif service == 20:
|
||||
param_packet = Service20FsfwTm.unpack(
|
||||
raw_telemetry=packet, time_reader=CdsShortTimestamp.empty()
|
||||
)
|
||||
if tm_packet.subservice == ParamSubservice.TM_DUMP_REPLY:
|
||||
param_wrapper = Service20ParamDumpWrapper(param_tm=param_packet)
|
||||
try:
|
||||
param = param_wrapper.get_param()
|
||||
obj = obj_id_dict.get(param_wrapper.param_tm.object_id)
|
||||
pw.dlog(f"Received parameter dump TM from {obj}")
|
||||
pw.dlog(f"Parameter: {param}")
|
||||
if param.rows == 1 and param.columns == 1:
|
||||
try:
|
||||
scalar_param = param.parse_scalar_param()
|
||||
if isinstance(scalar_param, int):
|
||||
pw.dlog(f"Scalar integer parameter: {scalar_param}")
|
||||
elif isinstance(scalar_param, float):
|
||||
pw.dlog(f"Scalar floating point parameter: {scalar_param}")
|
||||
except ValueError as e:
|
||||
pw.dlog(f"received {e} trying to parse scalar parameter")
|
||||
else:
|
||||
# TODO: Could improve display further by actually displaying a matrix as a
|
||||
# matrix using row and column information
|
||||
pw.dlog(
|
||||
"Received vector or matrix data:"
|
||||
f" {param.param_raw.hex(sep=',')}"
|
||||
)
|
||||
except ValueError as e:
|
||||
pw.dlog(f"received {e} when trying to parse parameters")
|
||||
except NotImplementedError as e:
|
||||
pw.dlog(f"received {e} when trying to parse parameters")
|
||||
else:
|
||||
pw.dlog(f"unknown subservice {tm_packet.subservice} for parameter service")
|
||||
elif service == 200:
|
||||
tm_packet = Service200FsfwTm.unpack(
|
||||
raw_telemetry=packet, time_reader=CdsShortTimestamp.empty()
|
||||
)
|
||||
if tm_packet.subservice == ModeSubservice.TM_CANT_REACH_MODE:
|
||||
obj_id = tm_packet.object_id
|
||||
obj_id_obj = obj_id_dict.get(obj_id)
|
||||
retval = tm_packet.return_value
|
||||
string_list = generic_retval_printout(retval)
|
||||
pw.dlog(f"Received Mode Reply from {obj_id_obj}: Can't reach mode.")
|
||||
for string in string_list:
|
||||
pw.dlog(f"Reason: {string}")
|
||||
dedicated_handler = True
|
||||
else:
|
||||
dedicated_handler = False
|
||||
else:
|
||||
_LOGGER.info(f"The service {service} is not implemented in Telemetry Factory")
|
||||
tm_packet.print_source_data(PrintFormats.HEX)
|
||||
dedicated_handler = True
|
||||
if not dedicated_handler and tm_packet is not None:
|
||||
printer.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet)
|
||||
raw_logger.log_tm(tm_packet)
|
218
eive_tmtc/pus_tm/pus_handler.py
Normal file
218
eive_tmtc/pus_tm/pus_handler.py
Normal file
@ -0,0 +1,218 @@
|
||||
"""Core EIVE TM handler module
|
||||
"""
|
||||
|
||||
import logging
|
||||
import sqlite3
|
||||
import uuid
|
||||
from typing import Any
|
||||
|
||||
from spacepackets.ccsds.time import CdsShortTimestamp
|
||||
from spacepackets.ecss import PusTelemetry
|
||||
from spacepackets.ecss.pus_17_test import Service17Tm
|
||||
from spacepackets.util import PrintFormats
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.logging.pus import RawTmtcTimedLogWrapper
|
||||
from tmtccmd.pus import VerificationWrapper
|
||||
from tmtccmd.pus.s20_fsfw_param import Service20FsfwTm, Service20ParamDumpWrapper
|
||||
from tmtccmd.pus.s20_fsfw_param_defs import CustomSubservice as ParamSubservice
|
||||
from tmtccmd.pus.s200_fsfw_mode import Service200FsfwReader, Service200FsfwTm
|
||||
from tmtccmd.pus.s200_fsfw_mode import Subservice as ModeSubservice
|
||||
from tmtccmd.tmtc import GenericApidHandlerBase, SpecificApidHandlerBase
|
||||
from eive_tmtc.config.definitions import TM_DB_PATH, PUS_APID
|
||||
|
||||
from eive_tmtc.config.object_ids import get_object_ids
|
||||
|
||||
from .action_reply_handler import handle_action_service_tm
|
||||
from .defs import PrintWrapper
|
||||
from .event_handler import handle_event_packet
|
||||
from .hk_handler import HkFilter, handle_hk_packet
|
||||
from .verification_handler import generic_retval_printout, handle_service_1_fsfw_packet
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PusHandler(SpecificApidHandlerBase):
|
||||
def __init__(
|
||||
self,
|
||||
wrapper: VerificationWrapper,
|
||||
printer: FsfwTmTcPrinter,
|
||||
raw_logger: RawTmtcTimedLogWrapper,
|
||||
hk_level: int,
|
||||
):
|
||||
super().__init__(PUS_APID, None)
|
||||
self.printer = printer
|
||||
self.verif_wrapper = wrapper
|
||||
self.raw_logger = raw_logger
|
||||
self.hk_level = hk_level
|
||||
self.these_objs_hk_only = []
|
||||
self.hk_filter = HkFilter(object_ids=self.these_objs_hk_only, set_ids=[])
|
||||
self.obj_id_dict = get_object_ids()
|
||||
self.pw = PrintWrapper(printer.file_logger)
|
||||
|
||||
def handle_tm(self, packet: bytes, _user_args: Any):
|
||||
self.pus_handler(
|
||||
packet,
|
||||
)
|
||||
|
||||
def pus_handler( # noqa C901 : Complexity okay here
|
||||
self,
|
||||
packet: bytes,
|
||||
):
|
||||
packet_uuid = uuid.uuid4()
|
||||
if len(packet) < 8:
|
||||
_LOGGER.warning("Detected packet shorter than 8 bytes!")
|
||||
return
|
||||
try:
|
||||
tm_packet = PusTelemetry.unpack(packet, CdsShortTimestamp.TIMESTAMP_SIZE)
|
||||
# _LOGGER.info(f"Sequence count: {tm_packet.seq_count}")
|
||||
except ValueError as value_error:
|
||||
_LOGGER.warning(f"{value_error}")
|
||||
_LOGGER.warning("Could not generate PUS TM object from raw data")
|
||||
_LOGGER.warning(f"Raw Packet: [{packet.hex(sep=',')}], REPR: {packet!r}")
|
||||
return
|
||||
timestamp = CdsShortTimestamp.unpack(tm_packet.timestamp)
|
||||
db_con = sqlite3.connect(TM_DB_PATH)
|
||||
self._store_packet_in_db(
|
||||
db_con=db_con,
|
||||
packet=packet,
|
||||
tm_packet=tm_packet,
|
||||
timestamp=timestamp,
|
||||
packet_uuid=packet_uuid,
|
||||
)
|
||||
service = tm_packet.service
|
||||
dedicated_handler = True
|
||||
if service == 1:
|
||||
handle_service_1_fsfw_packet(wrapper=self.verif_wrapper, raw_tm=packet)
|
||||
elif service == 3:
|
||||
handle_hk_packet(
|
||||
db_con=db_con,
|
||||
packet_uuid=packet_uuid,
|
||||
printer=self.printer,
|
||||
raw_tm=packet,
|
||||
obj_id_dict=self.obj_id_dict,
|
||||
hk_level=self.hk_level,
|
||||
hk_filter=self.hk_filter,
|
||||
)
|
||||
elif service == 5:
|
||||
handle_event_packet(raw_tm=packet, pw=self.pw)
|
||||
elif service == 8:
|
||||
handle_action_service_tm(
|
||||
raw_tm=packet, pw=self.pw, obj_id_dict=self.obj_id_dict
|
||||
)
|
||||
elif service == 17:
|
||||
pus17_tm = Service17Tm.unpack(
|
||||
data=packet, timestamp_len=CdsShortTimestamp.TIMESTAMP_SIZE
|
||||
)
|
||||
if pus17_tm.subservice == 2:
|
||||
self.verif_wrapper.dlog("Received Ping Reply TM[17,2]")
|
||||
dedicated_handler = True
|
||||
elif service == 20:
|
||||
self._handle_param_packet(packet, tm_packet)
|
||||
elif service == 200:
|
||||
dedicated_handler = self._handle_mode_packet(tm_packet)
|
||||
else:
|
||||
_LOGGER.info(
|
||||
f"The service {service} is not implemented in Telemetry Factory"
|
||||
)
|
||||
tm_packet.print_source_data(PrintFormats.HEX)
|
||||
dedicated_handler = True
|
||||
if not dedicated_handler and tm_packet is not None:
|
||||
_LOGGER.info(
|
||||
f"TM [{service},{tm_packet.subservice}] does not have a dedicated handler"
|
||||
)
|
||||
self.raw_logger.log_tm(tm_packet)
|
||||
|
||||
def _store_packet_in_db(
|
||||
self,
|
||||
db_con: sqlite3.Connection,
|
||||
packet: bytes,
|
||||
timestamp: CdsShortTimestamp,
|
||||
tm_packet: PusTelemetry,
|
||||
packet_uuid: uuid.UUID,
|
||||
):
|
||||
cursor = db_con.cursor()
|
||||
cursor.execute(
|
||||
"""
|
||||
CREATE TABLE IF NOT EXISTS pus_tm(
|
||||
packet_uuid TEXT PRIMARY KEY,
|
||||
generation_time TEXT,
|
||||
service NUM,
|
||||
subservice NUM,
|
||||
data_len NUM,
|
||||
raw_data BLOB
|
||||
)"""
|
||||
)
|
||||
cursor.execute(
|
||||
"INSERT INTO pus_tm VALUES(?, ?, ?, ?, ?, ?)",
|
||||
(
|
||||
str(packet_uuid),
|
||||
timestamp.as_datetime(),
|
||||
tm_packet.service,
|
||||
tm_packet.subservice,
|
||||
len(packet),
|
||||
packet,
|
||||
),
|
||||
)
|
||||
db_con.commit()
|
||||
|
||||
def _handle_param_packet(self, raw_data: bytes, tm_packet: PusTelemetry):
|
||||
param_packet = Service20FsfwTm.unpack(
|
||||
raw_telemetry=raw_data, timestamp_len=CdsShortTimestamp.TIMESTAMP_SIZE
|
||||
)
|
||||
if tm_packet.subservice == ParamSubservice.TM_DUMP_REPLY:
|
||||
param_wrapper = Service20ParamDumpWrapper(param_tm=param_packet)
|
||||
try:
|
||||
param = param_wrapper.get_param()
|
||||
obj = self.obj_id_dict.get(param_wrapper.param_tm.object_id)
|
||||
self.pw.dlog(f"Received parameter dump TM from {obj}")
|
||||
self.pw.dlog(f"Parameter: {param}")
|
||||
if param.rows == 1 and param.columns == 1:
|
||||
try:
|
||||
scalar_param = param.parse_scalar_param()
|
||||
if isinstance(scalar_param, int):
|
||||
self.pw.dlog(f"Scalar integer parameter: {scalar_param}")
|
||||
elif isinstance(scalar_param, float):
|
||||
self.pw.dlog(
|
||||
f"Scalar floating point parameter: {scalar_param}"
|
||||
)
|
||||
except ValueError as e:
|
||||
self.pw.dlog(f"received {e} trying to parse scalar parameter")
|
||||
else:
|
||||
# TODO: Could improve display further by actually displaying a matrix as a
|
||||
# matrix using row and column information
|
||||
self.pw.dlog(
|
||||
"Received vector or matrix data:"
|
||||
f" {param.param_raw.hex(sep=',')}"
|
||||
)
|
||||
except ValueError as e:
|
||||
self.pw.dlog(f"received {e} when trying to parse parameters")
|
||||
except NotImplementedError as e:
|
||||
self.pw.dlog(f"received {e} when trying to parse parameters")
|
||||
else:
|
||||
self.pw.dlog(
|
||||
f"unknown subservice {tm_packet.subservice} for parameter service"
|
||||
)
|
||||
|
||||
def _handle_mode_packet(self, pus_tm: PusTelemetry) -> bool:
|
||||
tm_packet = Service200FsfwReader(pus_tm)
|
||||
if tm_packet.tm.subservice == ModeSubservice.TM_CANT_REACH_MODE:
|
||||
obj_id = tm_packet.object_id
|
||||
obj_id_obj = self.obj_id_dict.get(obj_id)
|
||||
retval = tm_packet.return_value
|
||||
assert retval is not None
|
||||
string_list = generic_retval_printout(retval)
|
||||
self.pw.dlog(f"Received Mode Reply from {obj_id_obj}: Can't reach mode.")
|
||||
for string in string_list:
|
||||
self.pw.dlog(f"Reason: {string}")
|
||||
return True
|
||||
if tm_packet.tm.subservice == ModeSubservice.TM_WRONG_MODE_REPLY:
|
||||
self.pw.dlog(f"Received Mode TM wrong mode reply, mode: {tm_packet.mode}")
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class UnknownApidHandler(GenericApidHandlerBase):
|
||||
def handle_tm(self, apid: int, packet: bytes, _user_args: Any):
|
||||
_LOGGER.warning(
|
||||
f"Packet with unknown APID {apid} detected: {packet.hex(sep=',')}"
|
||||
)
|
@ -17,7 +17,7 @@ def handle_service_1_fsfw_packet(wrapper: VerificationWrapper, raw_tm: bytes):
|
||||
)
|
||||
# Error code with length 2 is FSFW specific
|
||||
tm_packet = Service1Tm.unpack(
|
||||
data=raw_tm, params=UnpackParams(CdsShortTimestamp.empty(), 1, 2)
|
||||
data=raw_tm, params=UnpackParams(CdsShortTimestamp.TIMESTAMP_SIZE, 1, 2)
|
||||
)
|
||||
fsfw_wrapper = Service1FsfwWrapper(tm_packet)
|
||||
res = wrapper.verificator.add_tm(tm_packet)
|
||||
|
@ -1,8 +1,3 @@
|
||||
from .payload.subsystem import add_payload_subsystem_cmds
|
||||
from .solar_array_deployment import add_sa_depl_cmds
|
||||
from .test import add_test_defs
|
||||
from .time import add_time_cmds
|
||||
from .health import add_health_cmd_defs
|
||||
from .system import add_system_cmd_defs
|
||||
from .tm_store import add_persistent_tm_store_cmd_defs
|
||||
from .tcs import add_tmp_sens_cmds
|
||||
|
@ -1,16 +1,16 @@
|
||||
import enum
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
CmdTreeNode,
|
||||
OpCodeEntry,
|
||||
TmtcDefinitionWrapper,
|
||||
tmtc_definitions_provider,
|
||||
)
|
||||
from tmtccmd.tmtc import service_provider, DefaultPusQueueHelper
|
||||
from tmtccmd.tmtc.decorator import ServiceProviderParams
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode
|
||||
from eive_tmtc.config.object_ids import ACS_BOARD_ASS_ID
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import ACS_BOARD_ASS_ID
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
|
||||
|
||||
@ -30,8 +30,8 @@ class DualSideSubmode(enum.IntEnum):
|
||||
DUAL_SIDE = 2
|
||||
|
||||
|
||||
def pack_acs_command(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in AcsOpCodes.ACS_ASS_A_SIDE:
|
||||
def pack_acs_board_command(q: DefaultPusQueueHelper, cmd_str: str):
|
||||
if cmd_str in AcsOpCodes.ACS_ASS_A_SIDE:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Mode.NORMAL,
|
||||
@ -39,7 +39,7 @@ def pack_acs_command(q: DefaultPusQueueHelper, op_code: str):
|
||||
q=q,
|
||||
info="Switching to ACS board assembly A side",
|
||||
)
|
||||
if op_code in AcsOpCodes.ACS_ASS_B_SIDE:
|
||||
if cmd_str in AcsOpCodes.ACS_ASS_B_SIDE:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Mode.NORMAL,
|
||||
@ -47,7 +47,7 @@ def pack_acs_command(q: DefaultPusQueueHelper, op_code: str):
|
||||
q=q,
|
||||
info="Switching to ACS board assembly B side",
|
||||
)
|
||||
if op_code in AcsOpCodes.ACS_ASS_DUAL_MODE:
|
||||
if cmd_str in AcsOpCodes.ACS_ASS_DUAL_MODE:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Mode.NORMAL,
|
||||
@ -55,7 +55,7 @@ def pack_acs_command(q: DefaultPusQueueHelper, op_code: str):
|
||||
q=q,
|
||||
info="Switching to ACS board assembly dual mode",
|
||||
)
|
||||
if op_code in AcsOpCodes.ACS_ASS_A_ON:
|
||||
if cmd_str in AcsOpCodes.ACS_ASS_A_ON:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Mode.ON,
|
||||
@ -63,7 +63,7 @@ def pack_acs_command(q: DefaultPusQueueHelper, op_code: str):
|
||||
q=q,
|
||||
info="Switching ACS board assembly A side on",
|
||||
)
|
||||
if op_code in AcsOpCodes.ACS_ASS_B_ON:
|
||||
if cmd_str in AcsOpCodes.ACS_ASS_B_ON:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Mode.ON,
|
||||
@ -71,7 +71,7 @@ def pack_acs_command(q: DefaultPusQueueHelper, op_code: str):
|
||||
q=q,
|
||||
info="Switching ACS board assembly B side on",
|
||||
)
|
||||
if op_code in AcsOpCodes.ACS_ASS_DUAL_ON:
|
||||
if cmd_str in AcsOpCodes.ACS_ASS_DUAL_ON:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Mode.ON,
|
||||
@ -79,7 +79,7 @@ def pack_acs_command(q: DefaultPusQueueHelper, op_code: str):
|
||||
q=q,
|
||||
info="Switching ACS board assembly dual side on",
|
||||
)
|
||||
if op_code in AcsOpCodes.ACS_ASS_OFF:
|
||||
if cmd_str in AcsOpCodes.ACS_ASS_OFF:
|
||||
pack_mode_cmd_with_info(
|
||||
object_id=ACS_BOARD_ASS_ID,
|
||||
mode=Mode.OFF,
|
||||
@ -89,11 +89,51 @@ def pack_acs_command(q: DefaultPusQueueHelper, op_code: str):
|
||||
)
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.ACS_BRD_ASS)
|
||||
def pack_acs_command_provider(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
pack_acs_command(q, op_code)
|
||||
def create_acs_board_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode("acs_brd", "ACS Board", hide_children_which_are_leaves=True)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
AcsOpCodes.ACS_ASS_A_SIDE[1],
|
||||
"Switch to ACS board A side",
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
AcsOpCodes.ACS_ASS_B_SIDE[1],
|
||||
"Switch to ACS board B side",
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
AcsOpCodes.ACS_ASS_DUAL_MODE[1],
|
||||
"Switch to ACS board dual mode",
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
AcsOpCodes.ACS_ASS_A_ON[1],
|
||||
"Switch ACS board A side on",
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
AcsOpCodes.ACS_ASS_B_ON[1],
|
||||
"Switch ACS board B side on",
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
AcsOpCodes.ACS_ASS_DUAL_ON[1],
|
||||
"Switch ACS board dual mode on",
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
AcsOpCodes.ACS_ASS_OFF[1],
|
||||
"Switch off ACS board",
|
||||
)
|
||||
)
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
|
@ -7,12 +7,8 @@ import struct
|
||||
from socket import AF_INET
|
||||
from typing import Tuple
|
||||
|
||||
from tmtccmd.config.tmtc import (
|
||||
OpCodeEntry,
|
||||
TmtcDefinitionWrapper,
|
||||
tmtc_definitions_provider,
|
||||
)
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.config.tmtc import CmdTreeNode
|
||||
from tmtccmd.fsfw.tmtc_printer import get_validity_buffer_str
|
||||
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
||||
from tmtccmd.pus.s20_fsfw_param import create_load_param_cmd
|
||||
from tmtccmd.pus.s20_fsfw_param_defs import (
|
||||
@ -34,11 +30,8 @@ from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
enable_periodic_hk_command_with_interval,
|
||||
make_sid,
|
||||
)
|
||||
from tmtccmd.tmtc import service_provider
|
||||
from tmtccmd.tmtc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tmtc.queue import DefaultPusQueueHelper
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import ACS_CONTROLLER
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.tmtc.acs.defs import AcsMode, SafeSubmode
|
||||
@ -73,6 +66,7 @@ class ActionId(enum.IntEnum):
|
||||
RESTORE_MEKF_NONFINITE_RECOVERY = 2
|
||||
UPDATE_TLE = 3
|
||||
READ_TLE = 4
|
||||
UPDATE_MEKF_STANDARD_DEVIATIONS = 5
|
||||
|
||||
|
||||
CTRL_STRAT_DICT = {
|
||||
@ -127,6 +121,7 @@ class OpCodes:
|
||||
RESTORE_MEKF_NONFINITE_RECOVERY = "restore_mekf_nonfinite_recovery"
|
||||
UPDATE_TLE = "update_tle"
|
||||
READ_TLE = "read_tle"
|
||||
UPDATE_MEKF_STANDARD_DEVIATIONS = "update_mekf_standard_deviations"
|
||||
SET_PARAMETER_SCALAR = "set_scalar_param"
|
||||
SET_PARAMETER_VECTOR = "set_vector_param"
|
||||
SET_PARAMETER_MATRIX = "set_matrix_param"
|
||||
@ -149,6 +144,10 @@ class Info:
|
||||
RESTORE_MEKF_NONFINITE_RECOVERY = "Restore MEKF non-finite recovery"
|
||||
UPDATE_TLE = "Update TLE"
|
||||
READ_TLE = "Read the currently stored TLE"
|
||||
UPDATE_MEKF_STANDARD_DEVIATIONS = (
|
||||
"Update the Standard Deviations within the MEKF to the current ACS Parameter "
|
||||
"Values"
|
||||
)
|
||||
SET_PARAMETER_SCALAR = "Set Scalar Parameter"
|
||||
SET_PARAMETER_VECTOR = "Set Vector Parameter"
|
||||
SET_PARAMETER_MATRIX = "Set Matrix Parameter"
|
||||
@ -169,84 +168,66 @@ if PERFORM_MGM_CALIBRATION:
|
||||
CALIBR_SOCKET.connect(CALIBRATION_ADDR)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def acs_cmd_defs(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCodes.OFF, info=Info.OFF)
|
||||
oce.add(keys=OpCodes.SAFE, info=Info.SAFE)
|
||||
oce.add(keys=OpCodes.DTBL, info=Info.DTBL)
|
||||
oce.add(keys=OpCodes.IDLE, info=Info.IDLE)
|
||||
oce.add(keys=OpCodes.NADIR, info=Info.NADIR)
|
||||
oce.add(keys=OpCodes.TARGET, info=Info.TARGET)
|
||||
oce.add(keys=OpCodes.GS, info=Info.GS)
|
||||
oce.add(keys=OpCodes.INERTIAL, info=Info.INERTIAL)
|
||||
oce.add(keys=OpCodes.SAFE_PTG, info=Info.SAFE_PTG)
|
||||
oce.add(keys=OpCodes.RESET_MEKF, info=Info.RESET_MEKF)
|
||||
oce.add(
|
||||
keys=OpCodes.RESTORE_MEKF_NONFINITE_RECOVERY,
|
||||
info=Info.RESTORE_MEKF_NONFINITE_RECOVERY,
|
||||
)
|
||||
oce.add(keys=OpCodes.UPDATE_TLE, info=Info.UPDATE_TLE)
|
||||
oce.add(keys=OpCodes.READ_TLE, info=Info.READ_TLE)
|
||||
oce.add(keys=OpCodes.SET_PARAMETER_SCALAR, info=Info.SET_PARAMETER_SCALAR)
|
||||
oce.add(keys=OpCodes.SET_PARAMETER_VECTOR, info=Info.SET_PARAMETER_VECTOR)
|
||||
oce.add(keys=OpCodes.SET_PARAMETER_MATRIX, info=Info.SET_PARAMETER_MATRIX)
|
||||
oce.add(keys=OpCodes.ONE_SHOOT_HK, info=Info.ONE_SHOOT_HK)
|
||||
oce.add(keys=OpCodes.ENABLE_HK, info=Info.ENABLE_HK)
|
||||
oce.add(keys=OpCodes.DISABLE_HK, info=Info.DISABLE_HK)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.ACS_CTRL.value, info="ACS Controller", op_code_entry=oce
|
||||
def create_acs_ctrl_node() -> CmdTreeNode:
|
||||
# Zip the two classes together into a dictionary
|
||||
op_code_strs = [
|
||||
getattr(OpCodes, key) for key in dir(OpCodes) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCodes) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
acs_ctrl = CmdTreeNode(
|
||||
"acs_ctrl", "ACS Controller", hide_children_which_are_leaves=True
|
||||
)
|
||||
for op_code, info in combined_dict.items():
|
||||
acs_ctrl.add_child(CmdTreeNode(op_code, info))
|
||||
return acs_ctrl
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.ACS_CTRL.value)
|
||||
def pack_acs_ctrl_command(p: ServiceProviderParams): # noqa C901
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
if op_code == OpCodes.OFF:
|
||||
def pack_acs_ctrl_command(q: DefaultPusQueueHelper, cmd_str: str): # noqa C901
|
||||
if cmd_str in OpCodes.OFF:
|
||||
q.add_log_cmd(f"{Info.OFF}")
|
||||
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, Mode.OFF, 0))
|
||||
elif op_code == OpCodes.SAFE:
|
||||
elif cmd_str in OpCodes.SAFE:
|
||||
q.add_log_cmd(f"{Info.SAFE}")
|
||||
q.add_pus_tc(
|
||||
pack_mode_command(ACS_CONTROLLER, AcsMode.SAFE, SafeSubmode.DEFAULT)
|
||||
)
|
||||
elif op_code == OpCodes.DTBL:
|
||||
elif cmd_str in OpCodes.DTBL:
|
||||
q.add_log_cmd(f"{Info.DTBL}")
|
||||
q.add_pus_tc(
|
||||
pack_mode_command(ACS_CONTROLLER, AcsMode.SAFE, SafeSubmode.DETUMBLE)
|
||||
)
|
||||
elif op_code == OpCodes.IDLE:
|
||||
elif cmd_str in OpCodes.IDLE:
|
||||
q.add_log_cmd(f"{Info.IDLE}")
|
||||
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, AcsMode.IDLE, 0))
|
||||
elif op_code == OpCodes.NADIR:
|
||||
elif cmd_str in OpCodes.NADIR:
|
||||
q.add_log_cmd(f"{Info.NADIR}")
|
||||
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, AcsMode.PTG_NADIR, 0))
|
||||
elif op_code == OpCodes.TARGET:
|
||||
elif cmd_str in OpCodes.TARGET:
|
||||
q.add_log_cmd(f"{Info.TARGET}")
|
||||
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, AcsMode.PTG_TARGET, 0))
|
||||
elif op_code == OpCodes.GS:
|
||||
elif cmd_str in OpCodes.GS:
|
||||
q.add_log_cmd(f"{Info.GS}")
|
||||
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, AcsMode.PTG_TARGET_GS, 0))
|
||||
elif op_code == OpCodes.INERTIAL:
|
||||
elif cmd_str in OpCodes.INERTIAL:
|
||||
q.add_log_cmd(f"{Info.INERTIAL}")
|
||||
q.add_pus_tc(pack_mode_command(ACS_CONTROLLER, AcsMode.PTG_INERTIAL, 0))
|
||||
elif op_code == OpCodes.SAFE_PTG:
|
||||
elif cmd_str in OpCodes.SAFE_PTG:
|
||||
q.add_log_cmd(f"{Info.SAFE_PTG}")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
ACS_CONTROLLER, ActionId.SOLAR_ARRAY_DEPLOYMENT_SUCCESSFUL
|
||||
)
|
||||
)
|
||||
elif op_code == OpCodes.RESET_MEKF:
|
||||
elif cmd_str in OpCodes.RESET_MEKF:
|
||||
q.add_log_cmd(f"{Info.RESET_MEKF}")
|
||||
q.add_pus_tc(create_action_cmd(ACS_CONTROLLER, ActionId.RESET_MEKF))
|
||||
elif op_code == OpCodes.RESTORE_MEKF_NONFINITE_RECOVERY:
|
||||
elif cmd_str in OpCodes.RESTORE_MEKF_NONFINITE_RECOVERY:
|
||||
q.add_log_cmd(f"{Info.RESTORE_MEKF_NONFINITE_RECOVERY}")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(ACS_CONTROLLER, ActionId.RESTORE_MEKF_NONFINITE_RECOVERY)
|
||||
)
|
||||
elif op_code == OpCodes.UPDATE_TLE:
|
||||
elif cmd_str in OpCodes.UPDATE_TLE:
|
||||
q.add_log_cmd(f"{Info.UPDATE_TLE}")
|
||||
while True:
|
||||
line1 = input("Please input the first line of the TLE: ")
|
||||
@ -262,29 +243,34 @@ def pack_acs_ctrl_command(p: ServiceProviderParams): # noqa C901
|
||||
print("The line does not have the required length of 69 characters")
|
||||
tle = line1.encode() + line2.encode()
|
||||
q.add_pus_tc(create_action_cmd(ACS_CONTROLLER, ActionId.UPDATE_TLE, tle))
|
||||
elif op_code == OpCodes.READ_TLE:
|
||||
elif cmd_str == OpCodes.READ_TLE:
|
||||
q.add_log_cmd(f"{Info.READ_TLE}")
|
||||
q.add_pus_tc(create_action_cmd(ACS_CONTROLLER, ActionId.READ_TLE))
|
||||
elif op_code == OpCodes.SET_PARAMETER_SCALAR:
|
||||
elif cmd_str == OpCodes.UPDATE_MEKF_STANDARD_DEVIATIONS:
|
||||
q.add_log_cmd(f"{Info.UPDATE_MEKF_STANDARD_DEVIATIONS}")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(ACS_CONTROLLER, ActionId.UPDATE_MEKF_STANDARD_DEVIATIONS)
|
||||
)
|
||||
elif cmd_str == OpCodes.SET_PARAMETER_SCALAR:
|
||||
q.add_log_cmd(f"{Info.SET_PARAMETER_SCALAR}")
|
||||
set_acs_ctrl_param_scalar(q)
|
||||
elif op_code == OpCodes.SET_PARAMETER_VECTOR:
|
||||
elif cmd_str == OpCodes.SET_PARAMETER_VECTOR:
|
||||
q.add_log_cmd(f"{Info.SET_PARAMETER_VECTOR}")
|
||||
set_acs_ctrl_param_vector(q)
|
||||
elif op_code == OpCodes.SET_PARAMETER_MATRIX:
|
||||
elif cmd_str == OpCodes.SET_PARAMETER_MATRIX:
|
||||
q.add_log_cmd(f"{Info.SET_PARAMETER_MATRIX}")
|
||||
set_acs_ctrl_param_matrix(q)
|
||||
elif op_code == OpCodes.ONE_SHOOT_HK:
|
||||
elif cmd_str == OpCodes.ONE_SHOOT_HK:
|
||||
q.add_log_cmd(Info.ONE_SHOOT_HK)
|
||||
request_dataset(q, DataSetRequest.ONESHOT)
|
||||
elif op_code == OpCodes.ENABLE_HK:
|
||||
elif cmd_str == OpCodes.ENABLE_HK:
|
||||
q.add_log_cmd(Info.ENABLE_HK)
|
||||
request_dataset(q, DataSetRequest.ENABLE)
|
||||
elif op_code == OpCodes.DISABLE_HK:
|
||||
elif cmd_str == OpCodes.DISABLE_HK:
|
||||
q.add_log_cmd(Info.DISABLE_HK)
|
||||
request_dataset(q, DataSetRequest.DISABLE)
|
||||
else:
|
||||
logging.getLogger(__name__).info(f"Unknown op code {op_code}")
|
||||
logging.getLogger(__name__).info(f"Unknown op code {cmd_str}")
|
||||
|
||||
|
||||
def request_dataset(q: DefaultPusQueueHelper, req_type: DataSetRequest):
|
||||
@ -428,7 +414,7 @@ def set_acs_ctrl_param_vector(q: DefaultPusQueueHelper):
|
||||
domain_id=sid,
|
||||
unique_id=pid,
|
||||
parameters=param,
|
||||
).pack()
|
||||
)
|
||||
)
|
||||
)
|
||||
else:
|
||||
@ -571,7 +557,7 @@ def handle_acs_ctrl_sus_raw_data(pw: PrintWrapper, hk_data: bytes):
|
||||
sus_list_formatted = vec_fmt.format(*sus_list)
|
||||
current_idx += length
|
||||
pw.dlog(f"SUS {idx} RAW: {sus_list_formatted}")
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=12))
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=12))
|
||||
|
||||
|
||||
def handle_acs_ctrl_sus_processed_data(pw: PrintWrapper, hk_data: bytes):
|
||||
@ -607,7 +593,7 @@ def handle_acs_ctrl_sus_processed_data(pw: PrintWrapper, hk_data: bytes):
|
||||
sun_ijk_model = vec_fmt.format(*sun_ijk_model)
|
||||
current_idx += inc_len
|
||||
pw.dlog(f"{'SUS ijk Model'.ljust(25)}: {sun_ijk_model}")
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=15))
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=15))
|
||||
|
||||
|
||||
def handle_raw_mgm_data(pw: PrintWrapper, hk_data: bytes):
|
||||
@ -621,7 +607,7 @@ def handle_raw_mgm_data(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog(f"Raw Data: {hk_data.hex(sep=',')}")
|
||||
return
|
||||
|
||||
def unpack_float_tuple(idx: int) -> (tuple, int):
|
||||
def unpack_float_tuple(idx: int) -> Tuple[tuple, int]:
|
||||
f_tuple = struct.unpack(
|
||||
float_tuple_fmt_str,
|
||||
hk_data[idx : idx + struct.calcsize(float_tuple_fmt_str)],
|
||||
@ -663,7 +649,7 @@ def handle_raw_mgm_data(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog(f"{entry[0].ljust(28)}: {entry[1]}")
|
||||
current_idx += 1
|
||||
assert current_idx == 61
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=6))
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=6))
|
||||
|
||||
|
||||
def handle_mgm_data_processed(pw: PrintWrapper, hk_data: bytes):
|
||||
@ -717,7 +703,7 @@ def handle_mgm_data_processed(pw: PrintWrapper, hk_data: bytes):
|
||||
current_idx += inc_len
|
||||
if PERFORM_MGM_CALIBRATION:
|
||||
perform_mgm_calibration(pw, mgm_3)
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=8))
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=8))
|
||||
|
||||
|
||||
def handle_gyr_data_raw(pw: PrintWrapper, hk_data: bytes):
|
||||
@ -751,7 +737,7 @@ def handle_gyr_data_raw(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog(f"{'GYR 1 L3'.ljust(15)}: {float_str_fmt.format(*gyr_1_l3)}")
|
||||
pw.dlog(f"{'GYR 2 ADIS'.ljust(15)}: {float_str_fmt.format(*gyr_2_adis)}")
|
||||
pw.dlog(f"{'GYR 3 L3'.ljust(15)}: {float_str_fmt.format(*gyr_3_l3)}")
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], 4))
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], 4))
|
||||
|
||||
|
||||
GYR_NAMES = ["GYR 0 ADIS", "GYR 1 L3", "GYR 2 ADIS", "GYR 3 L3"]
|
||||
@ -777,7 +763,7 @@ def handle_gyr_data_processed(pw: PrintWrapper, hk_data: bytes):
|
||||
]
|
||||
pw.dlog(f"GYR Vec Total: {gyr_vec_tot}")
|
||||
current_idx += inc_len
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=5))
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=5))
|
||||
|
||||
|
||||
def handle_gps_data_processed(pw: PrintWrapper, hk_data: bytes):
|
||||
@ -840,7 +826,7 @@ def handle_gps_data_processed(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog(f"GPS Altitude: {alt} [m]")
|
||||
pw.dlog(f"GPS Position: {pos} [m]")
|
||||
pw.dlog(f"GPS Velocity: {velo} [m/s]")
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=6))
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=6))
|
||||
|
||||
|
||||
def handle_attitude_estimation_data(pw: PrintWrapper, hk_data: bytes):
|
||||
@ -895,9 +881,9 @@ def handle_attitude_estimation_data(pw: PrintWrapper, hk_data: bytes):
|
||||
)
|
||||
current_idx += inc_len_quat
|
||||
pw.dlog(f"{'QUEST Quaternion'.ljust(25)}: {fmt_str_4.format(*quest_quat)}")
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=4))
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=4))
|
||||
return
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=3))
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=3))
|
||||
|
||||
|
||||
def handle_ctrl_val_data(pw: PrintWrapper, hk_data: bytes):
|
||||
@ -954,7 +940,7 @@ def handle_ctrl_val_data(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog(f"Control Values Error Quaternion: {err_quat}")
|
||||
pw.dlog(f"Control Values Error Angle: {err_ang} [deg]")
|
||||
pw.dlog(f"Control Values Target Rotational Rate: {tgt_rot} [deg/s]")
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=5))
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=5))
|
||||
|
||||
|
||||
def handle_act_cmd_data(pw: PrintWrapper, hk_data: bytes):
|
||||
@ -993,7 +979,7 @@ def handle_act_cmd_data(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog(f"Actuator Commands RW Target Torque: {rw_tgt_torque}")
|
||||
pw.dlog(f"Actuator Commands RW Target Speed: {rw_tgt_speed}")
|
||||
pw.dlog(f"Actuator Commands MTQ Target Dipole: {mtq_tgt_dipole}")
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=3))
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=3))
|
||||
|
||||
|
||||
def handle_fused_rot_rate_data(pw: PrintWrapper, hk_data: bytes):
|
||||
@ -1044,9 +1030,9 @@ def handle_fused_rot_rate_data(pw: PrintWrapper, hk_data: bytes):
|
||||
)
|
||||
else:
|
||||
pw.dlog(f"Ctrl Strategy (key unknown): {rot_rate_source}")
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=4))
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=4))
|
||||
return
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=3))
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=3))
|
||||
|
||||
|
||||
def handle_fused_rot_rate_source_data(pw: PrintWrapper, hk_data: bytes):
|
||||
@ -1101,7 +1087,7 @@ def handle_fused_rot_rate_source_data(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog(f"Fused Rotational Rate Total SUSMGM: {rot_rate_total_susmgm} [deg/s]")
|
||||
pw.dlog(f"Fused Rotational Rate Total QUEST: {rot_rate_total_quest} [deg/s]")
|
||||
pw.dlog(f"Fused Rotational Rate Total STR: {rot_rate_total_str} [deg/s]")
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=5))
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=5))
|
||||
|
||||
|
||||
def handle_acs_ctrl_action_replies(
|
||||
@ -1124,6 +1110,9 @@ def perform_mgm_calibration( # noqa C901: Complexity okay
|
||||
pw: PrintWrapper, mgm_tuple: Tuple
|
||||
): # noqa C901: Complexity okay
|
||||
global CALIBR_SOCKET, CALIBRATION_ADDR
|
||||
if not PERFORM_MGM_CALIBRATION:
|
||||
return
|
||||
assert CALIBR_SOCKET is not None
|
||||
try:
|
||||
declare_api_cmd = "declare_api_version 2"
|
||||
CALIBR_SOCKET.sendall(f"{declare_api_cmd}\n".encode())
|
||||
|
@ -3,10 +3,8 @@ import enum
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.config import CmdTreeNode
|
||||
from tmtccmd.pus.s200_fsfw_mode import create_mode_command, Mode
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
@ -15,7 +13,8 @@ from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
create_enable_periodic_hk_command_with_interval_with_diag,
|
||||
create_disable_periodic_hk_command_with_diag,
|
||||
)
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.pus.tc.s8_fsfw_action import create_action_cmd
|
||||
from tmtccmd.fsfw.tmtc_printer import get_validity_buffer_str
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -24,16 +23,25 @@ class GpsInfo:
|
||||
MAX_SATELLITES = 30
|
||||
|
||||
|
||||
class ActIds:
|
||||
RESET_GNSS = 5
|
||||
|
||||
|
||||
class AcsBoardSides(enum.IntEnum):
|
||||
A_SIDE = 0
|
||||
B_SIDE = 1
|
||||
|
||||
|
||||
class OpCode:
|
||||
OFF = "off"
|
||||
ON = "on"
|
||||
REQ_CORE_HK = ["core_hk_request"]
|
||||
ENABLE_CORE_HK = ["core_hk_enable"]
|
||||
DISABLE_CORE_HK = ["core_hk_disable"]
|
||||
REQ_SKYVIEW_HK = ["skyview_hk_request"]
|
||||
ENABLE_SKYVIEW_HK = ["skyview_hk_enable"]
|
||||
DISABLE_SKYVIEW_HK = ["skyview_hk_disable"]
|
||||
RESET_GNSS = ["reset"]
|
||||
REQ_CORE_HK = "core_hk_request"
|
||||
ENABLE_CORE_HK = "core_hk_enable"
|
||||
DISABLE_CORE_HK = "core_hk_disable"
|
||||
REQ_SKYVIEW_HK = "skyview_hk_request"
|
||||
ENABLE_SKYVIEW_HK = "skyview_hk_enable"
|
||||
DISABLE_SKYVIEW_HK = "skyview_hk_disable"
|
||||
RESET_GNSS = "reset_gnss"
|
||||
|
||||
|
||||
class Info:
|
||||
@ -53,32 +61,34 @@ class SetId(enum.IntEnum):
|
||||
SKYVIEW_HK = 1
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_gps_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCode.OFF, info=Info.OFF)
|
||||
oce.add(keys=OpCode.ON, info=Info.ON)
|
||||
oce.add(keys=OpCode.RESET_GNSS, info=Info.RESET_GNSS)
|
||||
oce.add(keys=OpCode.REQ_CORE_HK, info=Info.REQ_CORE_HK)
|
||||
oce.add(keys=OpCode.ENABLE_CORE_HK, info=Info.ENABLE_CORE_HK)
|
||||
oce.add(keys=OpCode.DISABLE_CORE_HK, info=Info.DISABLE_CORE_HK)
|
||||
oce.add(keys=OpCode.REQ_SKYVIEW_HK, info=Info.REQ_SKYVIEW_HK)
|
||||
oce.add(keys=OpCode.ENABLE_SKYVIEW_HK, info=Info.ENABLE_SKYVIEW_HK)
|
||||
oce.add(keys=OpCode.DISABLE_SKYVIEW_HK, info=Info.DISABLE_SKYVIEW_HK)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.GPS_CTRL.value,
|
||||
info="GPS/GNSS Controller",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
def create_gnss_node() -> CmdTreeNode:
|
||||
op_code_strs = [
|
||||
getattr(OpCode, key) for key in dir(OpCode) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
node = CmdTreeNode("gnss_ctrl", "GNSS Ctrl", hide_children_for_print=True)
|
||||
for op_code, info in combined_dict.items():
|
||||
node.add_child(CmdTreeNode(op_code, info))
|
||||
return node
|
||||
|
||||
|
||||
def pack_gps_command( # noqa: C901
|
||||
object_id: bytes, q: DefaultPusQueueHelper, op_code: str
|
||||
object_id: bytes, q: DefaultPusQueueHelper, cmd_str: str
|
||||
): # noqa: C901:
|
||||
if op_code in OpCode.RESET_GNSS:
|
||||
# TODO: This needs to be re-implemented
|
||||
_LOGGER.warning("Reset pin handling needs to be re-implemented")
|
||||
if op_code in OpCode.ENABLE_CORE_HK:
|
||||
if cmd_str == OpCode.RESET_GNSS:
|
||||
for val in AcsBoardSides:
|
||||
print("{:<2}: {:<20}".format(val, val.name))
|
||||
board_side = int(input("Select Board Side \n" ""))
|
||||
q.add_log_cmd(f"GPS: {Info.RESET_GNSS}")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
object_id=object_id,
|
||||
action_id=ActIds.RESET_GNSS,
|
||||
user_data=bytearray([board_side]),
|
||||
)
|
||||
)
|
||||
if cmd_str == OpCode.ENABLE_CORE_HK:
|
||||
interval = float(input("Please specify interval in floating point seconds: "))
|
||||
if interval <= 0:
|
||||
raise ValueError("invalid interval")
|
||||
@ -90,21 +100,21 @@ def pack_gps_command( # noqa: C901
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code in OpCode.DISABLE_CORE_HK:
|
||||
if cmd_str == OpCode.DISABLE_CORE_HK:
|
||||
q.add_log_cmd(f"gps: {Info.DISABLE_CORE_HK}")
|
||||
q.add_pus_tc(
|
||||
create_disable_periodic_hk_command_with_diag(
|
||||
diag=False, sid=make_sid(object_id=object_id, set_id=SetId.CORE_HK)
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.REQ_CORE_HK:
|
||||
if cmd_str == OpCode.REQ_CORE_HK:
|
||||
q.add_log_cmd(f"GPS: {Info.REQ_CORE_HK}")
|
||||
q.add_pus_tc(
|
||||
create_request_one_hk_command(
|
||||
sid=make_sid(object_id=object_id, set_id=SetId.CORE_HK)
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.ENABLE_SKYVIEW_HK:
|
||||
if cmd_str == OpCode.ENABLE_SKYVIEW_HK:
|
||||
interval = float(input("Please specify interval in floating point seconds: "))
|
||||
if interval <= 0:
|
||||
raise ValueError("invalid interval")
|
||||
@ -116,24 +126,24 @@ def pack_gps_command( # noqa: C901
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code in OpCode.DISABLE_SKYVIEW_HK:
|
||||
if cmd_str == OpCode.DISABLE_SKYVIEW_HK:
|
||||
q.add_log_cmd(f"gps: {Info.DISABLE_SKYVIEW_HK}")
|
||||
q.add_pus_tc(
|
||||
create_disable_periodic_hk_command_with_diag(
|
||||
diag=False, sid=make_sid(object_id=object_id, set_id=SetId.SKYVIEW_HK)
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.REQ_SKYVIEW_HK:
|
||||
if cmd_str == OpCode.REQ_SKYVIEW_HK:
|
||||
q.add_log_cmd(f"GPS: {Info.REQ_SKYVIEW_HK}")
|
||||
q.add_pus_tc(
|
||||
create_request_one_hk_command(
|
||||
sid=make_sid(object_id=object_id, set_id=SetId.SKYVIEW_HK)
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.ON:
|
||||
if cmd_str == OpCode.ON:
|
||||
q.add_log_cmd(f"GPS: {Info.ON}")
|
||||
q.add_pus_tc(create_mode_command(object_id, Mode.ON, 0))
|
||||
if op_code in OpCode.OFF:
|
||||
if cmd_str == OpCode.OFF:
|
||||
q.add_log_cmd(f"GPS: {Info.OFF}")
|
||||
q.add_pus_tc(create_mode_command(object_id, Mode.OFF, 0))
|
||||
|
||||
@ -193,9 +203,7 @@ def handle_core_data(pw: PrintWrapper, hk_data: bytes):
|
||||
)
|
||||
pw.dlog(f"GNSS Date: {date_string}")
|
||||
pw.dlog(f"Unix seconds {unix_seconds}")
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=hk_data[current_idx:], num_vars=14
|
||||
)
|
||||
pw.dlog(get_validity_buffer_str(validity_buffer=hk_data[current_idx:], num_vars=14))
|
||||
|
||||
|
||||
def handle_skyview_data(pw: PrintWrapper, hk_data: bytes):
|
||||
@ -255,6 +263,4 @@ def handle_skyview_data(pw: PrintWrapper, hk_data: bytes):
|
||||
used[idx],
|
||||
)
|
||||
)
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=hk_data[current_idx:], num_vars=6
|
||||
)
|
||||
pw.dlog(get_validity_buffer_str(validity_buffer=hk_data[current_idx:], num_vars=6))
|
||||
|
@ -3,6 +3,7 @@ import logging
|
||||
import struct
|
||||
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.config import CmdTreeNode
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s201_fsfw_health import pack_set_health_cmd_data, FsfwHealth
|
||||
from tmtccmd.pus.s201_fsfw_health import Subservice
|
||||
@ -59,7 +60,7 @@ GYR_SEL_DICT = {
|
||||
}
|
||||
|
||||
|
||||
def handle_gyr_cmd(q: DefaultPusQueueHelper, op_code: str):
|
||||
def handle_gyr_cmd(q: DefaultPusQueueHelper, cmd_str: str):
|
||||
print("Please select the Gyro Device")
|
||||
for k, v in GYR_SEL_DICT.items():
|
||||
print(f"{k}: {v[0]}")
|
||||
@ -72,23 +73,23 @@ def handle_gyr_cmd(q: DefaultPusQueueHelper, op_code: str):
|
||||
core_hk_id = AdisGyroSetId.CORE_HK
|
||||
else:
|
||||
core_hk_id = L3gGyroSetId.CORE_HK
|
||||
if op_code == OpCode.NML:
|
||||
if cmd_str == OpCode.NML:
|
||||
q.add_log_cmd(f"Gyro {gyr_info[0]} NORMAL mode")
|
||||
q.add_pus_tc(create_mode_command(gyr_obj_id, Mode.NORMAL, 0))
|
||||
if op_code == OpCode.OFF:
|
||||
if cmd_str == OpCode.OFF:
|
||||
q.add_log_cmd(f"Gyro {gyr_info[0]} OFF mode")
|
||||
q.add_pus_tc(create_mode_command(gyr_obj_id, Mode.OFF, 0))
|
||||
elif op_code == OpCode.CORE_HK:
|
||||
elif cmd_str == OpCode.CORE_HK:
|
||||
q.add_log_cmd(f"Gyro {gyr_info[0]} Core HK")
|
||||
q.add_pus_tc(create_request_one_hk_command(make_sid(gyr_obj_id, core_hk_id)))
|
||||
elif op_code == OpCode.CFG_HK:
|
||||
elif cmd_str == OpCode.CFG_HK:
|
||||
if not is_adis:
|
||||
raise ValueError("No config HK for L3 device")
|
||||
q.add_log_cmd(f"Gyro {gyr_info[0]} CFG HK")
|
||||
q.add_pus_tc(
|
||||
create_request_one_hk_command(make_sid(gyr_obj_id, AdisGyroSetId.CFG_HK))
|
||||
)
|
||||
elif op_code == OpCode.SET_FAULTY:
|
||||
elif cmd_str == OpCode.SET_FAULTY:
|
||||
q.add_log_cmd(f"Gyro {gyr_info[0]} set faulty")
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
@ -101,7 +102,7 @@ def handle_gyr_cmd(q: DefaultPusQueueHelper, op_code: str):
|
||||
)
|
||||
else:
|
||||
logging.getLogger(__name__).warning(
|
||||
f"invalid op code {op_code} for gyro command"
|
||||
f"invalid op code {cmd_str} for gyro command"
|
||||
)
|
||||
|
||||
|
||||
@ -177,6 +178,16 @@ def handle_l3g_gyro_hk(
|
||||
pw.dlog(f"Temperature {temp} °C")
|
||||
|
||||
|
||||
def create_gyros_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode("gyros", "Gyroscope devices")
|
||||
node.add_child(CmdTreeNode(OpCode.CORE_HK, "Request Core HK"))
|
||||
node.add_child(CmdTreeNode(OpCode.CFG_HK, "Request CFG HK"))
|
||||
node.add_child(CmdTreeNode(OpCode.NML, "Normal Mode"))
|
||||
node.add_child(CmdTreeNode(OpCode.OFF, "Off Mode"))
|
||||
node.add_child(CmdTreeNode(OpCode.SET_FAULTY, "Set Faulty"))
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_gyr_cmd_defs(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
|
@ -10,6 +10,8 @@ import logging
|
||||
import struct
|
||||
from typing import List
|
||||
|
||||
from tmtccmd.config import CmdTreeNode
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
@ -29,7 +31,7 @@ from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
)
|
||||
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.fsfw.tmtc_printer import get_validity_buffer_str
|
||||
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -91,6 +93,74 @@ class ImtqActionId:
|
||||
read_self_test_results = bytearray([0x0, 0x0, 0x0, 0x0D])
|
||||
|
||||
|
||||
CTN = CmdTreeNode
|
||||
|
||||
|
||||
def create_mgt_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode(
|
||||
"mgt", "iMTQ MGT device node", hide_children_which_are_leaves=True
|
||||
)
|
||||
node.add_child(CmdTreeNode(OpCode.OFF, "Mode OFF"))
|
||||
node.add_child(CmdTreeNode(OpCode.ON, "Mode ON"))
|
||||
node.add_child(CmdTreeNode(OpCode.NORMAL, "Mode Normal"))
|
||||
node.add_child(CmdTreeNode(OpCode.OFF, "Mode OFF"))
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.REQUEST_ENG_HK_NO_TORQUE, "Request Engineering HK One Shot")
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
OpCode.REQUEST_ENG_HK_WITH_TORQUE,
|
||||
"Request Engineering HK One Shot during Torque",
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.ENABLE_ENG_HK_NO_TORQUE, "Enable ENG HK not torque")
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.ENABLE_ENG_HK_WITH_TORQUE, "Enable ENG HK with torque")
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.DISABLE_ENG_HK_NO_TORQUE, "Disable ENG HK not torque")
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.DISABLE_ENG_HK_WITH_TORQUE, "Disable ENG HK with torque")
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
OpCode.REQUEST_MGM_RAW_NO_TORQUE,
|
||||
"Request MGM Raw Without Torque HK One Shot",
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.ENABLE_MGM_RAW_NO_TORQUE, "Enable MGM Raw Without Torque HK")
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
OpCode.DISABLE_MGM_RAW_NO_TORQUE, "Disable MGM Raw Without Torque HK"
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
OpCode.REQUEST_MGM_RAW_WITH_TORQUE,
|
||||
"Request MGM Raw With Torque HK One Shot",
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.ENABLE_MGM_RAW_WITH_TORQUE, "Enable MGM Raw With Torque HK")
|
||||
)
|
||||
node.add_child(
|
||||
CTN(OpCode.DISABLE_MGM_RAW_WITH_TORQUE, "Disable MGM Raw With Torque HK")
|
||||
)
|
||||
node.add_child(CTN(OpCode.POS_X_SELF_TEST, "IMTQ perform pos X self test"))
|
||||
node.add_child(CTN(OpCode.NEG_X_SELF_TEST, "IMTQ perform neg X self test"))
|
||||
node.add_child(CTN(OpCode.POS_Y_SELF_TEST, "IMTQ perform pos Y self test"))
|
||||
node.add_child(CTN(OpCode.NEG_Y_SELF_TEST, "IMTQ perform neg Y self test"))
|
||||
node.add_child(CTN(OpCode.POS_Z_SELF_TEST, "IMTQ perform pos Z self test"))
|
||||
node.add_child(CTN(OpCode.NEG_Z_SELF_TEST, "IMTQ perform neg Z self test"))
|
||||
node.add_child(CTN(OpCode.SET_DIPOLE, "IMTQ command dipole"))
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_imtq_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
@ -128,26 +198,26 @@ def add_imtq_cmds(defs: TmtcDefinitionWrapper):
|
||||
defs.add_service(CustomServiceList.IMTQ.value, "IMQT Device", oce)
|
||||
|
||||
|
||||
def pack_imtq_test_into( # noqa C901
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||
def create_imtq_command( # noqa C901
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, cmd_str: str
|
||||
):
|
||||
q.add_log_cmd(
|
||||
f"Testing ISIS IMTQ handler with object id: {object_id.as_hex_string}"
|
||||
)
|
||||
|
||||
if op_code == OpCode.OFF:
|
||||
if cmd_str == OpCode.OFF:
|
||||
q.add_log_cmd("IMTQ: Set mode off")
|
||||
command = pack_mode_data(object_id.as_bytes, Mode.OFF, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code == OpCode.ON:
|
||||
if cmd_str == OpCode.ON:
|
||||
q.add_log_cmd("IMTQ: Set mode on")
|
||||
command = pack_mode_data(object_id.as_bytes, Mode.ON, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code == OpCode.NORMAL:
|
||||
if cmd_str == OpCode.NORMAL:
|
||||
q.add_log_cmd("IMTQ: Mode Normal")
|
||||
command = pack_mode_data(object_id.as_bytes, Mode.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code == OpCode.POS_X_SELF_TEST:
|
||||
if cmd_str == OpCode.POS_X_SELF_TEST:
|
||||
q.add_log_cmd("IMTQ: Perform positive x self test")
|
||||
command = object_id.as_bytes + ImtqActionId.perform_positive_x_test
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
@ -160,7 +230,7 @@ def pack_imtq_test_into( # noqa C901
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetId.POSITIVE_X_TEST)
|
||||
q.add_pus_tc(generate_one_hk_command(sid))
|
||||
|
||||
if op_code == OpCode.NEG_X_SELF_TEST:
|
||||
if cmd_str == OpCode.NEG_X_SELF_TEST:
|
||||
q.add_log_cmd("IMTQ: Perform negative x self test")
|
||||
command = object_id.as_bytes + ImtqActionId.perform_negative_x_test
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
@ -171,7 +241,7 @@ def pack_imtq_test_into( # noqa C901
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetId.NEGATIVE_X_TEST)
|
||||
q.add_pus_tc(generate_one_hk_command(sid))
|
||||
|
||||
if op_code == OpCode.POS_Y_SELF_TEST:
|
||||
if cmd_str == OpCode.POS_Y_SELF_TEST:
|
||||
q.add_log_cmd("IMTQ: Perform positive y self test")
|
||||
command = object_id.as_bytes + ImtqActionId.perform_positive_y_test
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
@ -183,7 +253,7 @@ def pack_imtq_test_into( # noqa C901
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetId.POSITIVE_Y_TEST)
|
||||
q.add_pus_tc(generate_one_hk_command(sid))
|
||||
|
||||
if op_code == OpCode.NEG_Y_SELF_TEST:
|
||||
if cmd_str == OpCode.NEG_Y_SELF_TEST:
|
||||
q.add_log_cmd("IMTQ: Perform negative y self test")
|
||||
command = object_id.as_bytes + ImtqActionId.perform_negative_y_test
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
@ -196,7 +266,7 @@ def pack_imtq_test_into( # noqa C901
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetId.NEGATIVE_Y_TEST)
|
||||
q.add_pus_tc(generate_one_hk_command(sid))
|
||||
|
||||
if op_code == OpCode.POS_Z_SELF_TEST:
|
||||
if cmd_str == OpCode.POS_Z_SELF_TEST:
|
||||
q.add_log_cmd("IMTQ: Perform positive z self test")
|
||||
command = object_id.as_bytes + ImtqActionId.perform_positive_z_test
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
@ -209,7 +279,7 @@ def pack_imtq_test_into( # noqa C901
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetId.POSITIVE_Y_TEST)
|
||||
q.add_pus_tc(generate_one_hk_command(sid))
|
||||
|
||||
if op_code == OpCode.NEG_Z_SELF_TEST:
|
||||
if cmd_str == OpCode.NEG_Z_SELF_TEST:
|
||||
q.add_log_cmd("IMTQ: Perform negative z self test")
|
||||
command = object_id.as_bytes + ImtqActionId.perform_negative_z_test
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
@ -220,7 +290,7 @@ def pack_imtq_test_into( # noqa C901
|
||||
sid = make_sid(object_id.as_bytes, ImtqSetId.NEGATIVE_Z_TEST)
|
||||
q.add_pus_tc(generate_one_hk_command(sid))
|
||||
|
||||
if op_code in OpCode.SET_DIPOLE:
|
||||
if cmd_str in OpCode.SET_DIPOLE:
|
||||
x_dipole = int(input("Specify X dipole [range [0, 2000] * 10^-4 * Am^2]: "))
|
||||
y_dipole = int(input("Specify Y dipole [range [0, 2000] * 10^-4 * Am^2]: "))
|
||||
z_dipole = int(input("Specify Z dipole [range [0, 2000] * 10^-4 * Am^2]: "))
|
||||
@ -241,12 +311,12 @@ def pack_imtq_test_into( # noqa C901
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == "10": # doesnt seem to work anymore
|
||||
if cmd_str == "10": # doesnt seem to work anymore
|
||||
q.add_log_cmd("IMTQ: Get commanded dipole")
|
||||
command = object_id.as_bytes + ImtqActionId.get_commanded_dipole
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
if op_code == OpCode.ENABLE_ENG_HK_NO_TORQUE:
|
||||
if cmd_str == OpCode.ENABLE_ENG_HK_NO_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Enable ENG HK")
|
||||
interval = float(input("Please enter collection interval in seconds: "))
|
||||
cmds = create_enable_periodic_hk_command_with_interval_with_diag(
|
||||
@ -256,14 +326,14 @@ def pack_imtq_test_into( # noqa C901
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code == OpCode.DISABLE_ENG_HK_NO_TORQUE:
|
||||
if cmd_str == OpCode.DISABLE_ENG_HK_NO_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Disable ENG HK (No Torque)")
|
||||
q.add_pus_tc(
|
||||
create_disable_periodic_hk_command_with_diag(
|
||||
True, make_sid(object_id.as_bytes, ImtqSetId.ENG_HK_NO_TORQUE)
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.REQUEST_ENG_HK_WITH_TORQUE:
|
||||
if cmd_str == OpCode.REQUEST_ENG_HK_WITH_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Get engineering hk set with torque")
|
||||
q.add_pus_tc(
|
||||
create_request_one_diag_command(
|
||||
@ -273,7 +343,7 @@ def pack_imtq_test_into( # noqa C901
|
||||
)
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.ENABLE_ENG_HK_WITH_TORQUE:
|
||||
if cmd_str == OpCode.ENABLE_ENG_HK_WITH_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Enable ENG HK with torque")
|
||||
interval = float(input("Please enter collection interval in seconds: "))
|
||||
cmds = create_enable_periodic_hk_command_with_interval_with_diag(
|
||||
@ -283,14 +353,14 @@ def pack_imtq_test_into( # noqa C901
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code == OpCode.DISABLE_ENG_HK_WITH_TORQUE:
|
||||
if cmd_str == OpCode.DISABLE_ENG_HK_WITH_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Disable ENG HK with Torque")
|
||||
q.add_pus_tc(
|
||||
create_disable_periodic_hk_command_with_diag(
|
||||
True, make_sid(object_id.as_bytes, ImtqSetId.ENG_HK_SET_WITH_TORQUE)
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.REQUEST_ENG_HK_NO_TORQUE:
|
||||
if cmd_str == OpCode.REQUEST_ENG_HK_NO_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Get engineering hk set (no torque)")
|
||||
q.add_pus_tc(
|
||||
generate_one_diag_command(
|
||||
@ -300,7 +370,7 @@ def pack_imtq_test_into( # noqa C901
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == "12":
|
||||
if cmd_str == "12":
|
||||
q.add_log_cmd("IMTQ: Get calibrated MTM hk set")
|
||||
q.add_pus_tc(
|
||||
create_request_one_diag_command(
|
||||
@ -308,7 +378,7 @@ def pack_imtq_test_into( # noqa C901
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == OpCode.REQUEST_MGM_RAW_NO_TORQUE:
|
||||
if cmd_str == OpCode.REQUEST_MGM_RAW_NO_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Get raw MTM hk set")
|
||||
q.add_pus_tc(
|
||||
create_request_one_diag_command(
|
||||
@ -318,14 +388,14 @@ def pack_imtq_test_into( # noqa C901
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == OpCode.DISABLE_MGM_RAW_NO_TORQUE:
|
||||
if cmd_str == OpCode.DISABLE_MGM_RAW_NO_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Disable MGM RAW HK (No Torque)")
|
||||
q.add_pus_tc(
|
||||
create_disable_periodic_hk_command_with_diag(
|
||||
True, make_sid(object_id.as_bytes, ImtqSetId.RAW_MTM_NO_TORQUE)
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.ENABLE_MGM_RAW_NO_TORQUE:
|
||||
if cmd_str == OpCode.ENABLE_MGM_RAW_NO_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Enable MGM RAW HK (No Torque)")
|
||||
interval = float(input("Please enter collection interval in seconds: "))
|
||||
cmds = create_enable_periodic_hk_command_with_interval_with_diag(
|
||||
@ -335,7 +405,7 @@ def pack_imtq_test_into( # noqa C901
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code == OpCode.REQUEST_MGM_RAW_WITH_TORQUE:
|
||||
if cmd_str == OpCode.REQUEST_MGM_RAW_WITH_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Get raw MTM hk set")
|
||||
q.add_pus_tc(
|
||||
create_request_one_diag_command(
|
||||
@ -344,7 +414,7 @@ def pack_imtq_test_into( # noqa C901
|
||||
)
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.ENABLE_MGM_RAW_WITH_TORQUE:
|
||||
if cmd_str == OpCode.ENABLE_MGM_RAW_WITH_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Enable MGM RAW HK (No Torque)")
|
||||
interval = float(input("Please enter collection interval in seconds: "))
|
||||
cmds = create_enable_periodic_hk_command_with_interval_with_diag(
|
||||
@ -354,7 +424,7 @@ def pack_imtq_test_into( # noqa C901
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code == OpCode.DISABLE_MGM_RAW_WITH_TORQUE:
|
||||
if cmd_str == OpCode.DISABLE_MGM_RAW_WITH_TORQUE:
|
||||
q.add_log_cmd("IMTQ: Disable MGM RAW HK (No Torque)")
|
||||
q.add_pus_tc(
|
||||
create_disable_periodic_hk_command_with_diag(
|
||||
@ -473,7 +543,7 @@ def handle_dipole_set(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog(f"Dipole Y: {dipole_y}")
|
||||
pw.dlog(f"Dipole Z: {dipole_z}")
|
||||
pw.dlog(f"Current torque duration: {current_torque_duration}")
|
||||
FsfwTmTcPrinter.get_validity_buffer(hk_data[fmt_len:], 2)
|
||||
pw.dlog(get_validity_buffer_str(hk_data[fmt_len:], 2))
|
||||
|
||||
|
||||
def unpack_eng_hk(hk_data: bytes) -> List:
|
||||
@ -513,9 +583,7 @@ def handle_eng_set(pw: PrintWrapper, hk_data: bytes, torque_on: bool):
|
||||
for k, v in zip(ENG_HK_HEADERS, content_list):
|
||||
pw.dlog(f"{k.ljust(30)}: {v}")
|
||||
pw.dlog(
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=validity_buffer, num_vars=num_of_vars
|
||||
)
|
||||
get_validity_buffer_str(validity_buffer=validity_buffer, num_vars=num_of_vars)
|
||||
)
|
||||
|
||||
|
||||
@ -527,9 +595,7 @@ def handle_status_set(pw: PrintWrapper, hk_data: bytes):
|
||||
for k, v in zip(STATUS_HEADERS, content_list):
|
||||
pw.dlog(f"{k.ljust(30)}: {v}")
|
||||
pw.dlog(
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=validity_buffer, num_vars=num_of_vars
|
||||
)
|
||||
get_validity_buffer_str(validity_buffer=validity_buffer, num_vars=num_of_vars)
|
||||
)
|
||||
|
||||
|
||||
@ -550,9 +616,7 @@ def handle_calibrated_mtm_measurement(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog(str(header_list))
|
||||
pw.dlog(str(content_list))
|
||||
pw.dlog(
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=validity_buffer, num_vars=num_of_vars
|
||||
)
|
||||
get_validity_buffer_str(validity_buffer=validity_buffer, num_vars=num_of_vars)
|
||||
)
|
||||
|
||||
|
||||
@ -574,9 +638,7 @@ def handle_raw_mtm_measurement(pw: PrintWrapper, hk_data: bytes, torque_status:
|
||||
pw.dlog(str(header_list))
|
||||
pw.dlog(str(content_list))
|
||||
pw.dlog(
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=validity_buffer, num_vars=num_of_vars
|
||||
)
|
||||
get_validity_buffer_str(validity_buffer=validity_buffer, num_vars=num_of_vars)
|
||||
)
|
||||
|
||||
|
||||
@ -713,7 +775,5 @@ def handle_self_test_data(pw: PrintWrapper, hk_data: bytes):
|
||||
pw.dlog(str(header_list))
|
||||
pw.dlog(str(content_list))
|
||||
pw.dlog(
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=validity_buffer, num_vars=num_of_vars
|
||||
)
|
||||
get_validity_buffer_str(validity_buffer=validity_buffer, num_vars=num_of_vars)
|
||||
)
|
||||
|
@ -2,7 +2,7 @@ import enum
|
||||
import struct
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config import OpCodeEntry
|
||||
from tmtccmd.config import CmdTreeNode, OpCodeEntry
|
||||
|
||||
import eive_tmtc.config.object_ids as obj_ids
|
||||
from eive_tmtc.config.object_ids import (
|
||||
@ -47,17 +47,17 @@ MGM_SEL_DICT = {
|
||||
}
|
||||
|
||||
|
||||
def handle_mgm_cmd(q: DefaultPusQueueHelper, op_code: str):
|
||||
def handle_mgm_cmd(q: DefaultPusQueueHelper, cmd_str: str):
|
||||
print("Please select the MGM Device")
|
||||
for k, v in MGM_SEL_DICT.items():
|
||||
print(f"{k}: {v[0]}")
|
||||
sel_idx = int(input("Select MGM device by index: "))
|
||||
mgm_info = MGM_SEL_DICT[MgmSel(sel_idx)]
|
||||
mgm_obj_id = mgm_info[1]
|
||||
if op_code == OpCode.NORMAL:
|
||||
if cmd_str == OpCode.NORMAL:
|
||||
q.add_log_cmd(f"Gyro {mgm_info[0]} NORMAL mode")
|
||||
q.add_pus_tc(create_mode_command(mgm_obj_id, Mode.NORMAL, 0))
|
||||
if op_code == OpCode.OFF:
|
||||
if cmd_str == OpCode.OFF:
|
||||
q.add_log_cmd(f"Gyro {mgm_info[0]} OFF mode")
|
||||
q.add_pus_tc(create_mode_command(mgm_obj_id, Mode.OFF, 0))
|
||||
|
||||
@ -107,6 +107,13 @@ def handle_mgm_rm3100_hk_data(
|
||||
)
|
||||
|
||||
|
||||
def create_mgms_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode("mgms", "Magnetometer devices")
|
||||
node.add_child(CmdTreeNode(OpCode.NORMAL, "Normal Mode"))
|
||||
node.add_child(CmdTreeNode(OpCode.OFF, "Off Mode"))
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_mgm_cmd_defs(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
|
@ -6,12 +6,11 @@
|
||||
"""
|
||||
import enum
|
||||
import struct
|
||||
from typing import List
|
||||
from typing import List, Tuple
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.config.object_ids import RW1_ID, RW2_ID, RW3_ID, RW4_ID
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.config import CmdTreeNode
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
generate_one_hk_command,
|
||||
@ -23,9 +22,8 @@ from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode, Subservice
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.fsfw.tmtc_printer import get_validity_buffer_str
|
||||
|
||||
|
||||
class OpCodesDev:
|
||||
@ -53,11 +51,11 @@ class InfoDev:
|
||||
|
||||
|
||||
class OpCodesAss:
|
||||
ON = ["0", "on"]
|
||||
NML = ["1", "nml"]
|
||||
OFF = ["2", "off"]
|
||||
ALL_SPEED_UP = ["3", "speed_up"]
|
||||
ALL_SPEED_OFF = ["4", "speed_off"]
|
||||
ON = "on"
|
||||
NML = "nml"
|
||||
OFF = "off"
|
||||
ALL_SPEED_UP = "speed_up"
|
||||
ALL_SPEED_OFF = "speed_off"
|
||||
|
||||
|
||||
class ActionId:
|
||||
@ -99,55 +97,45 @@ class RampTime:
|
||||
MS_1000 = 1000
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_rw_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(info=InfoDev.SPEED, keys=OpCodesDev.SPEED)
|
||||
oce.add(info=InfoDev.ON, keys=OpCodesDev.ON)
|
||||
oce.add(info=InfoDev.OFF, keys=OpCodesDev.OFF)
|
||||
oce.add(info=InfoDev.NML, keys=OpCodesDev.NML)
|
||||
oce.add(info=InfoDev.REQ_TM, keys=OpCodesDev.REQ_TM)
|
||||
oce.add(info=InfoDev.GET_STATUS, keys=OpCodesDev.GET_STATUS)
|
||||
oce.add(info=InfoDev.GET_TM, keys=OpCodesDev.GET_TM)
|
||||
oce.add(info=InfoDev.ENABLE_STATUS_HK, keys=OpCodesDev.ENABLE_STATUS_HK)
|
||||
oce.add(info=InfoDev.DISABLE_STATUS_HK, keys=OpCodesDev.DISABLE_STATUS_HK)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.REACTION_WHEEL_1.value,
|
||||
info="Reaction Wheel 1",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.REACTION_WHEEL_2.value,
|
||||
info="Reaction Wheel 2",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.REACTION_WHEEL_3.value,
|
||||
info="Reaction Wheel 3",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.REACTION_WHEEL_4.value,
|
||||
info="Reaction Wheel 4",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
oce = OpCodeEntry()
|
||||
oce.add(info=InfoAss.ON, keys=OpCodesAss.ON)
|
||||
oce.add(info=InfoAss.NML, keys=OpCodesAss.NML)
|
||||
oce.add(info=InfoAss.OFF, keys=OpCodesAss.OFF)
|
||||
oce.add(info=InfoAss.ALL_SPEED_UP, keys=OpCodesAss.ALL_SPEED_UP)
|
||||
oce.add(info=InfoAss.ALL_SPEED_OFF, keys=OpCodesAss.ALL_SPEED_OFF)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.RW_ASSEMBLY.value,
|
||||
info="Reaction Wheel Assembly",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
def create_reaction_wheels_nodes() -> List[CmdTreeNode]:
|
||||
nodes = []
|
||||
for i in range(4):
|
||||
next_node = CmdTreeNode(
|
||||
f"rw_{i}", f"Reaction Wheel {i}", hide_children_which_are_leaves=True
|
||||
)
|
||||
next_node.add_child(CmdTreeNode(InfoDev.SPEED, OpCodesDev.SPEED))
|
||||
next_node.add_child(CmdTreeNode(InfoDev.ON, OpCodesDev.ON))
|
||||
next_node.add_child(CmdTreeNode(InfoDev.OFF, OpCodesDev.OFF))
|
||||
next_node.add_child(CmdTreeNode(InfoDev.NML, OpCodesDev.NML))
|
||||
next_node.add_child(CmdTreeNode(InfoDev.REQ_TM, OpCodesDev.REQ_TM))
|
||||
next_node.add_child(CmdTreeNode(InfoDev.GET_STATUS, OpCodesDev.GET_STATUS))
|
||||
next_node.add_child(CmdTreeNode(InfoDev.GET_TM, OpCodesDev.GET_TM))
|
||||
next_node.add_child(
|
||||
CmdTreeNode(InfoDev.ENABLE_STATUS_HK, OpCodesDev.ENABLE_STATUS_HK)
|
||||
)
|
||||
next_node.add_child(
|
||||
CmdTreeNode(InfoDev.DISABLE_STATUS_HK, OpCodesDev.DISABLE_STATUS_HK)
|
||||
)
|
||||
nodes.append(next_node)
|
||||
return nodes
|
||||
|
||||
|
||||
def pack_single_rw_test_into( # noqa C901: Complexity is okay here.
|
||||
object_id: bytes, rw_idx: int, q: DefaultPusQueueHelper, op_code: str
|
||||
def create_reaction_wheel_assembly_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode(
|
||||
"rw_assy", "Reaction Wheels Assembly", hide_children_which_are_leaves=True
|
||||
)
|
||||
node.add_child(CmdTreeNode(OpCodesAss.ON, InfoAss.ON))
|
||||
node.add_child(CmdTreeNode(OpCodesAss.NML, InfoAss.NML))
|
||||
node.add_child(CmdTreeNode(OpCodesAss.OFF, InfoAss.OFF))
|
||||
node.add_child(CmdTreeNode(OpCodesAss.ALL_SPEED_UP, InfoAss.ALL_SPEED_UP))
|
||||
node.add_child(CmdTreeNode(OpCodesAss.ALL_SPEED_OFF, InfoAss.ALL_SPEED_OFF))
|
||||
return node
|
||||
|
||||
|
||||
def create_single_rw_cmd( # noqa C901: Complexity is okay here.
|
||||
object_id: bytes, rw_idx: int, q: DefaultPusQueueHelper, cmd_str: str
|
||||
):
|
||||
if op_code == OpCodesDev.SPEED:
|
||||
if cmd_str == OpCodesDev.SPEED:
|
||||
speed, ramp_time = prompt_speed_ramp_time()
|
||||
q.add_log_cmd(
|
||||
f"RW {rw_idx}: {InfoDev.SPEED} with target "
|
||||
@ -155,41 +143,41 @@ def pack_single_rw_test_into( # noqa C901: Complexity is okay here.
|
||||
)
|
||||
q.add_pus_tc(pack_set_speed_command(object_id, speed, ramp_time))
|
||||
|
||||
if op_code == OpCodesDev.ON:
|
||||
if cmd_str == OpCodesDev.ON:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.ON}")
|
||||
mode_data = pack_mode_data(object_id, Mode.ON, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
|
||||
if op_code == OpCodesDev.NML:
|
||||
if cmd_str == OpCodesDev.NML:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.NML}")
|
||||
mode_data = pack_mode_data(object_id, Mode.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
|
||||
if op_code == OpCodesDev.OFF:
|
||||
if cmd_str == OpCodesDev.OFF:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.OFF}")
|
||||
mode_data = pack_mode_data(object_id, Mode.OFF, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
|
||||
if op_code == OpCodesDev.GET_TM:
|
||||
if cmd_str == OpCodesDev.GET_TM:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.GET_TM}")
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(
|
||||
sid=make_sid(object_id=object_id, set_id=RwSetId.TM_SET)
|
||||
)
|
||||
)
|
||||
if op_code == OpCodesDev.REQ_TM:
|
||||
if cmd_str == OpCodesDev.REQ_TM:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.REQ_TM}")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(object_id=object_id, action_id=ActionId.REQUEST_TM)
|
||||
)
|
||||
if op_code in OpCodesDev.GET_STATUS:
|
||||
if cmd_str == OpCodesDev.GET_STATUS:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.GET_STATUS}")
|
||||
q.add_pus_tc(
|
||||
generate_one_diag_command(
|
||||
sid=make_sid(object_id=object_id, set_id=RwSetId.STATUS_SET_ID)
|
||||
)
|
||||
)
|
||||
if op_code in OpCodesDev.ENABLE_STATUS_HK:
|
||||
if cmd_str == OpCodesDev.ENABLE_STATUS_HK:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.ENABLE_STATUS_HK}")
|
||||
interval = float(input("Please enter HK interval in floating point seconds: "))
|
||||
cmds = enable_periodic_hk_command_with_interval(
|
||||
@ -197,7 +185,7 @@ def pack_single_rw_test_into( # noqa C901: Complexity is okay here.
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code in OpCodesDev.DISABLE_STATUS_HK:
|
||||
if cmd_str == OpCodesDev.DISABLE_STATUS_HK:
|
||||
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.DISABLE_STATUS_HK}")
|
||||
q.add_pus_tc(
|
||||
disable_periodic_hk_command(
|
||||
@ -206,38 +194,38 @@ def pack_single_rw_test_into( # noqa C901: Complexity is okay here.
|
||||
)
|
||||
|
||||
|
||||
def pack_rw_ass_cmds(q: DefaultPusQueueHelper, object_id: bytes, op_code: str):
|
||||
if op_code in OpCodesAss.OFF:
|
||||
def pack_rw_ass_cmds(q: DefaultPusQueueHelper, object_id: bytes, cmd_str: str):
|
||||
if cmd_str in OpCodesAss.OFF:
|
||||
data = pack_mode_data(object_id=object_id, mode=Mode.OFF, submode=0)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=data
|
||||
)
|
||||
)
|
||||
if op_code in OpCodesAss.ON:
|
||||
if cmd_str in OpCodesAss.ON:
|
||||
data = pack_mode_data(object_id=object_id, mode=Mode.ON, submode=0)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=data
|
||||
)
|
||||
)
|
||||
if op_code in OpCodesAss.NML:
|
||||
if cmd_str in OpCodesAss.NML:
|
||||
data = pack_mode_data(object_id=object_id, mode=Mode.NORMAL, submode=0)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=data
|
||||
)
|
||||
)
|
||||
if op_code in OpCodesAss.ALL_SPEED_UP:
|
||||
if cmd_str in OpCodesAss.ALL_SPEED_UP:
|
||||
speed, ramp_time = prompt_speed_ramp_time()
|
||||
rw_speed_up_cmd_consec(q, [RW1_ID, RW2_ID, RW3_ID, RW4_ID], speed, ramp_time)
|
||||
if op_code in OpCodesAss.ALL_SPEED_OFF:
|
||||
if cmd_str in OpCodesAss.ALL_SPEED_OFF:
|
||||
rw_speed_down_cmd_consec(
|
||||
q, [RW1_ID, RW2_ID, RW3_ID, RW4_ID], prompt_ramp_time()
|
||||
)
|
||||
|
||||
|
||||
def prompt_speed_ramp_time() -> (int, int):
|
||||
def prompt_speed_ramp_time() -> Tuple[int, int]:
|
||||
speed = int(
|
||||
input("Specify speed [0.1 RPM, 0 or range [-65000, -1000] and [1000, 65000]: ")
|
||||
)
|
||||
@ -313,7 +301,7 @@ def handle_rw_hk_data(
|
||||
f"Current Limit Control mode {clc_mode}. 0: Low Current Mode (0.3 A), "
|
||||
"1: High Current Mode (0.6 A)"
|
||||
)
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], 5))
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], 5))
|
||||
if set_id == RwSetId.LAST_RESET:
|
||||
pw.dlog(
|
||||
f"Received Last Reset HK (ID {set_id}) from Reaction Wheel {object_id.name}"
|
||||
@ -402,7 +390,7 @@ def handle_rw_hk_data(
|
||||
)
|
||||
if current_idx > 0:
|
||||
pw.dlog(
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
get_validity_buffer_str(
|
||||
validity_buffer=hk_data[current_idx:], num_vars=27
|
||||
)
|
||||
)
|
||||
|
@ -9,13 +9,12 @@ import datetime
|
||||
import enum
|
||||
import logging
|
||||
import struct
|
||||
from typing import List, Tuple
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.utility.input_helper import InputHelper
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.config import CmdTreeNode
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
create_request_one_diag_command,
|
||||
create_request_one_hk_command,
|
||||
@ -23,16 +22,27 @@ from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
disable_periodic_hk_command,
|
||||
make_sid,
|
||||
)
|
||||
from tmtccmd.pus.s20_fsfw_param import create_load_param_cmd, create_scalar_u8_parameter
|
||||
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.fsfw.tmtc_printer import get_validity_buffer_str
|
||||
from eive_tmtc.config.object_ids import STR_ASSEMBLY, STAR_TRACKER_ID
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class FirmwareTarget(enum.IntEnum):
|
||||
MAIN = 1
|
||||
BACKUP = 10
|
||||
|
||||
|
||||
class ParamId(enum.IntEnum):
|
||||
FIRMWARE_TARGET = 1
|
||||
FIRMWARE_TARGET_PERSISTENT = 2
|
||||
|
||||
|
||||
class StarTrackerActionId(enum.IntEnum):
|
||||
PING = 0
|
||||
BOOT = 1
|
||||
@ -95,7 +105,10 @@ class StarTrackerActionId(enum.IntEnum):
|
||||
LOGLEVEL = 81
|
||||
LOG_SUBSCRIPTION = 82
|
||||
DEBUG_CAMERA = 83
|
||||
# Legacy variable.
|
||||
FIRMWARE_UPDATE = 84
|
||||
FIRMWARE_UPDATE_MAIN = 84
|
||||
FIRMWARE_UPDATE_BACKUP = 101
|
||||
SET_TIME_FROM_SYS_TIME = 87
|
||||
ADD_SECONDARY_TM_TO_NORMAL_MODE = 95
|
||||
RESET_SECONDARY_TM_SET = 96
|
||||
@ -119,12 +132,23 @@ class OpCode:
|
||||
UPLOAD_IMAGE = "upload_image"
|
||||
DOWNLOAD_IMAGE = "download_image"
|
||||
SET_IMG_PROCESSOR_MODE = "set_img_proc_mode"
|
||||
FW_UPDATE = "fw_update"
|
||||
FW_UPDATE_MAIN = "fw_update_main"
|
||||
SET_TIME_FROM_SYS_TIME = "set_time"
|
||||
RELOAD_JSON_CFG_FILE = "reload_json_cfg"
|
||||
FW_UPDATE_BACKUP = "fw_update_backup"
|
||||
SELECT_TARGET_FIRMWARE_MAIN = "fw_main"
|
||||
SELECT_TARGET_FIRMWARE_BACKUP = "fw_backup"
|
||||
SELECT_TARGET_FIRMWARE_MAIN_PERSISTENT = "fw_main_persistent"
|
||||
SELECT_TARGET_FIRMWARE_BACKUP_PERSISTENT = "fw_backup_persistent"
|
||||
REQUEST_VERSION = "request_version"
|
||||
|
||||
|
||||
class Info:
|
||||
ON_BOOTLOADER = "Switch to Mode On, Submode Bootloder"
|
||||
ON_FIRMWARE = "Switch to Mode On, Submode Firmware"
|
||||
NORMAL = "Switch to Mode Normal"
|
||||
OFF = "Switch to Mode Off"
|
||||
PING = "Send Ping"
|
||||
ONE_SHOOT_HK = "One shoot HK Set"
|
||||
ENABLE_HK = "Enable Periodic HK"
|
||||
DISABLE_HK = "Disable Periodic HK"
|
||||
@ -135,9 +159,17 @@ class Info:
|
||||
DOWNLOAD_IMAGE = "Download Optical Image"
|
||||
TAKE_IMAGE = "Take Image"
|
||||
SET_IMG_PROCESSOR_MODE = "Set Image Processor Mode"
|
||||
FW_UPDATE = "Firmware Update"
|
||||
FW_UPDATE_MAIN = "Update Main Firmware Slot"
|
||||
FW_UPDATE_BACKUP = "Update Backup Firmware Slot"
|
||||
SET_TIME_FROM_SYS_TIME = "Set time from system time"
|
||||
RELOAD_JSON_CFG_FILE = "Reload JSON configuration file. Reboot still required."
|
||||
SELECT_TARGET_FIRMWARE_MAIN = "Select main firmware slot"
|
||||
SELECT_TARGET_FIRMWARE_BACKUP = "Select backup firmware slot"
|
||||
SELECT_TARGET_FIRMWARE_MAIN_PERSISTENT = "Select main firmware slot persistently"
|
||||
SELECT_TARGET_FIRMWARE_BACKUP_PERSISTENT = (
|
||||
"Select backup firmware slot persistently"
|
||||
)
|
||||
REQUEST_VERSION = "Request the active Firmware Version"
|
||||
|
||||
|
||||
class SetId(enum.IntEnum):
|
||||
@ -159,6 +191,7 @@ class SetId(enum.IntEnum):
|
||||
BLOBS = 92
|
||||
CENTROID = 93
|
||||
CENTROIDS = 94
|
||||
BLOB_STATS = 102
|
||||
|
||||
|
||||
class DataSetRequest(enum.IntEnum):
|
||||
@ -241,68 +274,64 @@ def prompt_object_id_mode_cmd() -> bytes:
|
||||
|
||||
|
||||
def pack_star_tracker_commands( # noqa C901
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, cmd_str: str
|
||||
):
|
||||
q.add_log_cmd(
|
||||
f"Generate command for star tracker with object id: {object_id.as_hex_string}"
|
||||
)
|
||||
obyt = object_id.as_bytes
|
||||
if op_code == OpCode.ON_BOOTLOADER:
|
||||
if cmd_str == OpCode.ON_BOOTLOADER:
|
||||
q.add_log_cmd("Star tracker: Mode On, Submode Bootloader")
|
||||
data = pack_mode_data(prompt_object_id_mode_cmd(), Mode.ON, Submode.BOOTLOADER)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == OpCode.ON_FIRMWARE:
|
||||
if cmd_str == OpCode.ON_FIRMWARE:
|
||||
q.add_log_cmd("Star tracker: Mode On, Submode Firmware")
|
||||
data = pack_mode_data(prompt_object_id_mode_cmd(), Mode.ON, Submode.FIRMWARE)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == OpCode.NORMAL:
|
||||
if cmd_str == OpCode.NORMAL:
|
||||
q.add_log_cmd("Star tracker: Mode Normal")
|
||||
data = pack_mode_data(prompt_object_id_mode_cmd(), Mode.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == OpCode.OFF:
|
||||
if cmd_str == OpCode.OFF:
|
||||
q.add_log_cmd("Star tracker: Mode Off")
|
||||
data = pack_mode_data(prompt_object_id_mode_cmd(), Mode.OFF, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == OpCode.ONE_SHOOT_HK:
|
||||
if cmd_str == OpCode.ONE_SHOOT_HK:
|
||||
q.add_log_cmd(Info.ONE_SHOOT_HK)
|
||||
request_dataset(q, DataSetRequest.ONESHOT)
|
||||
if op_code == OpCode.ENABLE_HK:
|
||||
if cmd_str == OpCode.ENABLE_HK:
|
||||
q.add_log_cmd(Info.ENABLE_HK)
|
||||
request_dataset(q, DataSetRequest.ENABLE)
|
||||
if op_code == OpCode.DISABLE_HK:
|
||||
if cmd_str == OpCode.DISABLE_HK:
|
||||
q.add_log_cmd(Info.DISABLE_HK)
|
||||
request_dataset(q, DataSetRequest.DISABLE)
|
||||
if op_code == "4":
|
||||
if cmd_str == "4":
|
||||
q.add_log_cmd("Star tracker: Mode Raw")
|
||||
data = pack_mode_data(obyt, Mode.RAW, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == OpCode.PING:
|
||||
if cmd_str == OpCode.PING:
|
||||
q.add_log_cmd("Star tracker: Ping")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.PING)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "6":
|
||||
if cmd_str == "6":
|
||||
q.add_log_cmd("Star tracker: Switch to bootloader program")
|
||||
data = obyt + struct.pack(
|
||||
"!I", StarTrackerActionId.SWITCH_TO_BOOTLOADER_PROGRAM
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "7":
|
||||
if cmd_str == "7":
|
||||
q.add_log_cmd("Star tracker: Temperature request")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_TEMPERATURE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "8":
|
||||
q.add_log_cmd("Star tracker: Request version")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_VERSION)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "9":
|
||||
if cmd_str == "9":
|
||||
q.add_log_cmd("Star tracker: Request interface")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_INTERFACE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "10":
|
||||
if cmd_str == "10":
|
||||
q.add_log_cmd("Star tracker: Request power")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_POWER)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "11":
|
||||
if cmd_str == "11":
|
||||
q.add_log_cmd("Star tracker: Set subscription parameters")
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
@ -311,15 +340,15 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "12":
|
||||
if cmd_str == "12":
|
||||
q.add_log_cmd("Star tracker: Boot")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.BOOT)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "13":
|
||||
if cmd_str == "13":
|
||||
q.add_log_cmd("Star tracker: Request time")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_TIME)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == OpCode.UPLOAD_IMAGE:
|
||||
if cmd_str == OpCode.UPLOAD_IMAGE:
|
||||
q.add_log_cmd("Star tracker: Upload image")
|
||||
image = get_upload_image()
|
||||
data = (
|
||||
@ -328,7 +357,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(image, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == OpCode.DOWNLOAD_IMAGE:
|
||||
if cmd_str == OpCode.DOWNLOAD_IMAGE:
|
||||
q.add_log_cmd(f"STR: {Info.DOWNLOAD_IMAGE}")
|
||||
path = input("Specify storage location (default - /mnt/sd0/startracker): ")
|
||||
if not path:
|
||||
@ -339,7 +368,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(path, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "17":
|
||||
if cmd_str == "17":
|
||||
q.add_log_cmd("Star tracker: Set limits")
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
@ -348,7 +377,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "18":
|
||||
if cmd_str == "18":
|
||||
q.add_log_cmd("Star tracker: Set tracking parameters")
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
@ -357,7 +386,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "19":
|
||||
if cmd_str == "19":
|
||||
q.add_log_cmd("Star tracker: Mounting")
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
@ -366,7 +395,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "20":
|
||||
if cmd_str == "20":
|
||||
q.add_log_cmd("Star tracker: Camera")
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
@ -375,7 +404,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "22":
|
||||
if cmd_str == "22":
|
||||
q.add_log_cmd("Star tracker: Centroiding")
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
@ -384,7 +413,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "23":
|
||||
if cmd_str == "23":
|
||||
q.add_log_cmd("Star tracker: LISA")
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
@ -393,7 +422,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "24":
|
||||
if cmd_str == "24":
|
||||
q.add_log_cmd("Star tracker: Matching")
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
@ -402,7 +431,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "25":
|
||||
if cmd_str == "25":
|
||||
q.add_log_cmd("Star tracker: Validation")
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
@ -411,7 +440,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "26":
|
||||
if cmd_str == "26":
|
||||
q.add_log_cmd("Star tracker: Algo")
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
@ -420,7 +449,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == OpCode.TAKE_IMAGE:
|
||||
if cmd_str == OpCode.TAKE_IMAGE:
|
||||
q.add_log_cmd("Star tracker: Take image")
|
||||
actionid = int(
|
||||
input("Specify parameter ID (4: take image, 7: get histogram): ")
|
||||
@ -431,11 +460,11 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ struct.pack("!B", actionid)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "28":
|
||||
if cmd_str == "28":
|
||||
q.add_log_cmd("Star tracker: Stop str helper")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.STOP_STR_HELPER)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "30":
|
||||
if cmd_str == "30":
|
||||
q.add_log_cmd("Star tracker: Set name of download image")
|
||||
filename = input("Specify download image name: ")
|
||||
data = (
|
||||
@ -444,15 +473,15 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(filename, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "31":
|
||||
if cmd_str == "31":
|
||||
q.add_log_cmd("Star tracker: Request histogram")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_HISTOGRAM)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "32":
|
||||
if cmd_str == "32":
|
||||
q.add_log_cmd("Star tracker: Request contrast")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_CONTRAST)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "33":
|
||||
if cmd_str == "33":
|
||||
q.add_log_cmd("Star tracker: Set json filename")
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
@ -461,11 +490,11 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "35":
|
||||
if cmd_str == "35":
|
||||
q.add_log_cmd("Star tracker: Flash read")
|
||||
data = pack_read_command(obyt)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "36":
|
||||
if cmd_str == "36":
|
||||
q.add_log_cmd("Star tracker: Set flash read filename")
|
||||
filename = input("Specify filename: ")
|
||||
data = (
|
||||
@ -474,15 +503,15 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(filename, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "37":
|
||||
if cmd_str == "37":
|
||||
q.add_log_cmd("Star tracker: Get checksum")
|
||||
data = pack_checksum_command(obyt)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == OpCode.SET_TIME_FROM_SYS_TIME:
|
||||
if cmd_str == OpCode.SET_TIME_FROM_SYS_TIME:
|
||||
q.add_log_cmd(Info.SET_TIME_FROM_SYS_TIME)
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.SET_TIME_FROM_SYS_TIME)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "39":
|
||||
if cmd_str == "39":
|
||||
q.add_log_cmd("Star tracker: Download Centroid")
|
||||
id = 0
|
||||
data = (
|
||||
@ -491,7 +520,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ struct.pack("!B", id)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "41":
|
||||
if cmd_str == "41":
|
||||
q.add_log_cmd("Star tracker: Download matched star")
|
||||
id = 0
|
||||
data = (
|
||||
@ -500,7 +529,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ struct.pack("!B", id)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "42":
|
||||
if cmd_str == "42":
|
||||
q.add_log_cmd("Star tracker: Download DB Image")
|
||||
id = 0
|
||||
data = (
|
||||
@ -509,7 +538,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ struct.pack("!B", id)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "43":
|
||||
if cmd_str == "43":
|
||||
q.add_log_cmd("Star tracker: Download Blob Pixel")
|
||||
id = 0
|
||||
type = 1 # 0 - normal, 1 - fast
|
||||
@ -520,7 +549,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ struct.pack("!B", type)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "47":
|
||||
if cmd_str == "47":
|
||||
q.add_log_cmd("Star tracker: FPGA action")
|
||||
id = 3
|
||||
data = (
|
||||
@ -529,19 +558,19 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ struct.pack("!B", id)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "48":
|
||||
if cmd_str == "48":
|
||||
q.add_log_cmd("Star tracker: Unlock")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.UNLOCK)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "49":
|
||||
if cmd_str == "49":
|
||||
q.add_log_cmd("Star tracker: Request camera parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_CAMERA_PARAMS)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "50":
|
||||
if cmd_str == "50":
|
||||
q.add_log_cmd("Star tracker: Request limits")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_LIMITS)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == OpCode.SET_IMG_PROCESSOR_MODE:
|
||||
if cmd_str == OpCode.SET_IMG_PROCESSOR_MODE:
|
||||
q.add_log_cmd(Info.SET_IMG_PROCESSOR_MODE)
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
@ -550,7 +579,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "52":
|
||||
if cmd_str == "52":
|
||||
q.add_log_cmd("Star tracker: EGSE load ground config camera parameters")
|
||||
data = (
|
||||
obyt
|
||||
@ -558,7 +587,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(FileDefs.egse_ground_config, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "53":
|
||||
if cmd_str == "53":
|
||||
q.add_log_cmd("Star tracker: EGSE load flight config camera parameters")
|
||||
data = (
|
||||
obyt
|
||||
@ -566,55 +595,55 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(FileDefs.egse_flight_config, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "54":
|
||||
if cmd_str == "54":
|
||||
q.add_log_cmd("Star tracker: Request log level parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_LOG_LEVEL)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "55":
|
||||
if cmd_str == "55":
|
||||
q.add_log_cmd("Star tracker: Request mounting parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_MOUNTING)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "56":
|
||||
if cmd_str == "56":
|
||||
q.add_log_cmd("Star tracker: Request image processor parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_IMAGE_PROCESSOR)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "57":
|
||||
if cmd_str == "57":
|
||||
q.add_log_cmd("Star tracker: Request centroiding parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_CENTROIDING)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "58":
|
||||
if cmd_str == "58":
|
||||
q.add_log_cmd("Star tracker: Request lisa parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_LISA)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "59":
|
||||
if cmd_str == "59":
|
||||
q.add_log_cmd("Star tracker: Request matching parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_MATCHING)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "60":
|
||||
if cmd_str == "60":
|
||||
q.add_log_cmd("Star tracker: Request tracking parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_TRACKING)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "61":
|
||||
if cmd_str == "61":
|
||||
q.add_log_cmd("Star tracker: Request validation parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_VALIDATION)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "62":
|
||||
if cmd_str == "62":
|
||||
q.add_log_cmd("Star tracker: Request algo parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_ALGO)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "63":
|
||||
if cmd_str == "63":
|
||||
q.add_log_cmd("Star tracker: Request subscription parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_SUBSCRIPTION)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "64":
|
||||
if cmd_str == "64":
|
||||
q.add_log_cmd("Star tracker: Request log subscription parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_LOG_SUBSCRIPTION)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "65":
|
||||
if cmd_str == "65":
|
||||
q.add_log_cmd("Star tracker: Request debug camera parameters")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_DEBUG_CAMERA)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "66":
|
||||
if cmd_str == "66":
|
||||
q.add_log_cmd("Star tracker: Set log level parameters")
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
@ -623,7 +652,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "67":
|
||||
if cmd_str == "67":
|
||||
q.add_log_cmd("Star tracker: Set log subscription parameters")
|
||||
|
||||
json_file = get_config_file()
|
||||
@ -633,7 +662,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "68":
|
||||
if cmd_str == "68":
|
||||
q.add_log_cmd("Star tracker: Set debug camera parameters")
|
||||
json_file = get_config_file()
|
||||
data = (
|
||||
@ -642,16 +671,25 @@ def pack_star_tracker_commands( # noqa C901
|
||||
+ bytearray(json_file, "utf-8")
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == OpCode.FW_UPDATE:
|
||||
q.add_log_cmd(Info.FW_UPDATE)
|
||||
if cmd_str == OpCode.FW_UPDATE_MAIN:
|
||||
q.add_log_cmd(Info.FW_UPDATE_MAIN)
|
||||
firmware = get_firmware()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionId.FIRMWARE_UPDATE)
|
||||
+ struct.pack("!I", StarTrackerActionId.FIRMWARE_UPDATE_MAIN)
|
||||
+ firmware.encode()
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == OpCode.ADD_SECONDARY_TM_TO_NORMAL_MODE:
|
||||
if cmd_str == OpCode.FW_UPDATE_BACKUP:
|
||||
q.add_log_cmd(Info.FW_UPDATE_BACKUP)
|
||||
firmware = get_firmware()
|
||||
data = (
|
||||
obyt
|
||||
+ struct.pack("!I", StarTrackerActionId.FIRMWARE_UPDATE_BACKUP)
|
||||
+ firmware.encode()
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if cmd_str == OpCode.ADD_SECONDARY_TM_TO_NORMAL_MODE:
|
||||
q.add_log_cmd(Info.ADD_SECONDARY_TM_TO_NORMAL_MODE)
|
||||
for val in SetId:
|
||||
print("{:<2}: {:<20}".format(val, val.name))
|
||||
@ -663,7 +701,7 @@ def pack_star_tracker_commands( # noqa C901
|
||||
struct.pack("!I", set_id),
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.RESET_SECONDARY_TM_SET:
|
||||
if cmd_str == OpCode.RESET_SECONDARY_TM_SET:
|
||||
q.add_log_cmd(Info.RESET_SECONDARY_TM_SET)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
@ -671,18 +709,55 @@ def pack_star_tracker_commands( # noqa C901
|
||||
StarTrackerActionId.RESET_SECONDARY_TM_SET,
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.READ_SECONDARY_TM_SET:
|
||||
if cmd_str == OpCode.READ_SECONDARY_TM_SET:
|
||||
q.add_log_cmd(Info.READ_SECONDARY_TM_SET)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
STAR_TRACKER_ID, StarTrackerActionId.READ_SECONDARY_TM_SET
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.RELOAD_JSON_CFG_FILE:
|
||||
if cmd_str == OpCode.RELOAD_JSON_CFG_FILE:
|
||||
q.add_log_cmd(Info.RELOAD_JSON_CFG_FILE)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(STAR_TRACKER_ID, StarTrackerActionId.RELOAD_JSON_CFG_FILE)
|
||||
)
|
||||
if cmd_str == OpCode.SELECT_TARGET_FIRMWARE_MAIN:
|
||||
q.add_log_cmd(Info.SELECT_TARGET_FIRMWARE_MAIN)
|
||||
q.add_pus_tc(create_update_firmware_target_cmd(False, FirmwareTarget.MAIN))
|
||||
if cmd_str == OpCode.SELECT_TARGET_FIRMWARE_BACKUP:
|
||||
q.add_log_cmd(Info.SELECT_TARGET_FIRMWARE_BACKUP)
|
||||
q.add_pus_tc(create_update_firmware_target_cmd(False, FirmwareTarget.BACKUP))
|
||||
if cmd_str == OpCode.SELECT_TARGET_FIRMWARE_MAIN_PERSISTENT:
|
||||
q.add_log_cmd(Info.SELECT_TARGET_FIRMWARE_BACKUP)
|
||||
q.add_pus_tc(create_update_firmware_target_cmd(True, FirmwareTarget.MAIN))
|
||||
if cmd_str == OpCode.SELECT_TARGET_FIRMWARE_BACKUP_PERSISTENT:
|
||||
q.add_log_cmd(Info.SELECT_TARGET_FIRMWARE_BACKUP)
|
||||
q.add_pus_tc(create_update_firmware_target_cmd(True, FirmwareTarget.BACKUP))
|
||||
if cmd_str == OpCode.REQUEST_VERSION:
|
||||
q.add_log_cmd(Info.REQUEST_VERSION)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
object_id=STAR_TRACKER_ID, action_id=StarTrackerActionId.REQ_VERSION
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def create_update_firmware_target_cmd(
|
||||
persistent: bool, fw_target: FirmwareTarget
|
||||
) -> PusTelecommand:
|
||||
if persistent:
|
||||
param_id = ParamId.FIRMWARE_TARGET_PERSISTENT
|
||||
else:
|
||||
param_id = ParamId.FIRMWARE_TARGET
|
||||
return create_load_param_cmd(
|
||||
parameter=create_scalar_u8_parameter(
|
||||
STAR_TRACKER_ID,
|
||||
0,
|
||||
param_id,
|
||||
fw_target,
|
||||
),
|
||||
apid=0,
|
||||
)
|
||||
|
||||
|
||||
def request_dataset(q: DefaultPusQueueHelper, req_type: DataSetRequest):
|
||||
@ -814,6 +889,10 @@ def handle_str_hk_data(set_id: int, hk_data: bytes, pw: PrintWrapper):
|
||||
handle_centroids_set(hk_data, pw)
|
||||
elif set_id == SetId.CONTRAST:
|
||||
handle_contrast_set(hk_data, pw)
|
||||
elif set_id == SetId.BLOB_STATS:
|
||||
handle_blob_stats_set(hk_data, pw)
|
||||
elif set_id == SetId.VERSION:
|
||||
handle_version_set(hk_data, pw)
|
||||
else:
|
||||
_LOGGER.warning(f"HK parsing for Star Tracker set ID {set_id} unimplemented")
|
||||
|
||||
@ -836,6 +915,25 @@ def unpack_time_hk(hk_data: bytes, current_idx: int, pw: PrintWrapper) -> int:
|
||||
return current_idx
|
||||
|
||||
|
||||
def handle_version_set(hk_data: bytes, pw: PrintWrapper):
|
||||
pw.dlog("Received Version Set")
|
||||
if len(hk_data) != 16:
|
||||
_LOGGER.warning(
|
||||
f"Version dataset HK with length {len(hk_data)} of unexpected size"
|
||||
)
|
||||
current_idx = unpack_time_hk(hk_data, 0, pw)
|
||||
program = struct.unpack("!B", hk_data[current_idx : current_idx + 1])[0]
|
||||
pw.dlog(f"Program: {program}")
|
||||
current_idx += 1
|
||||
major = struct.unpack("!B", hk_data[current_idx : current_idx + 1])[0]
|
||||
pw.dlog(f"Major: {major}")
|
||||
current_idx += 1
|
||||
minor = struct.unpack("!B", hk_data[current_idx : current_idx + 1])[0]
|
||||
pw.dlog(f"Minor: {minor}")
|
||||
current_idx += 1
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=5))
|
||||
|
||||
|
||||
def handle_temperature_set(hk_data: bytes, pw: PrintWrapper):
|
||||
pw.dlog("Received temperature set")
|
||||
if len(hk_data) < 24:
|
||||
@ -850,7 +948,7 @@ def handle_temperature_set(hk_data: bytes, pw: PrintWrapper):
|
||||
pw.dlog(f"CMOS Temperature: {cmos_temp}")
|
||||
pw.dlog(f"FPGA Temperature: {fpga_temp}")
|
||||
current_idx += fmt_len
|
||||
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], 5)
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], 5))
|
||||
|
||||
|
||||
def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
|
||||
@ -924,7 +1022,7 @@ def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
|
||||
solution_strategy = hk_data[current_idx]
|
||||
pw.dlog(f"Solution strategy: {solution_strategy}")
|
||||
current_idx += 1
|
||||
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], 23)
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], 23))
|
||||
|
||||
|
||||
def handle_blob_set(hk_data: bytes, pw: PrintWrapper):
|
||||
@ -935,7 +1033,7 @@ def handle_blob_set(hk_data: bytes, pw: PrintWrapper):
|
||||
current_idx = unpack_time_hk(hk_data, 0, pw)
|
||||
blob_count = struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
||||
pw.dlog(f"Blob count: {blob_count}")
|
||||
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx + 4 :], num_vars=3)
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx + 4 :], num_vars=3))
|
||||
|
||||
|
||||
def handle_blobs_set(hk_data: bytes, pw: PrintWrapper):
|
||||
@ -963,7 +1061,7 @@ def handle_blobs_set(hk_data: bytes, pw: PrintWrapper):
|
||||
for idx in range(8):
|
||||
pw.dlog("{:<8} {:<8}".format(x_coords[idx], y_coords[idx]))
|
||||
assert current_idx == len(hk_data) - 1
|
||||
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=7)
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=7))
|
||||
|
||||
|
||||
def handle_centroid_set(hk_data: bytes, pw: PrintWrapper):
|
||||
@ -977,7 +1075,7 @@ def handle_centroid_set(hk_data: bytes, pw: PrintWrapper):
|
||||
current_idx += 4
|
||||
pw.dlog(f"Centroid count: {centroid_count}")
|
||||
assert current_idx == len(hk_data) - 1
|
||||
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=3)
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=3))
|
||||
|
||||
|
||||
def handle_centroids_set(hk_data: bytes, pw: PrintWrapper):
|
||||
@ -1004,7 +1102,7 @@ def handle_centroids_set(hk_data: bytes, pw: PrintWrapper):
|
||||
)
|
||||
)
|
||||
assert current_idx == len(hk_data) - 1
|
||||
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=6)
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=6))
|
||||
|
||||
|
||||
def handle_matched_centroids_set(hk_data: bytes, pw: PrintWrapper):
|
||||
@ -1048,7 +1146,7 @@ def handle_matched_centroids_set(hk_data: bytes, pw: PrintWrapper):
|
||||
)
|
||||
)
|
||||
assert current_idx == len(hk_data) - 1
|
||||
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=8)
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=8))
|
||||
|
||||
|
||||
def handle_auto_blob_set(hk_data: bytes, pw: PrintWrapper):
|
||||
@ -1066,7 +1164,7 @@ def handle_auto_blob_set(hk_data: bytes, pw: PrintWrapper):
|
||||
current_idx += inc_len
|
||||
assert current_idx == len(hk_data) - 1
|
||||
pw.dlog(f"Threshold {threshold}")
|
||||
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=3)
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=3))
|
||||
|
||||
|
||||
def handle_histo_or_contrast_set(name: str, hk_data: bytes, pw: PrintWrapper):
|
||||
@ -1116,6 +1214,35 @@ def handle_contrast_set(hk_data: bytes, pw: PrintWrapper):
|
||||
handle_histo_or_contrast_set("Contrast", hk_data, pw)
|
||||
|
||||
|
||||
def handle_blob_stats_set(hk_data: bytes, pw: PrintWrapper):
|
||||
pw.dlog("Received Blob Stats Set")
|
||||
if len(hk_data) < 65:
|
||||
raise ValueError(
|
||||
f"Matched BlobStats set with length {len(hk_data)} too short. Expected 65 bytes."
|
||||
)
|
||||
current_idx = unpack_time_hk(hk_data, 0, pw)
|
||||
|
||||
def fill_list(current_idx: int) -> Tuple[List[int], int]:
|
||||
list_to_fill = []
|
||||
for _ in range(16):
|
||||
list_to_fill.append(hk_data[current_idx])
|
||||
current_idx += 1
|
||||
return list_to_fill, current_idx
|
||||
|
||||
noise_list, current_idx = fill_list(current_idx)
|
||||
threshold_list, current_idx = fill_list(current_idx)
|
||||
lvalid_list, current_idx = fill_list(current_idx)
|
||||
oflow_list, current_idx = fill_list(current_idx)
|
||||
pw.dlog("Index | Noise | Threshold | LValid | Oflow")
|
||||
for i in range(16):
|
||||
pw.dlog(
|
||||
"{:<3} {:<3} {:<3} {:<3} {:<3}".format(
|
||||
i, noise_list[i], threshold_list[i], lvalid_list[i], oflow_list[i]
|
||||
)
|
||||
)
|
||||
pw.dlog(get_validity_buffer_str(hk_data[current_idx:], num_vars=6))
|
||||
|
||||
|
||||
def handle_star_tracker_action_replies(
|
||||
action_id: int, pw: PrintWrapper, custom_data: bytes
|
||||
):
|
||||
@ -1155,27 +1282,16 @@ def handle_read_secondary_tm_set(pw: PrintWrapper, custom_data: bytes):
|
||||
pw.dlog(f"Unknown Set ID {set_id}")
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_str_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCode.ON_BOOTLOADER, "Mode On, Submode Bootloader")
|
||||
oce.add(OpCode.ON_FIRMWARE, "Mode On, Submode Firmware")
|
||||
oce.add(OpCode.NORMAL, "Mode Normal")
|
||||
oce.add(OpCode.OFF, "Mode Off")
|
||||
oce.add(OpCode.PING, "Star Tracker: Ping")
|
||||
oce.add(OpCode.TAKE_IMAGE, "Take Image")
|
||||
oce.add(OpCode.UPLOAD_IMAGE, Info.UPLOAD_IMAGE)
|
||||
oce.add(OpCode.DOWNLOAD_IMAGE, Info.DOWNLOAD_IMAGE)
|
||||
oce.add(OpCode.ONE_SHOOT_HK, Info.ONE_SHOOT_HK)
|
||||
oce.add(OpCode.ENABLE_HK, Info.ENABLE_HK)
|
||||
oce.add(OpCode.DISABLE_HK, Info.DISABLE_HK)
|
||||
oce.add(OpCode.SET_IMG_PROCESSOR_MODE, Info.SET_IMG_PROCESSOR_MODE)
|
||||
oce.add(
|
||||
OpCode.ADD_SECONDARY_TM_TO_NORMAL_MODE, Info.ADD_SECONDARY_TM_TO_NORMAL_MODE
|
||||
def create_str_node() -> CmdTreeNode:
|
||||
# Zip the two classes together into a dictionary
|
||||
op_code_strs = [
|
||||
getattr(OpCode, key) for key in dir(OpCode) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
node = CmdTreeNode(
|
||||
"str", "Star Tracker Device", hide_children_which_are_leaves=True
|
||||
)
|
||||
oce.add(OpCode.READ_SECONDARY_TM_SET, Info.READ_SECONDARY_TM_SET)
|
||||
oce.add(OpCode.RESET_SECONDARY_TM_SET, Info.RESET_SECONDARY_TM_SET)
|
||||
oce.add(OpCode.FW_UPDATE, Info.FW_UPDATE)
|
||||
oce.add(OpCode.SET_TIME_FROM_SYS_TIME, Info.SET_TIME_FROM_SYS_TIME)
|
||||
oce.add(OpCode.RELOAD_JSON_CFG_FILE, Info.RELOAD_JSON_CFG_FILE)
|
||||
defs.add_service(CustomServiceList.STAR_TRACKER.value, "Star Tracker", oce)
|
||||
for op_code, info in combined_dict.items():
|
||||
node.add_child(CmdTreeNode(op_code, info))
|
||||
return node
|
||||
|
@ -1,22 +1,19 @@
|
||||
import enum
|
||||
from typing import Tuple, Dict
|
||||
from typing import Dict, Tuple
|
||||
|
||||
from eive_tmtc.tmtc.acs.defs import AcsMode, SafeSubmode
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
from eive_tmtc.config.object_ids import ACS_SUBSYSTEM_ID
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
CmdTreeNode,
|
||||
)
|
||||
from tmtccmd.pus.s200_fsfw_mode import Subservice as ModeSubservices
|
||||
from tmtccmd.tmtc import service_provider
|
||||
from tmtccmd.tmtc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
|
||||
from eive_tmtc.config.object_ids import ACS_SUBSYSTEM_ID
|
||||
from eive_tmtc.tmtc.acs.defs import AcsMode, SafeSubmode
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
|
||||
|
||||
class OpCode(str, enum.Enum):
|
||||
class CmdStr(str, enum.Enum):
|
||||
OFF = "off"
|
||||
SAFE = "safe"
|
||||
DETUMBLE = "detumble"
|
||||
@ -41,23 +38,20 @@ class Info(str, enum.Enum):
|
||||
|
||||
|
||||
HANDLER_LIST: Dict[str, Tuple[int, int, str]] = {
|
||||
OpCode.OFF: (AcsMode.OFF, 0, Info.OFF),
|
||||
OpCode.SAFE: (AcsMode.SAFE, SafeSubmode.DEFAULT, Info.SAFE),
|
||||
OpCode.DETUMBLE: (AcsMode.SAFE, SafeSubmode.DETUMBLE, Info.DETUMBLE),
|
||||
OpCode.IDLE: (AcsMode.IDLE, 0, Info.IDLE),
|
||||
OpCode.PTG_TARGET: (AcsMode.PTG_TARGET, 0, Info.PTG_TARGET),
|
||||
OpCode.PTG_TARGET_GS: (AcsMode.PTG_TARGET_GS, 0, Info.PTG_TARGET_GS),
|
||||
OpCode.PTG_TARGET_NADIR: (AcsMode.PTG_NADIR, 0, Info.PTG_TARGET_NADIR),
|
||||
OpCode.PTG_TARGET_INERTIAL: (AcsMode.PTG_INERTIAL, 0, Info.PTG_TARGET_INERTIAL),
|
||||
CmdStr.OFF: (AcsMode.OFF, 0, Info.OFF),
|
||||
CmdStr.SAFE: (AcsMode.SAFE, SafeSubmode.DEFAULT, Info.SAFE),
|
||||
CmdStr.DETUMBLE: (AcsMode.SAFE, SafeSubmode.DETUMBLE, Info.DETUMBLE),
|
||||
CmdStr.IDLE: (AcsMode.IDLE, 0, Info.IDLE),
|
||||
CmdStr.PTG_TARGET: (AcsMode.PTG_TARGET, 0, Info.PTG_TARGET),
|
||||
CmdStr.PTG_TARGET_GS: (AcsMode.PTG_TARGET_GS, 0, Info.PTG_TARGET_GS),
|
||||
CmdStr.PTG_TARGET_NADIR: (AcsMode.PTG_NADIR, 0, Info.PTG_TARGET_NADIR),
|
||||
CmdStr.PTG_TARGET_INERTIAL: (AcsMode.PTG_INERTIAL, 0, Info.PTG_TARGET_INERTIAL),
|
||||
}
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.ACS_SS.value)
|
||||
def build_acs_subsystem_cmd(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
def build_acs_subsystem_cmd(q: DefaultPusQueueHelper, cmd_path: str):
|
||||
info_prefix = "ACS Subsystem"
|
||||
if op_code in OpCode.REPORT_ALL_MODES:
|
||||
if cmd_path in CmdStr.REPORT_ALL_MODES:
|
||||
q.add_log_cmd(f"{info_prefix}: {Info.REPORT_ALL_MODES}")
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
@ -66,7 +60,7 @@ def build_acs_subsystem_cmd(p: ServiceProviderParams):
|
||||
app_data=ACS_SUBSYSTEM_ID,
|
||||
)
|
||||
)
|
||||
mode_info_tup = HANDLER_LIST.get(op_code)
|
||||
mode_info_tup = HANDLER_LIST.get(cmd_path)
|
||||
if mode_info_tup is None:
|
||||
return
|
||||
pack_mode_cmd_with_info(
|
||||
@ -78,10 +72,9 @@ def build_acs_subsystem_cmd(p: ServiceProviderParams):
|
||||
)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_acs_subsystem_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
for op_code, (_, _, info) in HANDLER_LIST.items():
|
||||
oce.add(op_code, info)
|
||||
oce.add(OpCode.REPORT_ALL_MODES, Info.REPORT_ALL_MODES)
|
||||
defs.add_service(CustomServiceList.ACS_SS, "ACS Subsystem", oce)
|
||||
def create_acs_subsystem_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode("acs", "ACS Subsystem", hide_children_which_are_leaves=True)
|
||||
for cmd_str, (_, _, info) in HANDLER_LIST.items():
|
||||
node.add_child(CmdTreeNode(cmd_str, info))
|
||||
node.add_child(CmdTreeNode(CmdStr.REPORT_ALL_MODES, Info.REPORT_ALL_MODES))
|
||||
return node
|
||||
|
@ -3,7 +3,7 @@ import struct
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.fsfw.tmtc_printer import get_validity_buffer_str
|
||||
|
||||
|
||||
class SetId(enum.IntEnum):
|
||||
@ -26,6 +26,6 @@ def handle_sus_hk(
|
||||
pw.dlog("AIN Channel | Raw Value (hex) | Raw Value (dec)")
|
||||
for idx, val in enumerate(channels):
|
||||
pw.dlog(f"{idx} | {val[0]:#06x} |" + str(val[0]).ljust(5))
|
||||
FsfwTmTcPrinter.get_validity_buffer(
|
||||
validity_buffer=hk_data[current_idx:], num_vars=7
|
||||
pw.dlog(
|
||||
get_validity_buffer_str(validity_buffer=hk_data[current_idx:], num_vars=7)
|
||||
)
|
||||
|
@ -1,22 +1,19 @@
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config.tmtc import (
|
||||
CmdTreeNode,
|
||||
)
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
|
||||
from eive_tmtc.config.object_ids import SUS_BOARD_ASS_ID
|
||||
from eive_tmtc.tmtc.acs.acs_board import DualSideSubmode
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tmtc import service_provider, DefaultPusQueueHelper
|
||||
from tmtccmd.tmtc.decorator import ServiceProviderParams
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode
|
||||
|
||||
|
||||
class SusOpCode:
|
||||
SUS_ASS_NOM_SIDE = ["0", "nom"]
|
||||
SUS_ASS_RED_SIDE = ["1", "red"]
|
||||
SUS_ASS_DUAL_MODE = ["2", "dual"]
|
||||
SUS_ASS_OFF = ["3", "off"]
|
||||
SUS_ASS_NOM_SIDE = "nom"
|
||||
SUS_ASS_RED_SIDE = "red"
|
||||
SUS_ASS_DUAL_MODE = "dual"
|
||||
SUS_ASS_OFF = "off"
|
||||
|
||||
|
||||
def pack_sus_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
@ -54,34 +51,16 @@ def pack_sus_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
)
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.SUS_BRD_ASS)
|
||||
def pack_sus_cmds_prvoider(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
pack_sus_cmds(q, op_code)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_sus_board_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(
|
||||
keys=SusOpCode.SUS_ASS_NOM_SIDE,
|
||||
info="Switch SUS board to nominal side",
|
||||
def create_sus_board_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode("sus_brd_assy", "SUS board assembly")
|
||||
node.add_child(
|
||||
CmdTreeNode(SusOpCode.SUS_ASS_RED_SIDE, "Switch SUS board to nominal side")
|
||||
)
|
||||
oce.add(
|
||||
keys=SusOpCode.SUS_ASS_RED_SIDE,
|
||||
info="Switch SUS board to redundant side",
|
||||
node.add_child(
|
||||
CmdTreeNode(SusOpCode.SUS_ASS_RED_SIDE, "Switch SUS board to redundant side")
|
||||
)
|
||||
oce.add(
|
||||
keys=SusOpCode.SUS_ASS_OFF,
|
||||
info="Switch off SUS board",
|
||||
)
|
||||
oce.add(
|
||||
keys=SusOpCode.SUS_ASS_DUAL_MODE,
|
||||
info="Switch SUS board to dual mode",
|
||||
)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.SUS_BRD_ASS.value,
|
||||
info="SUS Board Assembly",
|
||||
op_code_entry=oce,
|
||||
node.add_child(CmdTreeNode(SusOpCode.SUS_ASS_OFF, "Switch SUS board off"))
|
||||
node.add_child(
|
||||
CmdTreeNode(SusOpCode.SUS_ASS_DUAL_MODE, "Switch SUS board to dual mode")
|
||||
)
|
||||
return node
|
||||
|
@ -1 +0,0 @@
|
||||
from .subsystem import add_com_subsystem_cmds
|
@ -8,6 +8,8 @@
|
||||
import enum
|
||||
import struct
|
||||
|
||||
from tmtccmd.config import CmdTreeNode
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.config.tmtc import (
|
||||
@ -51,11 +53,11 @@ class Submode(enum.IntEnum):
|
||||
|
||||
|
||||
class OpCode:
|
||||
ENABLE_WITH_LOW_DATARATE = ["enable_low_datarate"]
|
||||
ENABLE_WITH_HIGH_DATARATE = ["enable_high_datarate"]
|
||||
DISABLE = ["disable"]
|
||||
ENABLE_ACTION = ["legacy_enable_tx"]
|
||||
DISABLE_ACTION = ["legacy_disable_tx"]
|
||||
ENABLE_WITH_LOW_DATARATE = "enable_low_datarate"
|
||||
ENABLE_WITH_HIGH_DATARATE = "enable_high_datarate"
|
||||
DISABLE = "disable"
|
||||
ENABLE_ACTION = "legacy_enable_tx"
|
||||
DISABLE_ACTION = "legacy_disable_tx"
|
||||
|
||||
|
||||
class Info:
|
||||
@ -67,29 +69,29 @@ class Info:
|
||||
|
||||
|
||||
def pack_ccsds_handler_command( # noqa C901
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, cmd_str: str
|
||||
):
|
||||
obyt = object_id.as_bytes
|
||||
prefix = "CCSDS Handler"
|
||||
q.add_log_cmd(f"Testing CCSDS handler with object id: {object_id.as_hex_string}")
|
||||
if op_code in OpCode.ENABLE_WITH_LOW_DATARATE:
|
||||
if cmd_str in OpCode.ENABLE_WITH_LOW_DATARATE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ENABLE_WITH_LOW_DATARATE}")
|
||||
q.add_pus_tc(create_mode_command(obyt, Mode.ON, Submode.DATARATE_LOW))
|
||||
if op_code in OpCode.ENABLE_WITH_HIGH_DATARATE:
|
||||
if cmd_str in OpCode.ENABLE_WITH_HIGH_DATARATE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ENABLE_WITH_HIGH_DATARATE}")
|
||||
q.add_pus_tc(create_mode_command(obyt, Mode.ON, Submode.DATARATE_HIGH))
|
||||
if op_code in OpCode.DISABLE:
|
||||
if cmd_str in OpCode.DISABLE:
|
||||
q.add_log_cmd(f"{prefix}: {Info.DISABLE}")
|
||||
q.add_pus_tc(create_mode_command(obyt, Mode.OFF, 0))
|
||||
if op_code in OpCode.ENABLE_ACTION:
|
||||
if cmd_str in OpCode.ENABLE_ACTION:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ENABLE_ACTION}")
|
||||
command = obyt + struct.pack("!I", ActionId.EN_TRANSMITTER)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCode.DISABLE_ACTION:
|
||||
if cmd_str in OpCode.DISABLE_ACTION:
|
||||
q.add_log_cmd(f"{prefix}: {Info.DISABLE_ACTION}")
|
||||
command = obyt + struct.pack("!I", ActionId.DIS_TRANSMITTER)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "4":
|
||||
if cmd_str == "4":
|
||||
q.add_log_cmd("CCSDS Handler: Set arbitrary bitrate")
|
||||
bitrate = int(input("Specify bit rate (bps): "))
|
||||
command = (
|
||||
@ -98,24 +100,36 @@ def pack_ccsds_handler_command( # noqa C901
|
||||
+ struct.pack("!I", bitrate)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "5":
|
||||
if cmd_str == "5":
|
||||
q.add_log_cmd("CCSDS Handler: Enable tx clock manipulator")
|
||||
command = obyt + struct.pack("!I", ActionId.ENABLE_TX_CLK_MANIPULATOR)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "6":
|
||||
if cmd_str == "6":
|
||||
q.add_log_cmd("CCSDS Handler: Disable tx clock manipulator")
|
||||
command = obyt + struct.pack("!I", ActionId.DISABLE_TX_CLK_MANIPULATOR)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "7":
|
||||
if cmd_str == "7":
|
||||
q.add_log_cmd("CCSDS Handler: Update tx data on rising edge of tx clock")
|
||||
command = obyt + struct.pack("!I", ActionId.UPDATE_ON_RISING_EDGE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "8":
|
||||
if cmd_str == "8":
|
||||
q.add_log_cmd("CCSDS Handler: Update tx data on falling edge of tx clock")
|
||||
command = obyt + struct.pack("!I", ActionId.UPDATE_ON_FALLING_EDGE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
|
||||
def create_ccsds_node() -> CmdTreeNode:
|
||||
op_code_strs = [
|
||||
getattr(OpCode, key) for key in dir(OpCode) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
node = CmdTreeNode("ccsds", "CCSDS Handler", hide_children_for_print=True)
|
||||
for op_code, info in combined_dict.items():
|
||||
node.add_child(CmdTreeNode(op_code, info))
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_ccsds_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
|
@ -60,51 +60,53 @@ class Info:
|
||||
RESET_NO_INIT = "Reset with mandatory initialization"
|
||||
|
||||
|
||||
def pack_pdec_handler_test(
|
||||
object_id: bytearray, q: DefaultPusQueueHelper, op_code: str
|
||||
def pack_pdec_handler_commands(
|
||||
object_id: bytes, q: DefaultPusQueueHelper, cmd_str: str
|
||||
):
|
||||
q.add_log_cmd(f"Testing PDEC handler with object id: {object_id.hex()}")
|
||||
prefix = "PDEC Handler "
|
||||
if op_code == OpCode.PRINT_CLCW:
|
||||
if cmd_str == OpCode.PRINT_CLCW:
|
||||
q.add_log_cmd(f"{prefix}: {Info.PRINT_CLCW}")
|
||||
command = object_id + CommandId.PRINT_CLCW
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == OpCode.PRINT_MON_REG:
|
||||
if cmd_str == OpCode.PRINT_MON_REG:
|
||||
q.add_log_cmd(f"{prefix}: {Info.PRINT_MON_REG}")
|
||||
command = object_id + CommandId.PRINT_PDEC_MON
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == OpCode.POSITIVE_WINDOW:
|
||||
if cmd_str == OpCode.POSITIVE_WINDOW:
|
||||
q.add_log_cmd(f"{prefix}: {Info.POSITIVE_WINDOW}")
|
||||
pw = int(input("Specify positive window to set: "))
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_u8_parameter(
|
||||
parameter=create_scalar_u8_parameter(
|
||||
object_id,
|
||||
0,
|
||||
ParameterId.POSITIVE_WINDOW,
|
||||
pw,
|
||||
)
|
||||
),
|
||||
apid=0,
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.NEGATIVE_WINDOW:
|
||||
if cmd_str == OpCode.NEGATIVE_WINDOW:
|
||||
q.add_log_cmd(f"{prefix}: {Info.NEGATIVE_WINDOW}")
|
||||
nw = int(input("Specify negative window to set: "))
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
create_scalar_u8_parameter(
|
||||
parameter=create_scalar_u8_parameter(
|
||||
object_id,
|
||||
0,
|
||||
ParameterId.NEGATIVE_WINDOW,
|
||||
nw,
|
||||
)
|
||||
),
|
||||
apid=0,
|
||||
)
|
||||
)
|
||||
if op_code == OpCode.RESET_NO_INIT:
|
||||
if cmd_str == OpCode.RESET_NO_INIT:
|
||||
q.add_log_cmd(f"{prefix}: {Info.RESET_NO_INIT}")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(object_id=object_id, action_id=ActionId.RESET_NO_INIT)
|
||||
)
|
||||
if op_code == OpCode.RESET_WITH_INIT:
|
||||
if cmd_str == OpCode.RESET_WITH_INIT:
|
||||
q.add_log_cmd(f"{prefix}: {Info.RESET_WITH_INIT}")
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(object_id=object_id, action_id=ActionId.RESET_WITH_INIT)
|
||||
|
@ -1,30 +1,25 @@
|
||||
import enum
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import COM_SUBSYSTEM_ID
|
||||
from eive_tmtc.tmtc.com.syrlinks_handler import Datarate
|
||||
from tmtccmd.pus.s20_fsfw_param_defs import create_scalar_u8_parameter
|
||||
|
||||
from .defs import Mode as ComMode
|
||||
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tmtc import service_provider
|
||||
from tmtccmd.tmtc.decorator import ServiceProviderParams
|
||||
from tmtccmd.pus.s200_fsfw_mode import (
|
||||
create_mode_command,
|
||||
create_read_mode_command,
|
||||
create_announce_mode_command,
|
||||
create_announce_mode_recursive_command,
|
||||
CmdTreeNode,
|
||||
)
|
||||
from tmtccmd.pus.s20_fsfw_param import (
|
||||
create_load_param_cmd,
|
||||
create_scalar_u32_parameter,
|
||||
)
|
||||
from tmtccmd.pus.s20_fsfw_param_defs import create_scalar_u8_parameter
|
||||
from tmtccmd.pus.s200_fsfw_mode import (
|
||||
create_announce_mode_command,
|
||||
create_announce_mode_recursive_command,
|
||||
create_mode_command,
|
||||
create_read_mode_command,
|
||||
)
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
|
||||
from tmtccmd.pus.s20_fsfw_param import create_scalar_u32_parameter
|
||||
from eive_tmtc.config.object_ids import COM_SUBSYSTEM_ID
|
||||
from eive_tmtc.tmtc.com.syrlinks_handler import Datarate
|
||||
|
||||
from .defs import Mode as ComMode
|
||||
|
||||
|
||||
class ParameterId(enum.IntEnum):
|
||||
@ -48,9 +43,9 @@ class OpCode:
|
||||
|
||||
class Info:
|
||||
RX_ONLY = "Syrlinks RX Only"
|
||||
TX_AND_RX_DEF_DATARATE = "Syrlinks with TX default datarate"
|
||||
TX_AND_RX_LOW_DATARATE = "Syrlinks with TX low datarate (BPSK modulation)"
|
||||
TX_AND_RX_HIGH_DATARATE = "Syrlinks with TX high datarate (0QPSK modulation)"
|
||||
TX_AND_RX_DEF_RATE = "Syrlinks with TX default datarate"
|
||||
TX_AND_RX_LOW_RATE = "Syrlinks with TX low datarate (BPSK modulation)"
|
||||
TX_AND_RX_HIGH_RATE = "Syrlinks with TX high datarate (0QPSK modulation)"
|
||||
TX_AND_RX_CARRIER_WAVE = "Syrlinks with TX carrier wave"
|
||||
UPDATE_DEFAULT_DATARATE_LOW = "Configure default low datarate (BPSK modulation)"
|
||||
UPDATE_DEFAULT_DATARATE_HIGH = "Configure default high datarate (0QPSK modulation)"
|
||||
@ -60,30 +55,27 @@ class Info:
|
||||
ANNOUNCE_MODE_RECURSIVE = "Announce mode recursively"
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.COM_SS)
|
||||
def build_com_subsystem_cmd(p: ServiceProviderParams): # noqa C901
|
||||
q = p.queue_helper
|
||||
o = p.op_code
|
||||
def build_com_subsystem_procedure(q: DefaultPusQueueHelper, cmd_str: str): # noqa C901
|
||||
prefix = "COM Subsystem"
|
||||
if o == OpCode.RX_ONLY:
|
||||
if cmd_str == OpCode.RX_ONLY:
|
||||
q.add_log_cmd(Info.RX_ONLY)
|
||||
q.add_pus_tc(create_mode_command(COM_SUBSYSTEM_ID, ComMode.RX_ONLY, 0))
|
||||
elif o == OpCode.TX_AND_RX_DEF_RATE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_DEF_DATARATE)
|
||||
elif cmd_str == OpCode.TX_AND_RX_DEF_RATE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_DEF_RATE)
|
||||
q.add_pus_tc(
|
||||
create_mode_command(COM_SUBSYSTEM_ID, ComMode.RX_AND_TX_DEF_DATARATE, 0)
|
||||
)
|
||||
elif o == OpCode.TX_AND_RX_LOW_RATE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_LOW_DATARATE)
|
||||
elif cmd_str == OpCode.TX_AND_RX_LOW_RATE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_LOW_RATE)
|
||||
q.add_pus_tc(
|
||||
create_mode_command(COM_SUBSYSTEM_ID, ComMode.RX_AND_TX_LOW_DATARATE, 0)
|
||||
)
|
||||
elif o == OpCode.TX_AND_RX_HIGH_RATE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_HIGH_DATARATE)
|
||||
elif cmd_str == OpCode.TX_AND_RX_HIGH_RATE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_HIGH_RATE)
|
||||
q.add_pus_tc(
|
||||
create_mode_command(COM_SUBSYSTEM_ID, ComMode.RX_AND_TX_HIGH_DATARATE, 0)
|
||||
)
|
||||
if o == OpCode.UPDATE_DEFAULT_DATARATE_LOW:
|
||||
if cmd_str == OpCode.UPDATE_DEFAULT_DATARATE_LOW:
|
||||
q.add_log_cmd(f"{prefix}: {Info.UPDATE_DEFAULT_DATARATE_LOW}")
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
@ -95,7 +87,7 @@ def build_com_subsystem_cmd(p: ServiceProviderParams): # noqa C901
|
||||
)
|
||||
)
|
||||
)
|
||||
if o == OpCode.UPDATE_DEFAULT_DATARATE_HIGH:
|
||||
if cmd_str == OpCode.UPDATE_DEFAULT_DATARATE_HIGH:
|
||||
q.add_log_cmd(f"{prefix}: {Info.UPDATE_DEFAULT_DATARATE_HIGH}")
|
||||
q.add_pus_tc(
|
||||
create_load_param_cmd(
|
||||
@ -107,12 +99,12 @@ def build_com_subsystem_cmd(p: ServiceProviderParams): # noqa C901
|
||||
)
|
||||
)
|
||||
)
|
||||
elif o == OpCode.TX_AND_RX_CARRIER_WAVE:
|
||||
elif cmd_str == OpCode.TX_AND_RX_CARRIER_WAVE:
|
||||
q.add_log_cmd(Info.TX_AND_RX_CARRIER_WAVE)
|
||||
q.add_pus_tc(
|
||||
create_mode_command(COM_SUBSYSTEM_ID, ComMode.RX_AND_TX_CARRIER_WAVE, 0)
|
||||
)
|
||||
elif o == OpCode.CHANGE_TRANSMITTER_TIMEOUT:
|
||||
elif cmd_str == OpCode.CHANGE_TRANSMITTER_TIMEOUT:
|
||||
timeout = int(input("Specify timeout to set [ms]: "))
|
||||
q.add_log_cmd(Info.CHANGE_TRANSMITTER_TIMEOUT)
|
||||
q.add_pus_tc(
|
||||
@ -125,28 +117,24 @@ def build_com_subsystem_cmd(p: ServiceProviderParams): # noqa C901
|
||||
)
|
||||
)
|
||||
)
|
||||
elif o == OpCode.READ_MODE:
|
||||
elif cmd_str == OpCode.READ_MODE:
|
||||
q.add_log_cmd(Info.READ_MODE)
|
||||
q.add_pus_tc(create_read_mode_command(COM_SUBSYSTEM_ID))
|
||||
elif o == OpCode.ANNOUNCE_MODE:
|
||||
elif cmd_str == OpCode.ANNOUNCE_MODE:
|
||||
q.add_log_cmd(Info.ANNOUNCE_MODE)
|
||||
q.add_pus_tc(create_announce_mode_command(COM_SUBSYSTEM_ID))
|
||||
elif o == OpCode.ANNOUNCE_MODE_RECURSIVE:
|
||||
elif cmd_str == OpCode.ANNOUNCE_MODE_RECURSIVE:
|
||||
q.add_log_cmd(Info.ANNOUNCE_MODE_RECURSIVE)
|
||||
q.add_pus_tc(create_announce_mode_recursive_command(COM_SUBSYSTEM_ID))
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_com_subsystem_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCode.RX_ONLY, Info.RX_ONLY)
|
||||
oce.add(OpCode.TX_AND_RX_LOW_RATE, Info.TX_AND_RX_LOW_DATARATE)
|
||||
oce.add(OpCode.TX_AND_RX_HIGH_RATE, Info.TX_AND_RX_HIGH_DATARATE)
|
||||
oce.add(OpCode.TX_AND_RX_DEF_RATE, Info.TX_AND_RX_DEF_DATARATE)
|
||||
oce.add(OpCode.UPDATE_DEFAULT_DATARATE_LOW, Info.UPDATE_DEFAULT_DATARATE_LOW)
|
||||
oce.add(OpCode.UPDATE_DEFAULT_DATARATE_HIGH, Info.UPDATE_DEFAULT_DATARATE_HIGH)
|
||||
oce.add(OpCode.CHANGE_TRANSMITTER_TIMEOUT, Info.CHANGE_TRANSMITTER_TIMEOUT)
|
||||
oce.add(OpCode.READ_MODE, Info.READ_MODE)
|
||||
oce.add(OpCode.ANNOUNCE_MODE, Info.ANNOUNCE_MODE)
|
||||
oce.add(OpCode.ANNOUNCE_MODE_RECURSIVE, Info.ANNOUNCE_MODE_RECURSIVE)
|
||||
defs.add_service(CustomServiceList.COM_SS, "COM Subsystem", oce)
|
||||
def create_com_subsystem_node() -> CmdTreeNode:
|
||||
op_code_strs = [
|
||||
getattr(OpCode, key) for key in dir(OpCode) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
node = CmdTreeNode("com", "COM Subsystem", hide_children_which_are_leaves=True)
|
||||
for op_code, info in combined_dict.items():
|
||||
node.add_child(CmdTreeNode(op_code, info))
|
||||
return node
|
||||
|
@ -8,30 +8,32 @@
|
||||
import enum
|
||||
import logging
|
||||
import math
|
||||
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.tmtc.com.defs import Mode as ComMode
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
make_sid,
|
||||
create_request_one_diag_command,
|
||||
create_request_one_hk_command,
|
||||
create_enable_periodic_hk_command_with_interval_with_diag,
|
||||
create_disable_periodic_hk_command_with_diag,
|
||||
)
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode, create_mode_command
|
||||
from eive_tmtc.config.object_ids import SYRLINKS_HANDLER_ID
|
||||
import struct
|
||||
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.config.tmtc import (
|
||||
CmdTreeNode,
|
||||
OpCodeEntry,
|
||||
TmtcDefinitionWrapper,
|
||||
tmtc_definitions_provider,
|
||||
)
|
||||
from tmtccmd.fsfw.tmtc_printer import get_validity_buffer_str
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode, create_mode_command
|
||||
from tmtccmd.pus.tc.s3_fsfw_hk import (
|
||||
create_disable_periodic_hk_command_with_diag,
|
||||
create_enable_periodic_hk_command_with_interval_with_diag,
|
||||
create_request_one_diag_command,
|
||||
create_request_one_hk_command,
|
||||
make_sid,
|
||||
)
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import SYRLINKS_HANDLER_ID
|
||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||
from eive_tmtc.pus_tm.hk import HkTmInfo
|
||||
from eive_tmtc.tmtc.com.defs import Mode as ComMode
|
||||
|
||||
|
||||
class SetId(enum.IntEnum):
|
||||
@ -57,6 +59,7 @@ class OpCode:
|
||||
HK_TX_REGS = "hk_tx_regs"
|
||||
TX_STATUS = "tx_status"
|
||||
RX_STATUS = "rx_status"
|
||||
SET_CW = "tx_cw"
|
||||
|
||||
|
||||
class Info:
|
||||
@ -102,6 +105,18 @@ class Datarate(enum.IntEnum):
|
||||
HIGH_RATE_MODULATION_0QPSK = 1
|
||||
|
||||
|
||||
def create_syrlinks_node() -> CmdTreeNode:
|
||||
op_code_strs = [
|
||||
getattr(OpCode, key) for key in dir(OpCode) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
node = CmdTreeNode("syrlinks", "Syrlinks Device", hide_children_for_print=True)
|
||||
for op_code, info in combined_dict.items():
|
||||
node.add_child(CmdTreeNode(op_code, info))
|
||||
return node
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_syrlinks_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
@ -143,42 +158,42 @@ def normal_mode_cmd(q: DefaultPusQueueHelper, info: str, submode: int):
|
||||
|
||||
|
||||
def pack_syrlinks_command( # noqa C901: Complexity okay here.
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, cmd_str: str
|
||||
):
|
||||
obyt = object_id.as_bytes
|
||||
prefix = "Syrlinks"
|
||||
q.add_log_cmd(f"Testing Syrlinks with object id: {object_id.as_hex_string}")
|
||||
if op_code == OpCode.OFF:
|
||||
if cmd_str == OpCode.OFF:
|
||||
q.add_log_cmd(f"{prefix}: {Info.OFF}")
|
||||
q.add_pus_tc(create_mode_command(obyt, Mode.OFF, 0))
|
||||
if op_code == OpCode.ON:
|
||||
if cmd_str == OpCode.ON:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ON}")
|
||||
q.add_pus_tc(create_mode_command(obyt, Mode.ON, ComMode.RX_ONLY))
|
||||
if op_code == OpCode.NORMAL_RX_ONLY:
|
||||
if cmd_str == OpCode.NORMAL_RX_ONLY:
|
||||
normal_mode_cmd(q, Info.NORMAL_RX_ONLY, ComMode.RX_ONLY)
|
||||
if op_code == OpCode.NORMAL_RX_AND_TX_LOW_DATARATE:
|
||||
if cmd_str == OpCode.NORMAL_RX_AND_TX_LOW_DATARATE:
|
||||
normal_mode_cmd(
|
||||
q, Info.NORMAL_RX_AND_TX_LOW_DATARATE, ComMode.RX_AND_TX_LOW_DATARATE
|
||||
)
|
||||
if op_code == OpCode.NORMAL_RX_AND_TX_DEF_DATARATE:
|
||||
if cmd_str == OpCode.NORMAL_RX_AND_TX_DEF_DATARATE:
|
||||
normal_mode_cmd(
|
||||
q, Info.NORMAL_RX_AND_TX_DEF_DATARATE, ComMode.RX_AND_TX_DEF_DATARATE
|
||||
)
|
||||
if op_code == OpCode.NORMAL_RX_AND_TX_HIGH_DATARATE:
|
||||
if cmd_str == OpCode.NORMAL_RX_AND_TX_HIGH_DATARATE:
|
||||
normal_mode_cmd(
|
||||
q, Info.NORMAL_RX_AND_TX_HIGH_DATARATE, ComMode.RX_AND_TX_HIGH_DATARATE
|
||||
)
|
||||
if op_code in OpCode.NORMAL_RX_AND_TX_CW:
|
||||
if cmd_str in OpCode.NORMAL_RX_AND_TX_CW:
|
||||
normal_mode_cmd(q, Info.NORMAL_RX_AND_TX_CW, ComMode.RX_AND_TX_CARRIER_WAVE)
|
||||
if op_code in OpCode.HK_RX_REGS:
|
||||
if cmd_str in OpCode.HK_RX_REGS:
|
||||
q.add_log_cmd(f"{prefix}: {Info.HK_RX_REGS}")
|
||||
sid = make_sid(obyt, SetId.RX_REGISTERS_DATASET)
|
||||
q.add_pus_tc(create_request_one_diag_command(sid))
|
||||
if op_code in OpCode.HK_TEMPS:
|
||||
if cmd_str in OpCode.HK_TEMPS:
|
||||
q.add_log_cmd(f"{prefix}: {Info.HK_TEMPS}")
|
||||
sid = make_sid(obyt, SetId.TEMPERATURE_SET_ID)
|
||||
q.add_pus_tc(create_request_one_hk_command(sid))
|
||||
if op_code in OpCode.ENABLE_HK_RX_REGS:
|
||||
if cmd_str in OpCode.ENABLE_HK_RX_REGS:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ENABLE_HK_RX_REGS}")
|
||||
sid = make_sid(obyt, SetId.RX_REGISTERS_DATASET)
|
||||
interval = float(input("HK interval in floating point seconds"))
|
||||
@ -187,11 +202,11 @@ def pack_syrlinks_command( # noqa C901: Complexity okay here.
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code in OpCode.DISABLE_HK_RX_REGS:
|
||||
if cmd_str in OpCode.DISABLE_HK_RX_REGS:
|
||||
q.add_log_cmd(f"{prefix}: {Info.DISABLE_HK_RX_REGS}")
|
||||
sid = make_sid(obyt, SetId.RX_REGISTERS_DATASET)
|
||||
q.add_pus_tc(create_disable_periodic_hk_command_with_diag(True, sid))
|
||||
if op_code in OpCode.ENABLE_HK_TX_REGS:
|
||||
if cmd_str in OpCode.ENABLE_HK_TX_REGS:
|
||||
q.add_log_cmd(f"{prefix}: {Info.ENABLE_HK_TX_REGS}")
|
||||
sid = make_sid(obyt, SetId.TX_REGISTERS_DATASET)
|
||||
interval = float(input("HK interval in floating point seconds"))
|
||||
@ -200,86 +215,96 @@ def pack_syrlinks_command( # noqa C901: Complexity okay here.
|
||||
)
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code in OpCode.DISABLE_HK_TX_REGS:
|
||||
if cmd_str in OpCode.DISABLE_HK_TX_REGS:
|
||||
q.add_log_cmd(f"{prefix}: {Info.DISABLE_HK_TX_REGS}")
|
||||
sid = make_sid(obyt, SetId.TX_REGISTERS_DATASET)
|
||||
q.add_pus_tc(create_disable_periodic_hk_command_with_diag(True, sid))
|
||||
if op_code in OpCode.HK_TX_REGS:
|
||||
if cmd_str in OpCode.HK_TX_REGS:
|
||||
q.add_log_cmd(f"{prefix}: {Info.HK_TX_REGS}")
|
||||
sid = make_sid(obyt, SetId.TX_REGISTERS_DATASET)
|
||||
q.add_pus_tc(create_request_one_diag_command(sid))
|
||||
if op_code in OpCode.TX_STATUS:
|
||||
if cmd_str in OpCode.TX_STATUS:
|
||||
q.add_log_cmd(f"{prefix}: {Info.TX_STATUS}")
|
||||
command = obyt + struct.pack("!I", CommandId.READ_TX_STATUS)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "9":
|
||||
if cmd_str == "9":
|
||||
q.add_log_cmd("Syrlinks: Read TX waveform")
|
||||
command = obyt + struct.pack("!I", CommandId.READ_TX_WAVEFORM)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "10":
|
||||
if cmd_str == "10":
|
||||
q.add_log_cmd("Syrlinks: Read TX AGC value high byte")
|
||||
command = obyt + struct.pack("!I", CommandId.READ_TX_AGC_VALUE_HIGH_BYTE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "11":
|
||||
if cmd_str == "11":
|
||||
q.add_log_cmd("Syrlinks: Read TX AGC value low byte")
|
||||
command = obyt + struct.pack("!I", CommandId.READ_TX_AGC_VALUE_LOW_BYTE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "12":
|
||||
if cmd_str == "12":
|
||||
q.add_log_cmd("Syrlinks: Write LCL config")
|
||||
command = obyt + struct.pack("!I", CommandId.WRITE_LCL_CONFIG)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "13":
|
||||
if cmd_str == "13":
|
||||
q.add_log_cmd("Syrlinks: Read RX status registers")
|
||||
command = obyt + struct.pack("!I", CommandId.READ_RX_STATUS_REGISTERS)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "14":
|
||||
if cmd_str == "14":
|
||||
q.add_log_cmd("Syrlinks: Read LCL config register")
|
||||
command = obyt + struct.pack("!I", CommandId.READ_LCL_CONFIG_REGISTER)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "15":
|
||||
if cmd_str == "15":
|
||||
q.add_log_cmd("Syrlinks: Set waveform OQPSK")
|
||||
command = obyt + struct.pack("!I", CommandId.SET_WAVEFORM_OQPSK)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "16":
|
||||
if cmd_str == "16":
|
||||
q.add_log_cmd("Syrlinks: Set waveform BPSK")
|
||||
command = obyt + struct.pack("!I", CommandId.SET_WAVEFORM_BPSK)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "17":
|
||||
if cmd_str == "17":
|
||||
q.add_log_cmd("Syrlinks: Set second config")
|
||||
command = obyt + struct.pack("!I", CommandId.SET_SECOND_CONFIG)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "18":
|
||||
if cmd_str == "18":
|
||||
q.add_log_cmd("Syrlinks: Enable debug printout")
|
||||
command = obyt + struct.pack("!I", CommandId.ENABLE_DEBUG)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "19":
|
||||
if cmd_str == "19":
|
||||
q.add_log_cmd("Syrlinks: Disable debug printout")
|
||||
command = obyt + struct.pack("!I", CommandId.DISABLE_DEBUG)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
|
||||
def handle_syrlinks_hk_data(pw: PrintWrapper, set_id: int, hk_data: bytes):
|
||||
if set_id == SetId.RX_REGISTERS_DATASET:
|
||||
return handle_syrlinks_rx_registers_dataset(pw, hk_data)
|
||||
elif set_id == SetId.TX_REGISTERS_DATASET:
|
||||
return handle_syrlinks_tx_registers_dataset(pw, hk_data)
|
||||
elif set_id == SetId.TEMPERATURE_SET_ID:
|
||||
return handle_syrlinks_temp_dataset(pw, hk_data)
|
||||
def handle_syrlinks_hk_data(
|
||||
hk_info: HkTmInfo,
|
||||
pw: PrintWrapper,
|
||||
):
|
||||
if hk_info.set_id == SetId.RX_REGISTERS_DATASET:
|
||||
return handle_syrlinks_rx_registers_dataset(hk_info, pw)
|
||||
elif hk_info.set_id == SetId.TX_REGISTERS_DATASET:
|
||||
return handle_syrlinks_tx_registers_dataset(hk_info, pw)
|
||||
elif hk_info.set_id == SetId.TEMPERATURE_SET_ID:
|
||||
return handle_syrlinks_temp_dataset(hk_info, pw)
|
||||
else:
|
||||
pw.dlog(f"Service 3 TM: Syrlinks handler reply with unknown set ID {set_id}")
|
||||
pw.dlog(
|
||||
f"Service 3 TM: Syrlinks handler reply with unknown set ID {hk_info.set_id}"
|
||||
)
|
||||
|
||||
|
||||
def handle_syrlinks_temp_dataset(pw: PrintWrapper, hk_data: bytes):
|
||||
def handle_syrlinks_temp_dataset(hk_info: HkTmInfo, pw: PrintWrapper):
|
||||
hk_data = hk_info.hk_data
|
||||
if len(hk_data) < 8:
|
||||
raise ValueError("expected at least 8 bytes of HK data")
|
||||
temp_power_amplifier = struct.unpack("!f", hk_data[0:4])[0]
|
||||
temp_baseband_board = struct.unpack("!f", hk_data[4:8])[0]
|
||||
pw.dlog(f"Temperatur Power Amplifier [C]: {temp_power_amplifier}")
|
||||
pw.dlog(f"Temperatur Baseband Board [C]: {temp_baseband_board}")
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[8:], 2))
|
||||
pw.dlog(get_validity_buffer_str(hk_data[8:], 2))
|
||||
|
||||
|
||||
def handle_syrlinks_rx_registers_dataset(pw: PrintWrapper, hk_data: bytes):
|
||||
def handle_syrlinks_rx_registers_dataset(
|
||||
hk_info: HkTmInfo,
|
||||
pw: PrintWrapper,
|
||||
):
|
||||
hk_data = hk_info.hk_data
|
||||
header_list = [
|
||||
"RX Status",
|
||||
"RX Sensitivity",
|
||||
@ -339,17 +364,45 @@ def handle_syrlinks_rx_registers_dataset(pw: PrintWrapper, hk_data: bytes):
|
||||
validity_buffer = hk_data[22:]
|
||||
for header, content in zip(header_list, content_list):
|
||||
pw.dlog(f"{header}: {content}")
|
||||
pw.dlog(
|
||||
FsfwTmTcPrinter.get_validity_buffer(validity_buffer=validity_buffer, num_vars=8)
|
||||
pw.dlog(get_validity_buffer_str(validity_buffer=validity_buffer, num_vars=8))
|
||||
print(f"Carrier Detect: {carrier_detect}")
|
||||
print(f"Carrier Lock: {carrier_lock}")
|
||||
print(f"Data Lock (data clock recovery loop lock status): {data_lock}")
|
||||
print(f"Data Valid (valid if TEB < 10e-5): {data_valid}")
|
||||
print(f"Data Lock (data clock recovery loop lock status): {data_lock}")
|
||||
print(f"RX AGC Inhibit: {rx_agc_inhibit}")
|
||||
print(f"RX AGC: {rx_agc}")
|
||||
print(f"Eb / E0RX [dB]: {eb_to_n0}")
|
||||
cursor = hk_info.db_con.cursor()
|
||||
cursor.execute(
|
||||
"""
|
||||
CREATE TABLE IF NOT EXISTS syrlinks_rx_regs(
|
||||
packet_uuid TEXT PRIMARY KEY,
|
||||
generation_time TEXT,
|
||||
carrier_detect NUM,
|
||||
carrier_lock NUM,
|
||||
data_lock NUM,
|
||||
data_valid NUM,
|
||||
rx_agc_inhibit NUM,
|
||||
rx_agc NUM,
|
||||
eb_to_e0_rx NUM
|
||||
)"""
|
||||