Hi,
I am trying to develope a URCap with an InstallationNode and a Toolbar. I finished the developement of the InstallationNode and just wanted to start the developement of the toolbar with soma basic swing components but the toolbar remains empty.
Then I simplified my code and printed some lines to debug.
Here is some of my Code…
The Activator:
public class ToolbarContribution implements SwingToolbarContribution{
private static final int HEADER_FONT_SIZE = 16;
private final ToolbarContext context;
ToolbarContribution(ToolbarContext context) {
this.context = context;
System.out.println("////////// ToolbarContribution initialized. ///////////");
}
@Override
public void openView() {
System.out.println("Opening Toolbar View...");
}
@Override
public void closeView() {
System.out.println("Closing Toolbar View...");
}
@Override
public void buildUI(final JPanel jPanel) {
System.out.println("Building Toolbar UI...");
javax.swing.SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.Y_AXIS));
JLabel label = new JLabel("Welcome to this Toolbar");
label.setFont(new Font("Arial", Font.BOLD, HEADER_FONT_SIZE));
jPanel.add(label);
jPanel.revalidate();
jPanel.repaint();
}
});
}
The ToolbarService:
public class ToolbarService implements SwingToolbarService {
@Override
public Icon getIcon() {
return new ImageIcon(getClass().getResource("/icons/ruhrbotics_logo.png"));
}
@Override
public void configureContribution(ToolbarConfiguration configuration) {
configuration.setToolbarHeight(400);
}
@Override
public SwingToolbarContribution createToolbar(ToolbarContext context) {
System.out.println("Creating SwingToolbarContribution...");
return new ToolbarContribution(context);
}
}
And the ToolbarContribution:
public class ToolbarContribution implements SwingToolbarContribution{
private static final int HEADER_FONT_SIZE = 16;
private final ToolbarContext context;
ToolbarContribution(ToolbarContext context) {
this.context = context;
System.out.println("////////// ToolbarContribution initialized. ///////////");
}
@Override
public void openView() {
System.out.println("Opening Toolbar View...");
}
@Override
public void closeView() {
System.out.println("Closing Toolbar View...");
}
@Override
public void buildUI(final JPanel jPanel) {
System.out.println("Building Toolbar UI...");
javax.swing.SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.Y_AXIS));
JLabel label = new JLabel("Welcome to this Toolbar");
label.setFont(new Font("Arial", Font.BOLD, HEADER_FONT_SIZE));
jPanel.add(label);
jPanel.revalidate();
jPanel.repaint();
}
});
}
With this I was able to find out that the buildUI() method does not run. But for now I am stuck. Here is part of my terminal after starting and closing ursim:
PROFINET registering!
10:47:07.214 WARN - Method used before correct value has been received from controller, returning default = joint_max_speed {thread: Thread-4 , loggerClass: com.ur.polyscope.robot.configuration.joint.JointConfigurationSettings}
10:47:07.214 WARN - Ignoring any future reports of error {thread: Thread-4 , loggerClass: com.ur.polyscope.robot.configuration.joint.JointConfigurationSettings}
Nov 21, 2024 10:47:07 AM com.steadystate.css.parser.CSSOMParser
WARNING: java.lang.ClassNotFoundException: com.steadystate.css.parser.SACParserCSS21 not found by org.w3c.css.sac [170]
Nov 21, 2024 10:47:07 AM com.steadystate.css.parser.CSSOMParser
WARNING: using the default ‘SACParserCSS21’ instead
10:47:07.699 WARN - Not connected to controller, trying to send string:
sec load_installation():
step_count_3d9c06b7_afa1_40f5_acb6_8cac3f3f873b = 0.0
thread Step_Counter_Thread_db87e220_3e1b_4418_a761_a802b3244f53():
while (True):
step_count_3d9c06b7_afa1_40f5_acb6_8cac3f3f873b = step_count_3d9c06b7_afa1_40f5_acb6_8cac3f3f873b + 1.0
sync()
end
end
run Step_Counter_Thread_db87e220_3e1b_4418_a761_a802b3244f53()
set_standard_analog_input_domain(0, 1)
set_standard_analog_input_domain(1, 1)
set_tool_analog_input_domain(0, 1)
set_tool_analog_input_domain(1, 1)
set_analog_outputdomain(0, 0)
set_analog_outputdomain(1, 0)
set_input_actions_to_default()
set_gravity([0.0, 0.0, 9.82])
set_target_payload(0.000000, [0.000000, 0.000000, 0.000000], [0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000])
set_tool_communication(False, 115200, 0, 1, 1.5, 3.5)
set_tool_output_mode(0)
set_tool_digital_output_mode(0, 1)
set_tool_digital_output_mode(1, 1)
set_tool_voltage(0)
set_tcp(p[0.0,0.0,0.0,0.0,0.0,0.0])
set_safety_mode_transition_hardness(1)
end
{thread: Thread-4 , loggerClass: com.ur.polyscope.controllerinterface.internal.ControllerSocket}
10:47:12.588 ERROR - No help files found: Help is unavailable! {thread: AWT-EventQueue-0 , loggerClass: com.ur.view.help.HelpLoader}
10:47:30.401 ERROR - Disconnected and failed: {thread: ControllerConnectionThread , loggerClass: com.ur.polyscope.controllerinterface.internal.ControllerSocket$ConnectionThread}
java.lang.NullPointerException
at com.ur.polyscope.controllerinterface.internal.ControllerSocket$ConnectionThread.parseMessage(ControllerSocket.java:351) ~[polyscope-controllerinterface-impl-4.8.1.jar:?]
at com.ur.polyscope.controllerinterface.internal.ControllerSocket$ConnectionThread.performWhileConnected(ControllerSocket.java:326) ~[polyscope-controllerinterface-impl-4.8.1.jar:?]
at com.ur.polyscope.controllerinterface.internal.ControllerSocket$ConnectionThread.run(ControllerSocket.java:265) [polyscope-controllerinterface-impl-4.8.1.jar:?]
2024-11-21 10:47:30,512 FATAL Unable to register shutdown hook because JVM is shutting down.
10:47:30.512 ERROR - File attachment not found: /home/ur/ursim/ursim-5.11.0.108249/.urcontrol/daemon_ur/log/current {thread: pool-117-thread-1 , loggerClass: com.ur.polyscope.flightrecorder.internal.attachment.FlightRecorderTextFileAttachment}
Thanks in advance for your help.