Permalink
Browse files

fixed bug in FSM behaviour.

  • Loading branch information...
javipalanca committed Jun 9, 2017
1 parent eabe807 commit a9f0bd9e912be117eedff69ce72c8aa7b191efb6
Showing with 18 additions and 33 deletions.
  1. +0 −1 README.md
  2. +5 −9 examples/fsm.py
  3. +4 −4 runspade.py
  4. +3 −10 setup.py
  5. +5 −8 spade/Behaviour.py
  6. +1 −1 spade/templates/messages.pyra
View
@@ -5,7 +5,6 @@
SPADE (Smart Python multi-Agent Development Environment) is a Multiagent and Organizations Platform based on the <a href="http://www.xmpp.org">XMPP/Jabber technology</a> and written in the <a href="http://www.python.org">Python</a> programming language. This technology offers by itself many features and facilities that ease the construction of MAS, such as an existing communication channel, the concepts of users (agents) and servers (platforms) and an extensible communication protocol based on XML, just like <a href="http://www.fipa.org">FIPA-ACL</a>. Many other agent platforms exist, but SPADE is the first to base its roots on the XMPP technology.
<img src="http://spade2.googlecode.com/files/spade_overview.png" height=420px/>
# User Documentation
View
@@ -46,13 +46,10 @@ class StateFour(spade.Behaviour.OneShotBehaviour):
def _process(self):
print "This is State Four..."
self.myAgent.counter = self.myAgent.counter + 1
if self.myAgent.counter > 11:
print "Counter ", self.myAgent.counter
print "Bye Bye"
self.myAgent._kill()
else:
self._exitcode = self.myAgent.TRANSITION_DEFAULT
print "Counter ", self.myAgent.counter
print "Bye Bye"
self.myAgent._kill()
def _setup(self):
time.sleep(2)
print "AdvancedAgent starting . . ."
@@ -81,8 +78,7 @@ def _setup(self):
b.registerTransition(self.STATE_TWO_CODE, self.STATE_THREE_CODE, self.TRANSITION_TO_THREE)
b.registerTransition(self.STATE_THREE_CODE, self.STATE_THREE_CODE, self.TRANSITION_DEFAULT)
b.registerTransition(self.STATE_THREE_CODE, self.STATE_FOUR_CODE, self.TRANSITION_TO_FOUR)
b.registerTransition(self.STATE_FOUR_CODE, self.STATE_FOUR_CODE, self.TRANSITION_DEFAULT)
self.addBehaviour(b, None)
if __name__ == "__main__":
View
@@ -19,8 +19,8 @@
from xmppd.xmppd import Server
__author__ = "Gustavo Aranda <gusarba@gmail.com> and Javier Palanca <jpalanca@gmail.com>"
__version__ = "2.2"
__copyright__ = "Copyright (C) 2006-2012"
__version__ = "2.3"
__copyright__ = "Copyright (C) 2006-2017"
__license__ = "LGPL"
@@ -43,7 +43,7 @@ def print_help():
def print_version():
print "SPADE " + colors.color_yellow + __version__ + colors.color_none + " by Javier Palanca, Gustavo Aranda, Miguel Escriva and others"
print "gusarba@gmail.com - http://spade2.googlecode.com"
print "jpalanca@gmail.com - https://github.com/javipalanca/SPADE"
raise SystemExit
# Actually start the program running.
@@ -90,7 +90,7 @@ def main():
except:
pass
print "SPADE ", colors.color_yellow + __version__ + colors.color_none, " <gusarba@gmail.com> - http://spade2.googlecode.com"
print "SPADE ", colors.color_yellow + __version__ + colors.color_none, " <jpalanca@gmail.com> - https://github.com/javipalanca/SPADE"
try:
import psyco
View
@@ -1,15 +1,10 @@
#!/usr/bin/env python
import os
import sys
import subprocess
#from distutils.core import setup, Extension
from setuptools import setup, Extension
import glob
from runspade import __version__
#if os.name != "posix":
# import py2exe
try:
import bdist_mpkg
except:
@@ -31,16 +26,16 @@
"SPARQLWrapper",
"unittest-xml-reporting"]
if subprocess.mswindows:
deps.append( 'pywin32' )
deps.append( 'pywin32' )
setup(name='SPADE',
version=__version__,
license="LGPL",
description='Smart Python multi-Agent Development Environment',
long_description=long_description,
author='Javier Palanca, Gustavo Aranda, Miguel Escriva',
author='Javier Palanca, Gustavo Aranda, Miguel Escriva and others',
author_email='jpalanca@gmail.com',
url='http://spade2.googlecode.com',
url='https://github.com/javipalanca/SPADE',
package_dir={'spade': 'spade'},
packages=['spade','spade.mtps', 'xmpp', 'xmppd', 'xmppd.modules', 'xmppd.socker', 'tlslite', 'tlslite.utils', 'tlslite.integration'],
scripts=['runspade.py','configure.py'],#,"tlslite/scripts/tls.py", "tlslite/scripts/tlsdb.py"],
@@ -61,5 +56,3 @@
],
install_requires = deps
)
View
@@ -776,17 +776,14 @@ def _transitionTo(self, newState):
pass
def _process(self):
if (self._actualState is None):
if self._actualState is None:
self._transitionTo(self._firstStateName)
#msg = self._receive(False)
b = self._states[self._actualState]
#if msg: buede .postMessage(msg)
self._lastexitcode = b._process()
if (b.done() or b._forceKill.isSet()):
if not self._lastexitcode:
self._lastexitcode = b.exitCode()
self._transitionTo(self._transitions[b._stateName][self._lastexitcode])
self._lastexitcode = None
if not self._lastexitcode:
self._lastexitcode = b.exitCode()
self._transitionTo(self._transitions[b._stateName][self._lastexitcode])
self._lastexitcode = None
def getCurrentState(self):
return self._states[self._actualState]
@@ -96,7 +96,7 @@ header.pyra
</script>
<!-- Diagrams using a external service. Replaced by sequence-diagram.js-->
<!--><div class=wsd wsd_style="napkin"><pre>
<!--<div class=wsd wsd_style="napkin"><pre>
@!diagram!@
</pre></div><script type="text/javascript" src="http://www.websequencediagrams.com/service.js"></script>
-->

0 comments on commit a9f0bd9

Please sign in to comment.