forked from federicocorrao/Nao-Computer-Vision-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod_launcher.py
More file actions
130 lines (111 loc) · 3.83 KB
/
mod_launcher.py
File metadata and controls
130 lines (111 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# -*- coding: cp1252 -*-
from naoqi import ALProxy
# from naoqi import ALModule
# form naoqi import ALBroker
# from naoqi import ALBehavior
# Informazioni sui moduli naoqi
# testModules() Verifica quali siano i moduli (della documentazione)
# caricati da naoqi
# listModules() Stampa moduli caricati da naoqi
# diffModules() Ritorna i moduli caricati da naoqi, non documentati
# (utente/sistema)
def printlist(l):
for i in l:
print i
# Verifica quali siano i moduli documentati non caricati da NAOqi
def testModules(ip = '127.0.0.1', port = 9559, silent = 0):
modules = [
# CORE
'BehaviorManager', 'ConnectionManager', 'Memory',
'Preferences', 'ResourceManager', # 'Module',
'Bonjour', 'Logger', 'Launcher', # DEP
# MOTION
'Motion', 'Navigation', 'RobotPosture',
'MotionRecorder', # DEP
# AUDIO
'AudioDevice', 'AudioPlayer', 'AudioRecorder',
'AudioSourceLocalization', 'SoundDetection',
'SpeechRecognition', 'TextToSpeech',
# SENSORS
'Battery', 'Fsr', 'Infrared', 'Laser',
'Sensors', 'Sonar', 'Leds',
'RobotPose', # DEP
# TRACKERS
'FaceTracker', 'RedBallTracker',
# VISION
'FaceDetection', 'BacklightingDetection', 'DarknessDetection',
'LandmarkDetection', 'MovementDetection', 'RedBallDetection',
'PhotoCapture', 'VideoDevice', 'VideoRecorder', 'VisionRecognition',
'VisualCompass',
'VisionToolBox' # DEP
# DCM (NON 'AL' + 'DCM')
]
r = []
for m in modules:
try:
p = ALProxy('AL' + m, ip, port)
except Exception as e:
if(silent == 0):
print "testModules(): Failed to load AL" + str(m)
else:
r.append('AL' + m)
return r
# Usa ALLauncher::isModulePresent, attenzione: deprecato
# Dovrebbe essere equivalente a testModules() ma più rapida
def testModules2(ip = '127.0.0.1', port = 9559, silent = 0):
modules = [
# CORE
'BehaviorManager', 'ConnectionManager', 'Memory',
'Preferences', 'ResourceManager', # 'Module',
'Bonjour', 'Logger', 'Launcher', # DEP
# MOTION
'Motion', 'Navigation', 'RobotPosture',
'MotionRecorder', # DEP
# AUDIO
'AudioDevice', 'AudioPlayer', 'AudioRecorder',
'AudioSourceLocalization', 'SoundDetection',
'SpeechRecognition', 'TextToSpeech',
# SENSORS
'Battery', 'Fsr', 'Infrared', 'Laser',
'Sensors', 'Sonar', 'Leds',
'RobotPose', # DEP
# TRACKERS
'FaceTracker', 'RedBallTracker',
# VISION
'FaceDetection', 'BacklightingDetection', 'DarknessDetection',
'LandmarkDetection', 'MovementDetection', 'RedBallDetection',
'PhotoCapture', 'VideoDevice', 'VideoRecorder', 'VisionRecognition',
'VisualCompass',
'VisionToolBox' # DEP
# DCM (NON 'AL' + 'DCM')
]
r = []
p = ALProxy("ALLauncher", ip, port)
for m in modules:
if (p.isModulePresent('AL' + m)):
r.append('AL' + m)
else:
if(silent == 0):
print 'testModules2(): AL' + m + ' not present'
return r
# Stampa moduli caricati da NAOqi
# Nota: ALLauncher è deprecato
def listModules(ip = '127.0.0.1', port = 9559, silent = 0):
p = ALProxy('ALLauncher', ip, port)
l = p.getGlobalModuleList()
for m in l:
if(silent == 0):
print "listModules(): " + m
return l
# Moduli non documentati ma caricati da NAOqi... (?)
def diffModules(ip = '127.0.0.1', port = 9559):
A = testModules(ip, port, 1)
B = listModules(ip, port, 1)
return list(set(B) - set(A))
# testModules()
# IP = '127.0.0.1'
# Port = 9559
# p = ALProxy("ALLauncher", IP, Port)
# name = 'ALMotion'
# print p.launchLocal(name)
# print p.isModulePresent(name)