ModBus communication configuration
About 2726 wordsAbout 9 min
ModBus is a communication method in which PickWiz serves as the client and Robot serves as the server. When PickWiz communicates with Robot, it actively controls Robot and sends instructions to Robot. After receiving the instructions, Robot executes the instructions and returns data.

Before configuring Robot ModBus communication, please refer to the [Project Operation Guide] (项目操作指南.md) to create a new project, and then click Robot Configuration Panel on the main interface to enter the New Robot interface.

1. Add new Robot
(1) Enter the Add Robot interface and click +Add Robot

(2) Select ModBus as the communication method, click Next to enter the Robot Configuration interface

2. Configure Robot
In the Robot Configuration interface, you can configure Robot information, basic communication configuration, and customized communication message configuration.

2.1 Robot information configuration

| Configuration Item | Description |
|---|---|
| Communication method | The communication protocol used to establish communication between PickWiz and Robot, which cannot be modified |
| Configuration name | The name of Robot configuration, supports Chinese and English, numbers, and characters |
| Configuration ID | The unique identification ID of the Robot configuration, which can be modified and only supports numbers |
| Brand | The brand of the Robot. If the Robot is connected to a PLC, select the brand. Other equipment |
| Model | The model of the Robot. If the Robot is connected to a PLC, select the model. Other equipment |
| Model | When selecting another device for brand and model, you need to upload the model of the device. The format of the model file is urdf |
| Number of axes | The number of axes of the robot arm owned by the Robot, optional three axes, four axes, or six axes |
| Rotation expression | Describes Robot's posture in three-dimensional space. Currently, there are two methods: Euler Angles and rotation vector. The order of Euler Angles can be modified. |
2.2 basic communication configuration

| configuration item | Description | |
|---|---|---|
| communication address | host ip | host ip address, the default is 127.0.0.1 | in ModBus communication mode
| port number | Robot connects to the designated port of the host. The default port number is 502. Generally, there is no need to modify | .|
| slave ID | Robot’s unique identifier. Through the slave ID, PickWiz can accurately identify and distinguish each Robot. Only numbers are supported. The default is 1. | can be modified.|
| Byte order | ModBus The byte order for communication between PickWiz and Robot in communication mode. ABCD/BADC/CDAB/DCBA is optional. The default is ABCD | .|
| read and write format | Euler Angles unit | Euler Angle's unit, optional angle, radian, default angle. |
| length unit | Robot uses the length unit, including Robot Pose, Target size, etc. The default is mm | |
| pose type | Robot Pose representation method, default tool pose. The tool pose refers to the pose of the Robot End-effector; the joint angle refers to the pose of each joint of the Robot. The pose combination of each joint can determine the pose of the robot arm or End-effector. Robot brand and model When selecting other devices, the pose type can only select tool pose | by default |
| Retain the number of decimal places | The floating point data in theRobot instruction retains several decimal places and only supports numbers. The default is 1 | |
2.3 Custom communication message configuration

3. ModBus command description
3.1 communication guarantee field
The communication guarantee field is used to monitor communication status and ensure the uniqueness and correctness of instruction execution.

| field | Description |
|---|---|
| Heartbeat | is used to monitor communication status. When the communication between Robot/PLC and PickWiz is connected, PickWiz writes 1 to the corresponding address block; when the communication between Robot/PLC and PickWiz is disconnected (PickWiz does not write 1 for a long time), Robot/PLC writes 0 | to the address block.
| trigger | is used to indicate whether Robot/PLC triggers instructions. When Robot/PLC triggers an instruction, Robot/PLC writes 1 to the trigger address block, and PickWiz reads data from the trigger address block; when Robot/PLC receives the information that PickWiz has received the instruction (the instruction confirmer is 1), Robot/PLC writes 0 to the trigger address block to prevent Robot/PLC from triggering a second time. After PickWiz executes the instruction, PickWiz Return the visual inspection result to Robot/PLC and read data from the trigger address block. If 0 is read, Robot/PLC can read the returned visual inspection result |
| command confirmer | is used to indicate whether PickWiz has received instructions. When Robot/PLC triggers the instruction and is read by PickWiz, PickWiz writes 1 to the instruction confirmer address block to notify Robot/PLC that the instruction has been received; when PickWiz completes the instruction and confirms that Robot/PLC has reset the trigger (write 0), PickWiz synchronously resets the instruction confirmer (writes 0) to inform Robot/PLC that the instruction has been executed, and the process ends. Robot reads the returned visual inspection results and then executes the task. |
| executes the instruction | is used to indicate that Robot/PLC executes a certain instruction. When Robot/PLC needs to execute an instruction, write 100/101 to the execution instruction address block; PickWiz reads data from the execution instruction address block to understand the instruction that Robot/PLC needs to execute. 100 is the photo taking command, 101 is the cache clearing command (used when taking multiple photos) |

3.2 calibration communication message

Robot sent to PickWiz command
When used for Eye-hand calibration and Eye in hand trigger photography, PickWiz obtains the current real-time pose of the Robot.
If Pose Type is Tool Pose selected in the basic communication configuration, the current Robot End-effector's Robot pose (6-bit data) is sent to PickWiz;
If Position Type is Joint Angle in the basic communication configuration, the joint posture (6-bit data) is sent, which is used to calculate the Pick Point joint posture closest to the reference joint posture.
When Eye-hand calibration or Eye in hand triggers photography, Robot writes the current Robot real-time pose to this address block, and PickWiz reads the pose from this address block.
Robot posture is 6-bit data, and storage space for 6-bit data needs to be reserved when writing to the address block.
3.3 visual computing communication message
When the value of execution command is 100, visual calculations can be performed and the following messages will take effect; check the checkbox and the corresponding address input box will pop up below. Enter the address block. When Robot triggers the photo command, it writes data to the corresponding address block and PickWiz will read the data of the corresponding address block.

(1) Robot sent to PickWiz command
| Field | Description |
|---|---|
| Joint pose | Robot reference joint pose, 6-digit data when the pose type is joint angle, you need to input the reference joint pose, which is used to calculate the Pick Point joint pose closest to the reference joint pose |
| Target size | Target size incoming materials are Targets of multiple sizes, and Robot needs to automatically adjust the crawling strategy according to different sizes. In different Scenes, the Target size digits passed in from the Robot side are different from the Target information corresponding to the digits. The circular Scene inputs 1 digit, representing the radius; the cylindrical Scene inputs 2 digits, representing radius\height; the carton Scene inputs 3 digits, representing length\width\height; the quadrilateral Scene inputs 2 digits, representing width\length. |
| Target Size Tolerance | Target Size Tolerance The incoming materials are Targets of multiple sizes, and the Robot needs to automatically adjust the crawling strategy according to different sizes. In different Scenes, the number of digits of the Target size tolerance passed in from the Robot side is different from the Target information corresponding to the number of digits. The number of digits passed in to the circular Scene is 1, representing the tolerance of the radius; the digits passed in to the cylindrical Scene are 2 digits, representing the tolerance of radius\height; the number of digits passed in to the quadrilateral Scene is 2 bits, representing the tolerance of width\length. |
| TargetID | TargetID, used by Robot to automatically switch the crawled Target |
| TaskID | TaskID, used by Robot to automatically switch Tasks |
| Calibration ID | Calibration ID, used for Robot to automatically switch Eye-hand calibration configuration files |
| End-effectorID | End-effectorID, used to automatically switch End-effector when Robot performs tasks |
| ROI ID | ID of ROI, used by Robot to automatically switch ROI |
| Visual ParameterID | Visual ParameterID, used by Robot to automatically switch visual Parameter |
| Scene ObjectID | Scene ObjectID, used by Robot to automatically switch Scene Object |
| Photography calculation type | Photography calculation type 0: Visual calculation after taking a new picture; 1: Use the cached image (the last image collected) for visual calculation; 2: Only take a picture 3: Take a picture of "random attitude automatic sampling" 4: Real-time correction of visual drift 5: Use historical data for visual calculation 6: Shut down the industrial computer |
(2)PickWiz sent to Robot command
- Visual inspection information
| Field | Description |
|---|---|
| Photographing completion signal | Photographing completion signal, 1 bit, indicating that the photographing is completed, Robot/PLC needs to be reset after receiving it |
| Detection result signal | Visual detection signal, 1 bit, default value is 100 for success, 0 for other exceptions, customizable configuration |
| Return instance type | Return instance type. The 1-digit instance type value is 0 for Target and 1 for pallet. Different instance types have different grabbing related information |
| The number of remaining instances | The number of remaining instances, 1 digit, under the fetching logic of shoot one, grab many, returns the current number of remaining cached instances |
| Return the number of instances | Return the number of instances, 1 digit, return the number of instances identified by Instance Segmentation2D, the value is less than or equal to the number of sent instances, if there are multiple instances, the grab related information length will increase with the number of returned instances |
| Total number of instance detections | Total number of instance detections, 1 digit, number of detection instances that have not been filtered by instances |
| Number of valid instances | Number of valid instances, 1 digit, number of detected instances after instance filtering |
| Target type | The type ID that can be returned when identifying multiple Target types. |
- Automatic calibration sampling and sending instructions
When the Eye-hand calibration method is "random posture automatic sampling", you need to set this command, otherwise Robot cannot communicate with PickWiz
| Field | Description |
|---|---|
| Calibration sampling results: Different calibration sampling results correspond to different signal values | 0: The minimum number of samples has been reached. 1: The new sample was added successfully. 11: The new sample failed. Sample list execution completed 13: Failed to generate sampling attitude |
| The next sampling pose | The next moving position of the Robot to collect calibration samples |
- Grab relevant information
The length of the crawling related information expressed below is the number of digits of the length of a single Pick Point. If it is multiple Pick Points, the length is the number of digits x the number of Pick Points.
General information for all Scenes
| field | Description |
|---|---|
| Target category | / |
| grab TargetID | 1 bit; indicates the current Target serial number |
| Pick Point pose | 6 bits; represents the pose data of Pick Point |
| Pick Point index | 1 bit; indicates the current Pick Point serial number |
| Additional information | 1 bit; indicates the current Target’s custom additional information |
| forward point | is only applicable when the pose type is joint angle, the length is 1 + the number of path points; the format is (number of path points, joint path point posture from pre-grab point to Pick Point) |
| retreat point | is only applicable when the pose type is joint angle, the length is 1 + the number of path points; the format is (number of path points, joint path point posture from Pick Point to retreat Pick Point) |
- Visual Status Code
Visual status codes are used for troubleshooting. The complete status codes are as follows:
You need to check "Visual Status Code" in PickWiz Send to Robot Command-Visual Detection Information, and configure the address block and communication data type.
If there is no custom configured visual status code, the default value is to return
100on success and0for other exceptions.
| Error content | Default value | Related nodes |
|---|---|---|
| Success | 100 | / |
| Detect base plate | 301 | Foreground Builder |
| Container frame not detected | 4000 | Container frame detection (Container Builder) |
| Instance not detected | 5000 | Instance Segmentation(Instance Builder) |
| No pose detected | 6000 | Pose Estimation (Pose Builder) |
| Pick Point not detected | 7000 | Pick Point Generation (Grasp Builder) |
| No path detected | 8000 | Robot Trajectory Builder (Trajectory Builder) |
| Instance size not detected | 9000 | Target Size Builder (Size Builder) |
| Empty ROI | 1101 | ValidPoints Criteria |
| No valid instance | 12000 | Instance Criteria |
| No valid Target pose | 13000 | Pose Criteria |
| No valid Pick Point | 14000 | Pick Point filter (Grasp Criteria) |
| All detection results are collision-uncatchable | 15000 | Collision detection filter (Collision Criteria) |
| No instance with valid size | 17000 | Target size filter (Size Criteria) |
| Exception | 20000 | General exception error, please check the log to confirm |
| Insufficient video memory | 20001 | General exception error, please check the log to confirm |
| Invalid input (please check the algorithm Parameter) | 20002 | General exception error, please check the log for confirmation |
| Full inspection | 20003 | Point Cloud processing operator related (full_detect_judgment) |
| Foreign object detection anomaly | 20004 | Instance filter operator related (foreign_matter_judgement) |
4. Edit, copy, and delete Robot configuration
(1) Edit Robot configuration
In the Add Robot interface, left-click the Robot configuration to edit the selected Robot configuration.

(2) Copy Robot configuration
Right-click the Robot configuration on the Add Robot interface to copy the selected Robot configuration.

(3) Delete Robot configuration
Right-click the Robot configuration on the Add Robot interface to delete the selected Robot configuration.

5. Select Robot configuration
After completing the ModBus communication configuration, you can select the Robot configuration for the current TaskScene in the Task main interface and select the corresponding Robot configuration in the Robot configuration selection column. PickWiz will try to establish communication with the Robot through the ModBus communication protocol.

If the communication connection is successful, the Robot communication connection status in the lower left corner of the main interface will display "Connected".

If the communication connection fails, the Robot communication connection status displays "Not Connected". Please check whether the network cable between the Robot and the industrial computer is firmly connected, whether the program loaded and run by the Robot system is correct, and then reconfigure the Robot.
