Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SPADE-BDI
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jpalanca
SPADE-BDI
Commits
3e01403e
Commit
3e01403e
authored
Apr 05, 2019
by
serfrape
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make ex control wait for agent to start
parent
40c500ab
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
control.py
examples/control.py
+12
-4
bdi.py
spade_bdi/bdi.py
+3
-3
No files found.
examples/control.py
View file @
3e01403e
...
...
@@ -16,6 +16,7 @@ class BossAgent(BDIAgent):
class
Modify
(
PeriodicBehaviour
):
async
def
run
(
self
):
if
self
.
agent
.
bdi_enabled
:
tipo
=
self
.
agent
.
bdi
.
get_belief_value
(
"type"
)[
0
]
if
tipo
==
'inc'
:
self
.
agent
.
bdi
.
set_belief
(
'type'
,
'dec'
)
...
...
@@ -24,12 +25,19 @@ class BossAgent(BDIAgent):
b
=
BDIAgent
(
"slave_1@localhost"
,
"bdisimple"
,
"slave.asl"
)
b
.
start
()
future
=
b
.
start
()
future
.
result
()
c
=
BDIAgent
(
"slave_2@localhost"
,
"bdisimple3"
)
c
.
start
()
a
=
BossAgent
(
"Boss@localhost"
,
"bdiboss"
,
"boss.asl"
)
a
.
start
()
future
=
c
.
start
()
future
.
result
()
a
=
BossAgent
(
"Boss@localhost"
,
"bdiboss"
)
future
=
a
.
start
()
future
.
result
()
a
.
set_asl
(
"boss.asl"
)
import
time
time
.
sleep
(
5
)
print
(
"Enabling BDI for slave2"
)
c
.
set_asl
(
"slave.asl"
)
time
.
sleep
(
5
)
print
(
"Disabling BDI for slave2"
)
c
.
set_asl
(
None
)
spade_bdi/bdi.py
View file @
3e01403e
# -*- coding: utf-8 -*-
from
abc
import
ABCMeta
,
abstractmethod
from
spade.behaviour
import
CyclicBehaviour
import
pyson
import
pyson.runtime
import
pyson.stdlib
import
os
import
asyncio
from
spade.agent
import
Agent
from
spade.template
import
Template
from
spade.message
import
Message
import
json
from
ast
import
literal_eval
from
loguru
import
logger
PERCEPT_TAG
=
frozenset
(
[
pyson
.
Literal
(
"source"
,
(
pyson
.
Literal
(
"percept"
),
))])
...
...
@@ -168,7 +167,8 @@ class BDIAgent(Agent):
if
self
.
agent
.
asl_file
:
self
.
agent
.
set_asl
(
self
.
agent
.
asl_file
)
else
:
print
(
"No ASL specified."
)
logger
.
info
(
"Warning: no ASL specified for {}."
.
format
(
self
.
agent
.
jid
))
async
def
run
(
self
):
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment