URCap Sample: IO Manipulator - Simple gripper URCap

IO Manipulator

Description of functionality:
This URCap simulates functionality for operating an open/close type gripper directly from the Tool IO of the robot.
User can test open/close of gripper by using buttons in UI, and select whether the program node should grip or release when executed
Actual status of the gripper is read from the IO’s in the API domain.io interface.

What topics are covered:
IO, DigitalIO, AnalogIO, com.ur.urcap.api.domain.io

Find it on Github!

3 Likes

If I want to read the GP_bool_out and GP_float_out IO, how can I do that? I tried to do it like this sample, but only I can read digitalIO,analogIO and modbusIO…

The GP-registers can only be listed in the Collection if they have been assigned a name in IO Setup.
This is the same behavior as is present e.g. in a Set or Wait node, where the register is only listed, when assigned a name.

The GP-registers value cannot be read or written from the API.
To do so, you will either need an RTDE client, or do this via URScript.

Well, using the sample ClientSendScript from SendScriptWithButton I cannot set the GP-registers.

I’m using the script : writer_output_boolean_register(0,False) (for example)
Is that correct?

Then I use this method to read the actual value…

private Boolean ValueVariable (BooleanRegister Variable){
if(Variable.getValueStr().equals(“True”)){
return true;
else{
return false;
}
}

Thanks for your time!

The GP-register values cannot be read using the API.
You need to read these using an RTDE client or in URScript.

E.g. writing with write_outpur_boolean_register(0, False) and reading with value = read_output_boolean_register(0)

One question Jacob…

How can I read the values of the GP-register? For sending the script I’m using the clientSendScript but I don’t know how to read values using this example.

To read the data I need to use something like getRobotRealtimeData? Or I can work like clientSendScript?

I’m not used to use Java, sorry :sweat_smile:

Thanks

The general approach would be something like;

  1. Start server on Java side
  2. Send Script
  3. Script reads value
  4. Script starts TCP client socket back to Java side server
  5. Script sends value
  6. Script closes socket, and terminates itself
  7. Java side server has received value, and terminates the server.

Or use a native RTDE client, to read the data directly from the RTDE register.