star tracker ping command

This commit is contained in:
Jakob.Meier 2021-08-16 10:03:40 +02:00
parent 950adf36ed
commit 95c5aa46d9
6 changed files with 53 additions and 3 deletions

View File

@ -31,3 +31,4 @@ class CustomServiceList(enum.Enum):
PLOC_SUPV = "ploc_supv"
PLOC_UPDATER = "ploc_updater"
CORE = 'core'
STAR_TRACKER = 'star_tracker'

View File

@ -154,6 +154,11 @@ class EiveHookObject(TmTcHookBase):
}
service_ploc_updater_tuple = ("Ploc Updater", op_code_dict_srv_ploc_updater)
op_code_dict_srv_star_tracker = {
"0": ("Star Tracker: Ping", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_star_tracker_tuple = ("Star tracker", op_code_dict_srv_star_tracker)
service_op_code_dict[CustomServiceList.P60DOCK.value] = service_p60_tuple
service_op_code_dict[CustomServiceList.PDU1.value] = service_pdu1_tuple
service_op_code_dict[CustomServiceList.PDU2.value] = service_pdu2_tuple
@ -166,6 +171,7 @@ class EiveHookObject(TmTcHookBase):
service_op_code_dict[CustomServiceList.RAD_SENSOR.value] = service_rad_sensor_tuple
service_op_code_dict[CustomServiceList.PLOC_SUPV.value] = service_ploc_supv_tuple
service_op_code_dict[CustomServiceList.PLOC_UPDATER.value] = service_ploc_updater_tuple
service_op_code_dict[CustomServiceList.STAR_TRACKER.value] = service_star_tracker_tuple
return service_op_code_dict
def get_json_config_file_path(self) -> str:

View File

@ -23,7 +23,7 @@ RW1_ID = bytes([0x44, 0x12, 0x00, 0x1])
RW2_ID = bytes([0x44, 0x12, 0x00, 0x2])
RW3_ID = bytes([0x44, 0x12, 0x00, 0x3])
RW4_ID = bytes([0x44, 0x12, 0x00, 0x4])
START_TRACKER_ID = bytes([0x44, 0x13, 0x00, 0x1])
STAR_TRACKER_ID = bytes([0x44, 0x13, 0x00, 0x1])
RAD_SENSOR_ID = bytes([0x44, 0x32, 0x00, 0xA5])
PLOC_SUPV_ID = bytes([0x44, 0x33, 0x00, 0x16])
PLOC_UPDATER_ID = bytes([0x44, 0x33, 0x00, 0x00])

View File

@ -46,7 +46,7 @@ def pack_pdu1_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "4":
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn star racker off"))
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn star tracker off"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, Channel.off)
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)

39
pus_tc/star_tracker.py Normal file
View File

@ -0,0 +1,39 @@
# -*- 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

View File

@ -28,10 +28,11 @@ from pus_tc.reaction_wheels import pack_single_rw_test_into
from pus_tc.rad_sensor import pack_rad_sensor_test_into
from pus_tc.ploc_upater import pack_ploc_updater_test_into
from pus_tc.core import pack_core_commands
from pus_tc.star_tracker import pack_star_tracker_commands_into
from config.definitions import CustomServiceList
from config.object_ids import P60_DOCK_HANDLER, PDU_1_HANDLER_ID, PDU_2_HANDLER_ID, ACU_HANDLER_ID, \
TMP_1075_1_HANDLER_ID, TMP_1075_2_HANDLER_ID, HEATER_ID, IMTQ_HANDLER_ID, PLOC_MPSOC_ID, RW1_ID, RW2_ID, RW3_ID, RW4_ID, \
RAD_SENSOR_ID, PLOC_SUPV_ID, PLOC_UPDATER_ID
RAD_SENSOR_ID, PLOC_SUPV_ID, PLOC_UPDATER_ID, STAR_TRACKER_ID
LOGGER = get_console_logger()
@ -95,6 +96,9 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu
if service == CustomServiceList.PLOC_UPDATER.value:
object_id = PLOC_UPDATER_ID
return pack_ploc_updater_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.STAR_TRACKER.value:
object_id = STAR_TRACKER_ID
return pack_star_tracker_commands_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.CORE.value:
return pack_core_commands(tc_queue=service_queue, op_code=op_code)
LOGGER.warning("Invalid Service !")