Adding Global Position

Forum Forums Visual Components 4.0 Python Programming in VC Adding Global Position

This topic contains 7 replies, has 3 voices, and was last updated by zesty zesty 10 months, 1 week ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #6570
    Avatar
    chnsbs
    Participant

    Hi everybody,

    I am working with KUKA Sim Pro 3 and trying to create some robot program routines automatically and adding some predefined global positions at the beginning and end of every routine. And afterwards my aim is to create these programs using a post-processor.

     

    Could you please advise how I can add global positions to the robot?

     

    Thank you in advance

     

    #6579
    zesty
    zesty
    Moderator

    Do you mean Home positions? You can create a script that listens for when new statements are added in which they are never at the very beginning nor end of the routine’s scope — by default new statements are added to end, but the addStatement() method has an optional param for defining index, and then scope of a routine can always be edited.

    You can use Python API to create KRL statements (the ones you see in Job Map panel) but I will need to refind an example on how to do this. Basically, you have to use the netCommand() and use something recgonized by a DLL. I will look and attach it when I find it.

    #6587
    Avatar
    chnsbs
    Participant

    Thanks for quick reply. An example of creating KRL statements using PYTHON API would be really helpful.

    But No, I don’t mean HOME positions. HOME positions are defined as properties in KUKA SimPro and have joint values not cartesian coordinates.

    In our Robot programs we usually use global positions for certain things. Because these positions are used in different movement programs in different scenarios.

     

    So let’s say I want to define a position as global and want to use this position in different programs(as I can do with HOME positions in VC). When I change the global position somewhere in the robot Program, It should be updated everywhere in the robot.

     

    Visual Components does not allow same Position name to exist more than one as statement. That is the main problem I have now. So i can just not use addStatemen() function in a routine and set the name.

     

    I am now trying to add new positions into Robot Properties like default HOME positions(but in cartesian coordinates not joint values) and be able to add these positions everywhere in the sub programs as we can do with HOME positions. Any help would be amazing here.

     

     

    #6589
    zesty
    zesty
    Moderator

    You should be able to add a vcProperty of type vcMatrix to a robot, thereby the position matrix of robot position in World coordinates could reference that property.

    For position names, a workaround is to add a new vcProperty of type String to motion statement/position, which does not have to a unique value, i.e. app only cares if the native properties are unique.

    I will make an example real quick and attach it. Still searching for that KRL example.

    #6610
    zesty
    zesty
    Moderator

    Does the attached file and script help? I created the matrix property in GUI to keep things simple.

    vcPositionFrame, vcStatement, vcRoutine,  vcProgram, and has createProperty() method

    Attachments:
    You must be logged in to view attached files.
    #6632
    eme
    eme
    Moderator

    The python API for Kuka.Sim statements is not complete as far as I know. The addStatement method that zesty suggested creates a Visual Components statement that the GUI and the post processor doesn’t fully understand.

    As zesty said there should be some level of python api for the Kuka statements that you can use thru netCommand, but I would recommend to ask Kuka support directly. Or let’s see if zesty finds an example for you.

    And in general each statement holds the positional data. So the position can’t be shared between statement for now. But a script could make sure that the positions in specific stataments are similar by somehow syncing them. I’ll discuss with zesty.

    #6652
    Avatar
    chnsbs
    Participant

    Thank you guys, that was really helpful.

    I edited the program as follows:

    Now I can add a VC_STRING type property to new_statement. Even though statement names are different, under global section,  I can set the name of this PosName variable as I want.

    new property

     

    As you guys also mentioned nex step would be following:

    In Job Map section , If I select a position with GLOBAL::PosName property and  click on touch up button or change value of it manually, I should update all positions in robot program with the same GLOBAL::PosName property.

     

    I think that could be possible. What kind of event handler should I use in this case?

     

    Thank you in advance…

    #6697
    zesty
    zesty
    Moderator

    For adding KRL statements, I attached a sample layout. The script is in the robot. Here is the script, which can you modify into a module that you can import in other scripts:

    My script is based on the following script developed by someone else:

    This is what I know:

    • You cannot use vcTeachContext to make this work. The placement of the statement is dependent on the active statement in robot program, thereby dependent on selection manager. For example, even if you change the active statement in teach context using vcTeachContext methods, it won’t update selection manager nor matter to the .NET command called to add the KRL statement.
    • The latter script was checking a lot of stuff, like the active statement in selection manager. I tried that, but it got too complicated when dealing with statements that have one or more scopes like While and If statements. So the former script just adds the placeholder to the given scope and “appends” it to the selection recognized by the manager.

    This is what I do not know:

    • Where do we go from here?
    Attachments:
    You must be logged in to view attached files.
Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.