コード例 #1
0
    def start_working(self, device):

        try:
            print('doing PickAndPlace')
            if device == "RPI":
                from Controller.GpioController import GpioController
                gpio = GpioController()
                gpio.initPins()
                gpio.gpioControl('elbow_f', 1.1)
                time.sleep(0.5)
                # gpio.gpioControl('grip_f', 0.3)
                # gpio.gpioControl('grip_b', 0.3)
                # time.sleep(0.5)
                gpio.gpioControl('elbow_b', 1.5)
                time.sleep(0.5)
            elif device == "LAPTOP":
                time.sleep(1)

            print('PickAndPlace finished..')
            print('Replying to WT server...')
            response = self.COMPLETED_MESSAGE
            return response

        except (ConnectionResetError, OSError) as e:
            print(e)
コード例 #2
0
    def start_working(self, device):
        try:
            print('doing PickAndFlipAndPress')
            if device == "RPI":
                from Controller.GpioController import GpioController
                gpio = GpioController()
                gpio.initPins()
                # gpio.gpioControl('wrist_f', 1)
                # time.sleep(0.5)
                gpio.gpioControl('grip_f', 0.7)
                gpio.gpioControl('grip_b', 0.7)
                time.sleep(0.5)
                gpio.gpioControl('grip_f', 0.7)
                gpio.gpioControl('grip_b', 0.7)
                time.sleep(0.5)
                # gpio.gpioControl('wrist_b', 1.2)
            elif device == "LAPTOP":
                time.sleep()

            print('PickAndFlipAndPress finished..')
            print('Replying to WT server...')
            encoded_response = self.COMPLETED_MESSAGE
            return encoded_response
        except (ConnectionResetError, OSError) as e:
            print(e)
コード例 #3
0
    def start_working(self, message, device):
        try:
            print('doing MoveMs to ' + str(message))
            if "left" in message:
                print(" \n \n \n move to left \n \n \n ")
                if device == "RPI":
                    from Controller.GpioController import GpioController
                    gpio = GpioController()
                    gpio.initPins()
                    gpio.gpioControl('rotate_l', 2.6)
                    time.sleep(1)
                elif device == "LAPTOP":
                    time.sleep(1)

                print('MoveMs finished..')
                print('Replying to server...')
                encoded_response = self.COMPLETED_MESSAGE_POS1
                return encoded_response
            elif "right" in message:
                print(" \n \n \n move to right \n \n \n ")
                if device == "RPI":
                    from Controller.GpioController import GpioController
                    gpio = GpioController()
                    gpio.initPins()
                    gpio.gpioControl('rotate_r', 2.4)
                    time.sleep(1)
                elif device == "LAPTOP":
                    time.sleep(1)

                print('MoveMs finished..')
                print('Replying to server...')
                encoded_response = self.COMPLETED_MESSAGE_POS2
                return encoded_response
            else:
                return "wrong message"

        except (ConnectionResetError, OSError) as e:
            print(e)