DoF - a Robotiq Community
Warning sign
The Dof Community was shut down in June 2023. This is a read-only archive.
If you have questions about Robotiq products please reach our support team.
Catherine_Bernier

Hey there,

So here are some command reference and example so that you can program your Robotiq 2-Finger gripper on a Denso RC8 controller.

Notice that all programs starts with #Include "Robotiq.pcs" - This is the required driver : Get it here!
Connect Command
Starts communication with ROBOTIQ Gripper.

Example – Connect 
#Include "Robotiq.pcs"
Sub Main
Dim Opt(5) As Integer
Call Robotiq("Connect", opt) 'Connect to Gripper
'Activation Completed
End Sub
Disconnect Command
Stops communication with ROBOTIQ Gripper.

Example – Disconnect
#Include "Robotiq.pcs"
Sub Main
Dim Opt(5) As Integer
Call Robotiq("Disconnect", opt) 'Disconnect from Gripper
'Gripper Disconnected
End Sub

Move Command
Move to a position with a set speed and force.
Input Values - Option variable array

Option(0) Input: Sets the target position for the Grippers Fingers.
zoom
Option(1) Input: Sets the Gripper closing or opening speed in real time, however, setting a speed will not initiate motion. 

zoom
Option(2) Input: Defines the final gripping force for the Gripper. The force will fix maximum current sent to the motor while in motion. If the current limit is exceeded, the fingers stops and trigger an object detection notification. 

zoom
*Option(3) and Option(4) are not used on the move function. Please ignore values if any. 

Example - Move
#Include "Robotiq.pcs"
Sub Main
Dim Opt(5) As Integer
Opt(0) = &hFF 'Close Position
Opt(1) = &hFF 'Full Speed
Opt(2) = &hFF 'Max Force
Call Robotiq("Move", opt) 'Move Gripper
End Sub
GripperStatus Command
Obtains Gripper Status, Position Request Echo, and Finger Current Bytes.
Return Values - Option variable array

Option(0) Output: Gripper Status Byte 

zoom

Option(1) Output: Reserved 

zoom

Option(2) Output: Fault Status 

zoom

Option(3) Output: Position Request Echo

zoom
Option(4) Output: Position

zoom

Option(5) Output: Finger Current

zoom

Example - Get Activation Status 
#Include "Robotiq.pcs"
Sub Main
Dim opt(5) As Integer
Dim var As Integer
Call Robotiq("Disconnect", opt) 'Disconnect from Gripper
Do While(1)
Call Robotiq("GripperStatus", opt) 'Get Gripper Status
'Check that Gripper Has been set for activation gACT == 0x1
If (opt(0) AND &b000000001) = 1 Then
'Check That Activation Has been completed gSTA != 0x03
If (opt(0) AND &b00110000) <> 1 Then
Exit Do 'Exit Loop
End If
Else
Call Robotiq("Connect", opt) 'Connect Gripper
End If
Loop
End Sub

gACT Command
Returns only the value of the Initialization status.
Return Values - Option variable array

Option(0) Output: Initialization Status

zoom

Example - Get Initialization Status 
#Include "Robotiq.pcs"
Sub Main
Dim Opt(5) As Integer
Call Robotiq("gACT", Opt)
If (Opt(0) = &b0) Then
PrintMsg "Gripper Not Active"
Else
PrintMsg "Gripper Active"
End If
End Sub
gGTO Command
Returns if the robot is stopped or if is currently moving to a point.
Return Values - Option variable array

Option(0) Output: Action Status

zoom
Example – Get Activation Status 
#Include "Robotiq.pcs"
Sub Main
Dim Opt(5) As Integer
Call Robotiq("gGTO", opt)
If (Opt(0) = &b0) Then
PrintMsg "Gripper Stopped"
Else
PrintMsg "Gripper Moving to Position"
End If
End Sub
gSTA Command
Returns the current motion status of the gripper.
Return Values - Option variable array

Option(0) Output: Motion Status 

zoom
Example – Get Motion Status
#Include "Robotiq.pcs"
Sub Main
Dim Opt(5) As Integer
Call Robotiq("gSTA", opt)
Select Case Opt(0)
Case &b00
PrintMsg "Gripper is in Reset"
Case &b01
PrintMsg "Activation in Progress"
Case &b11
PrintMsg "Activation is Completed"
End Select
End Sub
gOBJ Command
Returns the object detection status. The Object detection status is a built-in feature that provides information on possible object pick-up ignore if gGTO == 0.

Option(0) Output: Object detection status. 

zoom

Example – Get Object Detection Status
#Include "Robotiq.pcs"
Sub Main
Dim Opt(5) As Integer
Opt(0) = &hFF 'Close Position
Opt(1) = &h0F 'Slower speed (so gripper can detect when there
'isn’t a part and when it reached the end
'position)
Opt(2) = &hFF 'Max Force
Call Robotiq("Move", opt) 'Move Gripper
Do While(1)
'Get Object Detection Status While
'Gripper is closing
Call Robotiq("gOBJ", opt)
Select Case Opt(0)
Case &b11
PrintMsg "Gripper Fully Close. No Object Found"
Exit Do
Case &b01
PrintMsg "Object Found"
Exit Do
End Select
Loop
End Sub
gFLT Command
Returns Fault status general error messages which are useful for troubleshooting. Fault LED (red) is present on the Gripper chassis; LED can be blue, red or both and be solid or blinking.

Option (0) Output: General error messages that is useful for troubleshooting. 
zoom
gPR Command
Echo of Request position of the Gripper.

Option(0) Output: Value of target position. 

zoom

gPO Command
Current position of Gripper obtained via encoders.

Output(0) Output: Actual position of the Gripper obtained via the encoder.

zoom
gCU Command
Instantaneous current read from the motor drive, value between &b00000000 and &b11111111, approximate current equivalent is 10 * value read in mA.

There you go!
For an example of application, click here.