Пример #1
0
 def __init__(self, _name='/robotis'):
     """Initial object."""
     self.en_sim = False
     if len(sys.argv) >= 2:
         print(type(sys.argv[1]))
         if sys.argv[1] == 'True':
             rospy.set_param('self.en_sim', sys.argv[1])
             self.en_sim = rospy.get_param('self.en_sim')
     self.name = _name
     self.status = Status.initPose
     self.nowStatus = Status.initPose
     self.nextStatus = Status.idle
     self.reGripCnt = 0
     self.arm = ArmTask(self.name + '_arm', self.en_sim)
     self.pickListAll = len(lunchboxPos) + len(riceballPos) + len(drinkPos)
     self.pickList = PICKORDER
     self.pos = [0, 0, 0]
     self.euler = [0, 0, 0]
     self.phi = 0
     self.sucAngle = 0
     self.all_finish = False
     if self.name == 'right':
         self.is_right = 1
         self.speed = SPEED_R
     if self.name == 'left':
         self.is_right = -1
         self.speed = SPEED_L
     if self.en_sim:
         self.suction = SuctionTask(self.name + '_gazebo')
     else:
         self.suction = SuctionTask(self.name)
         rospy.on_shutdown(self.suction.gripper_vacuum_off)
Пример #2
0
    def __init__(self, _name = '/robotis'):
        """Initial object."""
        en_sim = False
        if len(sys.argv) >= 2:
            rospy.set_param('en_sim', sys.argv[1])
            en_sim = rospy.get_param('en_sim')

        self.name  = _name
        self.arm   = ArmTask(self.name + '_arm')
        self.pick_list = 2
        self.pos   = (0, 0, 0)
        self.euler = (0, 0, 0)
        self.phi   = 0
        if en_sim:
            self.suction = SuctionTask(self.name + '_gazebo')
            print "aa"
        else:
            self.suction = SuctionTask(self.name)
            print "bb"
Пример #3
0
    def __init__(self, _name='/robotis'):
        """Initial object."""
        self.en_sim = False
        self.__set_pubsub()
        if len(sys.argv) >= 2:
            print(type(sys.argv[1]))
            if sys.argv[1] == 'True':
                rospy.set_param('self.en_sim', sys.argv[1])
                self.en_sim = rospy.get_param('self.en_sim')
        self.name = _name
        self.state = initPose
        self.nowState = initPose
        self.nextState = idle
        self.reGripCnt = 0
        self.pickList = 0
        self.pickListAll = 8
        self.arm = ArmTask(self.name + '_arm')
        self.pos = [0, 0, 0]
        self.euler = [0, 0, 0]
        self.phi = 0
        self.sucAngle = 0
        self.sandwitchPos = [0, 0, 0]
        self.sandwitchEu = [0, 0, 0]
        self.sandwitchSuc = 0
        self.sandwitchVec = [0, 0, 0]
        self.camMovePos = [0, 0]
        self.Qrcode = ''
        self.checkCnt = 0
        self.moveCnt = 0
        self.mode = 'p2p'

        self.ROI_Pos = [0, 640, 0, 480]
        self.Vision_pos = [0, 0, 0, 0, 0, 0]
        if self.name == 'right':
            self.is_right = 1
        if self.name == 'left':
            self.is_right = -1
        if self.en_sim:
            self.suction = SuctionTask(self.name + '_gazebo')
        else:
            self.suction = SuctionTask(self.name)
            rospy.on_shutdown(self.suction.gripper_vaccum_off)
Пример #4
0
 def __init__(self, _name='/robotis'):
     """Initial object."""
     en_sim = False
     self.finish = False
     if len(sys.argv) >= 2:
         rospy.set_param('en_sim', sys.argv[1])
         en_sim = rospy.get_param('en_sim')
     self.name = _name
     self.state = initPose
     self.nextState = idle
     self.arm = ArmTask(self.name + '_arm')
     self.pick_list = 2
     self.pos = (0, 0, 0)
     self.euler = (0, 0, 0)
     self.phi = 0
     self.cnt = 0
     self.tmp_rr = -1
     if en_sim:
         self.suction = SuctionTask(self.name + '_gazebo')
     else:
         self.suction = SuctionTask(self.name)
Пример #5
0
 def finish(self):
     return self.pickList == self.pickListAll
     self.nowState = initPose
     self.nextState = idle
     self.reGripCnt = 0
     self.arm = ArmTask(self.name + '_arm')
     self.pos = [0, 0, 0]
     self.euler = [0, 0, 0]
     self.phi = 0
     self.sucAngle = 0
     self.sandwitchPos = [0, 0, 0]
     self.sandwitchEu = [0, 0, 0]
     self.sandwitchSuc = 0
     if self.name == 'right':
         self.is_right = 1
     if self.name == 'left':
         self.is_right = -1
     if self.en_sim:
         self.suction = SuctionTask(self.name + '_gazebo')
     else:
         self.suction = SuctionTask(self.name)
         rospy.on_shutdown(self.suction.gripper_vaccum_off)
Пример #6
0
 def __init__(self, _name='/robotis'):
     """Initial object."""
     en_sim = True
     if len(sys.argv) >= 2:
         rospy.set_param('en_sim', sys.argv[1])
         en_sim = rospy.get_param('en_sim')
     # if en_sim:
     #     print en_sim
     #     return
     self.name = _name
     self.state = initPose
     self.nextState = idle
     self.sucAngle = 0
     self.arm = ArmTask(self.name + '_arm')
     self.pick_list = 4
     self.pos = (0, 0, 0)
     self.euler = (0, 0, 0)
     self.phi = 0
     if en_sim:
         self.suction = SuctionTask(self.name + '_gazebo')
         print("aa")
     else:
         self.suction = SuctionTask(self.name)
         print("bb")
 def __init__(self, _name = '/robotis'):
     """Initial object."""
     self.en_sim = False
     if len(sys.argv) >= 2:
         print(type(sys.argv[1]))
         if sys.argv[1] == 'True':
             rospy.set_param('self.en_sim', sys.argv[1])
             self.en_sim = rospy.get_param('self.en_sim')
     self.img_data = ROI()
     self.img_data_list = []
     self.name = _name
     self.state = initPose
     self.nowState = initPose 
     self.nextState = idle
     self.reGripCnt = 0
     self.arm = ArmTask(self.name + '_arm')
     self.pos   = [0, 0, 0]
     self.euler = [0, 0, 0]
     self.phi   = 0
     self.sucAngle = 0
     self.No_Object_count = 0
     self.obj_name = ''
     self.standby_safeFlag = True       #  第一次開完箱子的狀態切換(只有開箱子用的到)
     self.close_box = False             #  關箱子的旗標
     self.finish_pos = False
     self.mode_2D = False
     self.finish = False
     if self.name == 'left':
         self.is_right = -1
         self.speed = SPEED_L
         self.faster_speed = 40
     self.init_pub_sub()
     if self.en_sim:
         self.suction = SuctionTask(self.name + '_gazebo')
     else:
         self.suction = SuctionTask(self.name)