def getRobot(self, email, password): for i in range(10): self.log.info("V 1.0") print("V1.0") audio_params = utils.AudioParams(Backends=["notinternal"], SampleRate=16000, Channels=1, SizeInFrames=True, TransmitRate=30) setup_result = animus.setup(audio_params, "PythonAnimusBasics", True) if not setup_result.success: time.sleep(5) continue if (email == os.getenv('EMAIL') and password == os.getenv('PASSWORD')): self.log.info("Logged in") login_result = animus.login_user(email, password, False) if login_result.success: self.log.info("Logged in") else: time.sleep(5) continue get_robots_result = animus.get_robots(True, True, False)
def getRobot(self): for i in range(10): self.log.info(animus.version()) # print(animus.version()) audio_params = utils.AudioParams(Backends=["notinternal"], SampleRate=16000, Channels=1, SizeInFrames=True, TransmitRate=30) setup_result = animus.setup(audio_params, "PythonAnimusBasics", True) if not setup_result.success: time.sleep(5) continue login_result = animus.login_user("*****@*****.**", "C3):]RR[Rs$Y", False) if login_result.success: self.log.info("Logged in") else: time.sleep(5) continue get_robots_result = animus.get_robots(True, True, False) # print(get_robots_result) if not get_robots_result.localSearchError.success: self.log.error(get_robots_result.localSearchError.description) if not get_robots_result.remoteSearchError.success: self.log.error(get_robots_result.remoteSearchError.description) if len(get_robots_result.robots) == 0: self.log.info("No Robots found") animus.close_client_interface() time.sleep(5) continue chosen_robot_details = get_robots_result.robots[0] self.myrobot = animus.Robot(chosen_robot_details) connected_result = self.myrobot.connect() if not connected_result.success: print("Could not connect with robot {}".format( self.myrobot.robot_details.robot_id)) animus.close_client_interface() time.sleep(5) continue else: break
def getAllRobots(self,email,password): for i in range(10): self.log.info(animus.version()) print(animus.version()) audio_params = utils.AudioParams( Backends=["notinternal"], SampleRate=16000, Channels=1, SizeInFrames=True, TransmitRate=30 ) setup_result = animus.setup( audio_params, "PythonAnimusBasics", True) if not setup_result.success: time.sleep(5) continue login_result = animus.login_user(email, password, False) if login_result.success: self.log.info("Logged in") else: time.sleep(5) continue get_robots_result = animus.get_robots(True, True, False) # print(get_robots_result) if not get_robots_result.localSearchError.success: self.log.error(get_robots_result.localSearchError.description) if not get_robots_result.remoteSearchError.success: self.log.error(get_robots_result.remoteSearchError.description) if len(get_robots_result.robots) == 0: self.log.info("No Robots found") animus.close_client_interface() time.sleep(5) continue if not len(get_robots_result.robots) ==0: self.allRobots=get_robots_result robotsRetrieved=animus_wrapper.proto_converters.proto_obj_to_dict(get_robots_result) robotsRetrieved=json.dumps(robotsRetrieved) return robotsRetrieved else: return None
SampleRate=16000, Channels=1, SizeInFrames=True, TransmitRate=30) setup_result = animus.setup(audio_params, "PythonAnimusBasics", True) if not setup_result.success: sys.exit(-1) login_result = animus.login_user("*****@*****.**", "C3):]RR[Rs$Y", False) if login_result.success: log.info("Logged in") else: sys.exit(-1) get_robots_result = animus.get_robots(True, True, False) data = proto_converters.proto_obj_to_dict(get_robots_result) # data=proto_converters.dict_to_proto_obj(data) print(data) # data=json.dumps(data) # with open("dummy_robots.json","w+") as writefile: # json.dump(data,writefile) # print(get_robots_result.robots[0].robot_id) # print(get_robots_result.robots[0].make) # print(get_robots_result.robots[0].model) # print(get_robots_result.robots[0].name) # print(get_robots_result.robots[0].robot_id) # print(get_robots_result.robots[0].robot_id) # print(get_robots_result.robots[0].robot_state.location.ip) # print(get_robots_result.robots[0].robot_state.location.city) # print(get_robots_result.robots[0].robot_state.location.region)