This commit is contained in:
Martin Zietz 2021-03-25 17:53:05 +01:00
parent 754edffeae
commit 80ee42089e
2 changed files with 64 additions and 0 deletions

63
pus_tc/imtq.py Normal file
View File

@ -0,0 +1,63 @@
# -*- coding: utf-8 -*-
"""
@file imtq.py
@brief Tests for the ISIS IMTQ (Magnettorquer) device handler
@author J. Meier
@date 25.03.2021
"""
from tmtccmd.core.definitions import QueueCommands
from tmtccmd.pus_tc.packer import TcQueueT
from tmtccmd.pus_tc.base import PusTelecommand
class ImtqTestProcedure:
"""
@brief Use this class to define the tests to perform for the IMTQ Handler.
@details Setting all to True will run all tests.
Setting all to False will only run the tests set to True.
"""
all = False
command_dipole = True
class ImtqActionIds:
start_actuation_dipole = bytearray([0x0, 0x0, 0x0, 0x02])
def pack_tmp1075_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
tc_queue.appendleft(
(QueueCommands.PRINT,
"Testing Tmp1075 Temperature Sensor Handler with object id: 0x" + object_id.hex())
)
if ImtqTestProcedure.all or ImtqTestProcedure.command_dipole:
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Commanding dipole"))
command = object_id + Tmp1075ActionIds.start_adc_conversion
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if Tmp1075TestProcedure.all or Tmp1075TestProcedure.get_temp:
tc_queue.appendleft((QueueCommands.PRINT, "TMP1075: Read temperature"))
command = object_id + Tmp1075ActionIds.get_temp
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
def pack_dipole_command(object_id: bytearray, x_dipole: int, y_dipole: int, z_dipole: int, duration: int) -> bytearray:
""" This function packs the command causing the ISIS IMTQ to generate a dipole.
@param object_id The object id of the gomspace device handler.
@param x_dipole The dipole of the x coil in 10^-4*Am^2
@param y_dipole The dipole of the y coil in 10^-4*Am^2
@param z_dipole The dipole of the z coil in 10^-4*Am^2
@param duration The duration in milliseconds the dipole will be generated by the coils.
When set to 0, the dipole will be generated until a new dipole actuation
command is sent.
"""
action_id = ImtqActionIds.start_actuation_dipole
command = bytearray()
command = object_id + action_id
xDipole
command
return command

1
tmtc_core Submodule

@ -0,0 +1 @@
Subproject commit bd46c5a85262140ab097b2704926745e1a0687d1