Add a Program for Distance Sensor Logging

To adjust the parameters (ProportionalGain, IntegralGain, DifferentialGain), you need to check the measured data of the laser displacement meter during execution of the distance tracking function.

Measured data of the laser displacement meter can be acquired by the following sample program.

Add ★ to the program created below.

Create a Motion Program

____________________________________________________________
Integer fileNum                           ' ★ Declare a file number
Function AIOTrackingSample
'============================================================
' Program to record the measured value of the distance sensor during execution of the distance tracking function.
'============================================================
'------------- Robot configuration ---------------
  Motor On
  Power High
  SpeedS 30
  AccelS 300, 300
  Tool 1
  '--------- Create a CSV file for recording ------------------
  fileNum = FreeFile                      ' ★ Acquire a file number
  WOpen "AIO_Monitor.csv" As fileNum     ' ★ Save to Project folder
  ' ------------- Motion part ---------------
  Move P1                                 ' Move to start point
  Xqt AIO_Monitor                         ' ★ Start to record the measured value by distance sensor
  AIO_TrackingSet 1, -1, 0, -3, 3, 0, 2  ' Sets the distance tracking function
  Wait 2AIO_TrackingStart 1, 10, 0, 0     ' Starts the distance tracking function
  Move P2                                 ' Starts the distance tracking function
  AIO_TrackingEnd                        ' Ends the distance tracking function
  Wait 2
  Quit AIO_Monitor                        ' ★ Quit recording the values by distance sensor
  Close #fileNum                          ' ★ Close CSV
  Motor Off
Fend

____________________________________________________________
Function AIO_Monitor                      ' ★
'=======================================================
' Called by AIOTrackingSample.
' Keep recording values input to Ch1 of analog I/O board to CSV.
'=======================================================
  Do                                      ' ★
    Print #fileNum, AIO_In(1)             ' ★
    Wait 0.002                            ' ★
  Loop                                    ' ★
Fend                                      ' ★
____________________________________________________________