KRC_INVERSE liefert null Werte für alle Achsen

  • Hallo zusammen,


    Ich steuere einen Kuka Agilus via UDP unter Verwendung von mxAutomation. Zur Berechnung einer Achsenposition verwende ich den Funktionsbaustein KRC_INVERSE. Dieser liefert aber manchmal null Werte (A1=0, A2=0, A3=0, A4=0, A5=0, A6=0) für alle Achsen obwohl ich ihm einen Punkt gebe, der definitiv nicht zu diesem Ergebnis führen sollte. Der Funktionsbaustein wirft keinen Fehler (ERROR = false), trotzdem passiert das. Ich kann den Fehler auch nicht wirklich reproduzieren. Hat jemand eine Idee warum das passiert, oder wie ich das weiter debuggen kann?


    Ich verwende Unity mit der mxAutomation Library unter Windows.

  • Schritt für Schritt zum Roboterprofi!
  • so verwende ich den Baustein:


  • IF evaluates condition immediately and chooses path. if this is interfacing to mxA, in your code this all happens too quickly... way before data had chance to go to KRC, compute inverse, then bring result back. by that time your code already skipped to line 24 and you never get result

  • Thanks for your reply. This block is running in a loop every 40ms, so at a certain point, the IF condition is evaluated and returns a result, which is then used to move to an axis position.


    This is my first project with Kuka, MxAutomation and C# and I made my way to this point using the example program provided by Kuka when I purchased MxAutomation. So what happens is, in each loop all properties of the `KRC_INVERSE` are defined. My app has a slightly different structure than in the first code block (didn't want to put all this code there in the first place)


    But to start from the beginning: My initial problem was, that I was not able to move the robot using cartesian coordinates. I tried the function block: `KRC_MoveDirectAbsolute` which was not working at all. Always got the error that `STATUS` and `TURN` where incorrect and I could not figure out how to determine valid values. When moving the robot using the SmartPad and watching the actual position, those values are constantly changing even if the robot moves from one axis position to another. This makes sense, but when defining this function block, I had no clue what to specify. So, my approach was to use `KRC_INVERSE` in order to first let KRC compute the axis position and then I can use these data to actual move the robot in a position I want to. If you have a hint for this problem, help is much appreciated.


    But coming back to the problem. In the class which controls the robot there is a function `MoveToCartesianPosition(E6POS pos) { ... }` In this function i create an instance of the function block `KRC_INVERSE`. And then in another function `Loop()`, which runs every 40ms, there is a state machine which actually does the part of setting all the properties of this function block and evaluates the result. Reading you reply, I assume, I don't need to define all properties every loop, correct? Could this causing the error? And what does the Method `OnCycle()` which every KRC function block has?


    The program works, only sometimes, the function block returns zero values for all axis. One can see it, in the video below where the robot goes to this position (around second 7) and then continues painting and dancing.


    Externer Inhalt twitter.com
    Inhalte von externen Seiten werden ohne deine Zustimmung nicht automatisch geladen und angezeigt.
    Durch die Aktivierung der externen Inhalte erklärst du dich damit einverstanden, dass personenbezogene Daten an Drittplattformen übermittelt werden. Mehr Informationen dazu haben wir in unserer Datenschutzerklärung zur Verfügung gestellt.

    2 Mal editiert, zuletzt von schub ()

    • Hilfreich

    Da dürfte panic_mode schon den richtigen Hinweis gegeben haben. Es scheint, als ob die Auswertung von _krcinverse parallel stattfindet (kenne mich da mit m automation nicht aus, entnehme das aber dem post von panic_mode).


    Durch den zyklischen Aufruf von _krcinverse und das sofortige Abfragen von done wird da einiges durcheinander kommen können.

    Sollte nicht nach einem Aufruf gewartet werden bis done true wird? In den meisten Fällen wird das sofort der Fall sein, aber manchmal wird es dann halt doch ein paar mikrosekunden dauern, dann kommt es zu dem problem.

  • Yes, I should create the KRC_INVERSE function block and set parameters and only check if its done inside the loop without setting all the properties again (even though they stay the same). Thanks for your reply, I will try this approach and will post results here.


    Nevertheless, if anyone can tell me, what the `OnCycle()` method is doing, it would be great, since I could not find any documentation about it. Maybe it helps to better understand the mxAutomation library.

  • Thanks for your replies. They pointed me in the right direction as it seems. The error does not occur anymore but since there was no way to reproduce this error, I can't be sure.


    Here is what I did (pseudocode with only relevant parts):


Erstelle ein Benutzerkonto oder melde dich an um zu kommentieren

Du musst ein Benutzerkonto haben um einen Kommentar hinterlassen zu können

Benutzerkonto erstellen
Neues Benutzerkonto für unsere Community erstellen. Geht einfach!
Neues Benutzerkonto erstellen
Anmelden
Du hast bereits ein Benutzerkonto? Melde dich hier an.
Jetzt anmelden