Merge remote-tracking branch 'origin/develop' into mueller/gps-hk-parsing
This commit is contained in:
@ -196,20 +196,36 @@ def pack_rw_ass_cmds(tc_queue: TcQueueT, object_id: bytes, op_code: str):
|
||||
|
||||
|
||||
def pack_set_speed_command(
|
||||
object_id: bytes, speed: int, ramp_time: int, ssc: int
|
||||
object_id: bytes, speed: int, ramp_time_ms: int, ssc: int
|
||||
) -> PusTelecommand:
|
||||
"""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 reach the commanded speed.
|
||||
:param ramp_time_ms: The time after which the reaction wheel will reach the commanded speed.
|
||||
Valid times are 10 - 10000 ms
|
||||
:param ssc: Source sequence count
|
||||
"""
|
||||
if speed > 0:
|
||||
if speed < 1000 or speed > 65000:
|
||||
raise ValueError(
|
||||
"Invalid RW speed specified. "
|
||||
"Allowed range is [1000, 65000] 0.1 * RPM"
|
||||
)
|
||||
else:
|
||||
if speed < -65000 or speed > -1000:
|
||||
raise ValueError(
|
||||
"Invalid RW speed specified. "
|
||||
"Allowed range is [-65000, -1000] 0.1 * RPM"
|
||||
)
|
||||
if ramp_time_ms < 0 or (
|
||||
ramp_time_ms > 0 and (ramp_time_ms > 10000 or ramp_time_ms < 10)
|
||||
):
|
||||
raise ValueError("Invalid Ramp Speed time. Allowed range is [10-10000] ms")
|
||||
command_id = RwCommandIds.SET_SPEED
|
||||
command = bytearray()
|
||||
command += object_id + command_id
|
||||
command = command + struct.pack("!i", speed)
|
||||
command = command + ramp_time.to_bytes(length=2, byteorder="big")
|
||||
command = command + ramp_time_ms.to_bytes(length=2, byteorder="big")
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=ssc, app_data=command)
|
||||
return command
|
||||
|
Reference in New Issue
Block a user