changing existing frames

  • I'm using sunrise workbench for programming kuka iiwa. I'm doing a project which will write words. For now I taught it a few letters (of the alphabet) with connecting frames. Now I have two problems.


    1. On the corner of each letter I made frame as base. Now I don’t know how I can change this base frame in file RoboticsAPI.data.xml.
    With this I plan to connect more letters in one word. For example, i want to change the parameter of y in frame P1 for +50mm


    2. I want to insert the desired word with a keypad on smartHMI modul. How do i make the program read string from keypad?


    Please :help:


    Thanks.

  • Is this what you want to accomplish?


  • If you want to enter a string in the smartpad then you must use processdata. Look inside "/SunriseProject/src/RoboticsAPI.data.ProcessDataExample.xml" and copy one of the process data that suits your needs into the the roboticsapi.data.xml file.


    You read process data like this:


    Code
    String word = getApplicationData().getProcessData("this is the id you assign to the field in roboticsapi.data.xml").getValue();
  • Thanks for advice,
    I figured out second part (read string on smartpad). But i still don't know how to change frame in file RoboticsAPI.data.xml. This is a problem because frame are saved as object frame in file RoboticsAPI.data.xml. In program above we can't take object frame instead of sourceFrame. So, i want to take object frame (for example "/base_for_D") from RoboticsAPI.data.xml, change y component and save new value in "/base_for_D".

  • In the written code, sourceFrame you can get like this:

    Code
    sourceFrame = _data.getFrame("/base_for_D");  // /base_for_D is the path to your frame


    Before this, _data must be injected

    Code
    @Inject private IApplicationData _data;

    Edited once, last by ddt ().

  • You do not have to inject the IApplicationData to get the frame.

    Quote

    Before this, _data must be injected

    Code
    @Inject private IApplicationData _data;


    Just drag and drop the frame from the 'Application Data' view into your editor, then you will get something like this:

    Code
    getApplicationData().getFrame("/P1");


    And this you can use to make your ObjectFrame available in you program:

    Quote

    ObjectFrame p1 = getApplicationData().getFrame("/P1");


  • If they want to use applicationData outside the roboticsAPI context (in any class that doesn't inherit from the RoboticsAPIApplication)then they must inject it or pass it in a constructor or something similar to that.


  • Here's the same method but it takes object frame as input. Should work the same way.


    AFAIK there's no way to modify frames in the xml file with KUKAs API. You could write a program that parses the xml file and edits it with some input but that's tedious. An easier way around this is to create a string in process data and save the translation and rotation of the base with comma separation then parse the data and apply it to a new ObjectFrame whenever you need to use the base.


    I don't really understand why you want to modify base values. Im feeling that you don't really understand the point of bases.

  • Quote

    AFAIK there's no way to modify frames in the xml file with KUKAs API.


    I guess this is away of the point, but actually, there is.

    Code
    IPersistenceEngine engine = RoboticsAPIApplication.getContext().getEngine(IPersistenceEngine.class);  // RoboticsAPIApplication should be 'this' if you use it in your RoboticsAPIApplication class.
    XmlApplicationDataSource defaultDataSource = (XmlApplicationDataSource) engine.getDefaultDataSource();


    This defaultDataSource is the class of XML file itself.
    you can addFrame, removeFrame, renameFrame, changeFrameTransformation, and manipulate other almost every parameters.


    But yes, it is still tedious to use. You might be in a need of making another class for manipulating this dataSource.

    Edited once, last by Seulki ().

  • Hi,


    I'm still tackling this problem. You said that it is not usual to change base. However, i need to change base because if i change base (for example BASE_za_E) it will move all child frames (BASE_za_E/P1- BASE_za_E/P5) related on a world coordinate system. I want to change it this way because it is then much easyer to later rotate a whole letter. For instance, i want to write word in radius.

  • I think the reason why someone said 'there's no point of modifying bases' is because
    you do not have to actually change its values.
    Just use transform() in your application without changing the ObjectFrame itself.
    -> Unlike actually changing the base transformation values, -as far as I remember- using transform() method does no effect to its child frames since you are gonna only be able to modify a snapshot(Frame) of an actual base(ObjectFrame). So you might be wanting to look at setParent(newParent, true) method as well for your child frames to be affected.


  • Hi,


    I'm still tackling this problem. You said that it is not usual to change base. However, i need to change base because if i change base (for example BASE_za_E) it will move all child frames (BASE_za_E/P1- BASE_za_E/P5) related on a world coordinate system. I want to change it this way because it is then much easyer to later rotate a whole letter. For instance, i want to write word in radius.


    What you want to do here is have one base that is child of world and create a frame for each letter. Then for each letter create an X amount of child frames that you will use to draw the letter. Something like this.


    Now if you transform frame LetterA then all child frames P1, P2 etc will change their position (they still retain their transformation from parent).

    You can have base like behaviour without declaring a frame as a base, the only difference between base and frame is that base can be calibrated with 3 points from the smartpad

Advertising from our partners