Creating frames with coordinates relative to the world base

  • Hi all,


    I'm trying to make some new frames within a program however it seems to be creating them all relative to the flange/tcp - which could be different each startup. Is there a way to create new frames whilst using world Cartesian transformation?


    Here is an example of the code:

    The frames will all have names of integers and this is in a loop to create multiple frames.

    To ensure it creates frames relative to the program being run I make sure to delete old frames before creating new ones.

    ToolchangerOrigin is a private var within the program that stores an arbitary point within it

  • That's because you're using a dynamic ObjectFrame as the reference(parent) of your new frames.

    I guess this.toolChangerOrigin is a tcp of your tool which is dynamic by posture of the robot and it differs by how your robot was placed when the code is executed.

    If you want to use World.Current.addChildFrame() method, just use it with 2 parameters one.


    plus, it seems you better use Frame not ObjectFrame by you saying deleting them.

    Frames are not stored in ApplicationData which means they are only programmed frames and be removed as the application ends.

    If it's World frame you want it to have as its parent, use

    Code
    Frame temp = new Frame(Transformation offset);


    This will automatically make a Frame as a child of root(World) and it's not written on Application data and be gone after the application terminates.


    Also, I recommend you to use ArrayList() of Frames to loop them or a simple array Frame[].

Advertising from our partners