コード例 #1
0
	def hold(self, joint_id=[1]):
		cmd =  "\"{"
		cmd += "\\\"action\\\":\\\"hold\\\","
		cmd += "\\\"joint_ids\\\":"+str(joint_id)
		cmd += "}\""
		SockJSClient.send(self,cmd)
		return 1
コード例 #2
0
	def delete_script(self, script_id=1):
		cmd =  "\"{"
		cmd += "\\\"action\\\":\\\"delete_script\\\","
		cmd += "\\\"script_id\\\":\\\""+str(script_id)+"\\\""
		cmd += "}\""
		SockJSClient.send(self,cmd)
		return 1
コード例 #3
0
	def save_script(self, script_name="", script_code=""):
		cmd =  "\"{"
		cmd += "\\\"action\\\":\\\"save_script\\\","
		cmd += "\\\"script_name\\\":\\\""+script_name+"\\\","
		cmd += "\\\"script_code\\\":\\\""+script_code+"\\\""
		cmd += "}\""
		SockJSClient.send(self,cmd)
		return 1
コード例 #4
0
	def test_script(self, script_code=""): 
		cmd =  "\"{" 
		cmd += "\\\"action\\\":\\\"test_script\\\"," 
		cmd += "\\\"script_id\\\":\\\"0\\\"," 
		cmd += "\\\"script_code\\\":\\\""+script_code+"\\\"" 
		cmd += "}\"" 
		SockJSClient.send(self, cmd) 
		return 1 
コード例 #5
0
	def calibrate(self, use_existing=True):
		if self.get_connection_info() == 2:
			cmd =  "\"{"
			cmd += "\\\"action\\\":\\\"calibrate\\\","
			cmd += "\\\"use_existing\\\":"+str(use_existing).lower()
			cmd += "}\""
			SockJSClient.send(self, cmd)
			return 1 
		return 0 
コード例 #6
0
	def initialize(self, model="PRob1R", kind='no_robot', channel_name="1", channel_type="PEAK_SYS_PCAN_USB", protocol="TMLCAN", host_id="10", baudrate="500000"):
		if self.get_connection_info() == 0:
			cmd =  "\"{"
			cmd += "\\\"action\\\":\\\"initialize\\\","
			cmd += "\\\"model\\\":\\\""+model+"\\\","
			cmd += "\\\"robot_kind\\\":\\\""+kind+"\\\""
			if kind == 'real':
				cmd += ","
				cmd += "\\\"channel_name\\\":\\\""+channel_name+"\\\","
				cmd += "\\\"channel_type\\\":\\\""+channel_type+"\\\","
				cmd += "\\\"protocol\\\":\\\""+protocol+"\\\","
				cmd += "\\\"host_id\\\":\\\""+host_id+"\\\","
				cmd += "\\\"baudrate\\\":\\\""+baudrate+"\\\""
			cmd += "}\""
			SockJSClient.send(self, cmd)
			return 1
		return 0
コード例 #7
0
	def pause(self):
		cmd =  "\"{"
		cmd += "\\\"action\\\":\\\"pause\\\""
		cmd += "}\""
		SockJSClient.send(self,cmd)
		return 1
コード例 #8
0
	def finalize(self):
		cmd =  "\"{"
		cmd += "\\\"action\\\":\\\"finalize\\\""
		cmd += "}\""
		SockJSClient.send(self, cmd)
		return 1
コード例 #9
0
	def recover(self):
		cmd =  "\"{"
		cmd += "\\\"action\\\":\\\"recover\\\""
		cmd += "}\""
		SockJSClient.send(self,cmd)
		return 1
コード例 #10
0
	def stop(self):
		cmd =  "\"{"
		cmd += "\\\"action\\\":\\\"stop\\\""
		cmd += "}\""
		SockJSClient.send(self,cmd) 
		return 1