หน่วยประมวลผลสำหรับหุ่นยนต์เครื่องพิมพ์ 3 มิติ

ในส่วนนี้แสดงการดัดแปลงหุ่นยนต์post processorเพื่อคำนวณการป้อนเครื่องอัดรัดก่อนการดำเนินการแต่ละการเคลื่อนที่ อีกทางเลือกหนึ่ง, การคำนวณเหล่านี้สามารถถูกทำได้บนหุ่นยนต์ควบคุม

ในขั้นตอนแรกที่จะขัดขวางการเรียกเครื่องอัดรีดและการอ่านค่าเครื่องอัดรีด (ค่า E) จากส่วนของ RunCode ในหน่วยประมวลผล:

    def RunCode(self, code, is_function_call = False):

        if is_function_call:

            if code.startswith("Extruder("):

                # Intercept the extruder command.

                # if the program call is Extruder(123.56)

                # we extract the number as a string

                # and convert it to a number

                self.NEW_E_LENGTH = float(code[9:-1])

                # Skip the program call generation

                return

            else:

                self.addline(code + "()")

        else:

            # Output program code

            self.addline(code)

ค่าเครื่องอัดฉีดถูกบันทึกตัวแปร NEW_E_LENGTH จากนั้น, เราจำเป็นต้องกำหนดขั้นตอนใหม่ซึ่งจะสร้างคำสั่งการป้อนค่าเครื่องอัดรีดอย่างเหมาะสมตามระยะทางระหว่างการเคลื่อนที่,ความเร็วของหุ่นยนต์และความเร่งของหุ่นยนต์ สามารถประมาณได้ว่าการป้อนเครื่องอัดรีดถูกขับเคลื่อนด้วยผลลัพธ์อนาล็อกเฉพาะจากหุ่นยนต์ควบคุม (ตัวเลขผลลัพธ์อนาล็อก 5 ในตัวอย่างนี้)

    def new_move(self, pose1, pose2):

        if pose1 isNone:

            return

           

        def Calculate_Time(Dist, Vmax, Amax):

            '''Calculate the time to move Dist with Amax acceleration and Vmax speed'''

            tacc = Vmax/Amax;

            Xacc = 0.5*Amax*tacc*tacc;

            if Dist <= 2*Xacc:

                # Vmax is not reached

                tacc = sqrt(Dist/Amax)

                Ttot = tacc*2

            else:

                # Vmax is reached

                Xvmax = Dist - 2*Xacc

                Tvmax = Xvmax/Vmax

                Ttot = 2*tacc + Tvmax

            return Ttot

           

        add_material = self.NEW_E_LENGTH - self.LAST_E_LENGTH

        self.LAST_E_LENGTH = self.NEW_E_LENGTH

       

        if add_material > 0:

            distance_mm = norm(subs3(pose1.Pos(), pose2.Pos()))

            # calculate movement time in seconds

            time_s = Calculate_Time(distance_mm, self.SPEED_MMS, self.ACCEL_MMSS)

            # add material

            self.setDO(5, (add_material/time_s))

        else:

            # DO not add material

            self.setDO(5,0)

สุดท้าย, พวกเราจำเป็นต้องกระตุ้นคำสั่ง new_move ของแต่ละคำแนะนำการเคลื่อนที่ใหม่ พวกเราสามารถเพิ่มกาเรียกนี้ตั้งแต่เริ่มต้นของคำสั่ง MoveL:

    def MoveL(self, pose, joints, conf_RLF=None):

        """Add a linear movement"""

        self.new_move(self.LAST_POSE, pose) # used for 3D printing