Robot handling / other commands

Programme

Runtime after programme start

The getRuntime() function specifies the runtime in seconds since the programme was started.

getRuntime();

Exit

The exit() method ends the programme and also switches back to the main menu. In the main menu, the brakes hold the robot in its current position, which means that it consumes less power.

joints(-20.00, 0.00, -23, 90.00, -92, 15.72, 0.5);
exit();
jointsLinear(20.00, 0.00, -23, 90.00, -92, 15.72, 0.5);

Tool, TCP & Weight

Open/Close

The openGripper() / closeGripper() function opens/closes the gripper. No parameters need to be passed, nor is a result returned.

Some grippers can be opened with this function. Of course, this depends on the manufacturer of the gripper, so it does not work with every gripper.

Calculate TCP-offset

It is possible to determine the offset of the tool centre point (TCP) from four specified robot poses using the calculateTCPOffset() function. To do this, a fixed point is approached from different directions with the tool to be calibrated. The positions of the flanges should be as far apart as possible. In the best case, they form a tetrahedron around the centre point.

The respective positions of the flange are calculated from the four robot poses (joint configurations). In the following, these points, which lie on a spherical shell, are used to determine the centre of the sphere. The offset of the TCP results from the vectors between the centre and the flange positions.

The more precisely the fixed point in the centre is aimed at during calibration, the more accurate the result. It is also possible to use five instead of four robot configurations. The best four configurations are then selected automatically.

If the distances between the flange positions are too small or the points lie in a common plane, calibration is not possible and an error is output.

Using the command in horstFX

The four/five joint configurations are passed to the 'calculateTCPOffset()' function. These can be transferred from the current robot position using the 'Joint values' button.

An example of the function being used is programmed here for the H1000:

// H1000
calculateTCPOffset ({ 
    "calibrationJoints": [
        {"joints": [ -1.528, 25.627, 22.704, 23.386, 6.472, -71.733]},
        {"joints": [ 4.927, 53.429, -24.310, -20.278, 90.981, 103.912]},
        {"joints": [ -8.614, 48.885, -16.167, 28.605, 81.420, -181.406]},
        {"joints": [ -0.448, 37.943, -3.433, -1.424, 56.950, -42.952]},
    ]});

Display calculation result

As a result, the offset of the TCP and the standard deviation in millimetres are displayed as an info message. The values can then be used as TCP values when creating a tool (see import and create tools).


Wait for / Pause

Pause

The sleep(timeMillis) command has only one parameter, which specifies how long the programme should pause at this point. The time is specified in milliseconds. The code snippet in the example would therefore let the programme sleep for 1 second (1000 milliseconds).

sleep(1000);

Wait for

The waitfor(inputName, value) function waits for the transferred input until it reaches the transferred value.

  • 1 Parameter: Name of the input (e.g. "INPUT_1")
  • 2 Parameter: Value to be waited for (0 or 1)
waitfor("INPUT_1", 0);

Coordinate system

By default, the basic coordinate system is stored for each programme. Additional self-defined coordinate systems can be added via the configurations. These must already be taught in for this. If you want to change the coordinate system during the programme, this is possible using the setCoordSystem() function. This is mainly used in connection with waypoints with a variable coordinate system.

setCoordSystem("Example_CoordSystem");

Messages and Pop-ups

Messages

Display a hint on the control panel that does not block the programme:

showHint("");

Display a hint on the control panel that does block the programme:

showInfo(""), showWarning("") and showError("") differ only in layout. Warning or error icons are displayed according to the name.

Pop-Up with input

It is possible to enter a value via a pop-up window:

var user_input = getUserInput("Pop-up title", "Insert Text:", "Enter a number...");

The following variations exist:

Some input devices, e.g. dial gauges, output values by simulating a key input that is terminated with Enter. As no person makes the input in this case, it is not necessary to display a pop-up. As soon as the activateReadFromKeyboard() method is called, HorstFX records all keystrokes. The method readFromKeyboard() blocks the programme until it registers an Enter and then returns the entire input as a string.

activateReadFromKeyboard();
showInfo(readFromKeyboard());

Check area

The function checkPoseConditions() checks whether the robot is currently in the specified area and returns true/false. The area to be checked can be specified via a map in three formats:

1. "conditionType": "CUBOID_CORNERS"

The coordinates of 4 corner points of the cuboid are specified. Their arrangement is visualised in the graphical user interface after calling the "Check area" block.
checkPoseConditions({
"conditionType": "CUBOID_CORNERS",
"tool": "No Tool",
"C1": [0.0, 0.0, 0.0],
"C2": [0.2, 0.0, 0.0],
"C3": [0.0, 0.2, 0.0],
"C4": [0.0, 0.0, 0.2]
}, "ex 1");

2. "conditionType": "CUBOID_XYZ"

The coordinates of a corner point are specified, followed by the distances in the x, y and z directions to the three neighbouring corners.

checkPoseConditions({
"conditionType": "CUBOID_XYZ",
"tool": "No Tool",
"C1": [0.1, 0.2, 0.3],
"x": 0.05,
"y": 0.1,
"z": 0.2
}, "ex 2");

3. "conditionType": "JOINTS"

A range in degrees is specified for each axis.

checkPoseConditions({
"conditionType": "JOINTS",
"tool": "No Tool",
"J1": [-50.0, 20.0],
"J2": [-5.0, 54.0],
"J3": [0.0, 30.0],
"J4": [12.0, 56.0],
"J5": [-56.0, 19.0],
"J6": [8.0, 148.0]
}, "ex 3");

The last parameter is a name that can be given to the area just specified.