The Big One #43
@@ -3,6 +3,7 @@ from functools import singledispatchmethod
|
|||||||
from slugify import slugify
|
from slugify import slugify
|
||||||
|
|
||||||
from control_backend.agents.bdi.agentspeak_ast import (
|
from control_backend.agents.bdi.agentspeak_ast import (
|
||||||
|
AstAtom,
|
||||||
AstBinaryOp,
|
AstBinaryOp,
|
||||||
AstExpression,
|
AstExpression,
|
||||||
AstLiteral,
|
AstLiteral,
|
||||||
@@ -215,7 +216,11 @@ class AgentSpeakGenerator:
|
|||||||
|
|
||||||
match norm:
|
match norm:
|
||||||
case ConditionalNorm(condition=cond):
|
case ConditionalNorm(condition=cond):
|
||||||
rule = AstRule(self._astify(norm), self._astify(phase) & self._astify(cond))
|
rule = AstRule(
|
||||||
|
self._astify(norm),
|
||||||
|
self._astify(phase) & self._astify(cond)
|
||||||
|
| AstAtom(f"force_{self.slugify(norm)}"),
|
||||||
|
)
|
||||||
case BasicNorm():
|
case BasicNorm():
|
||||||
rule = AstRule(self._astify(norm), self._astify(phase))
|
rule = AstRule(self._astify(norm), self._astify(phase))
|
||||||
|
|
||||||
|
|||||||
@@ -341,7 +341,6 @@ class BDICoreAgent(BaseAgent):
|
|||||||
|
|
||||||
norm_update_message = InternalMessage(
|
norm_update_message = InternalMessage(
|
||||||
to=settings.agent_settings.user_interrupt_name,
|
to=settings.agent_settings.user_interrupt_name,
|
||||||
sender=self.name,
|
|
||||||
thread="active_norms_update",
|
thread="active_norms_update",
|
||||||
body=str(norms),
|
body=str(norms),
|
||||||
)
|
)
|
||||||
@@ -364,6 +363,14 @@ class BDICoreAgent(BaseAgent):
|
|||||||
norms = agentspeak.grounded(term.args[1], intention.scope)
|
norms = agentspeak.grounded(term.args[1], intention.scope)
|
||||||
goal = agentspeak.grounded(term.args[2], intention.scope)
|
goal = agentspeak.grounded(term.args[2], intention.scope)
|
||||||
|
|
||||||
|
norm_update_message = InternalMessage(
|
||||||
|
to=settings.agent_settings.user_interrupt_name,
|
||||||
|
thread="active_norms_update",
|
||||||
|
body=str(norms),
|
||||||
|
)
|
||||||
|
|
||||||
|
self.add_behavior(self.send(norm_update_message))
|
||||||
|
|
||||||
self.logger.debug(
|
self.logger.debug(
|
||||||
'"reply_with_goal" action called with message=%s, norms=%s, goal=%s',
|
'"reply_with_goal" action called with message=%s, norms=%s, goal=%s',
|
||||||
message_text,
|
message_text,
|
||||||
|
|||||||
Reference in New Issue
Block a user