Esempio n. 1
0
 def __init__(self):
     rospy.sleep(2)
     self.__robot = NiryoRosWrapper()
     self.__robot.set_arm_max_velocity(SPEED)
     self.__robot.set_arm_max_acceleration(ACCELERATION)
     self.__set_led_state_service = rospy.ServiceProxy(
         '/niryo_robot_rpi/set_led_custom_blinker', LedBlinker)
     self.led_stop()
    def __init__(self):
        # Niryo Python Ros Wrapper instance
        self.__niryo_robot = NiryoRosWrapper()

        # Dict containing a mapping between
        # "Command" enumeration (defined in const_communication) and interpreter's functions
        self.__commands_dict = self.__generate_functions_dict()
        # - Enumerations mapping
        self.__axis_string_dict_convertor = {
            "X": ShiftPose.AXIS_X,
            "Y": ShiftPose.AXIS_Y,
            "Z": ShiftPose.AXIS_Z,
            "ROLL": ShiftPose.ROT_ROLL,
            "PITCH": ShiftPose.ROT_PITCH,
            "YAW": ShiftPose.ROT_YAW,
        }

        self.__pin_mode_string_dict_convertor = {
            "OUTPUT": PinMode.OUTPUT,
            "INPUT": PinMode.INPUT,
        }

        self.__digital_state_string_dict_convertor = {
            "HIGH": PinState.HIGH,
            "LOW": PinState.LOW,
        }

        self.__digital_state_string_dict_convertor_inv = {
            index: string
            for string, index in
            self.__digital_state_string_dict_convertor.iteritems()
        }

        self.__boolean_string_dict_converter = {"TRUE": True, "FALSE": False}

        self.__tools_string_dict_convertor = {
            "NONE": ToolID.NONE,
            "GRIPPER_1": ToolID.GRIPPER_1,
            "GRIPPER_2": ToolID.GRIPPER_2,
            "GRIPPER_3": ToolID.GRIPPER_3,
            "GRIPPER_4": ToolID.GRIPPER_4,
            "ELECTROMAGNET_1": ToolID.ELECTROMAGNET_1,
            "VACUUM_PUMP_1": ToolID.VACUUM_PUMP_1,
        }

        self.__grippers_string_dict_convertor = {
            "NONE": ToolID.NONE,
            "GRIPPER_1": ToolID.GRIPPER_1,
            "GRIPPER_2": ToolID.GRIPPER_2,
            "GRIPPER_3": ToolID.GRIPPER_3,
            "GRIPPER_4": ToolID.GRIPPER_4,
        }

        self.__conveyor_id_string_dict_convertor = {
            "NONE": ConveyorID.NONE,
            "ID_1": ConveyorID.ID_1,
            "ID_2": ConveyorID.ID_2,
        }
        self.__conveyor_id_string_dict_convertor_inv = {
            index: string
            for string, index in
            self.__conveyor_id_string_dict_convertor.iteritems()
        }

        self.__conveyor_direction_string_dict_convertor = {
            "FORWARD": ConveyorDirection.FORWARD,
            "BACKWARD": ConveyorDirection.BACKWARD,
        }

        self.__available_tools_string_dict_convertor_inv = {
            index: string
            for string, index in
            self.__tools_string_dict_convertor.iteritems()
        }
 def __init__(self):
     rospy.sleep(2)
     self.__robot = NiryoRosWrapper()