本文整理汇总了Python中RappCloud.RappPlatformService.call方法的典型用法代码示例。如果您正苦于以下问题:Python RappPlatformService.call方法的具体用法?Python RappPlatformService.call怎么用?Python RappPlatformService.call使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RappCloud.RappPlatformService
的用法示例。
在下文中一共展示了RappPlatformService.call方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from RappCloud import RappPlatformService [as 别名]
# 或者: from RappCloud.RappPlatformService import call [as 别名]
class RappInterfaceTest:
def __init__(self):
rospack = rospkg.RosPack()
pkgDir = rospack.get_path('rapp_testing_tools')
imagepath = path.join(pkgDir, 'test_data','qr_samples', 'hardFarQr.jpg')
self.msg = QrDetection(imageFilepath=imagepath)
self.svc = RappPlatformService(msg=self.msg)
self.valid_results = {
'qr_centers': [{'y': 580, 'x': 669}],
'qr_messages': ['This QR will be used to check the algorithmic robustness as it is quite small'],
'error': ''
}
def execute(self):
start_time = timeit.default_timer()
response = self.svc.call()
end_time = timeit.default_timer()
self.elapsed_time = end_time - start_time
return self.validate(response)
def validate(self, response):
error = response.error
if error != "":
return [error, self.elapsed_time]
if self.valid_results == response.serialize():
return [True, self.elapsed_time]
else:
return ["Unexpected result : " + str(return_data), self.elapsed_time]
示例2: __init__
# 需要导入模块: from RappCloud import RappPlatformService [as 别名]
# 或者: from RappCloud.RappPlatformService import call [as 别名]
class RappInterfaceTest:
def __init__(self):
rospack = rospkg.RosPack()
pkgDir = rospack.get_path('rapp_testing_tools')
imagepath = path.join(pkgDir, 'test_data',
'face_samples', 'klpanagi_medium_straight.jpg')
self.msg = FaceDetection(imageFilepath=imagepath, fast=False)
self.svc = RappPlatformService(persistent=True, msg=self.msg)
self.valid_faces = [{
'up_left_point': {'y': 545.0, 'x': 720.0},
'down_right_point': {'y': 672.0, 'x': 847.0}
}]
def execute(self):
start_time = timeit.default_timer()
response = self.svc.call()
end_time = timeit.default_timer()
self.elapsed_time = end_time - start_time
return self.validate(response)
def validate(self, response):
error = response.error
if error != "":
return [error, self.elapsed_time]
faces = response.faces
if self.valid_faces == faces:
return [True, self.elapsed_time]
else:
return ["Unexpected result : " + str(response), self.elapsed_time]
示例3: __init__
# 需要导入模块: from RappCloud import RappPlatformService [as 别名]
# 或者: from RappCloud.RappPlatformService import call [as 别名]
class RappInterfaceTest:
def __init__(self):
rospack = rospkg.RosPack()
pkgDir = rospack.get_path('rapp_testing_tools')
imagepath = path.join(pkgDir, 'test_data','qr_samples', 'mediumMediumQr.jpg')
self.msg = QrDetection(imageFilepath=imagepath)
self.svc = RappPlatformService(msg=self.msg)
self.valid_results = {
'qr_centers': [{'y': 535, 'x': 680}],
'qr_messages': ['This is NAO from Greece'],
'error': ''
}
def execute(self):
start_time = timeit.default_timer()
response = self.svc.call()
end_time = timeit.default_timer()
self.elapsed_time = end_time - start_time
return self.validate(response)
def validate(self, response):
error = response.error
if error != "":
return [error, self.elapsed_time]
if self.valid_results == response.serialize():
return [True, self.elapsed_time]
else:
return ["Unexpected result : " + str(return_data), self.elapsed_time]
示例4: __init__
# 需要导入模块: from RappCloud import RappPlatformService [as 别名]
# 或者: from RappCloud.RappPlatformService import call [as 别名]
class RappInterfaceTest:
def __init__(self):
rospack = rospkg.RosPack()
pkgDir = rospack.get_path('rapp_testing_tools')
imagepath = path.join(pkgDir, 'test_data',
'face_samples', 'multi_faces_frames', 'two_faces.jpg')
self.msg = FaceDetection(imageFilepath=imagepath, fast=False)
self.svc = RappPlatformService(persistent=True, msg=self.msg)
self.valid_numFaces = 2
def execute(self):
start_time = timeit.default_timer()
response = self.svc.call()
end_time = timeit.default_timer()
self.elapsed_time = end_time - start_time
return self.validate(response)
def validate(self, response):
error = response.error
if error != "":
return [error, self.elapsed_time]
numFaces = len(response.faces)
if self.valid_numFaces == numFaces:
return [True, self.elapsed_time]
else:
return ["Unexpected result : " + ' Number of faces found -> ' +\
str(numFaces) + ', expected -> ' + str(self.valid_numFaces), \
self.elapsed_time]
示例5: __init__
# 需要导入模块: from RappCloud import RappPlatformService [as 别名]
# 或者: from RappCloud.RappPlatformService import call [as 别名]
class RappInterfaceTest:
def __init__(self):
rospack = rospkg.RosPack()
pkgDir = rospack.get_path('rapp_testing_tools')
self.image = join(pkgDir, 'test_data',
'human_detection_samples', 'NAO_picture_3.png')
self.valid_humans = [{
'up_left_point': {'y': 30.0, 'x': 48.0},
'down_right_point': {'y': 399.0, 'x': 232.0}
}]
self.msg = HumanDetection(imageFilepath=self.image)
self.svc = RappPlatformService(self.msg)
def execute(self):
start_time = timeit.default_timer()
response = self.svc.call()
end_time = timeit.default_timer()
self.elapsed_time = end_time - start_time
return self.validate(response)
def validate(self, response):
error = response.error
if error != "":
return [error, self.elapsed_time]
humans = response.humans
if self.valid_humans == humans:
return [True, self.elapsed_time]
else:
return ["Unexpected result : " + str(response), self.elapsed_time]
示例6: __init__
# 需要导入模块: from RappCloud import RappPlatformService [as 别名]
# 或者: from RappCloud.RappPlatformService import call [as 别名]
class RappInterfaceTest:
def __init__(self):
self.validResults = {
'city': 'San Francisco',
'zip': '94107',
'country': 'United States',
'region': 'California',
'country_code': 'US',
'longtitude': -122.39330291748047,
'latitude': 37.76969909667969,
'timezone': 'America/Los_Angeles',
'error': ''
}
self.msg = Geolocation(ipaddr='104.16.115.182')
self.svc = RappPlatformService(self.msg)
def execute(self):
start_time = timeit.default_timer()
response = self.svc.call()
print response.serialize()
end_time = timeit.default_timer()
self.elapsed_time = end_time - start_time
return self.validate(response)
def validate(self, response):
error = response.error
if self.validResults == response.serialize():
return [True, self.elapsed_time]
else:
return [error, self.elapsed_time]
示例7: __init__
# 需要导入模块: from RappCloud import RappPlatformService [as 别名]
# 或者: from RappCloud.RappPlatformService import call [as 别名]
class RappInterfaceTest:
def __init__(self):
# Set the valid results
self.valid_results = True;
self.msg = OntologyIsSubsuperclass(
parent_class='SpatialThing',
child_class='Oven',
recursive=True)
self.svc = RappPlatformService(self.msg)
def execute(self):
start_time = timeit.default_timer()
# Call the RappCloud service
response = self.svc.call()
end_time = timeit.default_timer()
self.elapsed_time = end_time - start_time
return self.validate(response)
def validate(self, response):
error = response.error
if error != "":
return [error, self.elapsed_time]
# Get the returned data
return_data = response.result
# Check if the returned data are equal to the expected
if self.valid_results == return_data:
return [True, self.elapsed_time]
else:
return ["Unexpected result : " + str(return_data), self.elapsed_time]
示例8: __init__
# 需要导入模块: from RappCloud import RappPlatformService [as 别名]
# 或者: from RappCloud.RappPlatformService import call [as 别名]
class RappInterfaceTest:
def __init__(self):
self.msg = EmailFetch(
email='[email protected]',
password='',
server='imap.gmail.com',
port='',
date_from=0,
date_to=100000000,
email_status='',
num_emails=1)
self.svc = RappPlatformService(self.msg)
def execute(self):
start_time = timeit.default_timer()
response = self.svc.call()
end_time = timeit.default_timer()
self.elapsed_time = end_time - start_time
return self.validate(response)
def validate(self, response):
error = response.error
if error != "":
return [error, self.elapsed_time]
else:
return [True, self.elapsed_time]
示例9: __init__
# 需要导入模块: from RappCloud import RappPlatformService [as 别名]
# 或者: from RappCloud.RappPlatformService import call [as 别名]
class RappInterfaceTest:
def __init__(self):
rospack = rospkg.RosPack()
pkgDir = rospack.get_path('rapp_testing_tools')
audioFile = path.join(pkgDir, 'test_data',
'speech_detection_samples', 'recording_tuesday.ogg')
self.msg = SpeechRecognitionSphinx(
language='en',
audio_source='nao_ogg',
words=[u'tuesday', u'monday'],
sentences=[u'tuesday', u'monday'],
grammar=[],
audiofile=audioFile)
self.svc = RappPlatformService(self.msg)
self.valid_words_found = [u'tuesday']
def execute(self):
start_time = timeit.default_timer()
response = self.svc.call()
end_time = timeit.default_timer()
self.elapsed_time = end_time - start_time
return self.validate(response)
def validate(self, response):
error = response.error
if error != "":
return [error, self.elapsed_time]
if self.valid_words_found == response.words:
return [True, self.elapsed_time]
else:
return ["Unexpected result : " + str(response.words), self.elapsed_time]
示例10: __init__
# 需要导入模块: from RappCloud import RappPlatformService [as 别名]
# 或者: from RappCloud.RappPlatformService import call [as 别名]
class RappInterfaceTest:
def __init__(self):
rospack = rospkg.RosPack()
pkgDir = rospack.get_path('rapp_testing_tools')
self.msg = NewsExplore(
news_engine='',
keywords=[],
exclude_titles=[],
region='',
topic='',
num_news=5)
self.svc = RappPlatformService(self.msg)
def execute(self):
start_time = timeit.default_timer()
response = self.svc.call()
end_time = timeit.default_timer()
self.elapsed_time = end_time - start_time
return self.validate(response)
def validate(self, response):
error = response.error
if error != "":
return [error, self.elapsed_time]
if len(response.news_stories) == self.svc.num_news:
return [True, self.elapsed_time]
else:
return ["Unexpected result : " + \
' Number of news stories requested -> ' + \
str(self.svc.num_news) + ', received -> ' + \
str(len(response.news_stories)), self.elapsed_time]
示例11: __init__
# 需要导入模块: from RappCloud import RappPlatformService [as 别名]
# 或者: from RappCloud.RappPlatformService import call [as 别名]
class RappInterfaceTest:
def __init__(self):
rospack = rospkg.RosPack()
pkgDir = rospack.get_path('rapp_testing_tools')
audioFile = path.join(pkgDir, 'test_data',
'speech_detection_samples', 'recording_sentence2.ogg')
self.msg = SpeechRecognitionGoogle(
language='en',
audio_source='nao_ogg',
audiofile=audioFile)
self.svc = RappPlatformService(self.msg)
self.valid_words_found = ['check', 'my', 'mail']
def execute(self):
start_time = timeit.default_timer()
response = self.svc.call()
end_time = timeit.default_timer()
self.elapsed_time = end_time - start_time
return self.validate(response)
def validate(self, response):
error = response.error
if error != "":
return [error, self.elapsed_time]
words_found = response.words
alt_words_found = response.alternatives
if self.valid_words_found == words_found or self.valid_words_found in alt_words_found:
return [True, self.elapsed_time]
else:
return ["Unexpected result : " + str(response), self.elapsed_time]
示例12: __init__
# 需要导入模块: from RappCloud import RappPlatformService [as 别名]
# 或者: from RappCloud.RappPlatformService import call [as 别名]
class RappInterfaceTest:
def __init__(self):
rospack = rospkg.RosPack()
pkgDir = rospack.get_path('rapp_testing_tools')
zipFile = join(pkgDir, 'test_data', 'zip_files', \
'image_audio_sample.zip')
self.msg = EmailSend(
email='[email protected]',
password='',
server='smtp.gmail.com',
port='587',
recipients=['[email protected]', '[email protected]'],
body='Rapp Send Email Test',
subject='Rapp Send Email Test',
attach_file=zipFile)
self.svc = RappPlatformService(self.msg)
def execute(self):
start_time = timeit.default_timer()
response = self.svc.call()
end_time = timeit.default_timer()
self.elapsed_time = end_time - start_time
return self.validate(response)
def validate(self, response):
error = response.error
if error != "":
return [error, self.elapsed_time]
else:
return [True, self.elapsed_time]
示例13: __init__
# 需要导入模块: from RappCloud import RappPlatformService [as 别名]
# 或者: from RappCloud.RappPlatformService import call [as 别名]
class RappInterfaceTest:
def __init__(self):
self.msg = WeatherReportCurrent()
self.msg.req.city = 'Athens'
self.msg.req.weather_reporter = ''
self.msg.req.metric = 0
self.svc = RappPlatformService(self.msg)
def execute(self):
start_time = timeit.default_timer()
response = self.svc.call()
end_time = timeit.default_timer()
self.elapsed_time = end_time - start_time
return self.validate(response)
def validate(self, response):
if not response.error:
return [True, self.elapsed_time]
else:
return [response.error, self.elapsed_time]