update S/A depl cmd

This commit is contained in:
Robin Müller 2022-10-13 18:04:35 +02:00
parent 50abe69f26
commit 6e8ef41d7c
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
3 changed files with 81 additions and 23 deletions

View File

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
"""
@file solar_array_deployment.py
@brief The test function in this file simply returns a command which triggers the solar array deployment.
@author J. Meier
@date 15.02.2021
"""
from spacepackets.ecss import PusTelecommand
from tmtccmd.tc import DefaultPusQueueHelper
class ActionIds:
DEPLOY_SOLAR_ARRAYS = bytearray([0x0, 0x0, 0x0, 0x5])
def pack_solar_array_deployment_test_into(
object_id: bytearray, q: DefaultPusQueueHelper
):
q.add_log_cmd("Testing S/A Deployment")
command = object_id + ActionIds.DEPLOY_SOLAR_ARRAYS
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))

View File

@ -27,7 +27,7 @@ from tmtc.power.p60dock import pack_p60dock_cmds
from tmtc.power.pdu2 import pack_pdu2_commands
from tmtc.power.pdu1 import pack_pdu1_commands
from tmtc.power.acu import pack_acu_commands
from pus_tc.devs.solar_array_deployment import pack_solar_array_deployment_test_into
from tmtc.solar_array_deployment import pack_solar_array_deployment_test_into
from pus_tc.devs.imtq import pack_imtq_test_into
from pus_tc.devs.tmp1075 import pack_tmp1075_test_into
from pus_tc.devs.heater import pack_heater_cmds

View File

@ -0,0 +1,80 @@
# -*- coding: utf-8 -*-
"""
@file solar_array_deployment.py
@brief The test function in this file simply returns a command which triggers the solar array deployment.
@author J. Meier
@date 15.02.2021
"""
import struct
from config.definitions import CustomServiceList
from config.object_ids import SOLAR_ARRAY_DEPLOYMENT_ID
from tmtccmd.config.tmtc import (
tmtc_definitions_provider,
TmtcDefinitionWrapper,
OpCodeEntry,
)
from tmtccmd.tc import service_provider
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
from tmtccmd.tc.decorator import ServiceProviderParams
from tmtccmd import get_console_logger
LOGGER = get_console_logger()
class OpCodes:
MANUAL_DEPLOYMENT = "man_depl"
class Info:
MANUAL_DEPLOYMENT = "Manual Solar Array Deployment"
class ActionIds:
MANUAL_DEPLOYMENT = 5
@tmtc_definitions_provider
def pack_sa_depl_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add(keys=OpCodes.MANUAL_DEPLOYMENT, info=Info.MANUAL_DEPLOYMENT)
defs.add_service(
name=CustomServiceList.SA_DEPLYOMENT,
info="Solar Array Deployment",
op_code_entry=oce,
)
@service_provider(CustomServiceList.SA_DEPLYOMENT)
def pack_solar_array_deployment_test_into(p: ServiceProviderParams):
q = p.queue_helper
user_data = bytearray()
burn_time = 0
dry_run = 0
while True:
burn_time = int(input("Please specify burn time in seconds [0-120 secs]: "))
if burn_time < 0 or burn_time > 120:
LOGGER.warning(f"Invalid burn time {burn_time}")
continue
user_data.extend(struct.pack("!I", burn_time))
break
while True:
dry_run = input("Dry run? [y/n]: ")
if dry_run in ["yes", "y", "1"]:
dry_run = 1
elif dry_run in ["no", "n", "0"]:
dry_run = 0
else:
LOGGER.warning("Invalid input for dry run parameter")
continue
user_data.append(dry_run)
break
if dry_run == 1:
dry_run_str = " as dry run"
else:
dry_run_str = ""
q.add_log_cmd(f"Testing S/A Deployment with burn time {burn_time}{dry_run_str}")
command = make_fsfw_action_cmd(
SOLAR_ARRAY_DEPLOYMENT_ID, ActionIds.MANUAL_DEPLOYMENT, user_data
)
q.add_pus_tc(command)