2.3.1. Communication Methods and Data Structure
2.3.1. Communication Methods and Data Structure
In the online tracking function, the UDP/IP communications are performed between a PC as a server and a robots as a client with a communication cycle of 5 msec. Based on the C language, Figure 2.3 shows the structure of data which the PC transmits to and receives from the robot controller through the UDP/IP communications. The data size is 64 Bytes during the transmission and reception process. (char type is 1 byte, int type, 4 bytes and double type, 8 bytes.)
struct{ char Command; char char_dummy[3]; int State; int Count; int int_dummy; double dData[6]; } |
Figure 2.1 Send and Received Data Structure of UDP/IP communications
The Command of Figure 2.3 is the variable that shows the start and end of the connection, the incremental command of the position, and the transmission of the robot position between the PC and the robot. To correctly connect the PC to the robot controller and succeed in data communications, set and transmit appropriate command values as shown in the following Table 2.1. Refer to Chapter 2.3.2 with respect to the order of the online tracking communications, please.
Table 2.1 Variables of Command During the Communications
Variable name | Data transmission direction | ||
Robot controller→ PC | PC → robot controller | ||
Command | 'S' | - Transmit 'S' when running OnLTrack ON. - Notify the start of online tracking | - Notify the connection check by feeding the 'S' back after receiving the 'S' command from the controller. (If 'S' is not transmitted back to the controller, the controller ignores any data afterwards.) |
'P' | - Send 'P' when receiving an incremental command of a location (refer to the variables of State). - Transmit a robot’s current position together. (Refer to the variables of dData.) | - 'P' is used when an incremental command of a location is transmitted. (Refer to the variables of dData.) | |
'F' | - Transmit 'F' when running OnLTrack OFF. - Notify the end of online tracking. | - Transmit 'F' when the PC terminates the online tracking before the controller’s OnLTrack OFF is run. - Notify the end of online tracking. |
The variables of State of Figure 2.3 have meanings only when the robot controller transmits data to the PC. ‘State=1’ means the start of the connection, and ‘State=3’, the end of the connection. Therefore, when the Command is 'S', the State is 1; when the Command is 'F', the State is 3. When the Command is 'P', the State is -1 or 2. ‘2’ means that an incremental command of a position has been applied to a robot’s motion plan; otherwise, ‘-1’ means no application of the incremental command. (At the robot’s singular point, the robot’s motion is limited, so the incremental command of the position may not apply.) The summary on the variables of State is as seen in Table 2.2.
Table 2.2 Variables of State During the Communications
Variable name | Data transmission direction | ||
Robot controller→ PC | PC → robot controller | ||
State | 1 | - Send ‘1’ when running OnLTrack ON. - Notify the start of online tracking. | - N/A (reserved) |
2 | - When a incremental command of a position is received and applied | ||
-1 | -When the incremental command of the position was received but is not applied | ||
3 | - Send ‘3’ when running OnLTrack OFF. - Notify the end of online tracking. |
The Count of Figure 2.3 is the user-set variable that shows how many incremental commands of positions have been transmitted from the PC to the robot controller. When the controller transmits the robot’s current position to the PC, it sends the value of Count that has been received shortly before. Therefore, users increase the Count by one (1) every time they transmit data with use of the variable of Count; then compare the transmitted value of Count with the received Count from the controller; and may check easily whether the data has been transmitted shortly before. The summary on the variable Count is as seen in Table 2.3.
Table 2.3 Variable of Count During the Communications
Variable name | Data transmission direction | |
Robot controller → PC | PC → robot controller | |
Count | - Retransmit the value that has been received from the PC along with the robot’s current position. | - The number of transmitted incremental commands of locations - The user directly increases the value from 0 by one (1) during every transmission and may check whether the controller has received the previous data. |
The dData of Figure 2.3 has different data depending on the transmission directions. The data from a PC to a robot controller are the incremental commands of the positions where the robot will move within 5 msec; the data from the robot controller to the PC are the values of the rectangular coordinates showing the robot’s current position. It is recommended that the incremental command of the position should be transmitted in real time every 5 msec so that the robot moves smoothly considering its variable speed. When the controller runs the OnLTrack ON command, the incremental commands of the positions applies smoothly because the filter settings filter the incremental commands of positions, but a time delay may occur. In addition, incremental commands of positions are limited to the LIMIT POS and LIMIT VEL commands, so please refer to Chapter 2.2.2 of the command description. The robot’s current position in the rectangular coordinates received from the robot controller to the PC means the value of the tool position based on the robot coordinate system that applies the received incremental command of the position. The robot’s current position in the rectangular coordinates is the same as that of the value of the robot’s rectangular coordinates which may be monitored on TP. The summary on the variables of dData are as seen in Table 2.4.
Table 2.4 Variables of dData During the Communications
Variable name | Data transmission direction | |||
PC → robot controller | Robot controller → PC | |||
dData[0]~[5] | - Incremental commands of positions where a robot moves for 5 msec (the coordinate system of the incremental command follows the settings of the OnLTrack ON command)
| - Values of the current tool positions of the robot coordinate system that applies the incremental commands of positions
|