reaction wheel set speed command

This commit is contained in:
Jakob Meier 2021-06-25 12:07:16 +02:00
parent 36582621f2
commit 3d26373726
7 changed files with 79 additions and 19 deletions

View File

@ -23,3 +23,4 @@ class CustomServiceList(enum.Enum):
PLOC = "ploc"
PCDU = "pcdu",
SA_DEPLYOMENT = "sa_depl"
REACTION_WHEEL = "reaction_wheel"

View File

@ -63,6 +63,12 @@ class EiveHookObject(TmTcHookBase):
}
service_imtq_tuple = ("IMTQ Device", op_code_dict_srv_imtq)
op_code_dict_srv_rw = {
"0": ("Reaction Wheel: Run all commands", {OpCodeDictKeys.TIMEOUT: 2.0}),
"1": ("Reaction Wheel: Set speed", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_rw_tuple = ("Reaction Wheel", op_code_dict_srv_rw)
service_op_code_dict[CustomServiceList.ACU.value] = service_acu_tuple
service_op_code_dict[CustomServiceList.TMP1075_1.value] = service_tmp1075_1_tuple
service_op_code_dict[CustomServiceList.TMP1075_2.value] = service_tmp1075_2_tuple
@ -72,6 +78,7 @@ class EiveHookObject(TmTcHookBase):
service_op_code_dict[CustomServiceList.PDU1.value] = service_pdu2_tuple
service_op_code_dict[CustomServiceList.HEATER.value] = service_heater_tuple
service_op_code_dict[CustomServiceList.IMTQ.value] = service_imtq_tuple
service_op_code_dict[CustomServiceList.REACTION_WHEEL.value] = service_rw_tuple
return service_op_code_dict
def get_json_config_file_path(self) -> str:

View File

@ -19,6 +19,7 @@ SOLAR_ARRAY_DEPLOYMENT_ID = bytes([0x44, 0x00, 0x10, 0x01])
SYRLINKS_HANDLER = bytes([0x44, 0x00, 0x10, 0x02])
IMTQ_HANDLER_ID = bytearray([0x44, 0x00, 0x00, 0x14])
PLOC_ID = bytearray([0x44, 0x00, 0x00, 0x15])
RW1_ID = bytearray([0x44, 0x00, 0x00, 0x15])
def get_object_ids() -> Dict[bytes, list]:

View File

@ -12,23 +12,6 @@ from tmtccmd.ecss.tc import PusTelecommand
from tmtccmd.pus_tc.service_3_housekeeping import make_sid, generate_one_hk_command
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 = False
get_commanded_dipole = False
positive_x_test = True
negative_x_test = False
positive_y_test = False
negative_y_test = False
positive_z_test = False
negative_z_test = False
class ImtqSetIds:
ENG_HK_SET = 1
CAL_MTM_SET = 2
@ -178,7 +161,7 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
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 object_id The object id of the IMTQ handler.
@param x_dipole The dipole of the x coil in 10^-4*Am^2 (max. 2000)
@param y_dipole The dipole of the y coil in 10^-4*Am^2 (max. 2000)
@param z_dipole The dipole of the z coil in 10^-4*Am^2 (max. 2000)

65
pus_tc/reaction_wheels.py Normal file
View File

@ -0,0 +1,65 @@
# -*- coding: utf-8 -*-
"""
@file imtq.py
@brief Tests for the ISIS IMTQ (Magnettorquer) device handler
@author J. Meier
@date 25.03.2021
"""
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.pus_tc.packer import TcQueueT
from tmtccmd.ecss.tc import PusTelecommand
from tmtccmd.pus_tc.service_3_housekeeping import make_sid, generate_one_hk_command
class RwSetIds:
STATUS_SET_ID = 4
TEMPERATURE_SET_ID = 8
class RwCommandIds:
RESET_MCU = bytearray([0x0, 0x0, 0x0, 0x01])
# Reads status information from reaction wheel into dataset with id 4
GET_RW_STATUS = bytearray([0x0, 0x0, 0x0, 0x04])
SET_SPEED = bytearray([0x0, 0x0, 0x0, 0x06])
# Reads temperature from reaction wheel into dataset with id 8
GET_TEMPERATURE = bytearray([0x0, 0x0, 0x0, 0x08])
class SpeedDefinitions:
RPM_100 = 1000
RPM_5000 = 5000
class RampTime:
MS_100 = 100
def pack_single_rw_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
tc_queue.appendleft(
(QueueCommands.PRINT,
"Testing reaction wheel handler with object id: 0x" + object_id.hex())
)
if op_code == "0" or op_code == "1":
tc_queue.appendleft((QueueCommands.PRINT, "Reaction Wheel: Set speed"))
command = pack_set_speed_command(SpeedDefinitions.RPM_100, RampTime.MS_100)
command = PusTelecommand(service=8, subservice=128, ssc=40, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
def pack_set_speed_command(object_id: bytearray, speed: int, ramp_time: int) -> bytearray:
""" With this function a command is packed to set the speed of a reaction wheel
@param object_id The object id of the reaction wheel handler.
@param speed Valid speeds are [-65000, -1000] and [1000, 65000]. Values are specified in 0.1 * RPM
@param ramp_time The time after which the reaction wheel will reached the commanded speed. Valid times are
10 - 10000 ms
"""
command_id = RwCommandIds.SET_SPEED
command = bytearray()
command = object_id + command_id
command.extend(speed.to_bytes(length=4, byteorder='big'))
command.extend(ramp_time.to_bytes(length=2, byteorder='big'))
return command

View File

@ -68,6 +68,9 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu
if service == CustomServiceList.PLOC.value:
object_id = PLOC_ID
return pack_ploc_test_into(object_id=object_id, tc_queue=service_queue)
if service == CustomServiceList.REACTION_WHEEL.value:
object_id =
return pack_ploc_test_into(object_id=object_id, tc_queue=service_queue)
LOGGER.warning("Invalid Service !")

@ -1 +1 @@
Subproject commit b4358a15fd945a9e0103a707b2a2dc56c458b24a
Subproject commit b0cf33b8a6223247c5df38e5918ac8885c494c11