当前位置: 首页>>代码示例>>Python>>正文


Python Arduino.pumpStatus方法代码示例

本文整理汇总了Python中pyfirmata.Arduino.pumpStatus方法的典型用法代码示例。如果您正苦于以下问题:Python Arduino.pumpStatus方法的具体用法?Python Arduino.pumpStatus怎么用?Python Arduino.pumpStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyfirmata.Arduino的用法示例。


在下文中一共展示了Arduino.pumpStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Uarm

# 需要导入模块: from pyfirmata import Arduino [as 别名]
# 或者: from pyfirmata.Arduino import pumpStatus [as 别名]

#.........这里部分代码省略.........
            for n in range(0, 50):
                self.ivsKine(x_arr[n], y_arr[n], z_arr[n])
                self.writeAngle(self.angle[1], self.angle[2], self.angle[3], self.angle[1] * servo_4_relative + servo_4)
                time.sleep(timeSpend / 50.0)

        elif time == 0:
            self.ivsKine(x, y, z)
            self.writeAngle(self.angle[1], self.angle[2], self.angle[3], self.angle[1] * servo_4_relative + servo_4)

        else:
            pass

    def moveTo(self, x, y, z):

        if self.uarm_status == 0:
            self.uarmAttach()
            self.uarm_status = 1

        curXYZ = self.currentCoord()

        x_arr = {}
        y_arr = {}
        z_arr = {}

        self.interpolation(curXYZ[1], x)
        for n in range(0, 50):
            x_arr[n] = self.g_interpol_val_arr[n]

        self.interpolation(curXYZ[2], y)
        for n in range(0, 50):
            y_arr[n] = self.g_interpol_val_arr[n]

        self.interpolation(curXYZ[3], z)
        for n in range(0, 50):
            z_arr[n] = self.g_interpol_val_arr[n]

        for n in range(0, 50):
            self.ivsKine(x_arr[n], y_arr[n], z_arr[n])
            self.writeAngle(self.angle[1], self.angle[2], self.angle[3], 0)

            time.sleep(0.04)

    def moveToWithTime(self, x, y, z, timeSpend):

        if self.uarm_status == 0:
            self.uarmAttach()
            self.uarm_status = 1

        curXYZ = self.currentCoord()
        x_arr = {}
        y_arr = {}
        z_arr = {}

        if time > 0:
            self.interpolation(curXYZ[1], x)
            for n in range(0, 50):
                x_arr[n] = self.g_interpol_val_arr[n]

            self.interpolation(curXYZ[2], y)
            for n in range(0, 50):
                y_arr[n] = self.g_interpol_val_arr[n]

            self.interpolation(curXYZ[3], z)
            for n in range(0, 50):
                z_arr[n] = self.g_interpol_val_arr[n]

            for n in range(0, 50):
                self.ivsKine(x_arr[n], y_arr[n], z_arr[n])
                self.writeAngle(self.angle[1], self.angle[2], self.angle[3], 0)
                time.sleep(timeSpend / 50.0)

        elif time == 0:

            self.ivsKine(x, y, z)
            self.writeAngle(self.angle[1], self.angle[2], self.angle[3], 0)

        else:
            pass

    def moveToAtOnce(self, x, y, z):

        if self.uarm_status == 0:
            self.uarmAttach()
            self.uarm_status = 1

        self.ivsKine(x, y, z)
        self.writeAngle(self.angle[1], self.angle[2], self.angle[3], 0)

    def moveRelative(self, x, y, z, time, servo_4_relative, servo_4):
        pass

    def stopperStatus(self):
        val = self.uarm.pumpStatus(0)

        if val == 2 or val == 1:
            return val - 1
        else:
            print
            'ERROR: Stopper is not deteceted'
            return -1
开发者ID:dmopalmer,项目名称:UArmForPython,代码行数:104,代码来源:uarm_python.py

示例2: Uarm

# 需要导入模块: from pyfirmata import Arduino [as 别名]
# 或者: from pyfirmata.Arduino import pumpStatus [as 别名]

#.........这里部分代码省略.........

		elif time == 0:
			self.ivsKine(x,y,z)
			self.writeAngle(self.angle[1],self.angle[2],self.angle[3],self.angle[1]*servo_4_relative+servo_4)

		else:
			pass


	def moveTo(self,x,y,z):
		
		if self.uarm_status == 0:
			self.uarmAttach()
			self.uarm_status = 1


		curXYZ = self.currentCoord()

		x_arr = {}
		y_arr = {}
		z_arr = {}

		self.interpolation(curXYZ[1],x)
		for n in range(0,50):
			x_arr[n] = self.g_interpol_val_arr[n]

		self.interpolation(curXYZ[2],y)
		for n in range(0,50):
			y_arr[n] = self.g_interpol_val_arr[n]

		self.interpolation(curXYZ[3],z)
		for n in range(0,50):
			z_arr[n] = self.g_interpol_val_arr[n]
	
		for n in range(0,50):
			self.ivsKine(x_arr[n],y_arr[n],z_arr[n])
			self.writeAngle(self.angle[1],self.angle[2],self.angle[3],0)
		
			time.sleep(0.04)


	def moveToWithTime(self,x,y,z,timeSpend):
		
		if self.uarm_status == 0:
			self.uarmAttach()
			self.uarm_status = 1

		curXYZ = self.currentCoord()
		x_arr = {}
		y_arr = {}
		z_arr = {}

		if time >0:
			self.interpolation(curXYZ[1],x)
			for n in range(0,50):
				x_arr[n] = self.g_interpol_val_arr[n]

			self.interpolation(curXYZ[2],y)
			for n in range(0,50):
				y_arr[n] = self.g_interpol_val_arr[n]

			self.interpolation(curXYZ[3],z)
			for n in range(0,50):
				z_arr[n] = self.g_interpol_val_arr[n]
		
			for n in range(0,50):
				self.ivsKine(x_arr[n],y_arr[n],z_arr[n])
				self.writeAngle(self.angle[1],self.angle[2],self.angle[3],0)
				time.sleep(timeSpend/50.0)

		elif time == 0:
			
			self.ivsKine(x,y,z)
			self.writeAngle(self.angle[1],self.angle[2],self.angle[3],0)

		else:
			pass

	def moveToAtOnce(self,x,y,z):
		
		if self.uarm_status == 0:
			self.uarmAttach()
			self.uarm_status = 1

		self.ivsKine(x,y,z)
		self.writeAngle(self.angle[1],self.angle[2],self.angle[3],0)

	
	def moveRelative(self,x,y,z,time,servo_4_relative,servo_4):
		pass
		

	def stopperStatus(self):
		val = self.uarm.pumpStatus(0)
		
		if val ==2 or val ==1:
			return val-1
		else:
			print 'ERROR: Stopper is not deteceted'
			return -1
开发者ID:gx9702,项目名称:UArmForROS,代码行数:104,代码来源:uarm_python.py


注:本文中的pyfirmata.Arduino.pumpStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。