File tree Expand file tree Collapse file tree 15 files changed +272
-0
lines changed Expand file tree Collapse file tree 15 files changed +272
-0
lines changed Original file line number Diff line number Diff line change
1
+ # SublimeText stuff
2
+ * .sublime-workspace
3
+
1
4
# Byte-compiled / optimized / DLL files
2
5
__pycache__ /
3
6
* .py [cod ]
Original file line number Diff line number Diff line change
1
+ Antificial
2
+ ======
3
+ ** Antificial** is a real-time swarm simulation framework with real-time user interaction.
4
+
5
+ #### Screenshot
6
+ ![ Description] ( https://github.com/Antificial/antificial/blob/master/title.png " Description ")
7
+
8
+ ## Download
9
+ * [ Version 0.1] ( https://github.com/Antificial/antificial/archive/master.zip )
10
+
11
+ ## Usage
12
+ ```
13
+ $ git clone https://github.com/Antificial/antificial.git
14
+ $ cd antificial/
15
+ $ python main.py
16
+ ```
17
+
18
+ ## Contributors
19
+
20
+ ### Contributors on GitHub
21
+ * [ Contributors] ( https://github.com/Antificial/antificial/graphs/contributors )
22
+
23
+ ### Third party libraries
24
+ * [ Kivy] ( https://kivy.org ) Graphics Framework
25
+ * [ OpenCV] ( http://opencv.org ) Computer Vision Library
26
+
27
+ ## License
28
+ * see [ LICENSE] ( https://github.com/Antificial/antificial/blob/master/LICENSE ) file
29
+
30
+ ## Version
31
+ * Version 0.1
32
+
33
+ ## How to use this code
34
+ * see [ USAGE] ( https://github.com/Antificial/antificial/blob/master/USAGE.md ) file
Original file line number Diff line number Diff line change
1
+ Usage
2
+ ======
3
+ TODO
Original file line number Diff line number Diff line change
1
+ {
2
+ "build_systems" : [{
3
+ "name" : " Python" ,
4
+ "shell_cmd" : " python $project_path/antificial/main.py"
5
+ }],
6
+ "folders" : [{
7
+ "file_exclude_patterns" : [
8
+ " *.pyc"
9
+ ],
10
+ "folder_exclude_patterns" : [
11
+ " __pycache__"
12
+ ],
13
+ "name" : " Source" ,
14
+ "path" : " antificial"
15
+ }, {
16
+ "file_exclude_patterns" : [
17
+ " antificial.sublime-project"
18
+ ],
19
+ "folder_exclude_patterns" : [
20
+ " antificial"
21
+ ],
22
+ "name" : " Root" ,
23
+ "path" : " ."
24
+ }],
25
+ "settings" : {
26
+ "tab_size" : 4
27
+ }
28
+ }
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env python
2
+
3
+ # Import all modules to be directly available when this module is loaded
4
+ from .handler import run
5
+ from .colony import *
6
+
7
+ # Use this to set us up if called directly
8
+ def main ():
9
+ print ("This is the FW module reporting..." )
10
+
11
+ if __name__ == '__main__' :
12
+ main ()
Original file line number Diff line number Diff line change
1
+ class Ant (object ):
2
+ """Ant documentation"""
3
+ def __init__ (self , arg ):
4
+ super (Ant , self ).__init__ ()
5
+ self .arg = arg
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env python
2
+
3
+ from framework .colony .Ant import *
4
+
5
+ # Use this to set us up if called directly
6
+ def main ():
7
+ print ("This is the Colony module reporting..." )
8
+
9
+ if __name__ == '__main__' :
10
+ main ()
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env python
2
+
3
+ import util
4
+ import framework .colony as colony
5
+ import time
6
+
7
+ RUNNING = True
8
+ TIMEOUT = 1
9
+
10
+ def shutdown ():
11
+ print ("[FW] Shutting down..." )
12
+
13
+ def handle_commands (cc_queue ):
14
+ try :
15
+ cc = cc_queue .get (False )
16
+ if cc == "done" :
17
+ util .iprint ("[IR] Quit" )
18
+ global RUNNING
19
+ RUNNING = False
20
+ except :
21
+ pass
22
+
23
+ def work (cc_queue , ir_output , fw_input ):
24
+ while RUNNING :
25
+ handle_commands (cc_queue )
26
+ if ir_output .poll (TIMEOUT ):
27
+ input = ir_output .recv ()
28
+ util .iprint ("[FW] Received {input}!" )
29
+ util .iprint ("[FW] Sending {input} to RR..." )
30
+ fw_input .send (input )
31
+
32
+ # Run this from other code
33
+ def run (cc_queue , ir_output , fw_input ):
34
+ try :
35
+ print ("Running FW module..." )
36
+ work (cc_queue , ir_output , fw_input )
37
+ except KeyboardInterrupt as e :
38
+ shutdown ()
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env python
2
+
3
+ from .handler import run
4
+
5
+ # Use this to set us up if called directly
6
+ def main ():
7
+ print ("This is the IR module reporting..." )
8
+ run ()
9
+
10
+ if __name__ == '__main__' :
11
+ main ()
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env python
2
+
3
+ import util
4
+ import time
5
+
6
+ RUNNING = True
7
+
8
+ def shutdown ():
9
+ print ("[IR] Shutting down..." )
10
+
11
+ def handle_commands (cc_queue ):
12
+ try :
13
+ cc = cc_queue .get (False )
14
+ if cc == "done" :
15
+ util .iprint ("[IR] Quit" )
16
+ global RUNNING
17
+ RUNNING = False
18
+ except :
19
+ pass
20
+
21
+ def work (cc_queue , ir_input ):
22
+ count = 0
23
+ while RUNNING :
24
+ handle_commands (cc_queue )
25
+ util .iprint ("[IR] Sending number {count} to FW..." )
26
+ ir_input .send (count )
27
+ count += 1
28
+ time .sleep (1.0 )
29
+
30
+ # Run this from other code
31
+ def run (cc_queue , ir_input ):
32
+ try :
33
+ print ("Running IR module..." )
34
+ work (cc_queue , ir_input )
35
+ except KeyboardInterrupt as e :
36
+ shutdown ()
You can’t perform that action at this time.
0 commit comments