Compare commits

...

3 Commits

7 changed files with 82 additions and 53 deletions

View File

@@ -5,6 +5,8 @@
@author J. Meier
@date 25.03.2021
"""
import struct
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
@@ -276,11 +278,10 @@ def pack_dipole_command(
command is sent.
"""
action_id = ImtqActionIds.start_actuation_dipole
command = bytearray()
command = object_id + action_id
command.extend(x_dipole.to_bytes(length=2, byteorder="big"))
command.extend(y_dipole.to_bytes(length=2, byteorder="big"))
command.extend(z_dipole.to_bytes(length=2, byteorder="big"))
command.extend(duration.to_bytes(length=2, byteorder="big"))
command += struct.pack('!h', x_dipole)
command += struct.pack('!h', y_dipole)
command += struct.pack('!h', z_dipole)
command += struct.pack('!h', duration)
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
return command

View File

@@ -189,11 +189,11 @@ def pack_generic_hk_listening_cmds(
sid=sid_list[i],
)
)
activate_all_rws_in_sequence(
tc_queue=tc_queue, test_speed=0, test_ramp_time=5000, init_ssc=0
)
tc_queue.appendleft((QueueCommands.WAIT, 30))
if cfg.one_rw or cfg.two_rws:
activate_all_rws_in_sequence(
tc_queue=tc_queue, test_speed=0, test_ramp_time=5000, init_ssc=0
)
tc_queue.appendleft((QueueCommands.WAIT, 60))
current_time = time.time()
current_time += collection_time
if not cfg.use_tc_sched:
@@ -210,7 +210,7 @@ def pack_generic_hk_listening_cmds(
)
if not cfg.use_tc_sched:
tc_queue.appendleft((QueueCommands.WAIT, 120))
tc_queue.appendleft((QueueCommands.WAIT, 60))
sid_list.clear()
diag_list.clear()
@@ -330,9 +330,9 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
diag_list = [
False,
False,
True,
False,
False,
False
True
]
pack_acs_command(tc_queue=tc_queue, op_code="acs-a")
@@ -356,9 +356,9 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
diag_list = [
False,
False,
True,
False,
False,
False
True
]
for b_side_dev in b_side_pairs:
@@ -386,14 +386,14 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
diag_list = [
False,
False,
True,
False,
False,
False,
False,
True,
False,
False,
False,
False,
True,
]
pack_generic_hk_listening_cmds(
tc_queue=tc_queue,
@@ -413,12 +413,15 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
(oids.IMTQ_HANDLER_ID, ImtqSetIds.RAW_MTM_SET),
]
diag_list = [
False,
False,
False,
True,
True,
True,
]
# mgt 1: imtq und hk
# Command MGT to mode on
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, tc_queue=tc_queue, op_code="1")
tc_queue.appendleft((QueueCommands.WAIT, 5))
# Command MGT to normal mode
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, tc_queue=tc_queue, op_code="2")
for imtq_dev in imtq_pairs:
@@ -456,23 +459,24 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
diag_list = [
False,
False,
True,
False,
True,
False,
False,
Truehk,
False,
False,
False,
False,
False,
False,
False,
False,
False,
True,
True,
True,
True,
]
pack_acs_command(tc_queue=tc_queue, op_code="acs-d")
# mgt 2.: imtq + dual side + dipole
pack_imtq_test_into(
object_id=oids.IMTQ_HANDLER_ID, tc_queue=tc_queue, op_code="2"
)
# Command MGT to mode on
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, tc_queue=tc_queue, op_code="1")
tc_queue.appendleft((QueueCommands.WAIT, 20))
# Command MGT to normal mode
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, tc_queue=tc_queue, op_code="2")
for d_side_and_imtq_dev in d_side_and_imtq_pairs:
oid = d_side_and_imtq_dev[0]
@@ -514,12 +518,12 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
oids.SUS_11_R_LOC_XBYMZB_PT_ZB,
]
diag_list = [
False,
False,
False,
False,
False,
False,
True,
True,
True,
True,
True,
True,
]
# SUSs
@@ -537,6 +541,15 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
tc_queue.appendleft((QueueCommands.WAIT, 5.0))
pack_sus_cmds(tc_queue=tc_queue, op_code="sus-red")
diag_list = [
True,
True,
True,
True,
True,
True,
]
# SUSs
for red_sus in sus_r_ids:
sid_list.append(make_sid(red_sus, SetIds.HK))
@@ -557,7 +570,20 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
sid_list.append(make_sid(nom_sus, SetIds.HK))
for red_sus in sus_r_ids:
sid_list.append(make_sid(red_sus, SetIds.HK))
diag_list = diag_list + diag_list
diag_list = [
True,
True,
True,
True,
True,
True,
True,
True,
True,
True,
True,
True,
]
pack_generic_hk_listening_cmds(
tc_queue=tc_queue,
proc_key=key,
@@ -831,23 +857,23 @@ def activate_all_rws_in_sequence(
) -> int:
new_ssc = init_ssc
# RW1 speed cmd
tc_queue.appendleft((QueueCommands.WAIT, 5.0))
tc_queue.appendleft((QueueCommands.WAIT, 58))
new_ssc = rw_speed_cmd_single(
tc_queue, oids.RW1_ID, new_ssc, test_speed, test_ramp_time
)
tc_queue.appendleft((QueueCommands.WAIT, 15.0))
tc_queue.appendleft((QueueCommands.WAIT, 30))
new_ssc = rw_speed_cmd_single(
tc_queue, oids.RW2_ID, new_ssc, test_speed, test_ramp_time
)
tc_queue.appendleft((QueueCommands.WAIT, 15.0))
tc_queue.appendleft((QueueCommands.WAIT, 30))
new_ssc = rw_speed_cmd_single(
tc_queue, oids.RW3_ID, new_ssc, test_speed, test_ramp_time
)
tc_queue.appendleft((QueueCommands.WAIT, 15.0))
tc_queue.appendleft((QueueCommands.WAIT, 30))
new_ssc = rw_speed_cmd_single(
tc_queue, oids.RW4_ID, new_ssc, test_speed, test_ramp_time
)
tc_queue.appendleft((QueueCommands.WAIT, 15.0))
tc_queue.appendleft((QueueCommands.WAIT, 30))
return new_ssc

View File

@@ -60,7 +60,7 @@ def handle_adis_gyro_hk(
def handle_l3g_gyro_hk(
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
):
if set_id == L3gGyroSetIds:
if set_id == L3gGyroSetIds.CORE_HK:
pw = PrintWrapper(printer)
fmt_str = "!ffff"
inc_len = struct.calcsize(fmt_str)

View File

@@ -10,8 +10,10 @@ import config.object_ids as obj_ids
def handle_mgm_hk_data(
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
):
if object_id in [obj_ids.MGM_0_LIS3_HANDLER_ID, obj_ids.MGM_2_LIS3_HANDLER_ID]:
if object_id.as_bytes in [obj_ids.MGM_0_LIS3_HANDLER_ID, obj_ids.MGM_2_LIS3_HANDLER_ID]:
handle_mgm_lis3_hk_data(object_id, printer, set_id, hk_data)
elif object_id.as_bytes in [obj_ids.MGM_1_RM3100_HANDLER_ID, obj_ids.MGM_3_RM3100_HANDLER_ID]:
handle_mgm_rm3100_hk_data(object_id, printer, set_id, hk_data)
pass
@@ -23,7 +25,7 @@ def handle_mgm_lis3_hk_data(
fmt_str = "!ffff"
inc_len = struct.calcsize(fmt_str)
(field_x, field_y, field_z, temp) = struct.unpack(
fmt_str, hk_data[0 : 0 + inc_len]
fmt_str, hk_data[0: 0 + inc_len]
)
pw.dlog(f"Received MGM LIS3 from object {object_id}")
pw.dlog(

View File

@@ -22,5 +22,5 @@ def handle_sus_hk(
pw.dlog(f"Temperature: {temperature} C")
pw.dlog(f"AIN Channel | Raw Value (hex) | Raw Value (dec)")
for idx, val in enumerate(channels):
pw.dlog(f"{idx} | {val:#06x} | {str(val).ljust(5)}")
pw.dlog(f"{idx} | {val[0]:#06x} |" + str(val[0]).ljust(5))
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=7)

View File

@@ -35,8 +35,8 @@ def handle_thermal_controller_hk_data(
elif set_id == SetIds.DEVICE_TEMPERATURE_SET:
pw = PrintWrapper(printer)
pw.dlog("Received device temperature data")
fmt_str = "!fffffiiiiffffffffffffffffff"
tm_data = struct.unpack(fmt_str, hk_data[:90])
fmt_str = "!fhhhhiiiifHHHffffffffffffff"
tm_data = struct.unpack(fmt_str, hk_data[:94])
parsed_data = {
"Q7S_TEMPERATURE": tm_data[0],
"BATTERY_TEMPERATURE_1": tm_data[1],

Submodule tmtccmd updated: 03b70906a6...6914cfaaf6