Toolbar hand - mode

Hello,

I want to drive a seperate axis in hand mode with the toolbar from my URCap. I already created two buttons in the toolbar which can communicate with the installation node from the URCap. But now I dont know, how to set a digital output or send a modbus signal. I’m not able to write a second generateScript method. I know there are URCaps available which have a hand mode for seperate axis. So how can I write a second generateScript method? Or whats the proper way to impelent a hand mode?

No sure what you mean by “hand mode” exactly, but it sounds like you’d like to be able to Jog the external axis forward or backward via the toolbar? Or more generally, send script to the robot via the toolbar?

If this is the case, please see this post: URCap Sample: URCap-ScriptCommunicator

in which Ebbe has provided a class that allows you to send an execute script from Java.

Below is an example of some code I’ve written to do exactly this when pressing the “Forward” or “Reverse” buttons on my toolbar:

reverseButton.addMouseListener(new MouseAdapter() {
			@Override
			public void mousePressed(MouseEvent e) {
				//create a new instance of the ScriptCommand class
				final ScriptCommand jogToSlidePosition = new ScriptCommand();
				//create a new String to hold the command
				String setPosition = "write_output_integer_register(11, 0)";
				String setSpeed = "write_output_integer_register(12, floor(170 * read_input_float_register(0)))";
				String setAcc = "write_output_integer_register(13, 100)";
				String unlockRunstate = "set_runstate_gp_boolean_output_to_value(16, 0)";
				String enableServo = "write_output_boolean_register(16, True)";
				//assign the newly created command as Primary. Secondary commands cannot consume robot time
				jogToSlidePosition.setAsPrimaryProgram();
				//add the created string to the command
				jogToSlidePosition.appendLine(setPosition);
				jogToSlidePosition.appendLine(setSpeed);
				jogToSlidePosition.appendLine(setAcc);
				jogToSlidePosition.appendLine(unlockRunstate);
				jogToSlidePosition.appendLine(enableServo);
				System.out.println(jogToSlidePosition);
				//create a new instance of a ScriptSender
				final ScriptSender sender = new ScriptSender();
				//send the created script using the newly created sender
				sender.sendScriptCommand(jogToSlidePosition);
			}

These classes are incredibly helpful. One thing to note is that it uses socket commands, which are really good at lagging the robot BADLY if you send several requests quickly. You’ll notice this when you use them. They are somewhat slow to respond.

1 Like

Hi, @eric.feldmann,

I just came across this reply of yours while searching for ways to speed up response of ScriptSender.
Is there any way you know of to speed up the response time?
Or at least to prevent the sending of commands in quick succession?

I have a button which sends a command and if you press it many times in succession the teach pendant slows down significantly.
Once you stop pressing, you can observe the machine processing the commands in a very delayed manner.

Not that I’ve found. What you’re describing is exactly the lag I originally talked about. If you find a way to eliminate it, please let me know, because it makes certain applications almost unusable at times.