swingToolbarService and editing modbus variable

UR10e is mounted on a linear axis and this axis is controlled by an external motion controller(Beckhoff IPC).

We thought of implementing a swingToolbarService for jogging the axis by changing the modbus variables value when the user presses a button on the toolbar UI. We implemented the UI and UI was appearing correctly in the polyscope(simulated UR)

Now I want to implement the mouse pressed event when the button is pressed. Inside the mousePressed event i want to write a logic to change the modbus variables. Can someone tells me how to implement that?

Or is there any other method to implement the same?

Unfortunately we aren’t given access to any of the GPIO registers/booleans through the API. This has been a pain point for me for a long time. The closest thing you can get is to be able to SEE the value of NAMED registers, but there’s no methods to actually write to their value. This is not the case for the physical IO, which you CAN write to from the API. Seems completely backwards to me, but that’s the way it is.

That said, I’ve used these classes before to send URScript via Java to get the job done:

So you can just send the URScript that can write to a MODBUS register (assuming it exists). The downside here is that this method of communication is noticeably laggy, and gets REALLY bad if you spam click to send a log of scripts rapidly.

1 Like

Thanks eric for the information.

You were mentioning that we can write to a physical IO through API. How to do that from a swingToolbarService program?. From the given urcap we are establishing a socket connection and sending the urscript to the opened socket. How to directly write IO value without a socket communication.

Take a look at this post from a while back. It has a link to the git repo which contains the files/instructions on manipulating the IO through the API: URCap Sample: IO Manipulator - Simple gripper URCap

1 Like