top of page

9.18.3.3. ModbusTCP slave programming

9.18.3.3. ModbusTCP slave programming

Click “All” and “Communication command” in turn to open the communication command adding page.

Figure 9.18-48 Open the communication command add page

Click “Modbus”.

Figure 9.18-49 Select Modbus

Click “Modbus_TCP”.

Figure 9.18-50 Select Modbus_TCP

Select “slave station” to open the ModbusTCP slave station command adding page (figure 60).

Figure 9.18-51 slave command addition

  1. Write a single digital output DO (discrete input)

Select the DO name as “A Start”, the number of registers is 1 and the register value is 0, and click “Write Single Digital Output”. Finally, scroll to the bottom of the page and click the “Apply” button (Figure 62).

Figure 9.18-52 Adding Write Single Digital Output command

At this time, the robot program “testModbusSlave.lua” has added an command for the robot Modbus slave station to write a single digital output, switch the robot to the automatic mode, click the start button, and the robot will write the address value of the corresponding digital output named “A Start” as 0.

Figure 9.18-53 Write a single digital output LUA program

  1. Write multiple digital outputs DO (discrete input)

Open the ModbusTCP slave command addition page, find the “Digital Output Settings”, select the DO name as “A Start”, the number of registers is 5, and the register values are 1,0,1,0,1, where the number of register values corresponds to the set number of registers, and multiple register values are separated by English commas, and click “Write Digital Output”. Finally, scroll to the bottom of the page and click the “Apply” button (Figure 65).

Figure 9.18-54 Configures Writing Multiple Digital Outputs

At this time, the robot program “testModbusSlave.lua” has added an command for the robot Modbus slave station to write multiple digital outputs. Switch the robot to the automatic mode, click the start button, and the robot will start the slave station “A” and write the values of its four discrete input registers as 1, 0, 1, 0 and 1 respectively.

Figure 9.18-55 Write multiple digital output LUA programs

  1. Read a single digital output DO (discrete input)

Open the ModbusTCP master station command addition page, find “Digital Output Settings”, the name of DO is “A Start”, the number of registers is 1, and the register value does not need to be filled in. Click “Read Digital Output”. Finally, scroll to the bottom of the page and click the “Apply” button (Figure 68).

Figure 9.18-56 Configuring Reading a Single Digital Output

At this time, the robot program “testModbusSlave.lua” has added an command for the robot Modbus to read a single digital output from the station.

Figure 9.18-57 Read a single digital output program

Usually, after reading the Modbus register, the read value is stored in a variable, so it is necessary to define a variable to store the read value. As shown in figure 70, click the “switch mode” button “” to switch the robot lua program to the editable state, and write the variable “AStartValue” with added return value before the “ModbusSlaveReadDO” command, and the value read after executing the program will be stored in “AStartValue”.

Figure 9.18-58 Reading a single digital output into a variable

The register value of coil type is only 0 and 1, so different operations can be carried out by judging the different register values in robot programs. As shown in Figure 71, click the “Switch Mode” button “” to switch the robot teaching program to the non-editable mode, and add two joint motion commands to move to two different points “P1” and “P2” respectively.

Figure 9.18-59 Add motion commands of different points.

As shown in Figure 72, the program is switched to the editable mode again, and the judgment condition of the digital output value “AStartValue” is written. When the value of “AStartValue” is 1, the robot moves to the point “P1”, otherwise the robot moves to the point “P2”.

Figure 9.18-60 Move to different points according to different digital output values

Finally, switch the robot program to non-editable mode, switch the robot to automatic mode, and start the running program on the premise of confirming safety. As shown in figure 73, the second line of the program sets the DO value of the digital output named “A Start” to 1, so the robot will move to the “P1” point after executing the program.

Figure 9.18-61 Read the register value of a single coil and move it

  1. Read multiple digital outputs DO (discrete input)

As shown in Figure 74, open the ModbusTCP master station command addition page, find the “Digital Output Settings”, select the DO name as “A Start”, the number of registers is 2, and the register value does not need to be filled in, and click “Read Digital Output”. Finally, scroll to the bottom of the page and click the “Apply” button (Figure 75).

Figure 9.18-62 Configures Reading Multiple Digital Outputs

As shown in Figure 76, at this time, the robot program “testModbusSlave.lua” has added an command for the robot Modbus to read multiple digital outputs from the station.

Figure 9.18-63 Reading multiple digital output programs

As shown in figure 77, click the “switch mode” button “” to switch the robot lua program to the editable state. Since the number of readings is two, it is necessary to write and add two return values “value1,value2” before the “ModbusSlaveReadDO” command, and the values of the two digital output registers read after executing the program will be stored in the above two variables respectively. Similarly, you can judge “value1” and “value2”.

Figure 9.18-64 Reading Multiple Digital Outputs and Storing Variables

  1. Read DIgital input DI (coil)

As shown in Figure 78, open the ModbusTCP slave command addition page, find the “Digital Input Settings”, select the DI name as “A in place” and the number of registers as 2, and click “Read Digital Input”. Finally, scroll to the bottom of the page and click the “Apply” button (Figure 79).

Figure 9.18-65 Configuring Read Digital Input

As shown in Figure 80, at this time, the robot program “testModbusSlave.lua” has added an command for the robot Modbus to read digital input from the station.

Figure 9.18-66 Reading digital input program commands

As shown in Figure 81, click the “switch mode” button “” to switch the robot lua program to an editable state, and write the return value variable “AState,BState” before the “ModbusSlaveReadDI” command. The two digital input values read after executing the program will be stored in the variables “AState” and “BState” respectively, and you can control the robot to do different operations by judging the variable values.

Figure 9.18-67 Reading digital input program

  1. Read and write operations of analog output AO (input register) and analog input AI (hold register)

The reading and writing operations of analog output (input register) and analog input (holding register) are basically the same as those of digital output (discrete input) and digital input (coil), but the difference is that the data range of the latter is only 0 or 1, while the data range of the former is larger, so the specific operations can refer to the programming of digital output and digital input, and only the reading and writing operations of analog input (Figure 82) and analog output (Figure 83) are shown here.

Figure 9.18-68 Reading Analog Input

Figure 9.18-69 Reading and writing analog output

  1. Waiting for digital input

As shown in Figure 84, open the ModbusTCP slave command addition page, find “Waiting for digital input settings”, select the “A in place” register with DI name as configuration, the waiting status is “True”, and the timeout time is 5000 ms. Click “Add” button, and finally click “Apply” button.

Figure 9.18-70 Add the command of waiting for digital input

As shown in Figure 85, at this time, the robot program “testModbusSlave.lua” has added an command that the robot Modbus slave station waits for digital input. After starting the program, the robot will wait for the value of the “A in place” coil register of the slave station to become true, that is, the value 1. Since the set timeout is 5s, when the “A in place” signal is still 0 after the robot waits for 5s, the robot program will report a timeout error and the program will automatically stop running.

Figure 9.18-71 Waiting for Digital Input Program

  1. Waiting for analog input

As shown in figure 86, open the ModbusTCP slave command addition page, and find the voltage register with the AI name selected for “Waiting for Analog Input Settings”. The waiting state is “>”, the register value is 255, and the timeout time is 5000 ms.. Click “Add” button, and finally click “Apply” button.

Figure 9.18-72 Add an command to wait for analog input

As shown in Figure 87, at this time, the robot program “testModbusSlave.lua” has added an command that the robot Modbus slave station waits for the analog input value. After starting the program, the robot will wait for the slave station’s “voltage” register value to be greater than 255. Since the set timeout time is 5s, when the robot waits for 5s and the “voltage” signal is still less than 255, the robot program will report a timeout error and the program will automatically stop running.

Figure 9.18-73 Waiting for Analog Input Register Program

Open the ModbusTCP Slave command addition page, find the “Wait for Analog Input Setting” (i.e., wait for AI input register setting). Select the AI name as the configured “Liquid Level” register, set the wait condition to “=”, the register value to 255, and the timeout to 5000ms. Click the “Add” button, and finally click the “Apply” button.

Figure 9.18-73-2 Add Wait for Analog Input

At this point, a Modbus Slave command to wait for the AI input register value has been added to the robot program “test.lua”. After starting the program, the robot will continuously wait for the “Liquid Level” register value to equal 255. Since the timeout is set to 5s, if the “Liquid Level” signal still does not equal 255 after the robot waits for 5 seconds, the robot program will report a timeout error and automatically stop running.

9.18.3.4. ModbusTCP slave robot state feedback and control

The ModbusTCP slave input register addresses 310~473 of the cooperative robot are used to feed back the real-time status of the robot (see Annex 1: ModbusTCP slave address mapping table). You only need to read the value of the corresponding register with the master station equipment to obtain the corresponding real-time status data of the robot.

The coil register addresses 300~599 of ModbusTCP slave station of the cooperative robot are used for the master station equipment to control the robot (see Annex 1: ModbusTCP slave address mapping table). Taking coil address 502 as an example, this address function indicates “startup program”.

When the robot is in automatic mode, the master station equipment sets the value of address 502 from 0 to 1, the robot automatically starts to run the currently configured program; Take the coil address 300 as an example. It is used to control the output of the robot control box DO0. When the external master station sets the coil address 300 from 0 to 1, the automatic output of the control box DO0 is valid. Similarly, when the external master station sets the coil address 300 from 1 to 0, the output of the control box DO0 is invalid. As shown in Figure 88, click “Function Digital Input (Coil)” on the ModbusTCP slave station setting page to monitor all current function digital inputs.

Figure 9.18-74 Digital Input of Robot Slave Station Function

Figure 9.18-74 Modbus TCP Slave station address mapping table

Appendix 1: Modbus TCP Slave station address mapping table

9.19. Robot Backgrounder Function

9.19.1. Robot Backgrounder Function

The robot background program is a control program used to process the logical relationship of signals in the process of running the robot in the foreground motion program, and the background is also running, and the two are independent of each other in the operation relationship.

The background program can monitor the operating status of the foreground and at the same time send control signals to the foreground. The background program can also be connected with external devices through I/O communication to monitor and control the operation of robot peripheral equipment. Unlike the foreground teach-in, the background logic program can run commands, which cannot control any axis of motion. Therefore, it cannot be programmed with any robot axis motion commands. Only the logic control function and I/O communication function are retained.

When using a background program, the program scans in a loop from start to finish. The running cycle is 1 millisecond, and a delay function can be added to the background program to control the running cycle. During the execution of the background program, it is not affected by emergency stop, pause, or alarm.

Note

Run up to 8 background programs at the same time.

A maximum of 8 programs can be executed at the same time as background logic, and an error alarm will be sent when the number of programs exceeds the maximum value.

When the power is cut off, the background logic program will be automatically loaded and run according to the set state the next time the power is turned on.

9.19.1.1. Save the robot background program

Backgrounder creation, editing, and saving can only be used in the Backgrounder interface.

Step1:Open the robot background program interface. Open the teaching page, click “Program”, and then click “Coding”. Select the command background program in the upper left corner to enter the background program interface.

Note

The background program only contains logic judgment, assignment instructions, front-end control instructions, I/O interface instructions and Modbus communication instructions.

Figure 9.19-1 The robot background program interface

Step2:In manual mode, open the background teach program file. Click “New” to create a new teaching program file, edit the program, and click “Save” to save the file.

Note

The running cycle of the background program is 1 millisecond, and the provided delay function can be used in the program, as shown in the fourth line of the program in the following figure, to increase the delay of 1 second to control the running cycle.

Figure 9.19-2 Save the robot background program

9.19.1.2. Robot background program management

Successfully saved backgrounders can be created, paused, resumed, and deleted in the backgrounder management interface. The backgrounder management interface allows you to intuitively see the running status of all created backgrounders. Green is running, and red is paused.

Step1:Create a background program. Click the Background Program Management button, select the saved background program from the drop-down box, and click Start Run to run the corresponding background program.

Figure 9.19-3 Start running the robot background program

Step2:Resume and pause the background program. In the background program management page, click Resume and Pause on the monitor to resume and pause the corresponding background program.Click Delete on the monitor program to delete the corresponding background program.

Figure 9.19-4 Pause、resume、delete the background program

9.19.2. Use of the robot user variables

Note

The new user variable function is applicable to the data interaction between the robot background program and the foreground program, or between different background programs.

9.19.2.1. Robot user variable management

Before using user variables, you can rename them to your liking. Open the teach-in page, click “Program”, “Coding”, and “user variable management”, which can be used in both the foreground program and the background program. Click on the variable name to change the variable name directly.

Figure 9.19-5 Robot user variable management

9.19.2.2. Robot user variable use

When user variables are used in foreground and background programs, only the user variable read/write interface can be used.

Step1:In manual mode, open the teach-in program file. Open the teaching page, click “Program”, click “Coding”, and click “New” to create a new teaching program file.

Figure 9.19-6 Create a new teach-in program file

Step2:Use the user variable read interface. Click the “Variable” command, select “User Variable”, click the Get Variable Value drop-down box, select the user variable to be read, and click the “Add” and “Apply” buttons to write the user variable reading interface program.

Figure 9.19-7 Use the user variable read interface

Step3:Use user variables to write interfaces. Click the “Variable” command, select “User Variable”, click the Set Variable Value drop-down box, select the user variable to be set, and fill in the corresponding set value, which supports both constant and variable value. Click the Add and Apply buttons to write user variables and write interface programs.

Figure 9.19-8 Use the user variable write interface

9.20. XY horizontal constant

9.20.1. Overview

The principle of lateral constant force grinding in the XY direction is as follows: Lateral constant force grinding refers to applying a grinding tool (such as a grinding wheel, grinding disc, etc.) with a constant force on a specified workpiece surface, and controlling the movement of the tool along the XY direction to maintain a constant grinding force at the contact point.

9.20.2. Operation process of lateral constant force grinding function in XY direction

To perform constant force grinding using a force sensor, it is necessary to install a grinding tool under the force sensor and configure the tool coordinate system. Click on the “Initial” -> “Base” -> “Coordinate” -> “TCP” button in sequence to enter the “Tool coordinate system settings” interface. Select the coordinate system to be set in the “Coordinate system name” (taking toolcoord 0 coordinate system as an example), and set it according to the size of the end tool.

Figure 9.20-1 Set tool coordinate system

Force control reference coordinate system setting. In the web interface, click on “FT” -> “Reference coord.”, select “Custom coordinates”, and set each parameter to “0”. When the force sensor is working, different reference coordinate systems will affect the magnitude of the external force obtained by the sensor.

Figure 9.20-2 Set reference coordinate

Fix the flat plate to be polished in the robot workspace, and the plate should not shake. Place the end of the tool approximately perpendicular to the polishing plate and teach the starting and ending points.

Figure 9.20-3 Polishing layout diagram

Click on the “Program” -> “Coding” -> “F/T” button in sequence, and add the “FT_Control” instruction. The “FT_Control” command is a force controlled motion command that allows the robot to move around the set force.

Figure 9.20-4 Add FT_Control command

Figure 9.20-5 Example of FT_Control polishing instruction

The specific function of parameters:

Coordinate system name:The name corresponding to setting the sensor coordinate system;

Check the direction of force detection and set the detection threshold:Select the direction of the control force. In horizontal polishing, check Fx and Fy and set the corresponding expected constant force;

PID parameters:Set the PID proportional coefficients for force and torque, generally setting the F_P_gain to 0.001;

Maximum adjustment distance:corresponding to the maximum movement distance in the X, Y, and Z directions;

Maximum adjustment angle:corresponding to the maximum rotation angle of RX, RY, RZ;

Grinding disc radius:determined by the actual radius of the end grinding tool.

9.21. Automatic Singularity Avoidance Trajectory

9.21.1. Overview

When the robot encounters a singular range that cannot be passed by the robot in the LIN and ARC command tracks, the robot will report an error or prompt the next digit to be strange or a singular warning appears.

If you want to be able to reach the next waypoint that will pass through the singular range, you can use this function to avoid the singularity point through joint space or Cartesian space to reach the next target pose.

Figure 9.21-1 A simple schematic diagram of a robot’s singularity

The above figure is a schematic diagram of the robot singularity, the robot singularity includes three kinds of singularity: shoulder, elbow and wrist, and A is the 5 joint center WCP (Wrist Center Point), which is used to judge the shoulder singularity; B is the singular range of the shoulder, which resembles a cylinder, and its radius is the length of the robot DH parameter d4, and the robot enters the singular state when the WCP enters the cylinder B; C is the elbow singularity boundary of the robot, and the robot is in the elbow singularity state when J3=0 or 180°; D is the internal space, and it is in the wrist singular state when J5=0 or 180° at any position in the internal space.

Note

It should be noted that singularity is a motion characteristic determined by the physical structure of the robot, which should be avoided as much as possible during actual operation, and it will lead to changes in the terminal posture and speed and even configuration configuration when it is avoided by algorithms, and it is necessary to consider whether the side effects of avoidance affect the requirements before making a choice.

9.21.2. The trajectory automatically avoids the operation process of the singularity function

In the new program, click Add Robot LIN/ARC type motion command.

Figure 9.21-2 Add LIN/ARC LUA command

2.Click the “LIN” command, select the waypoint of the robot singularity, and click the “Singularity Avoidance” button in the “Motion Protection” sub-option of the command parameter configuration interface.

Figure 9.21-3 Turn on singularity avoidance switch

3.Singularity Avoidance parameters include Guard Mode, Shoulder Singularity, Elbow Singularity, and Wrist Singularity. Among them, the “protection mode” is divided into “joint mode” and “Cartesian mode”, which means that the robot can cross the singular from the joint space or bypass the singular from the Cartesian space; The parameters of the “Singular Adjustment” specify the maximum deviation between the range of the determination of singularity and the singularity avoidance, which is mm for shoulder and elbow singularity units, and ° for wrist singular units.

Note

The joint space will select the nearest trajectory between the joints, so there will be no limit situation, and the joint limit may occur when the Cartesian space is avoided, so you need to pay attention to and adjust it during teaching.

After selecting and setting the singularity avoidance parameters, you can click the “Add” button to add the command, and then click “Apply” to add the LUA command to the program.

Figure 9.21-4 Configure singularity avoidance parameters and add the lua command

The teach-in completes a typical LIN singular avoidance movement lua procedure as follows:

Figure 9.21-5 lua program that contains singularity avoidance instructions

The effect of achieving avoidance is as follows, and the red is the trajectory line at the end of the robot:

Figure 9.21-6 Example of a shoulder singular avoidance trajectory(top: Cartesian space, bottom: joint space)

Figure 9.21-7 Example of an elbow singular avoidance trajectory(top: Cartesian space, bottom: joint space)

Figure 9.21-8 Example of a wrist singular avoidance trajectory (joint space)

6.If the start and end points of the movement are within the set singular range, when more than one singularity occurs during the movement, or even when two or more singular situations occur at the same time, the interface will display a pop-up window of “[Warning] Singular Pose” to indicate that the current singular situation cannot be avoided.

Figure 9.21-9 The current singular situation cannot be avoided

9.22. Singularity crossing function in automatic mode

9.22.1. Overview

When the robot executes LIN or ARC commands and passes through a singularity, its speed may fluctuate drastically, leading to unstable motion control and even potential damage to the equipment. By utilizing the singularity crossing function, the robot can smoothly pass through singularities. This manual takes the example of the LIN command passing through a wrist singularity to illustrate how to use the singularity crossing function in automatic mode.

9.22.2. Operation Flow

  1. Teach the robot to execute the LIN command with two motion control points (named wristlin1 and wristlin2 in this manual).

  2. Click the “Program” button, then click “Coding”, select the “PTP” command under “Motion command”, and add the first motion point.

Figure 9.22-1 Add the first motion point

  1. Select the “LIN” command under “Motion command”, and add the second motion point. In the “Motion protection” section, select “Singularity Crossing,” and set the adjustment ranges for shoulder singularity, elbow singularity, and wrist singularity.

Figure 9.22-2 Set the singularity crossing parameters

  1. Generate and run the Lua program. The typical LIN command program for singularity crossing in automatic mode.

Figure 9.22-3 Typical singularities crossing LIN instructions

  1. Observe the robot’s motion results, and adjust the robot’s movement speed and singularity settings range to achieve different motion accuracy and impact.

9.22.3. Precision Impact Table

  1. Wrist singularity is the most easily triggered singularity type for the robot. A table comparing the precision and impact of wrist singularity for LIN and ARC commands has been compiled. The comparison table for LIN and ARC commands are shown below, (〇 indicates that a collision warning was triggered).

Table 9.22-3-1 Error of wrist singularity LIN command (Unit: mm)

Range / Velocity

2

20

40

60

80

100

2 mm

0.19

0.20

0.20

0.21

4 mm

0.14

0.14

0.14

0.14

0.14

0.14

6 mm

0.40

0.40

0.41

0.41

0.42

0.42

8 mm

0.82

0.83

0.83

0.84

0.83

0.84

10 mm

1.38

1.38

1.39

1.39

1.39

1.41

Table 9.22-3-2 Linear jerk of wrist singularity LIN command (Unit: m/s3)

Range / Velocity

2

20

40

60

80

100

2 mm

0.605

12.040

11.370

2743.000

4 mm

0.916

34.620

110.900

241.300

303.900

400.700

6 mm

0.906

59.700

139.600

343.700

445.600

582.900

8 mm

1.073

67.480

199.600

438.300

553.400

623.900

10 mm

1.013

69.490

195.800

556.600

649.300

953.300

Table 9.22-3-3 Angular jerk of wrist singularity LIN command (Unit: °/s³)

Range / Velocity

2

20

40

60

80

100

2 mm

1122

25140

24780

54890

4 mm

305

9035

26030

39330

60510

80330

6 mm

219

8161

19450

84700

109300

143400

8 mm

478

6651

19780

121600

150500

162100

10 mm

281

5296

14470

161600

177300

256000

Table 9.22-3-4 Error of wrist singularity ARC command (Unit: mm)

Range / Velocity

2

20

40

60

80

100

2 mm

1.06

1.06

1.05

1.05

4 mm

1.58

1.59

1.60

1.62

6 mm

3.31

3.34

3.35

3.32

3.39

3.33

8 mm

5.81

5.83

5.87

5.87

5.87

5.96

10 mm

9.06

9.09

9.12

9.17

9.17

9.22

Table 9.22-3-5 Linear jerk of wrist singularity ARC command (Unit: m/s3)

Range / Velocity

2

20

40

60

80

100

2 mm

13.970

643.000

2230.000

3408.000

4 mm

0.635

24.850

42.480

76.990

6 mm

3.000

19.960

45.350

57.120

77.050

59.800

8 mm

1.494

27.830

90.290

124.200

148.400

168.000

10 mm

0.460

31.870

112.600

211.000

229.300

117.500

Table 9.22-3-6 Angular jerk of wrist singularity ARC command (Unit: °/s³)

Range / Velocity

2

20

40

60

80

100

2 mm

3378

85380

228600

351900

4 mm

1098

31360

71460

104800

6 mm

390

15770

43650

79330

93930

124200

8 mm

315

10270

28770

57000

75840

94050

10 mm

504

6108

21470

34920

47280

97160

  1. Since shoulder singularity and elbow singularity correspond to the robot’s minimum and maximum working boundaries, respectively, precision cannot be used as an evaluation metric. Therefore, an impact comparison table for shoulder singularity is compiled, as shown in Tab, and an impact comparison table for elbow singularity is compiled, as shown below (where 〇 indicates that a collision warning was triggered).

Table 9.22-3-7 Linear jerk of shoulder singularity (Unit: m/s3)

Range / Velocity

2

20

40

60

80

100

40 mm

1.166

99.730

253.200

273.500

70 mm

1.047

92.440

328.900

634.500

878.400

1499.000

100 mm

1.060

90.250

273.900

506.600

926.300

1555.000

Table 9.22-3-8 Angular jerk of shoulder singularity (Unit: °/s³)

Range / Velocity

2

20

40

60

80

100

40 mm

396

89.83

824

348

70 mm

428

121

681

167

1783

35690

100 mm

440

151

473

246

1495

39280

Table 9.22-3-9 Linear jerk of elbow singularity (Unit: m/s3)

Range / Velocity

2

20

40

60

80

100

40 mm

0.905

14.430

52.080

87.380

129.400

657.000

70 mm

1.144

24.320

79.580

270.300

793.300

1478.000

100 mm

1.852

27.930

112.700

328.100

583.000

758.600

Table 9.22-3-10 Angular jerk of elbow singularity (Unit: °/s³)

Range / Velocity

2

20

40

60

80

100

40 mm

347

128

148

142

63

38050

70 mm

424

132

141

21780

56190

95610

100 mm

46

1443

6194

19940

35170

46770


robotic arm
FAIRINO ROBOTIC ARMS

Contact

Location: 10637 Scripps Summit Court,

San Diego, CA. 92131
Phone: (619) 333-FAIR
Email: hello@fairino.us

© 2023 FAIRINO Proudly created By G2T

bottom of page