Пример #1
0
    def get_pos_str(self):

        return conversions.pos2str(self.position)
Пример #2
0
    def get_text_for_item(self, block_id, item_id):

        item = self.ph.get_item_msg(block_id, item_id)

        text = "(" + str(item.id) + ") "

        if item.type == ProgIt.GET_READY:

            text += QtCore.QCoreApplication.translate("ProgramItem",
                                                      "GET_READY")

        elif item.type == ProgIt.WAIT_FOR_USER:

            text += QtCore.QCoreApplication.translate("ProgramItem",
                                                      "WAIT_FOR_USER")

        elif item.type == ProgIt.WAIT_UNTIL_USER_FINISHES:

            text += QtCore.QCoreApplication.translate(
                "ProgramItem", "WAIT_UNTIL_USER_FINISHES")

        elif item.type == ProgIt.PICK_FROM_POLYGON:

            text += QtCore.QCoreApplication.translate("ProgramItem",
                                                      "PICK_FROM_POLYGON")

            if self.ph.is_object_set(block_id, item_id):

                text += "\n" + "object type=" + item.object[0]

            else:

                text += "\n" + "object type=??"

        elif item.type == ProgIt.PICK_FROM_FEEDER:

            text += QtCore.QCoreApplication.translate("ProgramItem",
                                                      "PICK_FROM_FEEDER")

            if self.ph.is_pose_set(block_id, item_id):

                text += "\n" + conversions.pos2str(
                    (item.pose[0].pose.position.x,
                     item.pose[0].pose.position.y,
                     item.pose[0].pose.position.z))

            else:

                text += "\n" + "x=??, y=??, z=??"

            if self.ph.is_object_set(block_id, item_id):

                text += "\n" + "object type=" + item.object[0]

            else:

                text += "\n" + "object type=??"

        elif item.type == ProgIt.PICK_OBJECT_ID:

            text += QtCore.QCoreApplication.translate("ProgramItem",
                                                      "PICK_OBJECT_ID")

            if self.ph.is_object_set(block_id, item_id):

                text += "\n" + "object ID=" + item.object[0]

            else:

                text += "\n" + "object ID=??"

        elif item.type == ProgIt.PLACE_TO_POSE:

            text += QtCore.QCoreApplication.translate("ProgramItem",
                                                      "PLACE_TO_POSE")

            if self.ph.is_object_set(block_id, item.ref_id[0]):

                ref_item = self.ph.get_item_msg(block_id, item.ref_id[0])

                text += "\n" + \
                    "object from (" + \
                    str(item.ref_id[0]) + ")=" + ref_item.object[0]

            else:

                text += "\n" + "object from (" + str(item.ref_id[0]) + ")=??"

            if self.ph.is_pose_set(block_id, item_id):

                text += "\n" + conversions.pos2str(
                    (item.pose[0].pose.position.x,
                     item.pose[0].pose.position.y,
                     item.pose[0].pose.position.z))

            else:

                text += "\n" + "X: ??, Y: ??, Z: ??"

        elif item.type == ProgIt.PLACE_TO_GRID:

            text += QtCore.QCoreApplication.translate("ProgramItem",
                                                      "PLACE_TO_GRID")

            ref_item = self.ph.get_item_msg(block_id, item.ref_id[0])

            if ref_item.type == ProgIt.PICK_OBJECT_ID:

                if self.ph.is_object_set(block_id, item_id):

                    text += "\n" + "object ID=" + item.object[0]

                else:

                    text += "\n" + "object ID=??"

            elif ref_item.type == ProgIt.PICK_FROM_POLYGON:

                if self.ph.is_object_set(block_id, item_id):

                    text += "\n" + "object TYPE=" + item.object[0]

                else:

                    text += "\n" + "object TYPE=??"

        return text