Author Topic: KUKA_IIWA_Digital_IO_Error  (Read 1122 times)

avishek

  • Forum User
  • *
  • Posts: 21
    • View Profile
KUKA_IIWA_Digital_IO_Error
« on: July 26, 2021, 01:57:15 PM »
Hello Johannes,

I was trying to send out a digital output signal to KUKA IIWA 14 R820 through grasshopper and encountered an error ( DIGOUT Error.PNG).
Can you please tell me how to resolve this error? Do I need to declare the iogroup at some place in the RunXML or RunUDP file ?

I have attached the screenshots from grasshopper and the error from the pendant.

thanks
Avishek

Johannes @ Robots in Architecture

  • Lead Developer
  • Administrator
  • Forum User
  • *****
  • Posts: 1214
    • View Profile
    • Robots in Architecture
Re: KUKA_IIWA_Digital_IO_Error
« Reply #1 on: July 26, 2021, 05:11:53 PM »
Hello,

Sorry, there is no way to troubleshoot it from the screenshot, it just says that there is an object is null.
Did you reference your IO Group when setting up the communicator in Sunrise? If that is null, it would explain the error.

Best,
Johannes

avishek

  • Forum User
  • *
  • Posts: 21
    • View Profile
Re: KUKA_IIWA_Digital_IO_Error
« Reply #2 on: July 26, 2021, 05:15:32 PM »
Hi,

I did not know that IO Group had to be referenced. Now I have added this line to the communicator setup :
MediaFlangeIOGroup iogrp = new MediaFlangeIOGroup(kuka_Sunrise_Cabinet_1);
that seems to solve the problem for now. Is that all ?

Thanks

Johannes @ Robots in Architecture

  • Lead Developer
  • Administrator
  • Forum User
  • *****
  • Posts: 1214
    • View Profile
    • Robots in Architecture
Re: KUKA_IIWA_Digital_IO_Error
« Reply #3 on: July 26, 2021, 05:18:25 PM »
I hope so :)

Best,
Johannes

avishek

  • Forum User
  • *
  • Posts: 21
    • View Profile
Re: KUKA_IIWA_Digital_IO_Error
« Reply #4 on: July 27, 2021, 10:33:43 AM »
Hi Johannes,

In the present scope of KUKA|prc, is there any way to read the current state of IOs of iiwas ?

Thanks

Johannes @ Robots in Architecture

  • Lead Developer
  • Administrator
  • Forum User
  • *****
  • Posts: 1214
    • View Profile
    • Robots in Architecture
Re: KUKA_IIWA_Digital_IO_Error
« Reply #5 on: July 27, 2021, 05:06:52 PM »
Hello,

Not at the moment, though technically it's of course no problem at all.
If you look into the UDPSender.java you see that what it sends is basically...
Code: [Select]
return (new Integer(CmdQueue.size()).toString()) + "," + posstr + "," + cartstr + "," + forcevector;
The least needed data here is probably the forcevector string, which consists of...
Code: [Select]
String forcevector = df.format(force.getX()) + "," + df.format(force.getY())+ "," + df.format(force.getZ());
So instead of force.getX() you could get an IO state - just take care to turn it into a number, not "TRUE" or "FALSE" as a string.
In Grasshopper you could then just translate it back.

Best,
Johannes

avishek

  • Forum User
  • *
  • Posts: 21
    • View Profile
Re: KUKA_IIWA_Digital_IO_Error
« Reply #6 on: July 28, 2021, 12:24:16 PM »
Hi Johannes,

I have tried to take in account your suggestion and facing some trouble to get the IO States as force vector outputs. I have put a placeholder boolean and converted to a double and that value can be read in Grasshopper, so that works.
But when I am trying to pass/store the boolean value, read from the media flange, the program does not seem to work. I have followed the code structure in the UDPSender.java to modifiy the CollectPayload() function but the error is coming there. I am attaching a modified UDPSender.java file in the post. Could you please have a look and tell me where is it going wrong?

Thank you

Johannes @ Robots in Architecture

  • Lead Developer
  • Administrator
  • Forum User
  • *****
  • Posts: 1214
    • View Profile
    • Robots in Architecture
Re: KUKA_IIWA_Digital_IO_Error
« Reply #7 on: July 28, 2021, 05:42:51 PM »
I haven't worked with an iiwa properly in a while, but my guess would be that you are instantiating the IO-Group once when the program starts and once in your thread.
Rather construct it once in the base program and then pass a reference to the thread through its constructor.
Also, maybe IOs just aren't threadsafe. What error message are you getting?

Best,
Johannes

avishek

  • Forum User
  • *
  • Posts: 21
    • View Profile
Re: KUKA_IIWA_Digital_IO_Error
« Reply #8 on: July 30, 2021, 12:05:25 PM »
Hi,

If I am using line 83, then I am getting this. Please see the attached image.

Thanks

Johannes @ Robots in Architecture

  • Lead Developer
  • Administrator
  • Forum User
  • *****
  • Posts: 1214
    • View Profile
    • Robots in Architecture
Re: KUKA_IIWA_Digital_IO_Error
« Reply #9 on: July 30, 2021, 12:23:20 PM »
I guess that's the same problem as before, right?
Maybe try stepping through the code to see whether the entire IOGroup is null or just that method is causing problems. Also, try to run your code in the main program to see whether it's thread-related.
Best,
Johannes

avishek

  • Forum User
  • *
  • Posts: 21
    • View Profile
Re: KUKA_IIWA_Digital_IO_Error
« Reply #10 on: July 30, 2021, 12:30:59 PM »
In this case, the problem looks the same but last time RunUDP was running and when I was trying to pass a Digital IO then I was facing the problems. But now after enabling the line 83, I am getting the error while running RunUDP itself and the program is shutting down. I will try to run it in the main code and see what happens then.

Avishek

avishek

  • Forum User
  • *
  • Posts: 21
    • View Profile
Re: KUKA_IIWA_Digital_IO_Error
« Reply #11 on: August 13, 2021, 10:52:57 AM »
Hi Johannes,

With limited knowledge of Java and threading we have tried whatever we could to get the state of IO in the vector list. But with all the modifications we have done so far, we could not make it work and runUDP always gives an erros.
If you get some time, would you be kind enough to have a look at the issue?

Thank you
Avishek

Johannes @ Robots in Architecture

  • Lead Developer
  • Administrator
  • Forum User
  • *****
  • Posts: 1214
    • View Profile
    • Robots in Architecture
Re: KUKA_IIWA_Digital_IO_Error
« Reply #12 on: August 13, 2021, 12:43:54 PM »
Hello,

Have you asked KUKA whether you can read/write outputs from a separate thread? If it's a fundamental limitation, then we cannot do anything anyway and need to move the logic into the main thread.
If you post your current code (both the main .java file where you initialize everything as well as the RunUDP.java file) I can of course also take a look at the code.

Best,
Johannes

avishek

  • Forum User
  • *
  • Posts: 21
    • View Profile
Re: KUKA_IIWA_Digital_IO_Error
« Reply #13 on: August 16, 2021, 01:37:59 PM »
Hi Johannes,

I am attaching the two files here the UDPSender and the RunUDP. In the RunUDP @ line 74 I have declared the default MediaFlange IO and in UDPSender @ line 83 I have tried to read one of the pin. In this state if I run the RunUDP, it fails and gives the error I had posted last time.
It will be great if you have a look and help us to find a way to read the IOs in Grasshopper. Meanwhile we will try to talk to KUKA.
Thank you

Avishek

Johannes @ Robots in Architecture

  • Lead Developer
  • Administrator
  • Forum User
  • *****
  • Posts: 1214
    • View Profile
    • Robots in Architecture
Re: KUKA_IIWA_Digital_IO_Error
« Reply #14 on: August 17, 2021, 08:12:02 AM »
Hello,

Did you try passing the IO group via the constructor? So that UDPSender looks a bit like that:

Code: [Select]
public UDPSender(InetAddress externaladdress, int externalport, BlockingQueue<PRC_CommandData> UDPQueue, MediaFlangeIOGroup iogrp) throws SocketException {
socket = new DatagramSocket(30001);
address = externaladdress;
port = externalport;
CmdQueue = UDPQueue;
flangeIO = iogrp;
}

Currently you always recreate the IO group in the while loop:
flangeIO = new MediaFlangeIOGroup(cabinet);

Best,
Johannes