40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
|
# -*- coding: utf-8 -*-
|
||
|
"""
|
||
|
@file star_tracker.py
|
||
|
@brief Star tracker commanding
|
||
|
@author J. Meier
|
||
|
@date 14.08.2021
|
||
|
"""
|
||
|
import struct
|
||
|
|
||
|
from tmtccmd.config.definitions import QueueCommands
|
||
|
|
||
|
from tmtccmd.tc.packer import TcQueueT
|
||
|
from tmtccmd.ecss.tc import PusTelecommand
|
||
|
|
||
|
|
||
|
class StarTrackerActionIds:
|
||
|
PING = 0
|
||
|
REQ_TEMPERATURE = 25
|
||
|
|
||
|
|
||
|
def pack_star_tracker_commands_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
|
||
|
tc_queue.appendleft(
|
||
|
(QueueCommands.PRINT,
|
||
|
"Generate command for star tracker with object id: 0x" + object_id.hex())
|
||
|
)
|
||
|
|
||
|
if op_code == "0":
|
||
|
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Ping"))
|
||
|
command = pack_ping_command(object_id)
|
||
|
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
|
||
|
tc_queue.appendleft(command.pack_command_tuple())
|
||
|
|
||
|
|
||
|
def pack_ping_command(object_id: bytearray) -> bytearray:
|
||
|
data = int(input("Specify ping data: "))
|
||
|
command = bytearray()
|
||
|
command = object_id + struct.pack('!I', StarTrackerActionIds.PING)
|
||
|
command = command + struct.pack('!I', data)
|
||
|
return command
|