How to Control a Robotiq Gripper with FANUC CRX TP and Karel Programs
Use TP and Karel routines to activate, move, and monitor your Robotiq gripper on FANUC CRX
Context
This article explains how to control a Robotiq gripper connected to a FANUC CRX robot. Using a set of Robotiq-provided Karel and TP programs, you can activate the gripper, command it to open or close, move it to a custom position, and monitor its state. This guide is aimed at integrators and support personnel working with Robotiq grippers on FANUC CRX.
Information
1. Gripper Activation
To activate the gripper, use the IPL_ROBOTIQ_GRIPPER_ACT Karel program. You can pass the slave_id directly from a TP program or through the SET_VAR instruction.
Required Parameters:
- slave_id_from_set_var:
- 0 = from TP program
- 1 = from SET_VAR using variable rqSlaveId
- 0 = from TP program
- slave_id: 9, 2, 3, or 4
Example with SET_VAR:
SET_VAR(entry, 'IPL_ROBOTIQ_GRIPPER_ACT', 'rq_live_test', slave_id_from_set_var, status)
SET_VAR(entry, 'IPL_ROBOTIQ_GRIPPER_ACT', 'rqSlaveId', slave_id, status)
CALL_PROG('IPL_ROBOTIQ_GRIPPER_ACT', prog_index)
2. Open and Close the Gripper
Use the following TP programs:
- IPL_ROBOTIQ_GRIPPER_OPEN – Moves gripper to position 0 (fully open)
- IPL_ROBOTIQ_GRIPPER_CLOSE – Moves gripper to position 255 (fully closed)
These TP programs internally call the IPL_ROBOTIQ_GRIPPER_MOVE Karel program with preset position values.
3. Move Gripper to a Custom Position
Use the move_gripper routine in a Karel program to send a specific grip command.
Syntax:
move_gripper(slave_id, grip_pose, speed, force, wait_motion)
Parameters:
- slave_id: 9, 2, 3, or 4
- grip_pose: value between 0 (open) and 255 (close)
- speed: 0–255
- force: 0–255
- wait_motion: 0 (don’t wait) or 1 (wait for completion)
Returns TRUE when motion is completed.
4. Monitor Gripper State
The following routines allow you to retrieve gripper state feedback from the FANUC CRX robot:
Get Position
get_gripper_position(slave_id)
- Returns grip value between 0 and 255.
Check Activation
is_gripper_activated(slave_id)
- Returns TRUE or FALSE.
Object Detection
get_obj_detection_code(slave_id)
- Returns:
- 0 = Unknown
- 1 = Detected on open
- 2 = Detected on close
- 3 = No object
- 0 = Unknown
Fault Code
get_gripper_fault(slave_id)
- Returns:
- 0 = No fault
- 3–15 = Various fault codes (e.g., 5 = NOT_ACT, 8 = OVER_TEMPERATURE)
- 0 = No fault
5. Integration Tips
- Prefer using routines (move_gripper, get_obj_detection_code, etc.) in your Karel programs for greater control.
- Only use direct Karel program calls (IPL_ROBOTIQ_GRIPPER_MOVE, IPL_ROBOTIQ_GRIPPER_GRIP_CHECK) when specifically required by your logic.
- Always validate the slave ID and check for activation before attempting motion commands.
Conclusion
By using the Robotiq-provided TP and Karel programs, you can fully control and monitor your gripper on a FANUC CRX robot. Whether you're setting a simple open/close sequence or integrating advanced grip checks and fault recovery, these tools give you a flexible control interface.