I’m starting out with making a URCap to add some extra functionality to Polyscope, but I’m running into an issue with the new Swing UI. I’ve created a bare-bones view class for my program node, but whenever Polyscope makes a call to JPanel.add() in my buildUI method, I run into an unexpected error:
com.ur.swing.AuthorizationException: Method not supported from URCaps @DemoProgNodeView.buildUI():15
I’m not sure why this error occurs, since the example helloworldswing URCap seems to be able to use the add method just fine. It would be good if somebody could explain why this error occurs or the steps I’m supposed to take to develop an implementaion class for SwingProgramNodeView.
For reference, I’m using version 1.3.55 of the SDK, and the URCap is being made with version 1.3.0 of the API, running on Polyscope 3.6.0. 30512, here’s a screenshot of the error occurring in Polyscope running on a virtual machine:
I can’t upload an attachment, but if you’d like the full source for the URCap I can list it below, or package them up in a zip file once I get the ability to do so. So just for now, here’s the full code of the view class:
package com.companyname.demoapp.impl;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
import com.ur.urcap.api.contribution.ContributionProvider;
import com.ur.urcap.api.contribution.program.swing.SwingProgramNodeView;
public class DemoProgNodeView implements SwingProgramNodeView<DemoProgNodeCont> {
@Override
public void buildUI(JPanel panel, ContributionProvider<DemoProgNodeCont> contProvider) {
// Create a UI using java swing elements
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.add(new JPanel());
}
}
Please note, that this issue is only present on PolyScope 3.6.x, and that PolyScope 5.0 does not have this issue.
A potential workaround could be to keep working on PolyScope 5.0, until this bug is fixed.
I have the same problem as the developers mentioned above in this ticket. However, the problem is only when I run the URcap on the Robot and not on the URsim. As I have a CB3 model it is not possible to use PolyScope 5.0 as you have suggested. Do you have an estimated time for when this problem will be fixed? This is an urgent matter and it’s important that we can test the URcap on a Robot and not only on the URsim.
We found out about this bug when we went to test on a real robot instead of the ursim in the vm.
Now we are unable to test so we cannot continue developping a urcap.
It has already been three weeks since the bugreport, could you give us a status update?
I just upgraded our robots to use the new sdk with swing and encountered the same problem.
It is not really helpful to suggest to “keep” using version 5 which is not available for the CB3 robots as suggested already above.
Is there any update about a fix or a workaround for the time being?
Same error on my side with the Polyscope 3.6, through a virtual machine.
What is a bit strange is that all examples are working fine, either on Polyscope 3.6 or Polyscope 5.0, for me.
But if I am creating a new empty URCap project with the ./newURCap command, and adding the nodes from an example - the localization one in my case for instance - then I am getting the error.
This is the exact method I used to reproduce the problem. Creating a source-for-source copy of the examples provided in swing (I used the “Hello World Swing” example) based on the project templates provided by the ./newURCap script will produce this error consistently, I’m not sure if there’s a difference in program configuration or if it really is a problem with the SDK.
– Daniel
We had the same issue with our URCap (originally in our own io.vention.* package).
We observed that the ur samples (e.g. helloworldswing), once built and uploaded from our same dev environment, did work on the robot!
We diffed everything (pom.xml, assembly.xml, .classpath, activator etc.) - no explanation.
We then tried reworking our own URCap to be inside the com.ur.urcap.examples namespace… and it suddenly worked on the robot!
So there appears to be some sort of namespace dependency in the deployment, on com.ur.urcap.