Configuration of the driver

Important

This tutorial assumes familiarity with Fanuc controller cabinets, the Teach Pendant (iPendant) and the Roboguide environment. For more information on any of the steps in this tutorial, consult the documentation on these subjects provided by Fanuc Robotics.

Overview

In the previous chapter the ROS-Industrial driver components were installed on the robot controller. Now, before they can be started, some additional configuration of both the controller and the programs is required.

Server Tags

The ros_state and ros_relay programs make use of the User Socket Messaging (USM) software option, and expect two Server Tags to be available. By default ROS-Industrial uses 3 and 4, and they must be properly configured before use (1 and 2 are typically used by the built-in FTP server).

To check Tag availability and status, open the Host Comm setup screen (Menu SETUP Host Comm), and then go to the SETUP Servers listing using [SHOW] Servers. Pick two available Tags and write down their numbers (we’ll need those later, when updating the configuration of the ROS-Industrial programs). Finally, make sure the Tags are configured as follows (the comment is not required):

Server Tag configuration example

Go back to the SETUP Servers listing and verify that the chosen Tags are in state STARTED. If not, start each tag with [ACTION] DEFINE, then [ACTION] START, or restart the control cabinet. Make sure they have been started by re-opening the SETUP Servers screen (if necessary) and checking the Current State of both tags: it should say STARTED.

Server Tag state overview

For more information on User Socket Messaging and tags, see Chapter 11 and Section 11.3.2 of the relevant Karel Reference Manual [1].

Flags and Registers

The ros_relay and ros_movesm programs make use of several registers and flags. By default, flags 1 & 2, integer registers 1 & 2 and position registers 1 & 2 are used. Make sure these are not used by any other programs that may be running concurrently with the ROS-Industrial programs on the controller [3]. If any of the flags or registers are currently being used, find some alternatives, and note their numbers. We’ll use those in the next section.

All flags and integer registers can be used, but the position registers need two registers at consecutive locations (ie: PR[34] and PR[35]).

Tip

It is good practice to set a descriptive comment on the used flags and registers. This will make it easier later in this tutorial to verify that the correct flags and registers are used in the ROS-Industrial programs.

Maximum Concurrent Task Number

By default, the controller can only run a small number of concurrent user tasks, which could prevent the ROS-Industrial programs from starting. The currently configured number of allowed tasks is stored in the $SCR.$MAXNUMTASK system variable. Any number above 3 should be enough to start the KAREL programs, but higher may be necessary if the controller also starts other tasks.

Caution

Changing system variables can result in an unstable or non-functioning system. Before making any changes, be sure to have a recent backup of the controller and consult with the robot operator in case you are unsure about any of these steps.

The current value can be found in the SYSTEM Variables screen (Menu NEXT SYSTEM Variables). Scroll down to $SCR, press ENTER, then scroll to the $MAXNUMTASK entry.

To change the number, start the controller using a controlled start. Then open the Program Limits screen using Menu NEXT PROGRAM SETUP. Then input a new value for the User Tasks entry. Now restart the controller using Fctn START (COLD).

Refer to Section B.1.3 of the relevant Fanuc Operator’s Manual for the tool package installed on the robot controller for more information on how to perform a controlled start [2].

Payload, Tool and User Frames (optional)

The following system settings may influence the behaviour of the robot when used with ROS-Industrial, however for basic operation, changes to these settings are not absolutely necessary.

Caution

Changes to payload schedules and / or selected user and tool frames may not be apparent to other users of the robot and can potentially influence all other programs on the controller. Be sure to have a recent backup and / or write down their current values in order to be able to restore them if necessary.

For the payload schedule, input the correct information using the TP on the Motion/Payload Set setup screen (Menu NEXT SYSTEM Motion). Be sure to configure and select the correct schedule. For more information, see Section 9.14 in the the relevant Fanuc Operator’s Manual for the tool package installed on the robot controller [2].

Configured user and tool frames are (currently) ignored in the ROS Industrial nodes as motion trajectories are specified in joint space. This is also true for robot state reporting. The use of a user frame coincident with the world frame is however recommended as it helps in debugging and verifying the motion of the arm and the location of the TCP using the tf tools available in ROS.

Tool frames configured at the robot controller side are also not taken into account by the ROS motion planners, as tools should be represented by an appropriate URDF. The combination of the arm and tool URDFs provides similar information to the planning libraries (see also the Create a URDF for an Industrial Robot tutorial). It is however recommended to manually verify the correct tool frame setup on the TP, as the robot controller also uses this information.

Go to Menu Setup Frames and use the [OTHER] function key to switch between the Tool and User Frame listings. Disable the user frame: use the Next button, then press the CLRIND function key (alternatively, configure an all zeros user frame) [4]. Verify the tool frame setup in the Tool Frame screen.

For more information on user and tool frame setup, see Section 3.9 in the relevant Fanuc Operator’s Manual for the tool package installed on the robot controller [2].

KAREL and TPE Programs

With the information gathered in the previous sections, we can now proceed to configure the KAREL and TP programs on the controller. Even if you do not have to change any of the defaults, you still need to follow the steps in this section.

KAREL Programs

The default configuration of the ros_relay program is shown in Table 1. Table 2 shows the default configuration of the ros_state program.

Table 1: default configuration of ros_relay.

Table 2: default configuration of ros_state.

The data in these two tables will need to be entered into the configuration structures of the respective programs. If the above defaults cannot be used, update the relevant entries with the new values. If for instance Server Tag 3 is not available, use the index number of a Tag that can be used.

Showing Karel variables for a selected program

To access the configuration structures, open the Program Select window by pressing the Select button on the TP, then [TYPE] KAREL Progs. Now select ros_state (or ros_relay), and press ENTER. Press the Data button, then [TYPE] KAREL Vars. You should now see the cfg_ variable, press ENTER.

If you selected ros_state, the next screen should show the contents of Table 2. To change the server tag used, navigate to the s_tag_nr entry, press ENTER and input the new value. Press ENTER again when finished. Do this for all the entries in the structure.

Go back to Program Select and repeat this procedure for the ros_relay program (now use Table 1).

TPE Programs

Unfortunately, the TPE programs cannot use the configuration data of the KAREL programs, so they must be manually updated every time we change the used flags, integer or position registers. Fortunately, only the ros_movesm program needs to be updated.

ROS-Industrial TPE program 'movesm' being edited

On the TP, open the ros_movesm program, and update all statements referencing the flags, integer or position registers with the new values. Make sure they correspond with the values you entered in the KAREL configuration in the previous section. If you’ve set comments on the registers and flags in the Flags and Registers section, the TP program should show these in the appropriate places.

Caution

Incorrect configuration of the flags, integer or position registers can result in damage to your robot, you and / or your workcell. Please make sure they are free to use, before continuing with the next steps. If you are unsure about register or flag usage by other programs, ask the operator of the robot to assist you.

Motion Speed and Segment Termination

By default, the ros_relay program uses a CNT value of 50% and a fixed joint velocity of 20% for all motion commands (Table 1). Depending on the precision required during trajectory execution, these values can be changed. The relevant entries are move_cnt and move_speed in ros_relay, and can be changed using the procedure explained at the beginning of this section.

For more information on the influence of these two values on trajectory execution, see the Improving ROS-Industrial motion on an Industrial Robot tutorial.

Note

As all MoveIt motion plans are planned using the real velocity limits found in the URDF, the MoveIt Trajectory Execution Manager will frequently abort the execution (resulting in Trajectory stop messages on the User Menu on the TP). Execution monitoring can either be disabled, or the allowed time can be increased by setting the relevant parameters. See the The Trajectory Execution Manager section on the Executing Trajectories with MoveIt! page on the MoveIt wiki for more information.

The Troubleshooting subpage of fanuc_driver also has an entry on this: see Robot stops at seemingly random points during trajectory execution.

Complete the Configuration

As the last step, complete the configuration by setting the checked entry in each of the configuration structures to TRUE.