當前位置: 首頁>>代碼示例>>Python>>正文


Python RappPlatformService.call方法代碼示例

本文整理匯總了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]
開發者ID:johnjsb,項目名稱:rapp-platform,代碼行數:35,代碼來源:qr_detection_test_hard_far.py

示例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]
開發者ID:johnjsb,項目名稱:rapp-platform,代碼行數:37,代碼來源:face_detection_test_medium_straight.py

示例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]
開發者ID:johnjsb,項目名稱:rapp-platform,代碼行數:36,代碼來源:qr_detection_test_medium_medium.py

示例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]
開發者ID:johnjsb,項目名稱:rapp-platform,代碼行數:36,代碼來源:face_detection_test_two_faces_jpg.py

示例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]
開發者ID:johnjsb,項目名稱:rapp-platform,代碼行數:37,代碼來源:human_detection_test.py

示例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]
開發者ID:johnjsb,項目名稱:rapp-platform,代碼行數:37,代碼來源:geolocation_pass_ipaddr.py

示例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]
開發者ID:johnjsb,項目名稱:rapp-platform,代碼行數:36,代碼來源:ontology_is_subsuperclass_of_SpatialThing.py

示例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]
開發者ID:johnjsb,項目名稱:rapp-platform,代碼行數:32,代碼來源:email_fetch.py

示例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]
開發者ID:johnjsb,項目名稱:rapp-platform,代碼行數:40,代碼來源:speech_detection_sphinx_test_ogg_tuesday.py

示例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]
開發者ID:johnjsb,項目名稱:rapp-platform,代碼行數:39,代碼來源:news_explore_general.py

示例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]
開發者ID:johnjsb,項目名稱:rapp-platform,代碼行數:39,代碼來源:speech_detection_google_test_ogg_sentence2.py

示例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]
開發者ID:johnjsb,項目名稱:rapp-platform,代碼行數:38,代碼來源:email_send_zip.py

示例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]
開發者ID:johnjsb,項目名稱:rapp-platform,代碼行數:26,代碼來源:weather_report_current_Athens.py


注:本文中的RappCloud.RappPlatformService.call方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。