def get_script(self, script_id=1):
		SockJSClient.remove_status(self, "one_script")
		self.request_script(script_id)
		script = SockJSClient.get_status(self, "one_script")
		counter = 0
		while (script == 0):
		    time.sleep(0.001) 
		    script = SockJSClient.get_status(slef, "one_script")
	        counter += 1
	        if (counter > 100):
	            return 0
		return script
	def get_current(self):
		current = SockJSClient.get_status(self, "current")
		print("Current: ", current)
		return current
	def get_euler_position(self):
		position = SockJSClient.get_status(self, "euler_position")
		print("Euler Position: ", position)
		return position
	def get_position(self):
		position = SockJSClient.get_status(self, "position")
		print("Position: ", position)
		return position
	def get_actuator_release_state(self):
		state = SockJSClient.get_status(self, "actuator_release_state")
		print("Actuator Release State: ", state)
		return state
	def get_application_info(self):
		message = SockJSClient.get_status(self, "application_info")
		print("Application Info: ", message)
		return message
	def get_message_info(self):
		message = SockJSClient.get_status(self, "message_info")
		print("Message Info: ", message)
		return message
	def get_status_info(self):
		status = SockJSClient.get_status(self, "status_info")
		print("Status Info: ", status)
		return status
	def get_paths(self):
		paths = SockJSClient.get_status(self, "paths")
		print("Paths: ", paths)
		return paths
	def get_poses(self):
		poses = SockJSClient.get_status(self, "poses")
		print("Poses: ", poses)
		return poses
	def get_script_id(self, name):
		scripts = SockJSClient.get_status(slef, "scripts")
		for script in scripts:
		    if script[1] == name:
		      return script[0]
		return 0
	def get_scripts(self):
		scripts = SockJSClient.get_status(self, "scripts")
		#res.scripts = "hello py service"#str(scripts)
		print('service called')
		#print(str(scripts))
		return GetScriptsResponse(str(scripts))
	def get_connection_info(self):
		connection = SockJSClient.get_status(self, "connection_info")
		print("Connection Info: ", connection)
		return connection
示例#14
0
	ip = "192.168.80.219"
	#ip = "192.168.21.173"
	#ip = "localhost"
	#ip = "10.2.105.42"
	#ip = "192.168.1.16"
	myp = SockJSClient('/socket', ip, 8888)
	myp.connect()
		
	myp_get_connection_info()
	myp_initialize()
	time.sleep(2)
	myp_calibrate()
	time.sleep(0.5)
	
	while True:
		scripts = myp.get_status("scripts")
		print("Scripts: ", scripts)
		time.sleep(1)
	
	 #start xmlrpc server
#    server = SimpleXMLRPCServer(('', 8000), allow_none=True)
#
#    #register methods
#    server.register_introspection_functions() 
#    server.register_instance(RobotHandler())
#    
#    server.serve_forever()

except:
	print("Could not connect to myP at: ", ip)
	#traceback.print_exc()