feat: added force_norm handling in BDI core agent
ref: N25B-400
This commit is contained in:
@@ -164,6 +164,8 @@ class BDICoreAgent(BaseAgent):
|
||||
self._set_goal("transition_phase")
|
||||
case "force_trigger":
|
||||
self._force_trigger(msg.body)
|
||||
case "force_norm":
|
||||
self._force_norm(msg.body)
|
||||
case _:
|
||||
self.logger.warning("Received unknow user interruption: %s", msg)
|
||||
|
||||
@@ -311,6 +313,17 @@ class BDICoreAgent(BaseAgent):
|
||||
|
||||
self.logger.info("Manually forced trigger %s.", name)
|
||||
|
||||
# TODO: make this compatible for critical norms
|
||||
def _force_norm(self, name: str):
|
||||
self.bdi_agent.call(
|
||||
agentspeak.Trigger.addition,
|
||||
agentspeak.GoalType.belief,
|
||||
agentspeak.Literal("force_norm", (agentspeak.Literal(agentspeak.asl_repr(name)),)),
|
||||
agentspeak.runtime.Intention(),
|
||||
)
|
||||
|
||||
self.logger.info("Manually forced norm %s.", name)
|
||||
|
||||
def _add_custom_actions(self) -> None:
|
||||
"""
|
||||
Add any custom actions here. Inside `@self.actions.add()`, the first argument is
|
||||
|
||||
Reference in New Issue
Block a user