Add action service and controller component #5
@ -10,7 +10,6 @@ from tmtccmd.tmtc import DefaultPusQueueHelper
|
|||||||
from tmtccmd.pus.s11_tc_sched import create_time_tagged_cmd
|
from tmtccmd.pus.s11_tc_sched import create_time_tagged_cmd
|
||||||
from tmtccmd.pus.s200_fsfw_mode import Subservice as ModeSubservice
|
from tmtccmd.pus.s200_fsfw_mode import Subservice as ModeSubservice
|
||||||
|
|
||||||
from common import AcsId, Apid
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -66,14 +65,6 @@ def create_cmd_definition_tree() -> CmdTreeNode:
|
|||||||
)
|
)
|
||||||
root_node.add_child(scheduler_node)
|
root_node.add_child(scheduler_node)
|
||||||
|
|
||||||
acs_node = CmdTreeNode("acs", "ACS Subsystem Node")
|
|
||||||
mgm_node = CmdTreeNode("mgms", "MGM devices node")
|
|
||||||
mgm_node.add_child(mode_node)
|
|
||||||
mgm_node.add_child(hk_node)
|
|
||||||
|
|
||||||
acs_node.add_child(mgm_node)
|
|
||||||
root_node.add_child(acs_node)
|
|
||||||
|
|
||||||
return root_node
|
return root_node
|
||||||
|
|
||||||
|
|
||||||
@ -87,14 +78,10 @@ def pack_pus_telecommands(q: DefaultPusQueueHelper, cmd_path: str):
|
|||||||
assert len(cmd_path_list) >= 2
|
assert len(cmd_path_list) >= 2
|
||||||
if cmd_path_list[1] == "ping":
|
if cmd_path_list[1] == "ping":
|
||||||
q.add_log_cmd("Sending PUS ping telecommand")
|
q.add_log_cmd("Sending PUS ping telecommand")
|
||||||
return q.add_pus_tc(
|
return q.add_pus_tc(PusTelecommand(service=17, subservice=1))
|
||||||
PusTelecommand(apid=Apid.GENERIC_PUS, service=17, subservice=1)
|
|
||||||
)
|
|
||||||
elif cmd_path_list[1] == "trigger_event":
|
elif cmd_path_list[1] == "trigger_event":
|
||||||
q.add_log_cmd("Triggering test event")
|
q.add_log_cmd("Triggering test event")
|
||||||
return q.add_pus_tc(
|
return q.add_pus_tc(PusTelecommand(service=17, subservice=128))
|
||||||
PusTelecommand(apid=Apid.GENERIC_PUS, service=17, subservice=128)
|
|
||||||
)
|
|
||||||
if cmd_path_list[0] == "scheduler":
|
if cmd_path_list[0] == "scheduler":
|
||||||
assert len(cmd_path_list) >= 2
|
assert len(cmd_path_list) >= 2
|
||||||
if cmd_path_list[1] == "schedule_ping_10_secs_ahead":
|
if cmd_path_list[1] == "schedule_ping_10_secs_ahead":
|
||||||
@ -106,27 +93,10 @@ def pack_pus_telecommands(q: DefaultPusQueueHelper, cmd_path: str):
|
|||||||
create_time_tagged_cmd(
|
create_time_tagged_cmd(
|
||||||
time_stamp,
|
time_stamp,
|
||||||
PusTelecommand(service=17, subservice=1),
|
PusTelecommand(service=17, subservice=1),
|
||||||
apid=Apid.SCHED,
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if cmd_path_list[0] == "acs":
|
if cmd_path_list[0] == "acs":
|
||||||
assert len(cmd_path_list) >= 2
|
assert len(cmd_path_list) >= 2
|
||||||
if cmd_path_list[1] == "mgms":
|
|
||||||
assert len(cmd_path_list) >= 3
|
|
||||||
if cmd_path_list[2] == "hk":
|
|
||||||
if cmd_path_list[3] == "one_shot_hk":
|
|
||||||
q.add_log_cmd("Sending HK one shot request")
|
|
||||||
# TODO: Fix
|
|
||||||
# q.add_pus_tc(
|
|
||||||
# create_request_one_hk_command(
|
|
||||||
# make_addressable_id(Apid.ACS, AcsId.MGM_SET)
|
|
||||||
# )
|
|
||||||
# )
|
|
||||||
if cmd_path_list[2] == "mode":
|
|
||||||
if cmd_path_list[3] == "set_mode":
|
|
||||||
handle_set_mode_cmd(
|
|
||||||
q, "MGM 0", cmd_path_list[4], Apid.ACS, AcsId.MGM_0
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def handle_set_mode_cmd(
|
def handle_set_mode_cmd(
|
||||||
|
@ -28,12 +28,18 @@ impl ExperimentController {
|
|||||||
pub fn perform_operation(&mut self) {
|
pub fn perform_operation(&mut self) {
|
||||||
match self.composite_request_rx.try_recv() {
|
match self.composite_request_rx.try_recv() {
|
||||||
Ok(msg) => match msg.message {
|
Ok(msg) => match msg.message {
|
||||||
CompositeRequest::Hk(_) => todo!(),
|
CompositeRequest::Hk(_) => {
|
||||||
|
log::warn!("hk request handling unimplemented")
|
||||||
|
}
|
||||||
CompositeRequest::Action(action_req) => {
|
CompositeRequest::Action(action_req) => {
|
||||||
self.handle_action_request(msg.requestor_info, action_req);
|
self.handle_action_request(msg.requestor_info, action_req);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(_) => todo!(),
|
Err(e) => {
|
||||||
|
if e != mpsc::TryRecvError::Empty {
|
||||||
|
log::error!("composite request rx error: {:?}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.check_stop_file();
|
self.check_stop_file();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user