diff --git a/src/control_backend/agents/user_interrupt/user_interrupt_agent.py b/src/control_backend/agents/user_interrupt/user_interrupt_agent.py index 8a4d2a2..e58a42b 100644 --- a/src/control_backend/agents/user_interrupt/user_interrupt_agent.py +++ b/src/control_backend/agents/user_interrupt/user_interrupt_agent.py @@ -72,14 +72,8 @@ class UserInterruptAgent(BaseAgent): event_context, ) - elif event_type == "next_phase": - _ = 1 - - elif event_type == "reset_phase": - _ = 1 - - elif event_type == " reset_experiment": - _ = 1 + elif event_type in ["next_phase", "reset_phase", "reset_experiment"]: + await self._send_experiment_control_to_bdi_core(event_type) else: self.logger.warning( @@ -89,12 +83,33 @@ class UserInterruptAgent(BaseAgent): ) async def _send_experiment_control_to_bdi_core(self, type): + """ + method to send experiment control buttons to bdi core. + + :param type: the type of control button we should send to the bdi core. + """ + # Switch which thread we should send to bdi core + thread = "" + match type: + case "next_phase": + thread = "force_next_phase" + case "reset_phase": + thread = "reset_current_phase" + case "reset_experiment": + thread = "reset_experiment" + case _: + self.logger.warning( + "Received unknown experiment control type '%s' to send to BDI Core.", + type, + ) + out_msg = InternalMessage( to=settings.agent_settings.bdi_core_name, sender=self.name, - thread=type, + thread=thread, body="", ) + self.logger.debug("Sending experiment control '%s' to BDI Core.", thread) await self.send(out_msg) async def _send_to_speech_agent(self, text_to_say: str):