2021-08-16 10:03:40 +02:00
|
|
|
# -*- 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
|
2021-10-01 10:55:56 +02:00
|
|
|
from spacepackets.ecss.tc import PusTelecommand
|
2021-08-16 10:03:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
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
|