11. Robot Peripherals
11.1. Configure Gripper
1/**
2* @brief Configure gripper
3* @param [in] company Gripper manufacturer, to be determined
4* @param [in] device Device number, not currently used, default is 0
5* @param [in] softvesion Software version number, not currently used, default is 0
6* @param [in] bus Device bus position, currently unused, default is 0
7* @return Error code
8*/
9int SetGripperConfig(int company, int device, int softvesion, int bus);
11.2. Get gripper configuration
1/**
2* @brief Get gripper configuration
3* @param [in] company Gripper manufacturer, to be determined
4* @param [in] device Device number, currently unused, default is 0
5* @param [in] softvesion Software version number, currently unused, default is 0
6* @param [in] bus Device bus position, currently unused, default is 0
7* @return Error code
8*/
9int GetGripperConfig(int *company, int *device, int *softvesion, int *bus);
11.3. Activate Gripper
1/**
2* @brief Activate gripper
3* @param [in] index Gripper number
4* @param [in] act 0-reset, 1-activate
5* @return Error code
6*/
7int ActGripper(int index, byte act);
11.4. Control gripper
1/**
2* @brief Control gripper
3* @param [in] index Gripper ID
4* @param [in] pos Position percentage, range [0~100]
5* @param [in] vel Speed percentage, range [0~100]
6* @param [in] force Torque percentage, range [0~100]
7* @param [in] max_time Maximum wait time, range [0~30000], unit ms
8* @param [in] block 0-blocking, 1-non-blocking
9* @param [in] type Gripper type, 0-parallel gripper; 1-rotating gripper
10* @param [in] rotNum Number of rotation cycles
11* @param [in] rotVel Rotation speed percentage [0-100]
12* @param [in] rotTorque Rotation torque percentage [0-100]
13* @return Error code
14*/
15int MoveGripper(int index, int pos, int vel, int force, int max_time, byte block, int type, double rotNum, int rotVel, int rotTorque);
11.5. Get gripper motion status
1/**
2* @brief Get gripper motion status
3* @param [out] fault 0-no error, 1-error
4* @param [out] staus 0-motion not completed, 1-motion completed
5* @return Error code
6*/
7int GetGripperMotionDone(ref int fault, ref int status);
11.6. Get gripper activation status
1/**
2* @brief Get gripper activation status
3* @param [out] fault 0-no error, 1-error
4* @param [out] status bit0~bit15 corresponds to gripper numbers 0~15, bit=0 is not activated, bit=1 is activated
5* @return Error code
6*/
7int GetGripperActivateStatus(ref int fault, ref int status);
11.7. Get Gripper Position
1/**
2* @brief Get gripper position
3* @param [out] fault 0-no error, 1-error
4* @param [out] position Position percentage, range 0~100%
5* @return Error code
6*/
7int GetGripperCurPosition(ref int fault, ref int position);
11.8. Get gripper speed
1/**
2* @brief Get gripper speed
3* @param [out] fault 0-no error, 1-error
4* @param [out] speed Speed percentage, range 0~100%
5* @return Error code
6*/
7int GetGripperCurSpeed(ref int fault, ref int speed);
11.9. Get gripper current
1/**
2* @brief Get gripper current
3* @param [out] fault 0-no error, 1-error
4* @param [out] current Current percentage, range 0~100%
5* @return Error code
6*/
7int GetGripperCurrent(ref int fault, ref int current);
11.10. Get gripper voltage
1/**
2* @brief Get gripper voltage
3* @param [out] fault 0-no error, 1-error
4* @param [out] voltage Voltage, unit 0.1V
5* @return Error code
6*/
7int GetGripperVoltage(ref int fault, ref int voltage);
11.11. Get gripper temperature
1/**
2* @brief Get gripper temperature
3* @param [out] fault 0-no error, 1-error
4* @param [out] temp Temperature, unit °C
5* @return Error code
6*/
7int GetGripperTemp(ref int fault, ref int temp);
11.12. Calculate pre-gripping point - vision
1/**
2* @brief Calculate pre-gripping point - vision
3* @param [in] desc_pos Gripping point Cartesian pose
4* @param [in] zlength Z-axis offset
5* @param [in] zangle Rotation offset around the z-axis
6* @param [out] pre_pos Pre-pick point
7* @return Error code
8*/
9int ComputePrePick(DescPose desc_pos, double zlength, double zangle, ref DescPose pre_pos);
11.13. Calculate retreat point - vision
1/**
2* @brief Calculate retreat point - visual
3* @param [in] desc_pos Retreat point Cartesian pose
4* @param [in] zlength Z-axis offset
5* @param [in] zangle Rotation offset around the Z-axis
6* @param [out] post_pos Retreat point
7* @return Error code
8*/
9int ComputePostPick(DescPose desc_pos, double zlength, double zangle, ref DescPose post_pos);
11.14. Robot Gripper Operation Code Example
1private void button36_Click(object sender, EventArgs e)
2{
3 int company = 4;
4 int device = 0;
5 int softversion = 0;
6 int bus = 2;
7 int index = 2;
8 byte act = 0;
9 int max_time = 30000;
10 byte block = 0;
11 int status=0;
12 int fault=0;
13 int active_status = 0;
14 int current_pos = 0;
15 int current = 0;
16 int voltage = 0;
17 int temp = 0;
18 int speed = 0;
19
20 robot.SetGripperConfig(company, device, softversion, bus);
21 Thread.Sleep(1000);
22 robot.GetGripperConfig(ref company, ref device, ref softversion, ref bus);
23 Console.WriteLine("gripper config:{0},{1},{2},{3}\n", company, device, softversion, bus);
24
25 robot.ActGripper(index, act);
26 Thread.Sleep(1000);
27 act = 1;
28 robot.ActGripper(index, act);
29 Thread.Sleep(1000);
30
31 robot.MoveGripper(index, 90, 50, 50, max_time, block, 0, 0, 0, 0);
32 Thread.Sleep(1000);
33 robot.MoveGripper(index, 30, 50, 0, max_time, block, 0, 0, 0, 0);
34
35 robot.GetGripperMotionDone(ref fault, ref status);
36 Console.WriteLine("motion status:{0},{1}\n", fault, status);
37
38 robot.GetGripperActivateStatus(ref fault, ref active_status);
39 Console.WriteLine("gripper active fault is: {0}, status is: {1}\n", fault, active_status);
40
41 robot.GetGripperCurPosition(ref fault, ref current_pos);
42 Console.WriteLine("fault is:{0}, current position is: {1}\n", fault, current_pos);
43
44 robot.GetGripperCurCurrent(ref fault, ref current);
45 Console.WriteLine("fault is:{0}, current current is: {1}\n", fault, current);
46
47 robot.GetGripperVoltage(ref fault, ref voltage);
48 Console.WriteLine("fault is:{0}, current voltage is: {1} \n", fault, voltage);
49
50 robot.GetGripperTemp(ref fault, ref temp);
51 Console.WriteLine("fault is:{0}, current temperature is: {1}\n", fault, temp);
52
53 robot.GetGripperCurSpeed(ref fault, ref speed);
54 Console.WriteLine("fault is:{0}, current speed is: {1}\n", fault, speed);
55
56 int retval = 0;
57 DescPose prepick_pose = new DescPose();
58 DescPose postpick_pose = new DescPose();
59
60 DescPose p1Desc = new DescPose(-419.524f, -13.000f, 351.569f, -178.118f, 0.314f, 3.833f);
61 DescPose p2Desc = new DescPose(-321.222f, 185.189f, 335.520f, -179.030f, -1.284f, -29.869f);
62
63 retval = robot.ComputePrePick(p1Desc, 10, 0, ref prepick_pose);
64 Console.WriteLine("ComputePrePick retval is: {0}\n", retval);
65 Console.WriteLine("xyz is: {0}, {1}, {2}; rpy is: {3}, {4}, {5}\n",
66 prepick_pose.tran.x, prepick_pose.tran.y, prepick_pose.tran.z,
67 prepick_pose.rpy.rx, prepick_pose.rpy.ry, prepick_pose.rpy.rz);
68
69 retval = robot.ComputePostPick( p2Desc, -10, 0, ref postpick_pose);
70 Console.WriteLine("ComputePostPick retval is: {0}\n", retval);
71 Console.WriteLine("xyz is: {0}, {1}, {2}; rpy is: {3}, {4}, {5}\n",
72 postpick_pose.tran.x, postpick_pose.tran.y, postpick_pose.tran.z,
73 postpick_pose.rpy.rx, postpick_pose.rpy.ry, postpick_pose.rpy.rz);
74
75}
11.15. Get the number of rotations of the rotating gripper
1/**
2* @brief Get the number of rotations of the rotating gripper
3* @param [out] fault 0-no error, 1-error
4* @param [out] num Number of rotations
5* @return Error code
6*/
7int GetGripperRotNum(ref UInt16 fault, ref double num);
11.16. Get the rotation speed percentage of the rotating gripper
1/**
2* @brief Get the rotation speed percentage of the rotating gripper
3* @param [out] fault 0-no error, 1-error
4* @param [out] speed Rotation speed percentage
5* @return Error code
6*/
7int GetGripperRotSpeed(ref UInt16 fault, ref int speed);
11.17. Get the rotation torque percentage of the rotating gripper
1/**
2* @brief Get the rotational torque percentage of the rotating gripper
3* @param [out] fault 0-no error, 1-error
4* @param [out] torque Rotational torque percentage
5* @return Error code
6*/
7int GetGripperRotTorque(ref UInt16 fault, ref int torque);
11.18. Example of retrieving the rotational gripper status code
1int MoveRotGripper(int pos, double rotPos)
2{
3 robot.ResetAllError();
4 robot.ActGripper(1, 1);
5 Thread.Sleep(1000);
6 int rtn = robot.MoveGripper(1, pos, 50, 50, 5000, 1, 1, rotPos, 50, 100);
7 Console.WriteLine($"move gripper rtn is {rtn}" );
8 UInt16 fault = 0;
9 double rotNum = 0.0;
10 int rotSpeed = 0;
11 int rotTorque = 0;
12 robot.GetGripperRotNum(ref fault, ref rotNum);
13 robot.GetGripperRotSpeed(ref fault, ref rotSpeed);
14 robot.GetGripperRotTorque(ref fault, ref rotTorque);
15 Console.WriteLine($"gripper rot num :{ rotNum}, gripper rotSpeed :{rotSpeed}, gripper rotTorque : { rotTorque}");
16 return 0;
17}
11.19. Drive belt start/stop
1/**
2* @brief Conveyor belt start/stop
3* @param [in] status Status, 1-start, 0-stop
4* @return Error code
5*/
6int ConveyorStartEnd(byte status);
11.20. Record IO detection points
1/**
2* @brief Record IO detection point
3* @return Error code
4*/
5int ConveyorPointIORecord();
11.21. Record point A
1/**
2* @brief Record Point A
3* @return Error code
4*/
5int ConveyorPointARecord();
11.22. Record reference point
1/**
2* @brief Record reference point
3* @return Error code
4*/
5int ConveyorRefPointRecord();
11.23. Record Point B
1/**
2* @brief Record Point B
3* @return Error code
4*/
5int ConveyorPointBRecord();
11.24. Conveyor belt workpiece IO detection
1/**
2* @brief Conveyor workpiece IO detection
3* @param [in] max_t Maximum detection time, unit ms
4* @return Error code
5*/
6int ConveyorIODetect(int max_t);
11.25. Get Object Current Position
1/**
2* @brief Get object current position
3* @param [in] mode 1-track grab, 2-track movement, 3-TPD tracking
4* @return Error code
5*/
6int ConveyorGetTrackData(int mode);
11.26. Start conveyor tracking
1/**
2* @brief Start conveyor tracking
3* @param [in] status Status, 1-start, 0-stop
4* @return Error code
5*/
6int ConveyorTrackStart(byte status);
11.27. Conveyor tracking stop
1/**
2* @brief Conveyor tracking stop
3* @return Error code
4*/
5int ConveyorTrackEnd();
11.28. Drive Belt Parameter Configuration
1/**
2* @brief Drive belt parameter configuration
3* @param [in] para[0] Encoder channel 1~2
4* @param [in] para[1] Number of pulses per encoder revolution
5* @param [in] para[2] Conveyor belt travel distance per encoder revolution
6* @param [in] para[3] Workpiece coordinate system number Select the workpiece coordinate system number for tracking motion functionality; set to 0 for tracking grasping and TPD tracking
7* @param [in] para[4] Whether to configure vision 0: No configuration 1: Configuration
8* @param [in] para[5] Speed ratio for conveyor belt tracking and grasping options (1-100). Other options default to 1.
9* @param [in] followType Tracking motion type: 0-Tracking motion; 1 - Inspection movement
10* @param [in] startDis Inspection tracking requires setting, tracking start distance, -1: automatically calculated (inspection starts automatically when the workpiece reaches below the robot), unit mm, default value 0
11* @param [in] endDis Inspection tracking requires setting, tracking end distance, unit mm, default value 100
12* @return Error code
13*/
14int ConveyorSetParam(int encChannel, int resolution, double lead, int wpAxis, int vision, double speedRadio, int followType, int startDis=0, int endDis=100);
11.29. Set conveyor belt pickup point compensation
1/**
2* @brief Set conveyor belt catch point compensation
3* @param [in] cmp Compensation position double[3]{x, y, z}
4* @return Error code
5*/
6int ConveyorCatchPointComp(double[] cmp);
11.30. Conveyor belt tracking linear motion
1/**
2* @brief Conveyor belt tracking linear motion
3* @param [in] name Motion point name
4* @param [in] tool Tool coordinate number, range [0~14]
5* @param [in] wobj Workpiece coordinate number, range [0~14]
6* @param [in] vel Velocity percentage, range [0~100]
7* @param [in] acc Acceleration percentage, range [0~100], currently unavailable
8* @param [in] ovl Velocity scaling factor, range [0~100]
9* @param [in] blendR [-1.0] - move to position (blocked), [0~1000.0] - smooth radius (unblocked), unit mm
10* @return Error code
11*/
12int ConveyorTrackMoveL(string name, int tool, int wobj, float vel, float acc, float ovl, float blendR);
11.31. Conveyor communication input detection
1/**
2* @brief Conveyor communication input detection
3* @param [in] timeout Wait timeout in ms
4* @return Error code
5*/
6int ConveyorComDetect(int timeout);
11.32. Conveyor Communication Input Detection Trigger
1/**
2* @brief Conveyor Communication Input Detection Trigger
3* @return Error code
4*/
5int ConveyorComDetectTrigger();
11.33. Conveyor Communication Input Detection Trigger Example Program
1private void button3_Click(object sender, EventArgs e)
2{
3
4 // Disable the button to prevent repeated clicks
5 button3.Enabled = false;
6
7 // Execute time-consuming operations in a background thread
8 Thread conveyorThread = new Thread(ConveyorTest);
9 conveyorThread.IsBackground = true;
10 conveyorThread.Start();
11}
12
13private void button4_Click(object sender, EventArgs e)
14{
15 // Get user input
16 string input = texBox.Text;
17 Console.WriteLine($"please input a number to trigger:{input}");
18
19 int rtn = robot.ConveyorComDetectTrigger();
20 Console.WriteLine($"ConveyorComDetectTrigger return value: {rtn}");
21
22}
23
24private void ConveyorTest()
25{
26 // Use Invoke to update controls on the UI thread
27 this.Invoke((MethodInvoker)delegate {
28 Console.WriteLine( "Starting conveyor test...");
29 });
30
31 int retval = 0;
32 int index = 1;
33 int max_time = 30000;
34 bool block = false;
35 retval = 0;
36
37 /* Conveyor belt grabbing process */
38 DescPose startdescPose = new DescPose(139.176f, 4.717f, 9.088f, -179.999f, -0.004f, -179.990f);
39 JointPos startjointPos = new JointPos(-34.129f, -88.062f, 97.839f, -99.780f, -90.003f, -34.140f);
40
41 DescPose homePose = new DescPose(139.177f, 4.717f, 69.084f, -180.000f, -0.004f, -179.989f);
42 JointPos homejointPos = new JointPos(-34.129f, -88.618f, 84.039f, -85.423f, -90.003f, -34.140f);
43
44 ExaxisPos exaxisPos = new ExaxisPos(0, 0, 0, 0);
45 DescPose offdese = new DescPose(0, 0, 0, 0, 0, 0);
46
47 // Move to a safe position
48 retval = robot.MoveL(homejointPos, homePose, 1, 1, 100, 100, 100, -1, exaxisPos, 0, 0, offdese, 1, 1);
49 Console.WriteLine($"MoveL to safe position return value: {retval}");
50
51 // Conveyor detection
52 retval = robot.ConveyComDetect(1000 * 10);
53 Console.WriteLine($"ConveyorComDetect return value: {retval}");
54
55 // Get tracking data
56 retval = robot.ConveyorGetTrackData(2);
57 Console.WriteLine($"ConveyorGetTrackData return value: {retval}");
58
59 // Start tracking
60 retval = robot.ConveyorTrackStart(2);
61 Console.WriteLine($"ConveyorTrackStart return value: {retval}");
62
63 // Move to the starting position
64 robot.MoveL(startjointPos, startdescPose, 1, 1, 100, 100, 100, -1, exaxisPos, 0, 0, offdese, 1, 1);
65 robot.MoveL(startjointPos, startdescPose, 1, 1, 100, 100, 100, -1, exaxisPos, 0, 0, offdese, 1, 1);
66
67 // End tracking
68 retval = robot.ConveyorTrackEnd();
69 Console.WriteLine($"ConveyorTrackEnd return value: {retval}");
70
71 // Return to safe position
72 robot.MoveL(homejointPos, homePose, 1, 1, 100, 100, 100, -1, exaxisPos, 0, 0, offdese, 1, 1);
73
74 this.Invoke((MethodInvoker)delegate {
75 Console.WriteLine( "Conveyor belt test completed!");
76 button3.Enabled = true;
77 });
78}
11.34. Robot Conveyor Belt Operation Example Program
1private void btnConvert_Click(object sender, EventArgs e)
2{
3 Robot robot = new Robot();
4 robot.RPC( "192.168.58.2");
5 DescPose pos1 = new DescPose(0, 0, 0, 0, 0, 0);
6 DescPose pos2 = new DescPose(0, 0, 0, 0, 0, 0);
7
8 pos1.tran.x = -351.175;
9 pos1.tran.y = 3.389;
10 pos1.tran.z = 431.172;
11 pos1.rpy.rx = -179.111;
12 pos1.rpy.ry = -0.241;
13 pos1.rpy.rz = 90.388;
14
15 pos2.tran.x = -333.654;
16 pos2.tran.y = -229.003;
17 pos2.tran.z = 404.335;
18 pos2.rpy.rx = -179.139;
19 pos2.rpy.ry = -0.779;
20 pos2.rpy.rz = 91.269;
21 int rtn = -1;
22
23 double[] cmp = new double[3] { 0, 9.99, 0};
24 rtn = robot.ConveyorCatchPointComp(cmp);
25 if(rtn != 0)
26 {
27 return;
28 }
29 Console.WriteLine($"ConveyorCatchPointComp: rtn {rtn}");
30
31 rtn = robot.MoveCart(pos1, 0, 0, 100.0f, 180.0f, 100.0f, -1.0f, -1);
32 Console.WriteLine($"MoveCart: rtn {rtn}");
33
34 rtn = robot.ConveyorIODetect(10000);
35 Console.WriteLine($"ConveyorIODetect: rtn {rtn}");
36
37 robot.ConveyorGetTrackData(1);
38 rtn = robot. ConveyorTrackStart(1);
39 Console.WriteLine($"ConveyorTrackStart: rtn {rtn}");
40
41 rtn = robot.ConveyorTrackMoveL( "cvrCatchPoint", 0, 0, 100.0f, 0.0f, 100.0f, -1.0f, 0, 0);
42 Console.WriteLine($"ConveyorTrackMoveL: rtn {rtn}");
43
44 rtn = robot.MoveGripper(1, 59, 43, 21, 30000, 0);
45 Console.WriteLine($"MoveGripper: rtn {rtn}");
46
47 rtn = robot.ConveyorTrackMoveL( "cvrRaisePoint", 0, 0, 100.0f, 0.0f, 100.0f, -1.0f, 0, 0);
48 Console.WriteLine($"ConveyorTrackMoveL: rtn {rtn}");
49
50 rtn = robot.ConveyorTrackEnd();
51 Console.WriteLine($"ConveyorTrackEnd: rtn {rtn}");
52
53 rtn = robot.MoveCart(pos2, 0, 0, 100.0f, 180.0f, 100.0f, -1.0f, -1);
54 Console.WriteLine($"MoveCart: rtn {rtn}");
55
56 rtn = robot.MoveGripper(1, 100, 43, 21, 30000, 0);
57 Console.WriteLine($"MoveGripper: rtn {rtn}");
58}
11.35. End Sensor Configuration
1/**
2* @brief End Sensor Configuration
3* @param [in] idCompany Manufacturer, 18-JUNKONG; 25-HUIDE
4* @param [in] idDevice Type, 0-JUNKONG/RYR6T.V1.0
5* @param [in] idSoftware Software version, 0-J1.0/HuiDe1.0 (not yet available)
6* @param [in] idBus Mounting location, 1-End 1 port; 2-End 2 port... 8-Endpoint 8 port (not yet available)
7* @return Error code
8*/
9int AxleSensorConfig(int idCompany, int idDevice, int idSoftware, int idBus);
11.36. Get endpoint sensor configuration
1/**
2* @brief Get terminal sensor configuration
3* @param [out] idCompany Manufacturer, 18-JUNKONG; 25-HUIDE
4* @param [out] idDevice Type, 0-JUNKONG/RYR6T.V1.0
5* @return Error code
6*/
7int AxleSensorConfigGet(ref int idCompany, ref int idDevice);
11.37. End-of-line sensor activation
1/**
2* @brief End-of-line sensor activation
3* @param [in] actFlag 0-reset; 1-activate
4* @return Error code
5*/
6int AxleSensorActivate(int actFlag);
11.38. End Sensor Register Write
1/**
2* @brief End Sensor Register Write
3* @param [in] devAddr Device Address Number 0-255
4* @param [in] regHAddr High 8 bits of the register address
5* @param [in] regLAddr Low 8 bits of the register address
6* @param [in] regNum Number of registers 0-255
7* @param [in] data1 Value to write to the register 1
8* @param [in] data2 Value to write to the register 2
9* @param [in] isNoBlock 0-blocking; 1-non-blocking
10* @return Error code
11*/
12 int AxleSensorRegWrite(int devAddr, int regHAddr, int regLAddr, int regNum, int data1, int data2, int isNoBlock);
11.39. End Sensor Code Example
1private void button2_Click_1(object sender, EventArgs e)
2{
3 robot.AxleSensorConfig(18, 0, 0, 1);
4 int company = -1;
5 int type = -1;
6 robot.AxleSensorConfigGet(ref company, ref type);
7 Console.WriteLine( "company is " + company + ", type is " + type);
8
9 int rtn = robot.AxleSensorActivate(1);
10 Console.WriteLine( "AxleSensorActivate rtn is " + rtn);
11
12 Thread.Sleep(1000);
13
14 rtn = robot.AxleSensorRegWrite(1, 4, 6, 1, 0, 0, 0);
15 Console.WriteLine( "AxleSensorRegWrite rtn is " + rtn);
16}
11.40. Obtain robot peripheral protocol
New in version C#SDK-v1.0.6.
1/**
2* @brief Get robot peripheral protocol
3* @param [out] protocol Robot peripheral protocol number 4096-Extended Axle Control Card; 4097-ModbusSlave; 4098-ModbusMaster
4* @return Error code
5*/
6int GetExDevProtocol(ref int protocol);
11.41. Set robot peripheral protocol
New in version C#SDK-v1.0.6.
1/**
2* @brief Set robot peripheral protocol
3* @param [in] protocol Robot peripheral protocol number 4096-Extended Axis Control Card; 4097-Modbus Slave; 4098-Modbus Master
4* @return Error code
5*/
6int SetExDevProtocol(int protocol);
11.42. Example program for setting robot peripheral protocol
1private void btnSetProto_Click(object sender, EventArgs e)
2{
3 int protocol = 4096;
4 int rtn = robot.SetExDevProtocol(protocol);
5
6 Console.WriteLine( "SetExDevProtocol rtn " + rtn);
7 rtn = robot.GetExDevProtocol(ref protocol);
8 Console.WriteLine( "GetExDevProtocol rtn " + rtn + " protocol is: " + protocol);
9}
11.43. Get end-point communication parameters
1/**
2* @brief Get terminal communication parameters
3* @param param Terminal communication parameters
4* @return Error code
5*/
6int GetAxleCommunicationParam(ref AxleComParam getParam);
11.44. Set terminal communication parameters
1/**
2* @brief Set terminal communication parameters
3* @param param Terminal communication parameters
4* @return Error code
5*/
6int SetAxleCommunicationParam(AxleComParam param);
11.45. Set terminal file transfer type
1/**
2* @brief Set the terminal file transfer type
3* @param type 1-MCU upgrade file; 2-LUA file
4* @return Error code
5*/
6int SetAxleFileType(int type);
11.46. Set enable terminal LUA execution
1/**
2* @brief Enable LUA execution at the end
3* @param enable 0-Disabled; 1-Enabled
4* @return Error code
5*/
6int SetAxleLuaEnable(int enable);
11.47. End LUA file exception error recovery
1/**
2* @brief End-of-file LUA file exception error recovery
3* @param status 0-do not recover; 1-recover
4* @return Error code
5*/
6int SetRecoverAxleLuaErr(int status);
11.48. Get the enable status of the terminal LUA execution
1/**
2* @brief Get the enable status of the terminal LUA execution
3* @param [out] status 0-disabled; 1-enabled
4* @return Error code
5*/
6int GetAxleLuaEnableStatus(ref int status);
11.49. Set the enable type of the terminal LUA terminal device
1/**
2* @brief Set the enable type of the terminal LUA terminal device
3* @param [in] forceSensorEnable Force sensor enable status, 0-disabled; 1-enabled
4* @param [in] gripperEnable Gripper enable status, 0-disabled; 1-enabled
5* @param [in] IOEnable IO device enable status, 0-disabled; 1-enabled
6* @return Error code
7*/
8int SetAxleLuaEnableDeviceType(int forceSensorEnable, int gripperEnable, int IOEnable);
11.50. Get the enable type of the end-of-line LUA device
1/**
2* @brief Get the enable type of the end LUA device
3* @param [out] forceSensorEnable Force sensor enable status, 0-disabled; 1-enabled
4* @param [out] gripperEnable Gripper enable status, 0-disabled; 1-enabled
5* @param [out] IOEnable IO device enable status, 0-disabled; 1-enabled
6* @return Error code
7*/
8int GetAxleLuaEnableDeviceType(ref int forceSensorEnable, ref int gripperEnable, ref int IOEnable);
11.51. Get the currently configured end device
1/**
2* @brief Get the currently configured end device
3* @param [out] forceSensorEnable Force sensor enable device number 0-disabled; 1-enabled
4* @param [out] gripperEnable Gripper enable device number, 0-disabled;1-enabled
5* @param [out] IODeviceEnable IO device enable ID, 0-disabled; 1-enabled
6* @return Error code
7*/
8int GetAxleLuaEnableDevice(ref int[] forceSensorEnable, ref int[] gripperEnable, ref int[] IODeviceEnable);
11.52. Set enable gripper action control functionality
1/**
2* @brief Set enable claw action control function
3* @param [in] id claw device number
4* @param [in] func func[0]-claw enable; func[1]-claw initialization; 2-position setting;3-Set speed; 4-Set torque; 6-Read gripper status; 7-Read initialization status; 8-Read fault code; 9-Read position; 10-Read speed;11-read torque
5* @return Error code
6*/
7int SetAxleLuaGripperFunc(int id, int[] func);
11.53. Get enable claw action control function
1/**
2* @brief Get enable claw action control function
3* @param [in] id Gripper device ID
4* @param [out] func func[0]-Gripper enable; func[1]-Gripper initialization; 2-Position setting; 3-Speed setting; 4-Torque setting; 6-Read gripper status; 7-Read initialization status; 8-Read fault code; 9-Read position; 10-Read speed; 11-Read torque
5* @return Error code
6*/
7int GetAxleLuaGripperFunc(int id, ref int[] func);
11.54. Writing robot Ethercat slave file
1/**
2* @brief Writing robot Ethercat slave file
3* @param [in] type Slave file type, 1-upgrade slave file; 2-upgrade slave configuration file
4* @param [in] slaveID Slave ID
5* @param [in] fileName Upload file name
6* @return Error code
7*/
8int SlaveFileWrite(int type, int slaveID, string fileName);
11.55. Upload terminal Lua open protocol file
1/**
2* @brief Upload end Lua open protocol file
3* @param filePath Local lua file path name ".../AXLE_LUA_End_DaHuan.lua"
4* @return Error code
5*/
6int AxleLuaUpload(string filePath);
11.56. Robot Ethercat slave enters boot mode
1/**
2* @brief Robot Ethercat slave enters boot mode
3* @return Error code
4*/
5int SetSysServoBootMode();
11.57. Robot End-of-Arm LUA File Operation Code Example
1 private void button41_Click(object sender, EventArgs e)
2{
3 ROBOT_STATE_PKG pkg = new ROBOT_STATE_PKG();
4 robot.AxleLuaUpload("D://zUP/AXLE_LUA_End_JunDuo_Xinjingcheng.lua");
5
6 AxleComParam param = new AxleComParam(7, 8, 1, 0, 5, 3, 1);
7 robot.SetAxleCommunicationParam(param);
8
9 AxleComParam getParam = new AxleComParam();
10 robot.GetAxleCommunicationParam(ref getParam);
11 Console.WriteLine("GetAxleCommunicationParam param is {0} {1} {2} {3} {4} {5} {6}",
12 getParam.baudRate, getParam.dataBit, getParam.stopBit, getParam.verify,
13 getParam.timeout, getParam.timeoutTimes, getParam.period);
14
15 robot.SetAxleLuaEnable(1);
16 int luaEnableStatus = 0;
17 robot.GetAxleLuaEnableStatus(ref luaEnableStatus);
18 robot.SetAxleLuaEnableDeviceType(0, 1, 0);
19
20 int forceEnable = 0;
21 int gripperEnable = 0;
22 int ioEnable = 0;
23 robot.GetAxleLuaEnableDeviceType(ref forceEnable, ref gripperEnable, ref ioEnable);
24 Console.WriteLine("GetAxleLuaEnableDeviceType param is {0} {1} {2}", forceEnable, gripperEnable, ioEnable);
25
26 int[] func = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
27 robot.SetAxleLuaGripperFunc(1, func);
28 int[] getFunc = new int[16];
29 robot.GetAxleLuaGripperFunc(1, ref getFunc);
30 int[] getforceEnable = new int[16];
31 int[] getgripperEnable = new int[16];
32 int[] getioEnable = new int[16];
33 robot.GetAxleLuaEnableDevice(ref getforceEnable, ref getgripperEnable, ref getioEnable);
34 Console.WriteLine("\ngetforceEnable status : ");
35 foreach (int i in getforceEnable)
36 {
37 Console.Write(i + ",");
38 }
39 Console.WriteLine("\ngetgripperEnable status : ");
40 foreach (int i in getgripperEnable)
41 {
42 Console.Write(i + ",");
43 }
44 Console.WriteLine("\ngetioEnable status : ");
45 foreach (int i in getioEnable)
46 {
47 Console.Write(i + ",");
48 }
49 Console.WriteLine();
50 robot.ActGripper(1, 0);
51 Thread.Sleep(2000);
52 robot.ActGripper(1, 1);
53 Thread.Sleep(2000);
54 robot.MoveGripper(1, 90, 10, 100, 50000, 0, 0, 0, 0, 0);
55 int pos = 0;
56 while (true)
57 {
58 robot.GetRobotRealTimeState(ref pkg);
59 Console.WriteLine("gripper pos is " + pkg.gripper_position);
60 Thread.Sleep(100);
61 }
62}
11.59. Code example
New in version C#SDK-V1.1.3: Web-3.8.2
1private void button11_Click(object sender, EventArgs e)
2{
3
4 ROBOT_STATE_PKG pkg = new ROBOT_STATE_PKG();
5 int state = 0;
6 while (true)
7 {
8 int rtn = robot.GetSmarttoolBtnState(ref state);
9 string binaryString = Convert.ToString(state, 2).PadLeft(32, '0');
10 Console.WriteLine($"GetSmarttoolBtnState rtn (binary): {binaryString}");
11 Thread.Sleep(100);
12 }
13
14}
11.60. Upload Open Protocol Lua File
New in version C#SDK-V1.1.7: Web-3.8.5
1/**
2* @brief Upload Open Protocol Lua File
3* @param filePath Local open protocol lua file path name
4* @return Error code
5*/
6public int OpenLuaUpload(String filePath)
11.61. Get Slave Board Parameters
New in version C#SDK-V1.1.7: Web-3.8.5
1/**
2* @brief Get Slave Board Parameters
3* @param type 0-Ethercat, 1-CClink, 3-Ethercat, 4-EIP
4* @param version Protocol version
5* @param connState 0-Disconnected 1-Connected
6* @return Error code
7*/
8public int GetFieldBusConfig(int[] type, int[] version, int[] connState)
11.62. Write Slave DO
New in version C#SDK-V1.1.7: Web-3.8.5
1/**
2* @brief Write Slave DO
3* @param DOIndex DO number
4* @param wirteNum Number to write
5* @param status Value to write, max 8
6* @return Error code
7*/
8public int FieldBusSlaveWriteDO(int DOIndex, int wirteNum, int[] status)
11.63. Write Slave AO
New in version C#SDK-V1.1.7: Web-3.8.5
1/**
2* @brief Write slave station AO
3* @param [in] AOIndex AO number
4* @param [in] writeNum Number of values to write
5* @param [in] status Array of values to write (maximum 8), AO0~AO15 are integer type, AO16~AO31 are floating point type
6* @return Error code
7*/
8public int FieldBusSlaveWriteAO(int AOIndex, int writeNum, double[] status)
11.64. Read Slave DI
New in version C#SDK-V1.1.7: Web-3.8.5
1/**
2* @brief Read Slave DI
3* @param DOIndex DI number
4* @param readNum Number to read
5* @param status Read value, max 8
6* @return Error code
7*/
8public int FieldBusSlaveReadDI(int DOIndex, int readNum, int[] status)
11.65. Read Slave AI
New in version C#SDK-V1.1.7: Web-3.8.5
1/**
2* @brief Read Slave AI
3* @param AIIndex AI number
4* @param readNum Number to read
5* @param status Read value, max 8
6* @return Error code
7*/
8public int FieldBusSlaveReadAI(int AIIndex, int readNum, double[] status)
11.66. Wait for Extended DI Input
New in version C#SDK-V1.1.7: Web-3.8.5
1/**
2* @brief Wait for Extended DI Input
3* @param DIIndex DI number
4* @param status 0-Low level; 1-High level
5* @param waitMs Max waiting time (ms)
6* @return Error code
7*/
8public int FieldBusSlaveWaitDI(int DIIndex, int status, int waitMs)
11.67. Wait for Extended AI Input
New in version C#SDK-V1.1.7: Web-3.8.5
1/**
2* @brief Wait for Extended AI Input
3* @param AIIndex AI number
4* @param waitType 0-Greater than; 1-Less than
5* @param value AI value
6* @param waitMs Max waiting time (ms)
7* @return Error code
8*/
9public int FieldBusSlaveWaitAI(int AIIndex, int waitType, double value, int waitMs)
11.69. Control Array Sucker
New in version C#SDK-V1.1.7: Web-3.8.5
1/**
2* @brief Control Array Sucker
3* @param slaveID Slave ID
4* @param len Length
5* @param ctrlValue Control value 1-Suction at max vacuum; 2-Suction at set vacuum; 3-Stop suction
6* @return Error code
7*/
8public int SetSuckerCtrl(int slaveID, int len, int[] ctrlValue)
11.70. Get Array Sucker Status
New in version C#SDK-V1.1.7: Web-3.8.5
1/**
2* @brief Get Array Sucker Status
3* @param slaveID Slave ID
4* @param state Adsorption state 0-Release object; 1-Workpiece detected and adsorbed successfully; 2-No object adsorbed; 3-Object detached
5* @param pressValue Current vacuum degree Unit kpa
6* @param error Sucker current error code
7* @return Error code
8*/
9public int GetSuckerState(int slaveID, int[] state, int[] pressValue, int[] error)
11.71. Wait for Sucker Status
New in version C#SDK-V1.1.7: Web-3.8.5
1/**
2* @brief Wait for Sucker Status
3* @param slaveID Slave ID
4* @param state Adsorption state 0-Release object; 1-Workpiece detected and adsorbed successfully; 2-No object adsorbed; 3-Object detached
5* @param ms Max waiting time
6* @return Error code
7*/
8public int WaitSuckerState(int slaveID, int state, int ms)
11.72. Array Sucker Control Command Code Example
1private void TestSucker(Robot robot)
2{
3
4 int[] ctrl = new int[20];
5 int state=0;
6 int pressValue=0;
7 int error=0;
8 int rtn;
9
10
11 // Upload and load open protocol file
12 robot.OpenLuaUpload(@"C:\SDK\CtrlDev_sucker.lua");
13 Thread.Sleep(2000);
14 robot.UnloadCtrlOpenLUA(1);
15 robot.LoadCtrlOpenLUA(1);
16 Thread.Sleep(1000);
17
18 // Control sucker in broadcast mode with maximum adsorption capacity
19 ctrl[0] = 1;
20 robot.SetSuckerCtrl(0, 1, ctrl);
21
22 // Monitor states of sucker 1 and sucker 12 in a loop
23 for (int i = 0; i < 100; i++)
24 {
25 robot.GetSuckerState(1, ref state, ref pressValue, ref error);
26 Console.WriteLine($"sucker1 state is {state}, pressValue is {pressValue}, error num is {error}");
27 robot.GetSuckerState(12, ref state, ref pressValue, ref error);
28 Console.WriteLine($"sucker12 state is {state}, pressValue is {pressValue}, error num is {error}");
29 Thread.Sleep(100);
30 }
31 // Wait for sucker 1 to reach adsorbed state, timeout 100ms
32 int ret = robot.WaitSuckerState(1, 1, 100);
33 Console.WriteLine($"WaitSuckerState result is {ret}");
34
35 // Unicast mode to turn off sucker 1 and 12
36 ctrl[0] = 3;
37 robot.SetSuckerCtrl(1, 1, ctrl);
38 robot.SetSuckerCtrl(12, 1, ctrl);
39
40 robot.CloseRPC();
41}
11.73. Laser peripheral on/off function
New in version C#SDK-V1.1.8: Web-3.8.6
1/**
2* @brief Laser peripheral on/off function
3* @param [in] OnOff 0-off 1-on
4* @param [in] weldId Weld seam ID, default is 0
5* @return Error code
6*/
7public int LaserTrackingLaserOnOff(int OnOff, int weldId)
11.74. Laser tracking start/stop function
New in version C#SDK-V1.1.8: Web-3.8.6
1/**
2* @brief Laser tracking start/stop function
3* @param [in] OnOff 0-stop 1-start
4* @param [in] coordId Laser peripheral tool coordinate system number
5* @return Error code
6*/
7public int LaserTrackingTrackOnOff(int OnOff, int coordId)
11.75. Laser positioning - fixed direction
New in version C#SDK-V1.1.8: Web-3.8.6
1/**
2* @brief Laser positioning - fixed direction
3* @param [in] direction 0-x+ 1-x- 2-y+ 3-y- 4-z+ 5-z-
4* @param [in] vel Speed in %
5* @param [in] distance Maximum positioning distance in mm
6* @param [in] timeout Positioning timeout in ms
7* @param [in] posSensorNum Laser calibrated tool coordinate number
8* @return Error code
9*/
10public int LaserTrackingSearchStart_xyz(int direction, int vel, int distance, int timeout, int posSensorNum)
11.76. Laser positioning - arbitrary direction
New in version C#SDK-V1.1.8: Web-3.8.6
1/**
2* @brief Laser positioning - arbitrary direction
3* @param [in] directionPoint XYZ coordinates of the positioning input point
4* @param [in] vel Speed in %
5* @param [in] distance Maximum positioning distance in mm
6* @param [in] timeout Positioning timeout in ms
7* @param [in] posSensorNum Laser calibrated tool coordinate number
8* @return Error code
9*/
10public int LaserTrackingSearchStart_point(DescTran directionPoint, int vel, int distance, int timeout, int posSensorNum)
11.77. Laser positioning stop
New in version C#SDK-V1.1.8: Web-3.8.6
1/**
2* @brief Laser positioning stop
3* @return Error code
4*/
5public int LaserTrackingSearchStop()
11.78. Laser IP configuration
New in version C#SDK-V1.1.8: Web-3.8.6
1/**
2* @brief Laser IP configuration
3* @param [in] ip IP address of the laser peripheral
4* @param [in] port Port number of the laser peripheral
5* @return Error code
6*/
7public int LaserTrackingSensorConfig(string ip, int port)
11.79. Laser peripheral sampling period configuration
New in version C#SDK-V1.1.8: Web-3.8.6
1/**
2* @brief Laser peripheral sampling period configuration
3* @param [in] period Laser peripheral sampling period in ms
4* @return Error code
5*/
6public int LaserTrackingSensorSamplePeriod(int period)
11.80. Laser peripheral driver loading
New in version C#SDK-V1.1.8: Web-3.8.6
1/**
2* @brief Laser peripheral driver loading
3* @param [in] type Laser peripheral driver protocol type 101-Ruiniu 102-Chuangxiang 103-Quanshi 104-Tongzhou 105-Aotai
4* @return Error code
5*/
6public int LoadPosSensorDriver(int type)
11.81. Laser Peripheral Driver Unloading
New in version C#SDK-V1.1.8: Web-3.8.6
1/**
2* @brief Laser peripheral driver unloading
3* @return Error code
4*/
5public int UnLoadPosSensorDriver()
11.82. Laser Weld Seam Trajectory Recording
New in version C#SDK-V1.1.8: Web-3.8.6
1/**
2* @brief Laser weld seam trajectory recording
3* @param [in] status 0-stop recording 1-real-time tracking 2-start recording
4* @param [in] delayTime Delay time in ms
5* @return Error code
6*/
7public int LaserSensorRecord1(int status, int delayTime)
11.83. Laser Weld Seam Trajectory Replay
New in version C#SDK-V1.1.8: Web-3.8.6
1/**
2* @brief Laser weld seam trajectory replay
3* @param [in] delayTime Delay time in ms
4* @param [in] speed Speed in %
5* @return Error code
6*/
7public int LaserSensorReplay(int delayTime, double speed)
11.84. Laser Tracking Replay
New in version C#SDK-V1.1.8: Web-3.8.6
1/**
2* @brief Laser tracking replay
3* @return Error code
4*/
5public int MoveLTR()
11.85. Laser Weld Seam Trajectory Recording and Replay
1/**
2* @brief Laser Seam Trajectory Recording and Replay
3* @param [in] delayMode Mode 0-Delay Time 1-Delay Distance
4* @param [in] delayTime Delay time in milliseconds (ms)
5* @param [in] delayDisExAxisNum Extended Axis Number
6* @param [in] delayDis Delay distance in millimeters (mm)
7* @param [in] sensitivePara Compensation Sensitivity Coefficient
8* @param [in] trackMode Fixed-point Tracking Type. 0-Extended Axis Asynchronous Motion; 1-Robot
9* @param [in] triggerMode Fixed-point Tracking Trigger Method. 0-Tracking Duration; 1-IO
10* @param [in] runTime Robot Fixed-point Tracking Duration in seconds (s)
11* @param [in] speed Speed in percentage (%)
12* @return Error Code
13*/
14public int LaserSensorRecordandReplay(int delayMode, int delayTime, int delayDisExAxisNum,double delayDis, double sensitivePara, int trackMode, int triggerMode,double runTime, double speed)
11.86. Move to Laser Record Start Point
New in version C#SDK-V1.1.8: Web-3.8.6
1/**
2* @brief Move to laser record start point
3* @param [in] moveType 0-PTP 1-LIN
4* @param [in] ovl Speed in %
5* @return Error code
6*/
7public int MoveToLaserRecordStart(int moveType, double ovl)
11.87. Move to Laser Record End Point
New in version C#SDK-V1.1.8: Web-3.8.6
1/**
2* @brief Move to laser record end point
3* @param [in] moveType 0-PTP 1-LIN
4* @param [in] ovl Speed in %
5* @return Error code
6*/
7public int MoveToLaserRecordEnd(int moveType, double ovl)
11.88. Move to Laser Sensor Positioning Point
New in version C#SDK-V1.1.8: Web-3.8.6
1/**
2* @brief Move to laser sensor positioning point
3* @param [in] moveFlag Motion type: 0-PTP; 1-LIN
4* @param [in] ovl Speed scaling factor, 0-100
5* @param [in] dataFlag Weld seam cache data selection: 0-execute planning data; 1-execute recorded data
6* @param [in] plateType Plate type: 0-corrugated plate; 1-corrugated cardboard; 2-fence plate; 3-oil drum; 4-corrugated shell steel
7* @param [in] trackOffectType Laser sensor offset type: 0-no offset; 1-base coordinate system offset; 2-tool coordinate system offset; 3-laser sensor raw data offset
8* @param [in] offset Offset value
9* @return Error code
10*/
11public int MoveToLaserSeamPos(int moveFlag, double ovl, int dataFlag, int plateType, int trackOffectType, DescPose offset)
11.89. Get laser sensor positioning point coordinate information
New in version C#SDK-V1.1.8: Web-3.8.6
1/**
2* @brief Get laser sensor positioning point coordinate information
3* @param [in] trackOffectType Laser sensor offset type: 0-no offset; 1-base coordinate system offset; 2-tool coordinate system offset; 3-laser sensor raw data offset
4* @param [in] offset Offset value
5* @param [out] jPos Joint position [°]
6* @param [out] descPos Cartesian position [mm]
7* @param [out] tool Tool coordinate system
8* @param [out] user Workpiece coordinate system
9* @param [out] exaxis Extended axis position [mm]
10* @return Error code
11*/
12public int GetLaserSeamPos(int trackOffectType, DescPose offset, ref JointPos jPos, ref DescPose descPos, ref int tool, ref int user, ref ExaxisPos exaxis)
11.90. Laser Peripheral Sensor Parameter Configuration and Debugging Code Example
New in version C#SDK-V1.1.8: Web-3.8.6
1void testLaserConfig()
2{
3 int[] ctrl = new int[20];
4 int state;
5 int pressValue;
6 int error;
7 robot.LaserTrackingSensorConfig("192.168.58.20", 5020);
8 robot.LaserTrackingSensorSamplePeriod(20);
9 robot.LoadPosSensorDriver(101);
10 robot.LaserTrackingLaserOnOff(0, 0);
11 System.Threading.Thread.Sleep(3000);
12 robot.LaserTrackingLaserOnOff(1, 0);
13}
11.91. Laser Trajectory Scanning and Trajectory Replay Code Example
New in version C#SDK-V1.1.8: Web-3.8.6
1void testLaserRecordAndReplay()
2{
3 int[] ctrl = new int[20];
4 int state;
5 int pressValue;
6 int error;
7 robot.OpenLuaUpload("D://zUP/CtrlDev_laser_ruiniu-0117.lua");
8 System.Threading.Thread.Sleep(2000);
9 robot.SetCtrlOpenLUAName(0, "CtrlDev_laser_ruiniu-0117.lua");
10 robot.UnloadCtrlOpenLUA(0);
11 robot.LoadCtrlOpenLUA(0);
12 System.Threading.Thread.Sleep(8000);
13 for (int i=0;i<10;++i)
14 {
15 JointPos startjointPos = new JointPos(56.205, -117.951, 141.872, -118.149, -94.217, -122.176);
16 DescPose startdescPose = new DescPose(-97.552, -282.855, 26.675, 174.182, -1.338, -91.707);
17 ExaxisPos exaxisPos = new ExaxisPos(0, 0, 0, 0);
18 DescPose offdese = new DescPose(0, 0, 0, 0, 0, 0);
19
20 robot.MoveL(startjointPos, startdescPose, 1, 0, 100, 100, 100, -1, exaxisPos, 0, 0, offdese, 0);
21 robot.LaserSensorRecord1(2, 10);
22
23 JointPos endjointPos = new JointPos(68.809, -87.100, 121.120, -127.233, -95.038, -109.555);
24 DescPose enddescPose = new DescPose(-103.555, -464.234, 13.076, 174.179, -1.344, -91.709);
25 robot.MoveL(endjointPos, enddescPose, 1, 0, 50, 100, 100, -1, exaxisPos, 0, 0, offdese, 0);
26
27 robot.LaserSensorRecord1(0, 10);
28 robot.MoveToLaserRecordStart(1, 30);
29 robot.LaserSensorReplay(10, 100);
30 robot.MoveLTR();
31 robot.LaserSensorRecord1(0, 10);
32 Console.WriteLine($"Number of completions : {i+1} ");
33 }
34
35}
11.92. Laser Positioning and Real-time Tracking Code Example
New in version C#SDK-V1.1.8: Web-3.8.6
1public static void testLasertrack()
2{
3 int[] ctrl = new int[20];
4 int state;
5 int pressValue;
6 int error;
7 robot.OpenLuaUpload("D://zUP/CtrlDev_laser_ruiniu-0117.lua");
8 System.Threading.Thread.Sleep(2000);
9 robot.SetCtrlOpenLUAName(0, "CtrlDev_laser_ruiniu-0117.lua");
10 robot.UnloadCtrlOpenLUA(0);
11 robot.LoadCtrlOpenLUA(0);
12 System.Threading.Thread.Sleep(8000);
13 for (int i = 0; i < 10; ++i)
14 {
15 JointPos startjointPos = new JointPos(56.205, -117.951, 141.872, -118.149, -94.217, -122.176);
16 DescPose startdescPose = new DescPose(-97.552, -282.855, 26.675, 174.182, -1.338, -91.707);
17 ExaxisPos exaxisPos = new ExaxisPos(0, 0, 0, 0);
18 DescPose offdese = new DescPose(0, 0, 0, 0, 0, 0);
19 DescTran directionPoint = new DescTran();
20
21 robot.MoveL(startjointPos, startdescPose, 1, 0, 100, 100, 100, -1, exaxisPos, 0, 0, offdese, 0);
22 robot.LaserTrackingSearchStart_xyz(3, 100, 300, 1000, 3);
23 robot.LaserTrackingSearchStop();
24 robot.MoveToLaserSeamPos(1, 30, 0, 0, 0, offdese);
25
26 robot.LaserTrackingTrackOnOff(1, 3);
27
28 JointPos endjointPos = new JointPos(68.809, -87.100, 121.120, -127.233, -95.038, -109.555);
29 DescPose enddescPose = new DescPose(-103.555, -464.234, 13.076, 174.179, -1.344, -91.709);
30 robot.MoveL(endjointPos, enddescPose, 1, 0, 20, 100, 100, -1, exaxisPos, 0, 0, offdese, 0);
31 robot.LaserTrackingTrackOnOff(0, 3);
32 Console.WriteLine($"Number of completions : {i + 1} ");
33 }
34}
11.93. Extended Axis and Robot Synchronized Laser Tracking Code Example
New in version C#SDK-V1.1.8: Web-3.8.6
1public void TestLaserTrackAndExitAxis()
2{
3 ExaxisPos startexaxisPos = new ExaxisPos(0, 0, 0, 0);
4 ExaxisPos seamexaxisPos = new ExaxisPos(-10, 0, 0, 0);
5 ExaxisPos endexaxisPos = new ExaxisPos(-30, 0, 0, 0);
6 DescPose offdese = new DescPose(0, 0, 0, 0, 0, 0);
7 JointPos startjointPos = new JointPos(58.337, -119.628, 146.037, -116.358, -92.224, -117.654);
8 DescPose startdescPose = new DescPose(-53.375, -255.363, 0.919, 178.054, 1.077, -94.026);
9 for (int i=0;i<10;++i)
10 {
11 robot.ExtAxisSyncMoveJ(startjointPos, startdescPose, 1, 0, 100, 100, 100, startexaxisPos, -1, 0, offdese);
12 Console.WriteLine("11111");
13 int ret = robot.LaserTrackingSearchStart_xyz(3, 100, 300, 1000, 2);
14 robot.LaserTrackingSearchStop();
15 Console.WriteLine("2222");
16 int tool = 0;
17 int user = 0;
18 JointPos seamjointPos = new JointPos();
19 DescPose seamdescPose = new DescPose();
20 robot.GetLaserSeamPos(0, offdese, ref seamjointPos, ref seamdescPose, ref tool, ref user, ref startexaxisPos);
21 Console.WriteLine($"{seamjointPos.jPos[0]}, {seamjointPos.jPos[1]}, {seamjointPos.jPos[2]}, " +
22 $"{seamjointPos.jPos[3]}, {seamjointPos.jPos[4]}, {seamjointPos.jPos[5]}, " +
23 $"{seamdescPose.tran.x}, {seamdescPose.tran.y}, {seamdescPose.tran.z}, " +
24 $"{seamdescPose.rpy.rx}, {seamdescPose.rpy.ry}, {seamdescPose.rpy.rz}");
25 if (ret == 0)
26 {
27 robot.ExtAxisSyncMoveJ(seamjointPos, seamdescPose, 1, 0, 100, 100, 100, seamexaxisPos, -1, 0, offdese);
28 Console.WriteLine("3333");
29 robot.LaserTrackingTrackOnOff(1, 2);
30 JointPos endjointPos = new JointPos(70.580, -90.918, 126.593, -125.154, -92.162, -105.403);
31 DescPose enddescPose = new DescPose(-53.375, -419.020, 0.920, 178.054, 1.076, -94.026);
32 robot.ExtAxisSyncMoveL(endjointPos, enddescPose, 1, 0, 20, 100, 100, -1, endexaxisPos, 0, offdese);
33 robot.LaserTrackingTrackOnOff(0, 2);
34 }
35 Console.WriteLine($"Number of completions : {i + 1} ");
36 }
37}
11.94. End-Effector Transparent Transmission Function Enable/Disable
1/**
2* @brief Enable end-effector general transparent transmission function
3* @param [in] enable, 0-disable, 1-enable
4* @return Error code
5*/
6public int SetAxleGenComEnable(int mode)
11.95. End-Effector Transparent Transmission Function Non-Periodic Data Transmission and Reception
1/**
2* @brief End-effector sends non-periodic data and waits for response
3* @param [in] len_snd, length of data to send
4* @param [in] sndBuff[], data to send
5* @param [in] len_rcv, length of data to receive
6* @param [out] rcvBuff[], response data
7* @return Error code
8*/
9public int SndRcvAxleGenComCmdData(int len_snd, int[] sndBuff, int len_rcv, ref int[] rcvdata)
11.96. Code Example for Non-Periodic Data Communication of DIO Health Care Moxibustion Head Based on End-Effector Transparent Transmission Function
1void testAxleGenCom()
2{
3 int[] led_on = new int[6] { 0xAB, 0xBA, 0x12, 0x01, 0x01, 0x79 };
4 int[] led_off = new int[6] { 0xAB, 0xBA, 0x12, 0x01, 0x00, 0x78 };
5 int[] version = new int[5]{ 0xAB, 0xBA, 0x11, 0x00, 0x76 };
6 int[] state = new int[6] { 0xAB, 0xBA, 0x1B,0x01, 0xAA, 0x2B };
7 int[] cycleState = new int[6] { 0xAB, 0xBA, 0x12, 0x01, 0x00, 0x78 };
8
9 int[] rcvdata = new int[16];
10 int ret = 0;
11 int cnt = 1;
12
13 JointPos p1Joint = new JointPos(88.708, -86.178, 140.989, -141.825, -89.162, -49.879);
14 DescPose p1Desc = new DescPose(188.007, -377.850, 260.207, 178.715, 2.823, -131.466);
15
16 JointPos p2Joint = new JointPos(112.131, -75.554, 126.989, -139.027, -88.044, -26.477);
17 DescPose p2Desc = new DescPose(368.003, -377.848, 260.211, 178.715, 2.823, -131.465);
18
19 ExaxisPos exaxisPos = new ExaxisPos(0, 0, 0, 0);
20 DescPose offdese = new DescPose(0, 0, 0, 0, 0, 0);
21
22 //Enable end-effector transparent transmission function
23 robot.SetAxleGenComEnable(1);
24 robot.SetAxleLuaEnable(1);
25
26 while(cnt<=10)
27 {
28 //Read version number
29 ret = robot.SndRcvAxleGenComCmdData(5, version, 10, ref rcvdata);
30 Console.WriteLine($" hard version : {rcvdata[4]},hard code:{rcvdata[5]}, soft version:{rcvdata[6]} {rcvdata[7]}, soft code:{rcvdata[8]}");
31 if (ret != 0)
32 {
33 break;
34 }
35 Thread.Sleep(1000);
36 //Read moxibustion head presence status
37 ret = robot.SndRcvAxleGenComCmdData(6, state, 6, ref rcvdata);
38 Console.WriteLine($" state : {rcvdata[4]}");
39 Thread.Sleep(1000);
40 //Turn on moxibustion head laser
41 ret = robot.SndRcvAxleGenComCmdData(6, led_on, 6, ref rcvdata);
42 Console.WriteLine($"led on rcv data is: {rcvdata[0]},{rcvdata[1]}, {rcvdata[2]}, {rcvdata[3]}, {rcvdata[4]}, {rcvdata[5]}");
43 robot.MoveJ(p1Joint, p1Desc, 0, 0, 100, 100, 100, exaxisPos, -1, 0, offdese);
44 Thread.Sleep(4000);
45 //Turn off moxibustion head laser
46 ret = robot.SndRcvAxleGenComCmdData(6, led_off, 6, ref rcvdata);
47 Console.WriteLine($"led off rcv data is: {rcvdata[0]},{rcvdata[1]}, {rcvdata[2]}, {rcvdata[3]}, {rcvdata[4]}, {rcvdata[5]}");
48 robot.MoveJ(p2Joint, p2Desc, 0, 0, 100, 100, 100, exaxisPos, -1, 0, offdese);
49 Thread.Sleep(1000);
50 Console.WriteLine($"***********************complate No. {cnt} SDK test*****************************");
51 cnt++;
52 }
53
54}
11.97. Download Open Protocol Lua File
1/**
2* @brief Download open protocol Lua file
3* @param [in] fileName Open protocol file name "CtrlDev_XXX.lua"
4* @param [in] savePath Path to save the open protocol file
5* @return Error code
6*/
7public int OpenLuaDownload(string fileName, string savePath)
11.98. Delete Open Protocol Lua File
1/**
2* @brief Delete open protocol Lua file
3* @param [in] fileName Name of the open protocol Lua file to delete "CtrlDev_XXX.lua"
4* @return Error code
5*/
6public int OpenLuaDelete(string fileName)
11.99. Delete All Open Protocol Lua Files
1/**
2* @brief Delete all open protocol Lua files
3* @return Error code
4*/
5public int AllOpenLuaDelete()
11.100. SDK Code Example for Open Protocol Lua File Operations
1public int TestCtrlOpenLuaOperate()
2{
3 int rtn;
4
5 // Upload Lua file to robot
6 rtn = robot.OpenLuaUpload("D://zUP/openlua/CtrlDev_WELDING_A.lua");
7 Console.WriteLine($"OpenLuaUpload rtn is {rtn}");
8 rtn = robot.OpenLuaUpload("D://zUP/openlua/CtrlDev_SWDPOLISH.lua");
9 Console.WriteLine($"OpenLuaUpload rtn is {rtn}");
10
11 // Download Lua file from robot
12 rtn = robot.OpenLuaDownload("CtrlDev_WELDING_A.lua", "D://zDOWN/");
13 Console.WriteLine($"OpenLuaDownload rtn is {rtn}");
14 rtn = robot.OpenLuaDownload("CtrlDev_SWDPOLISH.lua", "D://zDOWN/");
15 Console.WriteLine($"OpenLuaDownload rtn is {rtn}");
16
17 // Set control open protocol Lua name
18 rtn = robot.SetCtrlOpenLUAName(0, "CtrlDev_WELDING_A.lua");
19 Console.WriteLine($"SetCtrlOpenLUAName rtn is {rtn}");
20 rtn = robot.SetCtrlOpenLUAName(1, "CtrlDev_SWDPOLISH.lua");
21 Console.WriteLine($"SetCtrlOpenLUAName rtn is {rtn}");
22
23 // Get control open protocol Lua name
24 string[] name = new string[4];
25 rtn = robot.GetCtrlOpenLUAName(ref name);
26 Console.WriteLine($"ctrl open lua names : {name[0]}, {name[1]}, {name[2]}, {name[3]}");
27
28 // Load and unload open protocol Lua
29 rtn = robot.LoadCtrlOpenLUA(1);
30 Console.WriteLine($"LoadCtrlOpenLUA rtn is {rtn}");
31 robot.Sleep(2000);
32 rtn = robot.UnloadCtrlOpenLUA(1);
33 Console.WriteLine($"UnloadCtrlOpenLUA rtn is {rtn}");
34
35 // Delete specified Lua file and all Lua files
36 rtn = robot.OpenLuaDelete("CtrlDev_WELDING_A.lua");
37 Console.WriteLine($"OpenLuaDelete rtn is {rtn}");
38 rtn = robot.AllOpenLuaDelete();
39 Console.WriteLine($"AllOpenLuaDelete rtn is {rtn}");
40
41 return 0;
42}