Note: This tutorial assumes that you have completed the previous tutorials: Installation of ROS-Industrial on Fanuc controllers.
(!) Please ask about problems and questions regarding this tutorial on Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Configuration of the ROS-Industrial driver on Fanuc controllers

Description: This tutorial guides you through the configuration of the ROS-Industrial Fanuc components on the controller.

Keywords: Fanuc, Roboguide, Industrial, R-30iA, R-J3iC, KAREL, TP

Tutorial Level: INTERMEDIATE

Next Tutorial: Running the ROS Industrial programs on your Fanuc robot


Before the ROS-Industrial programs 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 (MenuSETUPHost 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 [3, Chapter 11] and [3, Section 11.3.2].

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 controller1. 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: posreg 34 and 35).

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.

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 (MenuNEXTSYSTEMVariables). 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 MenuNEXTPROGRAM SETUP. Then input a new value for the User Tasks entry. Now restart the controller using FctnSTART (COLD).

Refer to [1, Section B.1.3] for more information on how to perform a controlled start.

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.

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 (MenuNEXTSYSTEMMotion). Be sure to configure and select the correct schedule. For more information, see [1, Section 9.14].

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 MenuSetupFrames 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) 2. Verify the tool frame setup in the Tool Frame screen.

For more information on user and tool frame setup, see [1, Section 3.9].

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.

If the KAREL programs do not show up on the TP, or you cannot change the display TYPE to KAREL Progs, make sure the KAREL support has been properly setup on your controller. See KAREL programs are invisible on the Program Select window on the Troubleshooting page.

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.

Name Type Default Unit Description
checked boolean False - Configuration has been completed by user
f_msm_rdy integer 1 - movesm i'face: 'ready/ack' signal flag
f_msm_drdy integer 2 - movesm i'face: 'data ready' signal flag
loop_hz integer 42 Hz Main loop update rate
move_cnt integer 50 % CNT to set with each joint motion instruction
move_speed integer 20 % Joint speed to set for all trajectory points
pr_move integer 1 - movesm i'face: position register for next trajectory point
r_move_spd integer 1 - movesm i'face: integer register for motion speed
r_move_cnt integer 2 - movesm i'face: integer register for CNT value
s_tcp_nr integer 11000 - TCP port to listen on
s_tag_nr integer 4 - Index of the Server Tag to use
um_clear boolean True - Clear user menu on start
  • Table 1: default configuration of ros_relay.

Name Type Default Unit Description
checked boolean False - Configuration has been completed by user
loop_hz integer 42 Hz Main loop update rate
sloop_div integer 10 - Divider for robot_status reporter loop
s_tcp_nr integer 11002 - TCP port to listen on
s_tag_nr integer 3 - Index of the Server Tag to use
um_clear boolean True - Clear user menu on start
  • 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.

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.

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.


This concludes this tutorial. Continue to the next to find out how to run the programs.


  1. Note that the list of flags can be accessed via MenuI/ONEXTFlag. The F[] array on the TP corresponds to the FLG[] array in the KAREL programs. (1)

  2. Depending on the configuration and mounting of the arm, an 'all-zeros' user frame may not be the best choice. In those situations, be sure to configure a more suitabe frame. (2)


  1. FANUC Robot Series, R-30iA, Handling Tool, Operator's Manual, B-82594EN-2/02
  2. FANUC Robot series, R-30iA/R-30iA Mate Controller, KAREL Function, Operator's Manual, B-83144EN/01
  3. FANUC Robotics SYSTEM, R-30iA Controller, KAREL Reference Manual, MARRC75KR07091E Rev C

Wiki: fanuc/Tutorials/hydro/Configuration (last edited 2019-10-09 11:54:20 by GvdHoorn)