Discussion

Left ArrowBack to discussions page
Hey there,

So here are some command reference and example so that you can program your Robotiq FT sensor on a Denso RC8 controller.
Notice that all programs starts with #Include "Robotiq_FS.pcs" - This is the required driver : Get it here.

Info Command
Obtain hardware information.
Example - Info
#Include "Robotiq_FS.pcs"
Sub Main
Dim Opt As Variant
Call Robotiq_FS("Info", Opt) 'Get FT300 Sensor Information
PrintMsg "Firmware Ver.: " & Opt(0)
PrintMsg "Serial No.: " & Opt(1)
PrintMsg "Production Year: " & Opt(2)
End Sub
Start_Stream Command
Start data streaming.
Example - Start_Stream
#Include "Robotiq_FS.pcs"
Sub Main
Dim Opt As Variant
Call Robotiq_FS("Start_Stream", Opt) 'Start Streaming
End Sub

Stop_Stream Command
Stop data streaming.
Example - Stop_Stream
#Include "Robotiq_FS.pcs"
Sub Main
Dim Opt As Variant
Call Robotiq_FS("Stop_Stream", Opt) 'Start Streaming
End Sub
Get_Data Command
Get FT300 sensor data.
Example - Get_Data
#Include "Robotiq_FS.pcs"
Sub Main
Dim Opt As Variant
Call Robotiq_FS("Get_Data", Opt) 'Get Force Data
PrintMsg "Fx: " & Opt(0)
PrintMsg "Fy: " & Opt(1)
PrintMsg "Fz: " & Opt(2)
PrintMsg "Mx: " & Opt(3)
PrintMsg "My: " & Opt(4)
PrintMsg "Mz: " & Opt(5)
End Sub

Application Example: Force Data HMI



Force.pn1 Code:

#Include  raw
#Include "Robotiq_FS.pcs"

Dim Option As Variant 'Return Variable
Dim stream_flag As Integer

Dim zero_fx As Single
Dim zero_fy As Single
Dim zero_fz As Single
Dim zero_mx As Single
Dim zero_my As Single
Dim zero_mz As Single

Sub Panel_INITIALIZE()

     'Check if Connection has been made before trying to connect
     If Comm.State(COM_PORT_FT) = 1 Then
          'Get Sensor HW Information
          Call Robotiq_FS("Stop_Stream", Option)
          Call Robotiq_FS("Info", Option)
          'Get Data
          Label10.Caption = Option(0)
          Label11.Caption = Option(1)
          Label12.Caption = Option(2)

          PBSTART.Active = 3 'Enable Start Button

          PLCOMSTATE.FG = &h00FF00
     Else
          'Terminate HMI Panel Program
          PrintMsg "Connection Failed... Exit Panel and Retry"
          PLCOMSTATE.FG = &h0000FF
          Exit Sub
     End If
End Sub

Sub PBSTART_CLICKED()
     'Start Streamming
     Call Robotiq_FS("Start_Stream", Option)
     stream_flag = 1 'Turn Stream Flag -> ON
     PBSTOP.Active = 3
     PBSTART.Active = 1
     PBZERO.Active = 3
End Sub

Sub PBSTOP_CLICKED()
     'Stop Streaming
     Call Robotiq_FS("Stop_Stream", Option)
     stream_flag = 0 'Turn Stream Flag -> OFF
     PBSTOP.Active = 1
     PBSTART.Active = 3
     PBZERO.Active = 1
End Sub

Sub TIMER1_TIMER()
     If stream_flag = 1 Then
          'Get Data
          Call Robotiq_FS("GetData", Option)
          Label18.Caption = SprintF("%-08.3f", Option(0) - zero_fx)
          Label17.Caption = SprintF("%-08.3f", Option(1) - zero_fy)
          Label16.Caption = SprintF("%-08.3f", Option(2) - zero_fz)
          Label15.Caption = SprintF("%-08.3f", Option(3) - zero_mx)
          Label14.Caption = SprintF("%-08.3f", Option(4) - zero_my)
          Label13.Caption = SprintF("%-08.3f", Option(5) - zero_mz)
     End If
End Sub

Sub PBZERO_CLICKED()
     'Zero calibration
     If stream_flag = 1 Then
          Call Robotiq_FS("GetData", Option)
          zero_fx = Option(0)
          zero_fy = Option(1)
          zero_fz = Option(2)
          zero_mx = Option(3)
          zero_my = Option(4)
          zero_mz = Option(5)
     End If
End Sub
Hope this helps.

Catherine Bernier, Jr. Eng. 

Comments

Sign In or Register to comment.
Left ArrowBack to discussions page