Esempio n. 1
0
 def srvSetNineAxisUpdateFrequence(self, params):
     print(params)
     if params.value not in [15, 30, 60, 100]:
         return SetInt32Response()
     else:
         self.nine_axis_update_frequence = params.value
         return SetInt32Response(0, params.value)
Esempio n. 2
0
 def srvCameraSetEnable(self, params):
     if params.value == 1 and self.camera.active == False:
         ret = self.camera.open_camera(params.port)
         return SetInt32Response(1, ret)
     elif params.value == 0:
         self.camera.active = False
         return SetInt32Response(1, 0)
     return SetInt32Response()
Esempio n. 3
0
 def srvMotorSetCurrentPosition(self, params):
     if params.port == 0:
         for i in range(5):
             self.d51_driver.motor_set_position(i + 1, params.value)
     else:
         self.d51_driver.motor_set_position(params.port, params.value)
     return SetInt32Response(params.port, params.value)
Esempio n. 4
0
 def srvMotorSetRotate(self, params):
     # print(params)
     cur_position = Lepi.motor_get_current_position(params.port)
     # print(cur_position,params.value*2+cur_position)
     Lepi.motor_set_target_position(params.port,
                                    params.value * 2 + cur_position)
     return SetInt32Response(params.port, params.value)
Esempio n. 5
0
	def cbLaunchTerminal(self,params):
		print(params)
		if params.value == 1:
			if self.terminal and self.terminal.isalive():
				terminated=self.terminal.terminate(force=True)
				rospy.loginfo(terminated)
			self.terminal = pexpect.spawn("konsole")
		else:
			if self.terminal and self.terminal.isalive():
				terminated=self.terminal.terminate(force=True)
				rospy.loginfo(terminated)
		return SetInt32Response()
Esempio n. 6
0
 def srvMotorSetPosition(self, params):
     self.d51_driver.motor_set_point(params.port, params.value)
     return SetInt32Response(params.port, params.value)
Esempio n. 7
0
 def srvMotorSetSpeed(self, params):
     self.d51_driver.motor_set_speed(params.port, params.value)
     return SetInt32Response(params.port, params.value)
Esempio n. 8
0
 def srvMotorSetRotate(self, params):
     position = self.d51_driver.motor_get_position(params.port)
     self.d51_driver.motor_set_point(params.port,
                                     params.value * 2 + position)
     return SetInt32Response(params.port, params.value)
Esempio n. 9
0
	def srvMotorSetEnable(self,msg):
		print(msg)
		Lepi.motor_set_enable(msg.port,msg.value)
		return SetInt32Response(msg.port,msg.value)
Esempio n. 10
0
 def srvMotorSetType(self, params):
     self.d51_driver.motor_set_type(params.port, params.value)
     if params.value == 1:
         self.d51_driver._motor_set_pulse(params.port, params.value)
     return SetInt32Response(params.port, params.value)
Esempio n. 11
0
 def srvSensor9AxesSetEnable(self, params):
     # print(params)
     if params.port == 0x46:
         self.i2c_driver.nineAxisSetEnable(params.value)
         return SetInt32Response(params.port, params.value)
     return SetInt32Response(params.port, params.value)
Esempio n. 12
0
 def srvCameraSetRectify(self, params):
     if params.value == 1:
         self.camera.setRectify(True)
     elif params.value == 0:
         self.camera.setRectify(False)
     return SetInt32Response(1, params.value)
Esempio n. 13
0
 def srvMotorSetSpeed(self, params):
     # print(params)
     Lepi.motor_set_speed(params.port, params.value)
     return SetInt32Response(params.port, params.value)
Esempio n. 14
0
 def srvSetResize(self, params):
     if params.port <= 480 and params.port >= 10:
         if params.value <= 360 and params.value >= 10:
             self.detector.setResize(params.port, params.value)
     return SetInt32Response(params.port, params.value)
Esempio n. 15
0
 def srvMotorSetType(self, params):
     # print(params)
     res = Lepi.motor_set_type(params.port, params.value)
     # print(res)
     return SetInt32Response(params.port, params.value)
Esempio n. 16
0
 def srvMotorSetEnable(self, params):
     # print(params)
     Lepi.motor_set_enable(params.port, params.value)
     return SetInt32Response(params.port, params.value)
Esempio n. 17
0
 def cbSetThreshold(self, params):
     self.detector.set_threshold(params.value)
     return SetInt32Response(params.port, params.value)
Esempio n. 18
0
	def srvMotorSetPosition(self,msg):
		print(msg)
		Lepi.motor_set_target_position(msg.port,msg.value)
		return SetInt32Response(msg.port,msg.value)
Esempio n. 19
0
	def srvMotorSetSpeed(self,msg):
		print(msg)
		Lepi.motor_set_speed(msg.port,msg.value)
		return SetInt32Response(msg.port,msg.value)
Esempio n. 20
0
 def srvCameraSetFlip(self, params):
     self.camera.setFlip(params.value)
     return SetInt32Response(0, params.value)
Esempio n. 21
0
 def srvMotorSetCurrentPosition(self, params):
     # print(params)
     Lepi.motor_set_current_position(params.port, params.value)
     return SetInt32Response(params.port, params.value)
Esempio n. 22
0
 def srvSensorSetMode(self, params):
     self.d51_driver.sensor_set_mode(params.port, params.value)
     return SetInt32Response(params.port, params.value)
Esempio n. 23
0
 def srvSensorSetValue(self, params):
     data = Lepi.sensor_set_value(6 - params.port, params.value)
     return SetInt32Response(params.port, params.value)
Esempio n. 24
0
 def srvSystemPoweroff(self, params):
     self.d51_driver.system_poweroff()
     os.system('bash -c "sleep 2 && sudo halt" &')
     return SetInt32Response()
Esempio n. 25
0
 def srvSensorSetMode(self, params):
     status = Lepi.sensor_set_mode(6 - params.port, params.value)
     return SetInt32Response(params.port, params.value)
Esempio n. 26
0
 def cbSetThreshold(self, params):
     if params.value > 0 and params.value < 100:
         self.detector.setThreshold(params.value)
     return SetInt32Response(params.port, params.value)
Esempio n. 27
0
 def srvSetSize(self, params):
     if params.port <= 480 and params.port >= 10:
         self.IMAGE_W = params.port
     if params.value <= 360 and params.value >= 10:
         self.IMAGE_H = params.value
     return SetInt32Response(params.port, params.value)