11. Robot peripherals
11.1. Configure gripper
1/**
2* @brief Configure gripper
3* @param [in] config .company Gripper manufacturer, 1-Robotiq, 2-Huiling, 3-Tianji, 4-Dahuan, 5-Zhixing
4* @param [in] config .device Device number, Robotiq(0-2F-85 series), Huiling(0-NK series,1-Z-EFG-100), Tianji(0-TEG-110), Dahuan(0-PGI-140), Zhixing(0-CTPM2F20)
5* @param [in] config .softvesion Software version, not currently used, default 0
6* @param [in] config .bus Device bus position at end, not currently used, default 0
7* @return Error code
8*/
9int SetGripperConfig(DeviceConfig config);
11.2. Get gripper configuration
1/**
2* @brief Get gripper configuration
3* @param [out] config .company Gripper manufacturer, 1-Robotiq, 2-Huiling, 3-Tianji, 4-Dahuan, 5-Zhixing
4* @param [out] config .device Device number, Robotiq(0-2F-85 series), Huiling(0-NK series,1-Z-EFG-100), Tianji(0-TEG-110), Dahuan(0-PGI-140), Zhixing(0-CTPM2F20)
5* @param [out] config .softvesion Software version, not currently used, default 0
6* @param [out] config .bus Device bus position at end, not currently used, default 0
7* @return Error code
8*/
9int GetGripperConfig(DeviceConfig config);
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, int act);
11.4. Control gripper
1/**
2* @brief Control gripper
3* @param [in] index Gripper number
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-rotary gripper
10* @param [in] rotNum Rotation turns
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, int block, int type, double rotNum, int rotVel, int rotTorque);
11.5. Get gripper motion status
1/**
2* @brief Get gripper motion status
3* @return List[0]:Error code; List[1] : fault 0-no error, 1-error; List[2]: staus 0-motion not completed, 1-motion completed
4*/
5List<Integer> GetGripperMotionDone();
11.6. Get gripper activation status
1/**
2* @brief Get gripper activation status
3* @return List[0]:Error code; List[1] : fault 0-no error, 1-error; List[2]: status bit0~bit15 correspond to gripper numbers 0~15, bit=0 not activated, bit=1 activated
4*/
5List<Number> GetGripperActivateStatus()
11.7. Get gripper position
1/**
2* @brief Get gripper position
3* @return List[0]:Error code; List[1] : fault 0-no error, 1-error; List[2]: position Position percentage, range 0~100%
4*/
5List<Number> GetGripperCurPosition()
11.8. Get gripper speed
1/**
2* @brief Get gripper speed
3* @return List[0]:Error code; List[1] : fault 0-no error, 1-error; List[2]: speed Speed percentage, range 0~100%
4*/
5List<Number> GetGripperCurSpeed()
11.9. Get gripper current
1/**
2* @brief Get gripper current
3* @return List[0]:Error code; List[1] : fault 0-no error, 1-error; List[2]: current Current percentage, range 0~100%
4*/
5List<Number> GetGripperCurCurrent()
11.10. Get gripper voltage
1/**
2* @brief Get gripper voltage
3* @return List[0]:Error code; List[1] : fault 0-no error, 1-error; List[2]:voltage Voltage, unit 0.1V
4*/
5List<Number> GetGripperVoltage()
11.11. Get gripper temperature
1/**
2* @brief Get gripper temperature
3* @return List[0]:Error code; List[1] : fault 0-no error, 1-error; List[2]:temp Temperature, unit ℃
4*/
5List<Number> GetGripperTemp()
11.12. Calculate pre-grasp point - vision
1/**
2* @brief Calculate pre-grasp point - vision
3* @param [in] desc_pos Grasp point cartesian pose
4* @param [in] zlength z-axis offset
5* @param [in] zangle Rotation offset around z-axis
6* @param [out] pre_pos Pre-grasp point
7* @return Error code
8*/
9int ComputePrePick(DescPose desc_pos, double zlength, double zangle, DescPose pre_pos);
11.13. Calculate retreat point - vision
1/**
2* @brief Calculate retreat point - vision
3* @param [in] desc_pos Grasp point cartesian pose
4* @param [in] zlength z-axis offset
5* @param [in] zangle Rotation offset around z-axis
6* @param [out] post_poss Retreat point
7* @return Error code
8*/
9int ComputePostPick(DescPose desc_pos, double zlength, double zangle, DescPose post_pos);
11.14. Robot gripper operation code example
1public static int TestGripper(Robot robot)
2{
3 int company = 4;
4 int device = 0;
5 int softversion = 0;
6 int bus = 2;
7 int index = 2;
8 int act = 0;
9 int max_time = 30000;
10 int block = 0;
11
12 int current_pos = 0;
13 int current = 0;
14 int voltage = 0;
15 int temp = 0;
16 int speed = 0;
17
18 DeviceConfig cnn=new DeviceConfig(company,device,softversion,bus);
19 robot.SetGripperConfig(cnn);
20 robot.GetGripperConfig(cnn);
21
22 robot.ActGripper(index, act);
23 robot.Sleep(1000);
24 act = 1;
25 robot.ActGripper(index, act);
26 robot.Sleep(1000);
27
28 robot.MoveGripper(index, 100, 50, 50, max_time, block, 0, 0, 0, 0);
29 robot.Sleep(1000);
30 robot.MoveGripper(index, 0, 50, 0, max_time, block, 0, 0, 0, 0);
31
32 List<Integer> stat=new ArrayList<>();
33 stat=robot.GetGripperMotionDone();
34
35 List<Number> list=new ArrayList<>();
36 list=robot.GetGripperActivateStatus();
37
38 list=robot.GetGripperCurPosition();
39
40 list=robot.GetGripperCurCurrent();
41
42 list=robot.GetGripperVoltage();
43
44 list=robot.GetGripperTemp();
45
46 list=robot.GetGripperCurSpeed();
47
48 int retval = 0;
49 DescPose prepick_pose = new DescPose(){};
50 DescPose postpick_pose = new DescPose(){};
51
52 DescPose p1Desc=new DescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
53 DescPose p2Desc=new DescPose(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
54
55 retval = robot.ComputePrePick(p1Desc, 10, 0, prepick_pose);
56
57 retval = robot.ComputePostPick(p2Desc, -10, 0, postpick_pose);
58 return 0;
59}
11.15. Get rotary gripper rotation turns
1/**
2* @brief Get rotary gripper rotation turns
3* @return List[0]:Error code List[1]: 0-no error, 1-error List[2]:Rotation turns
4*/
5List<Number> GetGripperRotNum();
11.16. Get rotary gripper rotation speed percentage
1/**
2* @brief Get rotary gripper rotation speed percentage
3* @return List[0]:Error code List[1]: 0-no error, 1-error List[2]:Rotation speed percentage
4*/
5List<Number> GetGripperRotSpeed();
11.17. Get rotary gripper rotation torque percentage
1/**
2* @brief Get rotary gripper rotation torque percentage
3* @return List[0]:Error code List[1]: 0-no error, 1-error List[2]:Rotation torque percentage
4*/
5List<Number> GetGripperRotTorque();
11.18. Code example for getting rotary gripper status
1public static int TestRotGripperState(Robot robot)
2{
3 int fault = 0;
4 List<Number> rotNum=new ArrayList<>();
5 List<Number> rotSpeed=new ArrayList<>();
6 List<Number> rotTorque=new ArrayList<>();
7
8 rotNum=robot.GetGripperRotNum();
9 rotSpeed=robot.GetGripperRotSpeed();
10 rotTorque=robot.GetGripperRotTorque();
11 System.out.println("gripper rot num :"+rotNum.get(2)+ ", gripper rotSpeed :"+rotSpeed.get(2)+",gripper rotTorque : "+rotTorque.get(2));
12
13 return 0;
14}
11.19. Conveyor start/stop
1/**
2* @brief Conveyor start/stop
3* @param [in] status Status, 1-start, 0-stop
4* @return Error code
5*/
6int ConveyorStartEnd(int status);
11.20. Record IO detection point
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 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-tracking grasp, 2-tracking motion, 3-TPD tracking
4* @return Error code
5*/
6int ConveyorGetTrackData(int mode);
11.26. Conveyor tracking start
1/**
2* @brief Conveyor tracking start
3* @param [in] status Status, 1-start, 0-stop
4* @return Error code
5*/
6int ConveyorTrackStart(int status);
11.27. Conveyor tracking stop
1/**
2* @brief Conveyor tracking stop
3* @return Error code
4*/
5int ConveyorTrackEnd();
11.28. Conveyor parameter configuration
Changed in version Java: SDK-v1.0.4-3.8.1
1/**
2* @brief Conveyor parameter configuration
3* @param [in] encChannel Encoder channel 1~2
4* @param [in] resolution Pulses per encoder revolution
5* @param [in] lead Conveyor travel distance per encoder revolution
6* @param [in] wpAxis Workpiece coordinate system number For tracking motion function, set to 0 for tracking grasp and TPD tracking
7* @param [in] vision Whether vision is configured 0 no 1 yes
8* @param [in] speedRadio Speed ratio For conveyor tracking grasp option (1-100) Default 1 for other options
9* @param [in] followType Tracking motion type, 0-tracking motion; 1-chasing inspection motion
10* @param [in] startDis Required for chasing grasp, tracking start distance, -1: auto calculate (automatically chase after workpiece reaches below robot), unit mm, default 0
11* @param [in] endDis Required for chasing grasp, tracking end distance, unit mm, default 100
12* @return Error code
13*/
14int ConveyorSetParam(int encChannel, int resolution, double lead, int wpAxis, int vision, double speedRadio, int followType, int startDis, int endDis);
11.29. Set conveyor grasp point compensation
1/**
2* @brief Set conveyor grasp point compensation
3* @param [in] cmp Compensation position double[3]{x, y, z}
4* @return Error code
5*/
6int ConveyorCatchPointComp(Object[] cmp);
11.30. Conveyor linear motion
1/**
2* @brief Linear motion
3* @param [in] name Motion point description
4* @param [in] tool Tool coordinate number, range [0~14]
5* @param [in] wobj Workpiece coordinate number, range [0~14]
6* @param [in] vel Speed percentage, range [0~100]
7* @param [in] acc Acceleration percentage, range [0~100], not currently available
8* @param [in] ovl Speed scaling factor, range [0~100]
9* @param [in] blendR [-1.0]-move to position (blocking), [0~1000.0]-smoothing radius (non-blocking), unit mm
10* @return Error code
11*/
12int ConveyorTrackMoveL(String name, int tool, int wobj, double vel, double acc, double ovl, double blendR);
11.31. Conveyor communication input detection
New in version Java: SDK-v1.0.4-3.8.1
1/**
2* @brief Conveyor communication input detection
3* @param [in] timeout Wait timeout time ms
4* @return Error code
5*/
6int ConveyorComDetect(int timeout);
11.32. Conveyor communication input detection trigger
New in version Java: SDK-v1.0.4-3.8.1
1/**
2* @brief Conveyor communication input detection trigger
3* @param [in] timeout Wait timeout time ms
4* @return Error code
5*/
6int ConveyorComDetectTrigger();
11.33. Robot conveyor operation example program
1public static int TestConveyor(Robot robot)
2{
3 int retval = 0;
4
5 retval = robot.ConveyorStartEnd(1);
6
7 retval = robot.ConveyorPointIORecord();
8
9 retval = robot.ConveyorPointARecord();
10
11 retval = robot.ConveyorRefPointRecord();
12
13 retval = robot.ConveyorPointBRecord();
14
15 retval = robot.ConveyorStartEnd(0);
16
17 retval = 0;
18
19 retval = robot.ConveyorSetParam(1,10000,200,0,0,20,0,0,100);
20
21 Object[] cmp = new Object[]{ 0.0, 0.0, 0.0 };
22 retval = robot.ConveyorCatchPointComp(cmp);
23
24 int index = 1;
25 int max_time = 30000;
26 int block = 0;
27 retval = 0;
28
29 DescPose p1Desc=new DescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
30 DescPose p2Desc=new DescPose(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
31
32
33 retval = robot.MoveCart(p1Desc, 1, 0, 100.0, 100.0, 100.0, -1.0, -1);
34
35 retval = robot.WaitMs(1);
36
37 retval = robot.ConveyorTrackStart(1);
38
39 retval = robot.ConveyorTrackMoveL("cvrCatchPoint", 1, 0, 100, 100, 100, -1.0);
40
41 retval = robot.MoveGripper(index, 51, 40, 30, max_time, block, 0, 0, 0, 0);
42
43 retval = robot.ConveyorTrackMoveL("cvrRaisePoint", 1, 0, 100, 100, 100, -1.0);
44
45 retval = robot.ConveyorTrackEnd();
46
47 robot.MoveCart(p2Desc, 1, 0, 100.0, 100.0, 100.0, -1.0, -1);
48
49 retval = robot.MoveGripper(index, 100, 40, 10, max_time, block, 0, 0, 0, 0);
50
51 return 0;
52}
11.34. End sensor configuration
1/**
2* @brief End sensor configuration
3* @param [in] config idCompany Manufacturer, 18-JUNKONG; 25-HUIDE
4* @param [in] config idDevice Type, 0-JUNKONG/RYR6T.V1.0
5* @param [in] config idSoftware Software version, 0-J1.0/HuiDe1.0(not currently available)
6* @param [in] config idBus Mount position, 1-end port 1; 2-end port 2...8-end port 8(not currently available)
7* @return Error code
8*/
9int AxleSensorConfig(DeviceConfig config);
11.35. Get end sensor configuration
1/**
2* @brief Get end sensor configuration
3* @param [out] config idCompany Manufacturer, 18-JUNKONG; 25-HUIDE
4* @param [out] config idDevice Type, 0-JUNKONG/RYR6T.V1.0
5* @return Error code
6*/
7int AxleSensorConfigGet(DeviceConfig config);
11.36. End sensor activation
1/**
2* @brief End sensor activation
3* @param [in] actFlag 0-reset; 1-activate
4* @return Error code
5*/
6int AxleSensorActivate(int actFlag);
11.37. End sensor register write
1/**
2* @brief End sensor register write
3* @param [in] devAddr Device address number 0-255
4* @param [in] regHAddr Register address high 8 bits
5* @param [in] regLAddr Register address low 8 bits
6* @param [in] regNum Register count 0-255
7* @param [in] data1 Write register value 1
8* @param [in] data2 Write register value 2
9* @param [in] isNoBlock 0-blocking; 1-non-blocking
10* @return Error code
11*/
12int AxleSensorRegWrite(int devAddr, int regHAddr, int regLAddr, int regNum, int data1, int data2, int isNoBlock);
11.38. End sensor code example
1public static int TestAxleSensor(Robot robot)
2{
3 DeviceConfig con=new DeviceConfig(18,0,0,1);
4 robot.AxleSensorConfig(con);
5 int company = -1;
6 int type = -1;
7 robot.AxleSensorConfigGet(con);
8
9 int rtn = robot.AxleSensorActivate(1);
10
11 robot.Sleep(1000);
12
13 rtn = robot.AxleSensorRegWrite(1, 4, 6, 1, 0, 0, 0);
14 return 0;
15}
11.39. Get robot peripheral protocol
1/**
2* @brief Get robot peripheral protocol
3* @return List[0]:Error code; List[1] : int protocol Robot peripheral protocol number 4096-extension axis control card; 4097-ModbusSlave; 4098-ModbusMaster
4*/
5List<Integer> GetExDevProtocol();
11.40. Set robot peripheral protocol
1/**
2* @brief Set robot peripheral protocol
3* @param [in] protocol Robot peripheral protocol number 4096-extension axis control card; 4097-ModbusSlave; 4098-ModbusMaster
4* @return Error code
5*/
6int SetExDevProtocol(int protocol);
11.41. Set robot peripheral protocol example program
1public static int TestExDevProtocol(Robot robot)
2{
3 int protocol = 4096;
4 int rtn = robot.SetExDevProtocol(protocol);
5 List<Integer> integer=new ArrayList<>();
6 integer = robot.GetExDevProtocol();
7
8 return 0;
9}
11.42. Get end communication parameters
1/**
2* @brief Get end communication parameters
3* @param [out] param End communication parameters
4* @return Error code
5*/
6int GetAxleCommunicationParam(AxleComParam param)
11.43. Set end communication parameters
1/**
2* @brief Set end communication parameters
3* @param [in] param End communication parameters
4* @return Error code
5*/
6int SetAxleCommunicationParam(AxleComParam param)
11.44. Set end file transfer type
1/**
2* @brief Set end file transfer type
3* @param [in] type 1-MCU upgrade file; 2-LUA file
4* @return Error code
5*/
6public int SetAxleFileType(int type)
11.45. Set enable end LUA execution
1/**
2* @brief Set enable end LUA execution
3* @param [in] enable 0-disable; 1-enable
4* @return Error code
5*/
6public int SetAxleLuaEnable(int enable)
11.46. End LUA file error recovery
1/**
2* @brief End LUA file error recovery
3* @param [in] status 0-no recovery; 1-recover
4* @return Error code
5*/
6public int SetRecoverAxleLuaErr(int status)
11.47. Get end LUA execution enable status
1/**
2* @brief Get end LUA execution enable status
3* @param [out] status[0]: 0-disabled; 1-enabled
4* @return Error code
5*/
6int GetAxleLuaEnableStatus(int[] status)
11.48. Set end LUA end device enable type
1/**
2* @brief Set end LUA end device enable type
3* @param forceSensorEnable Force sensor enable status, 0-disable; 1-enable
4* @param gripperEnable Gripper enable status, 0-disable; 1-enable
5* @param IOEnable IO device enable status, 0-disable; 1-enable
6* @return Error code
7*/
8public int SetAxleLuaEnableDeviceType(int forceSensorEnable, int gripperEnable, int IOEnable)
11.49. Get end LUA end device enable type
1/**
2 * @brief Get end LUA end device enable type
3 * @param enable enable[0]:forceSensorEnable Force sensor enable status, 0-disable; 1-enable
4 * @param enable enable[1]:gripperEnable Gripper enable status, 0-disable; 1-enable
5 * @param enable enable[2]:IOEnable IO device enable status, 0-disable; 1-enable
6 * @return Error code
7 */
8public int GetAxleLuaEnableDeviceType(int[] enable)
11.50. Get currently configured end devices
1/**
2 * @brief Get currently configured end devices
3 * @param forceSensorEnable Force sensor enable device number 0-disabled; 1-enabled
4 * @param gripperEnable Gripper enable device number, 0-disabled; 1-enabled
5 * @param IODeviceEnable IO device enable device number, 0-disabled; 1-enabled
6 * @return Error code
7 */
8public int GetAxleLuaEnableDevice(int[] forceSensorEnable, int[] gripperEnable, int[] IODeviceEnable)
11.51. Set enable gripper action control function
1/**
2 * @brief Set enable gripper action control function
3 * @param id Gripper device number
4 * @param func func[0]-gripper enable; func[1]-gripper initialization; 2-position set; 3-speed set; 4-torque set; 6-read gripper status; 7-read initialization status; 8-read error code; 9-read position; 10-read speed; 11-read torque
5 * @return Error code
6 */
7public int SetAxleLuaGripperFunc(int id, int[] func)
11.52. Get enable gripper action control function
1/**
2 * @brief Get enable gripper action control function
3 * @param id Gripper device number
4 * @param func func[0]-gripper enable; func[1]-gripper initialization; 2-position set; 3-speed set; 4-torque set; 6-read gripper status; 7-read initialization status; 8-read error code; 9-read position; 10-read speed; 11-read torque
5 * @return Error code
6 */
7public int GetAxleLuaGripperFunc(int id, int[] func)
11.53. Robot Ethercat slave file write
1/**
2 * @brief Robot Ethercat slave file write
3 * @param type Slave file type, 1-upgrade slave file; 2-upgrade slave configuration file
4 * @param slaveID Slave number
5 * @param fileName Upload file name
6 * @return Error code
7 */
8public int SlaveFileWrite(int type, int slaveID, String fileName)
11.54. Upload end 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 */
6public int AxleLuaUpload(String filePath)
11.55. Robot Ethercat slave enter boot mode
1/**
2 * @brief Robot Ethercat slave enter boot mode
3 * @return Error code
4 */
5public int SetSysServoBootMode()
11.56. Robot end LUA file operation code example
1public static int TestAxleLua(Robot robot)
2{
3 robot.AxleLuaUpload("D://zUP/AXLE_LUA_End_DaHuan.lua");
4
5 AxleComParam param=new AxleComParam(7, 8, 1, 0, 5, 3, 1);
6 robot.SetAxleCommunicationParam(param);
7
8 robot.GetAxleCommunicationParam(param);
9
10 robot.SetAxleLuaEnable(1);
11 int[] luaEnableStatus = new int[]{0};
12 robot.GetAxleLuaEnableStatus(luaEnableStatus);
13 robot.SetAxleLuaEnableDeviceType(0, 1, 0);
14
15 int forceEnable = 0;
16 int gripperEnable = 0;
17 int ioEnable = 0;
18 int [] enable=new int[]{0,0,0};
19 robot.GetAxleLuaEnableDeviceType(enable);
20
21 int[] func = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
22 robot.SetAxleLuaGripperFunc(1, func);
23 int[] getFunc = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
24 robot.GetAxleLuaGripperFunc(1, getFunc);
25 int[] getforceEnable = { 0,0,0,0,0,0,0,0};
26 int[] getgripperEnable = { 0,0,0,0,0,0,0,0};
27 int[] getioEnable = { 0,0,0,0,0,0,0,0};
28 robot.GetAxleLuaEnableDevice(getforceEnable, getgripperEnable, getioEnable);
29 for (int i = 0; i < 8; i++)
30 {
31 System.out.println(getforceEnable[i]);
32 }
33 System.out.println("getgripperEnable status : ");
34 for (int i = 0; i < 8; i++)
35 {
36 System.out.println(getgripperEnable[i]);
37 }
38 System.out.println("getioEnable status : ");
39 for (int i = 0; i < 8; i++)
40 {
41 System.out.println(getioEnable[i]);
42 }
43 robot.ActGripper(1, 0);
44 robot.Sleep(2000);
45 robot.ActGripper(1, 1);
46 robot.Sleep(2000);
47 robot.MoveGripper(1, 90, 10, 100, 50000, 0, 0, 0, 0, 0);
48 int pos = 0;
49 while (true)
50 {
51 ROBOT_STATE_PKG pkg=new ROBOT_STATE_PKG();
52 pkg=robot.GetRobotRealTimeState();
53 System.out.println("gripper pos is:"+pkg.gripper_position);
54 robot.Sleep(100);
55 }
56
57}
11.59. Upload Open Protocol Lua File
New in version Java: SDK-v1.0.8-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.60. Get Slave Board Parameters
New in version Java: SDK-v1.0.8-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.61. Write Slave DO
New in version Java: SDK-v1.0.8-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.62. Write Slave AO
New in version Java: SDK-v1.0.8-3.8.5
1/*
2* @brief Write Slave AO
3* @param AOIndex AO number
4* @param writeNum Number of values to write
5* @param status Array of values to write (up to 8 values), AO0~AO15 are integer, AO16~AO31 are floating point
6* @return Error code
7*/
8public int FieldBusSlaveWriteAO(int AOIndex, int writeNum, double[] status)
11.63. Read Slave DI
New in version Java: SDK-v1.0.8-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.64. Read Slave AI
New in version Java: SDK-v1.0.8-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.65. Wait for Extended DI Input
New in version Java: SDK-v1.0.8-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.66. Wait for Extended AI Input
New in version Java: SDK-v1.0.8-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.68. Control Array Sucker
New in version Java: SDK-v1.0.8-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.69. Get Array Sucker Status
New in version Java: SDK-v1.0.8-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.70. Wait for Sucker Status
New in version Java: SDK-v1.0.8-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.71. Array Sucker Control Command Code Example
1public static void testSucker(Robot robot)
2{
3 //Upload and load open protocol file
4 robot.OpenLuaUpload("C://project/peripheralSDK/CtrlDev_sucker.lua");
5 robot.Sleep(2000);
6 robot.UnloadCtrlOpenLUA(1);
7 robot.LoadCtrlOpenLUA(1);
8 robot.Sleep(1000);
9 //Control sucker in broadcast mode, adsorb with maximum capacity
10 int[] ctrl = {1};
11 robot.SetSuckerCtrl(0, 1, ctrl);
12 int[] state=new int[1];
13 int[] pressVlaue=new int[1];
14 int[] error=new int[1];
15 //Loop monitor status of sucker 1 and sucker 12
16 for (int i = 0; i < 100; i++)
17 {
18 robot.GetSuckerState(1, state,pressVlaue, error);
19 System.out.println("sucker1 state is:"+state[0]+",pressVlaue is:"+pressVlaue[0]+",error num is"+error[0]);
20 robot.GetSuckerState(12, state, pressVlaue, error);
21 System.out.println("sucker12 state is :"+state[0]+", pressVlaue is:"+pressVlaue[0]+",error num is:"+error[0]);
22 robot.Sleep(100);
23 }
24 //Wait for sucker 1 to be in adsorbed state, wait time 100ms
25 int ret = robot.WaitSuckerState(1, 1, 100);
26 System.out.println("WaitSuckerState result is:"+ ret);
27 //Unicast mode to turn off sucker 1 and 12
28 ctrl[0] = 3;
29 robot.SetSuckerCtrl(1, 1, ctrl);
30 robot.SetSuckerCtrl(12, 1, ctrl);
31 robot.CloseRPC();
32}
11.72. Laser Peripheral On/Off Function
New in version Java: SDK-v1.0.9-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.73. Laser Tracking Start/Stop Function
New in version Java: SDK-v1.0.9-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.74. Laser Positioning - Fixed Direction
New in version Java: SDK-v1.0.9-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.75. Laser Positioning - Arbitrary Direction
New in version Java: SDK-v1.0.9-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.76. Laser Positioning Stop
New in version Java: SDK-v1.0.9-3.8.6
1/**
2 * @brief Laser positioning stop
3 * @return Error code
4 */
5public int LaserTrackingSearchStop()
11.77. Laser IP Configuration
New in version Java: SDK-v1.0.9-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.78. Laser Peripheral Sampling Period Configuration
New in version Java: SDK-v1.0.9-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.79. Laser Peripheral Driver Loading
New in version Java: SDK-v1.0.9-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.80. Laser Peripheral Driver Unloading
New in version Java: SDK-v1.0.9-3.8.6
1/**
2 * @brief Laser peripheral driver unloading
3 * @return Error code
4 */
5public int UnLoadPosSensorDriver()
11.81. Laser Weld Seam Trajectory Recording
New in version Java: SDK-v1.0.9-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.82. Laser Weld Seam Trajectory Replay
New in version Java: SDK-v1.0.9-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.83. Laser Tracking Replay
New in version Java: SDK-v1.0.9-3.8.6
1/**
2 * @brief Laser tracking replay
3 * @return Error code
4 */
5public int MoveLTR()
11.84. Laser Weld Seam Trajectory Recording and Replay
New in version Java: SDK-v1.0.9-3.8.6
1 /**
2 * @brief Laser Weld Seam Trajectory Replay
3 * @param delayMode Mode 0-Delay Time 1-Delay Distance
4 * @param delayTime Delay time in milliseconds (ms)
5 * @param delayDisExAxisNum Extended Axis Number
6 * @param delayDis Delay distance in millimeters (mm)
7 * @param sensitivePara Compensation Sensitivity Coefficient
8 * @param trackMode Fixed-point Tracking Type. 0-Extended Axis Asynchronous Motion; 1-Robot
9 * @param triggerMode Fixed-point Tracking Trigger Method. 0-Tracking Duration; 1-IO
10 * @param runTime Robot Fixed-point Tracking Duration in seconds (s)
11 * @param speed Speed in percentage (%)
12 * @return Error Code
13 */
14 public int LaserSensorRecordandReplay(int delayMode, int delayTime, int delayDisExAxisNum, double delayDis, double sensitivePara, int trackMode, int triggerMode, double runTime, double speed)
11.85. Move to Laser Record Start Point
New in version Java: SDK-v1.0.9-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.86. Move to Laser Record End Point
New in version Java: SDK-v1.0.9-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.87. Move to Laser Sensor Positioning Point
New in version Java: SDK-v1.0.9-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.88. Get Laser Sensor Positioning Point Coordinate Information
New in version Java: SDK-v1.0.9-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, JointPos jPos, DescPose descPos, int[] tool, int[] user, ExaxisPos exaxis)
11.89. Laser Peripheral Sensor Parameter Configuration and Debugging Code Example
1public static void testLaserConfig(Robot robot)
2{
3 robot.LaserTrackingSensorConfig("192.168.58.20", 5020);
4
5 robot.LaserTrackingSensorSamplePeriod(20);
6
7 robot.LoadPosSensorDriver(101);
8 robot.LaserTrackingLaserOnOff(0,0);
9
10 robot.Sleep(3000);
11
12 robot.LaserTrackingLaserOnOff(1, 0);
13
14 robot.CloseRPC();
15}
11.90. Laser Trajectory Scanning and Trajectory Replay Code Example
1public static void testLaserRecordAndReplay(Robot robot)
2{
3 // Upload and load open protocol file
4 robot.OpenLuaUpload("D://zUP/CtrlDev_laser_ruiniu-0117.lua");
5 robot.Sleep(2000);
6 robot.SetCtrlOpenLUAName(0, "CtrlDev_laser_ruiniu-0117.lua");
7 robot.UnloadCtrlOpenLUA(0);
8 robot.LoadCtrlOpenLUA(0);
9 robot.Sleep(8000);
10
11 for (int i=0;i<10;++i){
12 JointPos startjointPos=new JointPos(56.205, -117.951, 141.872, -118.149, -94.217, -122.176);
13 DescPose startdescPose=new DescPose(-97.552, -282.855, 26.675, 174.182, -1.338, -91.707);
14 ExaxisPos exaxisPos=new ExaxisPos(0, 0, 0, 0);
15 DescPose offdese=new DescPose(0, 0, 0, 0, 0, 0);
16 robot.MoveL(startjointPos, startdescPose, 1, 0, 100, 100, 100, -1, 0,exaxisPos, 0, 0, offdese, 0,1, 1);
17
18 robot.LaserSensorRecord1(2, 10);
19
20 JointPos endjointPos=new JointPos(68.809, -87.100, 121.120, -127.233, -95.038, -109.555);
21 DescPose enddescPose=new DescPose(-103.555, -464.234, 13.076, 174.179, -1.344, -91.709);
22 robot.MoveL(endjointPos, enddescPose, 1, 0, 50, 100, 100, -1,0, exaxisPos, 0, 0, offdese, 0,1, 1);
23
24 robot.LaserSensorRecord1(0, 10);
25
26 robot.MoveToLaserRecordStart(1, 30);
27
28 robot.LaserSensorReplay(10, 100);
29
30 robot.MoveLTR();
31
32 robot.LaserSensorRecord1(0, 10);
33 }
34
35 robot.CloseRPC();
36}
11.91. Laser Positioning and Real-time Tracking Code Example
1public static void testLasertrack(Robot robot)
2{
3 // Upload and load open protocol file
4 robot.OpenLuaUpload("D://zUP/CtrlDev_laser_ruiniu-0117.lua");
5 robot.Sleep(2000);
6 robot.SetCtrlOpenLUAName(0, "CtrlDev_laser_ruiniu-0117.lua");
7 robot.UnloadCtrlOpenLUA(0);
8 robot.LoadCtrlOpenLUA(0);
9 robot.Sleep(8000);
10 for(int i=0;i<10;++i){
11 JointPos startjointPos=new JointPos(56.205, -117.951, 141.872, -118.149, -94.217, -122.176);
12 DescPose startdescPose=new DescPose(-97.552, -282.855, 26.675, 174.182, -1.338, -91.707);
13 ExaxisPos exaxisPos=new ExaxisPos(0, 0, 0, 0);
14 DescPose offdese=new DescPose(0, 0, 0, 0, 0, 0);
15 DescTran directionPoint=new DescTran();
16 robot.MoveL(startjointPos, startdescPose, 1, 0, 100, 100, 100, -1, 0,exaxisPos, 0, 0, offdese, 0,1, 1);
17
18 robot.LaserTrackingSearchStart_xyz(3, 100, 300, 1000, 3);
19 robot.LaserTrackingSearchStop();
20
21 //robot.GetRobotTeachingPoint(name, data);
22 robot.MoveToLaserSeamPos(1, 30, 0, 0, 0, offdese);
23 //printf("%f, %f, %f,%f, %f, %f,%f, %f, %f,%f, %f, %f\n", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11]);
24
25 robot.LaserTrackingTrackOnOff(1, 3);
26 //robot.LaserTrackingTrackOn(3);
27 JointPos endjointPos=new JointPos(68.809,-87.100,121.120,-127.233,-95.038,-109.555);
28 DescPose enddescPose=new DescPose(-103.555,-464.234,13.076,174.179,-1.344,-91.709);
29 robot.MoveL(endjointPos, enddescPose, 1, 0, 20, 100, 100, -1, 0,exaxisPos, 0, 0, offdese, 0,1, 1);
30
31 robot.LaserTrackingTrackOnOff(0, 3);
32 System.out.println("Current iteration: "+(i+1));
33 }
34 robot.CloseRPC();
35}
11.92. Extended Axis and Robot Synchronized Laser Tracking Code Example
1public static void testLasertrackandExitAxis(Robot robot)
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 seamjointPos=new JointPos(0, 0, 0, 0, 0, 0);
8 DescPose seamdescPose=new DescPose(0, 0, 0, 0, 0, 0);
9
10 for(int i =0;i<10;++i) {
11 // Move to the starting point for positioning
12 JointPos startjointPos = new JointPos(58.337, -119.628, 146.037, -116.358, -92.224, -117.654);
13 DescPose startdescPose = new DescPose(-53.375, -255.363, 0.919, 178.054, 1.077, -94.026);
14 robot.ExtAxisSyncMoveJ(startjointPos, startdescPose, 1, 0, 100, 100, 100, startexaxisPos, -1, 0, offdese);
15
16 System.out.println("11111");
17 // Start positioning along -y direction
18 int ret = robot.LaserTrackingSearchStart_xyz(3, 100, 300, 1000, 2);
19 robot.LaserTrackingSearchStop();
20 System.out.println("2222");
21 int[] tool = new int[1];
22 int[] user = new int[1];
23 robot.GetLaserSeamPos(0, offdese, seamjointPos, seamdescPose, tool, user, startexaxisPos);
24 System.out.println(seamjointPos.J1 + ", " + seamjointPos.J2 + ", " +
25 seamjointPos.J3 + ", " + seamjointPos.J4 + ", " +
26 seamjointPos.J5 + ", " + seamjointPos.J6 + ", " +
27 seamdescPose.tran.x + ", " + seamdescPose.tran.y + ", " +
28 seamdescPose.tran.z + ", " + seamdescPose.rpy.rx + ", " +
29 seamdescPose.rpy.ry + ", " + seamdescPose.rpy.rz);
30 // If positioning is successful
31 if (ret == 0) {
32 // Robot and extended axis synchronously move to the positioning point
33 robot.ExtAxisSyncMoveJ(seamjointPos, seamdescPose, 1, 0, 100, 100, 100, seamexaxisPos, -1, 0, offdese);
34
35 // Start laser tracking along the positioning point and synchronously move with extended axis
36 System.out.println("3333");
37 robot.LaserTrackingTrackOnOff(1, 2);
38 JointPos endjointPos = new JointPos(70.580, -90.918, 126.593, -125.154, -92.162, -105.403);
39 DescPose enddescPose = new DescPose(-53.375, -419.020, 0.920, 178.054, 1.076, -94.026);
40 robot.ExtAxisSyncMoveL(endjointPos, enddescPose, 1, 0, 20, 100, 100, -1, endexaxisPos, 0, offdese);
41 ;
42 // Stop tracking
43 robot.LaserTrackingTrackOnOff(0, 2);
44 System.out.println("44444");
45 }
46 System.out.println("Current run count: "+i);
47 }
48 robot.CloseRPC();
49}
11.93. End-Effector Transparent Transmission Function Enable/Disable SDK Interface
1/**
2* @brief Enable end-effector general transparent transmission function
3* @param enable, 0-disable, 1-enable
4* @return Error code
5*/
6public int SetAxleGenComEnable(int mode)
11.94. End-Effector Transparent Transmission Function Non-Periodic Data Transmission and Reception SDK Interface
1/**
2* @brief End-effector sends non-periodic data and waits for response
3* @param lenSnd Length of data to send
4* @param sndBuff Data to send
5* @param lenRcv Length of data to receive
6* @param [out] rcvData Response data
7* @return Error code
8*/
9public int SndRcvAxleGenComCmdData(int lenSnd, int[] sndBuff, int lenRcv, int[] rcvData)
11.95. Code Example for Non-Periodic Data Communication of DIO Health Care Moxibustion Head Based on End-Effector Transparent Transmission Function
1public static void testAxleGenCom(Robot robot) {
2int[] led_on = {0xAB, 0xBA, 0x12, 0x01, 0x01, 0x79};
3int[] led_off = {0xAB, 0xBA, 0x12, 0x01, 0x00, 0x78};
4int[] version = {0xAB, 0xBA, 0x11, 0x00, 0x76};
5int[] state = {0xAB, 0xBA, 0x1B, 0x01, 0xAA, 0x2B};
6
7int[] rcvdata = new int[16];
8int ret = 0;
9int cnt = 1;
10
11JointPos p1Joint = new JointPos(88.708, -86.178, 140.989, -141.825, -89.162, -49.879);
12DescPose p1Desc = new DescPose(188.007, -377.850, 260.207, 178.715, 2.823, -131.466);
13
14JointPos p2Joint = new JointPos(112.131, -75.554, 126.989, -139.027, -88.044, -26.477);
15DescPose p2Desc = new DescPose(368.003, -377.848, 260.211, 178.715, 2.823, -131.465);
16
17ExaxisPos exaxisPos = new ExaxisPos(0, 0, 0, 0);
18DescPose offdese = new DescPose(0, 0, 0, 0, 0, 0);
19
20// Enable end-effector transparent transmission function
21robot.SetAxleGenComEnable(1);
22robot.SetAxleLuaEnable(1);
23
24while (cnt <= 10000) {
25 // Read version number
26 ret = robot.SndRcvAxleGenComCmdData(5, version, 10, rcvdata);
27 if (ret == 0) {
28 System.out.printf(" hard version : %d,hard code:%d, soft version:%d %d, soft code:%d \n",
29 rcvdata[4], rcvdata[5], rcvdata[6], rcvdata[7], rcvdata[8]);
30 } else {
31 System.out.println("SndRcvAxleGenComCmdData version fail: " + ret);
32 break;
33 }
34 robot.Sleep(1000);
35
36 // Read moxibustion head presence status
37 ret = robot.SndRcvAxleGenComCmdData(6, state, 6, rcvdata);
38 if (ret == 0) {
39 System.out.printf(" state : %d \n", rcvdata[4]);
40 }
41 robot.Sleep(1000);
42
43 // Turn on moxibustion head laser
44 ret = robot.SndRcvAxleGenComCmdData(6, led_on, 6, rcvdata);
45 if (ret == 0) {
46 System.out.printf("led on rcv data is: %d, %d, %d, %d, %d, %d\n",
47 rcvdata[0], rcvdata[1], rcvdata[2], rcvdata[3], rcvdata[4], rcvdata[5]);
48 }
49 robot.MoveJ(p1Joint, p1Desc, 0, 0, 100.0, 100.0, 100.0, exaxisPos, -1.0, 0, offdese);
50 robot.Sleep(4000);
51
52 // Turn off moxibustion head laser
53 ret = robot.SndRcvAxleGenComCmdData(6, led_off, 6, rcvdata);
54 if (ret == 0) {
55 System.out.printf("led off rcv data is: %d, %d, %d, %d, %d, %d \n",
56 rcvdata[0], rcvdata[1], rcvdata[2], rcvdata[3], rcvdata[4], rcvdata[5]);
57 }
58 robot.MoveJ(p2Joint, p2Desc, 0, 0, 100.0, 100.0, 100.0, exaxisPos, -1.0, 0, offdese);
59 robot.Sleep(1000);
60
61 System.out.println("***********************complete No. " + cnt + " SDK test*****************************");
62 cnt++;
63}
64}
11.96. Download Open Protocol Lua File
1/**
2* @brief Download open protocol Lua file
3* @param fileName Open protocol file name "CtrlDev_XXX.lua"
4* @param savePath Path to save the open protocol file
5* @return Error code
6*/
7public int OpenLuaDownload(string fileName, string savePath)
11.97. 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.98. Delete All Open Protocol Lua Files
1/**
2* @brief Delete all open protocol Lua files
3* @return Error code
4*/
5public int AllOpenLuaDelete()
11.99. Code Example for Controller Peripheral Open Protocol Upload, Download, and Delete
1public static int TestCtrlOpenLuaOperate(Robot robot) {
2 int rtn;
3 rtn = robot.OpenLuaUpload("D://zUP/openlua/CtrlDev_WELDING_A.lua");
4 System.out.println("OpenLuaUpload rtn is " + rtn);
5 rtn = robot.OpenLuaUpload("D://zUP/openlua/CtrlDev_SWDPOLISH.lua");
6 System.out.println("OpenLuaUpload rtn is " + rtn);
7 rtn = robot.OpenLuaDownload("CtrlDev_WELDING_A.lua", "D://zDOWN/");
8 System.out.println("OpenLuaDownload rtn is " + rtn);
9 rtn = robot.OpenLuaDownload("CtrlDev_SWDPOLISH.lua", "D://zDOWN/");
10 System.out.println("OpenLuaDownload rtn is " + rtn);
11
12 rtn = robot.SetCtrlOpenLUAName(0, "CtrlDev_WELDING_A.lua");
13 System.out.println("SetCtrlOpenLUAName rtn is " + rtn);
14 rtn = robot.SetCtrlOpenLUAName(1, "CtrlDev_SWDPOLISH.lua");
15 System.out.println("SetCtrlOpenLUAName rtn is " + rtn);
16
17 String[] names = new String[4];
18 rtn = robot.GetCtrlOpenLUAName(names);
19 System.out.println("GetCtrlOpenLUAName rtn is " + rtn + ", names: " +
20 names[0] + ", " + names[1] + ", " + names[2] + ", " + names[3]);
21
22 rtn = robot.LoadCtrlOpenLUA(1);
23 System.out.println("LoadCtrlOpenLUA rtn is " + rtn);
24 robot.Sleep(2000);
25 rtn = robot.UnloadCtrlOpenLUA(1);
26 System.out.println("UnloadCtrlOpenLUA rtn is " + rtn);
27
28 rtn = robot.OpenLuaDelete("CtrlDev_WELDING_A.lua");
29 System.out.println("OpenLuaDelete rtn is " + rtn);
30 rtn = robot.AllOpenLuaDelete();
31 System.out.println("AllOpenLuaDelete rtn is " + rtn);
32
33 robot.Sleep(1000);
34 return 0;
35}