speec and ramp time configurable

This commit is contained in:
2022-10-18 15:41:41 +02:00
parent d4496a131b
commit 30a763a7f7
6 changed files with 139 additions and 8 deletions

View File

@ -126,6 +126,8 @@ def add_rw_cmds(defs: TmtcDefinitionWrapper):
oce.add(info=InfoAss.ON, keys=OpCodesAss.ON)
oce.add(info=InfoAss.NML, keys=OpCodesAss.NML)
oce.add(info=InfoAss.OFF, keys=OpCodesAss.OFF)
oce.add(info=InfoAss.ALL_SPEED_UP, keys=OpCodesAss.ALL_SPEED_UP)
oce.add(info=InfoAss.ALL_SPEED_OFF, keys=OpCodesAss.ALL_SPEED_OFF)
defs.add_service(
name=CustomServiceList.RW_ASSEMBLY.value,
info="Reaction Wheel Assembly",
@ -137,12 +139,7 @@ def pack_single_rw_test_into(
object_id: bytes, rw_idx: int, q: DefaultPusQueueHelper, op_code: str
):
if op_code in OpCodesDevs.SPEED:
speed = int(
input(
"Specify speed [0.1 RPM, 0 or range [-65000, -1000] and [1000, 65000]: "
)
)
ramp_time = int(input("Specify ramp time [ms, range [10, 20000]]: "))
speed, ramp_time = prompt_speed_ramp_time()
q.add_log_cmd(
f"RW {rw_idx}: {InfoDevs.SPEED} with target "
f"speed {speed / 10.0} RPM and {ramp_time} ms ramp time"
@ -218,9 +215,23 @@ def pack_rw_ass_cmds(q: DefaultPusQueueHelper, object_id: bytes, op_code: str):
)
)
if op_code in OpCodesAss.ALL_SPEED_UP:
rw_speed_up_cmd_consec(q, [RW1_ID, RW2_ID, RW3_ID, RW4_ID], 65000, 10000)
speed, ramp_time = prompt_speed_ramp_time()
rw_speed_up_cmd_consec(q, [RW1_ID, RW2_ID, RW3_ID, RW4_ID], speed, ramp_time)
if op_code in OpCodesAss.ALL_SPEED_OFF:
rw_speed_down_cmd_consec(q, [RW1_ID, RW2_ID, RW3_ID, RW4_ID], 10000)
rw_speed_down_cmd_consec(
q, [RW1_ID, RW2_ID, RW3_ID, RW4_ID], prompt_ramp_time()
)
def prompt_speed_ramp_time() -> (int, int):
speed = int(
input("Specify speed [0.1 RPM, 0 or range [-65000, -1000] and [1000, 65000]: ")
)
return speed, prompt_ramp_time()
def prompt_ramp_time() -> int:
return int(input("Specify ramp time [ms, range [10, 20000]]: "))
def pack_set_speed_command(