Revision 35 as of 2013-09-29 10:36:23

Clear message

Note: 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.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Installation of ROS-Industrial on Fanuc controllers

Description: This tutorial guides you through an installation of the ROS-Industrial programs on Fanuc controllers.

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

Tutorial Level: INTERMEDIATE

Next Tutorial: Running the ROS Industrial programs

There are two main steps in setting up a Fanuc manipulator for use with ROS Industrial: 1) building and installing the necessary KAREL and TPE programs, and 2) configuring the controller for use with these programs.

Prerequisites

In order to be able to complete this tutorial, you should have access to the following:

  • the fanuc_driver package (somewhere accessible to your Windows PC)

  • an installation of Fanuc Roboguide1

  • a Windows PC or VM (Roboguide does not run on Linux)
  • a USB stick or some other method of transferring the necessary files to the controller

In addition to the above, the following software options should be present on your robot (besides basic networking and TCP/IP support):

  • KAREL (R632)
  • User Socket Messaging (R648)

Building and installing the programs

Before the ROS Industrial KAREL programs can be transferred to the robot controller, they need to be compiled into binaries. In this tutorial, we'll use Fanuc Roboguide for compiling (or building, in Fanuc terminology), and in the next as a simulator, providing us with a test environment.

Creating a workcell

First, create a new workcell in Roboguide, either by using the wizard or by creating a copy from your actual robot controller. When using the wizard, be sure to select the correct Application package, as well as the correct robot type. On the software options screen, also make sure to select at least options R632 (KAREL) and R648 (User Socket Messaging).

After completing the wizard, you should end up with an empty workcell with just your robot in the middle of it. If you chose to create a copy of the controller, the Cell Browser might show programs and files that were already present on the robot under the Programs and Files sections. As long as they do not conflict with the ROS Industrial KAREL programs, they can be ignored.

Importing the sources

In the Cell Browser, import the KAREL and TPE sources into the workcell using the ProjectAdd Files menu option. Browse to your local fanuc_driver package and select all *.kl files in the KAREL subdirectory not ending in _h or _t. After clicking the Open button, the Files section in the Cell Browser should contain at least these files:

  • libind_hdr.kl

  • libind_log.kl

  • libind_mth.kl

  • libind_pkt.kl

  • libind_rs.kl

  • libssock.kl

  • ros_relay.kl

  • ros_state.kl

Now add the *.ls files in the TPE subdirectory as well. The Cell Browser should now also show the following files:

  • rosrelay.ls

  • rosstate.ls

  • ros.ls

  • ros_movesm.ls

Picking free 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, tags 3 and 4 are used. On the TP, open the Host Comm setup screen, and then go to the SETUP Servers listing using [SHOW]Servers. If you have no other programs making use of USM, three and four should be available.

If not, find two others and note their tag numbers. Now open the ros_relay.kl file in Roboguide and update the MOTION_TAG constant: enter the first of the two free tag numbers. Do the same for ros_state.kl and the STATE_TAG constant, but use the second free number. Save both files and close them.

For more information on User Socket Messaging and tags, see [3, Chapter 11].

Checking flag and register usage

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 present on the controller.

If any of the flags or registers are currently being used, find some alternatives, and note their numbers. Now open ros_relay.kl in Roboguide and update the MOVE_PREG, MOVE_SPD_REG, MOVE_CNT_REG, RI_MSM_RDY and RI_MSM_DRDY constants accordingly. Save the file and close it. Open ros_movesm.ls and update all indices of the flags and registers with their new values. Again, save and close the file.

Note: 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.

Building

Now build all files by selecting ProjectBuildAll in Roboguide (if you have other source files under Files, build only those listed under Importing the sources). No errors or warnings should be reported, and the Programs section in the Cell Browser should show the compiled binaries.

Copying the programs to the real controller

Finally, the binaries need to be transferred to the real controller. This can be done by using a USB stick, or by using a direct transfer over a network connection. Refer to [1, Chapter 8] for information on how to copy files using removable media. Refer to the Roboguide help files for information on how to perform network transfers of files to robots.

After copying the binaries onto the robot controller, open the Program Select window by pressing the Select button on the real TP, then [TYPE]KAREL Progs. Make sure the following programs are listed:

  • LIBIND_HDR

  • LIBIND_LOG

  • LIBIND_MTH

  • LIBIND_PKT

  • LIBIND_RS

  • LIBSSOCK

  • ROS_RELAY

  • ROS_STATE

Also check to make sure the necessary TPE programs are present by pressing [TYPE]TP Programs. You should see entries for:

  • ROSRELAY

  • ROSSTATE

  • ROS

  • ROS_MOVESM

Configuring the controller

Some additional configuration of the controller is required in order for the ROS Industrial programs to work correctly. This should be done on both the virtual TP (in Roboguide) as well as on the real controller.

Maximum concurrent task number

Note: 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.

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

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.

Server Tags

The two tags chosen in the Picking free Server Tags section need to be configured. This section assumes tags 3 and 4 are used, but be sure to configure the correct tags in case you changed them in the KAREL sources earlier.

On the TP, again open the SETUP Servers listing on the Host Comm setup screen. Select tag three and press DETAIL, now configure the tag as follows:

Protocol

SM

Startup State

START

Inactivity Timeout

1 min

The rest of the fields should be empty or at their defaults. Do the same for tag four.

Go back to the SETUP Servers listing and 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.

Refer to [3, Section 11.3.2] for more information on configuring server tags.

Payload settings, Tool and User frames

Three additional configuration items influence the behaviour of the robot when used with the ROS Industrial nodes: the selected user and tool frames and the arm payload schedule.

For the payload schedule, input the correct information using the TP on the Motion/Payload Set setup screen. This screen can be found via 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 at joint coordinate (and velocity) level. 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.

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 in its safety algorithms.

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].

Next

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

Notes

  1. As an alternative to Roboguide, WinOLPC / OlpcPRO or even the KCL console could be used to compile the KAREL sources into p-code binaries. These alternatives are not documented in this tutorial, and only the use of Roboguide is described. (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)

References

  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