New in version C#SDK-V1.1.7: Web-3.8.5
/**
* @brief Read Slave DI
* @param DOIndex DI number
* @param readNum Number to read
* @param status Read value, max 8
* @return Error code
*/
public 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
/**
* @brief Read Slave AI
* @param AIIndex AI number
* @param readNum Number to read
* @param status Read value, max 8
* @return Error code
*/
public 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
/**
* @brief Wait for Extended DI Input
* @param DIIndex DI number
* @param status 0-Low level; 1-High level
* @param waitMs Max waiting time (ms)
* @return Error code
*/
public 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
/**
* @brief Wait for Extended AI Input
* @param AIIndex AI number
* @param waitType 0-Greater than; 1-Less than
* @param value AI value
* @param waitMs Max waiting time (ms)
* @return Error code
*/
public int FieldBusSlaveWaitAI(int AIIndex, int waitType, double value, int waitMs)
11.68. Slave Mode Related Interface Command Code Example
private void button101_Click(object sender, EventArgs e)
{
int rtn = 0;
int type = 0, version = 0, connState = 0;
int[] ctrl = new int[8];
int[] ctrlAO = new int[8];
int[] DI = new int[8];
double[] AI = new double[8];
if (rtn != 0)
{
return;
}
// Upload and load open protocol file
robot.OpenLuaUpload("E://zup/CtrlDev_field.lua");
Thread.Sleep(2000);
robot.SetCtrlOpenLUAName(3, "CtrlDev_field.lua");
robot.UnloadCtrlOpenLUA(3);
robot.LoadCtrlOpenLUA(3);
Thread.Sleep(8000);
// Get protocol type, software version, and connection status with PLC
robot.GetFieldBusConfig(ref type, ref version, ref connState);
Console.WriteLine($"type is {type}, version is {version}, connState is {connState}");
// Write DO0 = 1, DO1 = 0, DO2 = 1
ctrl[0] = 1;
ctrl[1] = 0;
ctrl[2] = 1;
robot.FieldBusSlaveWriteDO(0, 3, ctrl);
// Write AO2 = 0x1000
ctrlAO[0] = 0x1000;
robot.FieldBusSlaveWriteAO(2, 1, ctrlAO);
for (int i = 0; i < 100; i++)
{
robot.FieldBusSlaveReadDI(0, 4, ref DI);
Console.WriteLine($"DI0 is {DI[0]}, DI1 is {DI[1]}, DI2 is {DI[2]}, DI3 is {DI[3]}");
robot.FieldBusSlaveReadAI(0, 3, ref AI);
Console.WriteLine($"AI0 is {AI[0]}, AI1 is {AI[1]}, AI2 is {AI[2]}");
Thread.Sleep(10);
}
int ret = robot.FieldBusSlaveWaitDI(0, 1, 100);
Console.WriteLine($"FieldBusSlaveWaitDI result is {ret}");
ret = robot.FieldBusSlaveWaitAI(0, 0, 400.00f, 100);
Console.WriteLine($"FieldBusSlaveWaitAI result is {ret}");
}
11.69. Control Array Sucker
New in version C#SDK-V1.1.7: Web-3.8.5
/**
* @brief Control Array Sucker
* @param slaveID Slave ID
* @param len Length
* @param ctrlValue Control value 1-Suction at max vacuum; 2-Suction at set vacuum; 3-Stop suction
* @return Error code
*/
public 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
/**
* @brief Get Array Sucker Status
* @param slaveID Slave ID
* @param state Adsorption state 0-Release object; 1-Workpiece detected and adsorbed successfully; 2-No object adsorbed; 3-Object detached
* @param pressValue Current vacuum degree Unit kpa
* @param error Sucker current error code
* @return Error code
*/
public 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
/**
* @brief Wait for Sucker Status
* @param slaveID Slave ID
* @param state Adsorption state 0-Release object; 1-Workpiece detected and adsorbed successfully; 2-No object adsorbed; 3-Object detached
* @param ms Max waiting time
* @return Error code
*/
public int WaitSuckerState(int slaveID, int state, int ms)
11.72. Array Sucker Control Command Code Example
private void TestSucker(Robot robot)
{
int[] ctrl = new int[20];
int state=0;
int pressValue=0;
int error=0;
int rtn;
// Upload and load open protocol file
robot.OpenLuaUpload(@"C:\SDK\CtrlDev_sucker.lua");
Thread.Sleep(2000);
robot.UnloadCtrlOpenLUA(1);
robot.LoadCtrlOpenLUA(1);
Thread.Sleep(1000);
// Control sucker in broadcast mode with maximum adsorption capacity
ctrl[0] = 1;
robot.SetSuckerCtrl(0, 1, ctrl);
// Monitor states of sucker 1 and sucker 12 in a loop
for (int i = 0; i < 100; i++)
{
robot.GetSuckerState(1, ref state, ref pressValue, ref error);
Console.WriteLine($"sucker1 state is {state}, pressValue is {pressValue}, error num is {error}");
robot.GetSuckerState(12, ref state, ref pressValue, ref error);
Console.WriteLine($"sucker12 state is {state}, pressValue is {pressValue}, error num is {error}");
Thread.Sleep(100);
}
// Wait for sucker 1 to reach adsorbed state, timeout 100ms
int ret = robot.WaitSuckerState(1, 1, 100);
Console.WriteLine($"WaitSuckerState result is {ret}");
// Unicast mode to turn off sucker 1 and 12
ctrl[0] = 3;
robot.SetSuckerCtrl(1, 1, ctrl);
robot.SetSuckerCtrl(12, 1, ctrl);
robot.CloseRPC();
}
11.73. Laser peripheral on/off function
New in version C#SDK-V1.1.8: Web-3.8.6
/**
* @brief Laser peripheral on/off function
* @param [in] OnOff 0-off 1-on
* @param [in] weldId Weld seam ID, default is 0
* @return Error code
*/
public 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
/**
* @brief Laser tracking start/stop function
* @param [in] OnOff 0-stop 1-start
* @param [in] coordId Laser peripheral tool coordinate system number
* @return Error code
*/
public int LaserTrackingTrackOnOff(int OnOff, int coordId)
11.75. Laser positioning - fixed direction
New in version C#SDK-V1.1.8: Web-3.8.6
/**
* @brief Laser positioning - fixed direction
* @param [in] direction 0-x+ 1-x- 2-y+ 3-y- 4-z+ 5-z-
* @param [in] vel Speed in %
* @param [in] distance Maximum positioning distance in mm
* @param [in] timeout Positioning timeout in ms
* @param [in] posSensorNum Laser calibrated tool coordinate number
* @return Error code
*/
public 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
/**
* @brief Laser positioning - arbitrary direction
* @param [in] directionPoint XYZ coordinates of the positioning input point
* @param [in] vel Speed in %
* @param [in] distance Maximum positioning distance in mm
* @param [in] timeout Positioning timeout in ms
* @param [in] posSensorNum Laser calibrated tool coordinate number
* @return Error code
*/
public 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
/**
* @brief Laser positioning stop
* @return Error code
*/
public int LaserTrackingSearchStop()
11.78. Laser IP configuration
New in version C#SDK-V1.1.8: Web-3.8.6
/**
* @brief Laser IP configuration
* @param [in] ip IP address of the laser peripheral
* @param [in] port Port number of the laser peripheral
* @return Error code
*/
public 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
/**
* @brief Laser peripheral sampling period configuration
* @param [in] period Laser peripheral sampling period in ms
* @return Error code
*/
public int LaserTrackingSensorSamplePeriod(int period)
11.80. Laser peripheral driver loading
New in version C#SDK-V1.1.8: Web-3.8.6
/**
* @brief Laser peripheral driver loading
* @param [in] type Laser peripheral driver protocol type 101-Ruiniu 102-Chuangxiang 103-Quanshi 104-Tongzhou 105-Aotai
* @return Error code
*/
public int LoadPosSensorDriver(int type)
11.81. Laser Peripheral Driver Unloading
New in version C#SDK-V1.1.8: Web-3.8.6
/**
* @brief Laser peripheral driver unloading
* @return Error code
*/
public int UnLoadPosSensorDriver()
11.82. Laser Weld Seam Trajectory Recording
New in version C#SDK-V1.1.8: Web-3.8.6
/**
* @brief Laser weld seam trajectory recording
* @param [in] status 0-stop recording 1-real-time tracking 2-start recording
* @param [in] delayTime Delay time in ms
* @return Error code
*/
public 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
/**
* @brief Laser weld seam trajectory replay
* @param [in] delayTime Delay time in ms
* @param [in] speed Speed in %
* @return Error code
*/
public int LaserSensorReplay(int delayTime, double speed)
11.84. Laser Tracking Replay
New in version C#SDK-V1.1.8: Web-3.8.6
/**
* @brief Laser tracking replay
* @return Error code
*/
public int MoveLTR()
11.85. Laser Weld Seam Trajectory Recording and Replay
/**
* @brief Laser Seam Trajectory Recording and Replay
* @param [in] delayMode Mode 0-Delay Time 1-Delay Distance
* @param [in] delayTime Delay time in milliseconds (ms)
* @param [in] delayDisExAxisNum Extended Axis Number
* @param [in] delayDis Delay distance in millimeters (mm)
* @param [in] sensitivePara Compensation Sensitivity Coefficient
* @param [in] trackMode Fixed-point Tracking Type. 0-Extended Axis Asynchronous Motion; 1-Robot
* @param [in] triggerMode Fixed-point Tracking Trigger Method. 0-Tracking Duration; 1-IO
* @param [in] runTime Robot Fixed-point Tracking Duration in seconds (s)
* @param [in] speed Speed in percentage (%)
* @return Error Code
*/
public 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
/**
* @brief Move to laser record start point
* @param [in] moveType 0-PTP 1-LIN
* @param [in] ovl Speed in %
* @return Error code
*/
public 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
/**
* @brief Move to laser record end point
* @param [in] moveType 0-PTP 1-LIN
* @param [in] ovl Speed in %
* @return Error code
*/
public 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
/**
* @brief Move to laser sensor positioning point
* @param [in] moveFlag Motion type: 0-PTP; 1-LIN
* @param [in] ovl Speed scaling factor, 0-100
* @param [in] dataFlag Weld seam cache data selection: 0-execute planning data; 1-execute recorded data
* @param [in] plateType Plate type: 0-corrugated plate; 1-corrugated cardboard; 2-fence plate; 3-oil drum; 4-corrugated shell steel
* @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
* @param [in] offset Offset value
* @return Error code
*/
public 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
/**
* @brief Get laser sensor positioning point coordinate information
* @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
* @param [in] offset Offset value
* @param [out] jPos Joint position [°]
* @param [out] descPos Cartesian position [mm]
* @param [out] tool Tool coordinate system
* @param [out] user Workpiece coordinate system
* @param [out] exaxis Extended axis position [mm]
* @return Error code
*/
public 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
void testLaserConfig()
{
int[] ctrl = new int[20];
int state;
int pressValue;
int error;
robot.LaserTrackingSensorConfig("192.168.58.20", 5020);
robot.LaserTrackingSensorSamplePeriod(20);
robot.LoadPosSensorDriver(101);
robot.LaserTrackingLaserOnOff(0, 0);
System.Threading.Thread.Sleep(3000);
robot.LaserTrackingLaserOnOff(1, 0);
}
11.91. Laser Trajectory Scanning and Trajectory Replay Code Example
New in version C#SDK-V1.1.8: Web-3.8.6
void testLaserRecordAndReplay()
{
int[] ctrl = new int[20];
int state;
int pressValue;
int error;
robot.OpenLuaUpload("D://zUP/CtrlDev_laser_ruiniu-0117.lua");
System.Threading.Thread.Sleep(2000);
robot.SetCtrlOpenLUAName(0, "CtrlDev_laser_ruiniu-0117.lua");
robot.UnloadCtrlOpenLUA(0);
robot.LoadCtrlOpenLUA(0);
System.Threading.Thread.Sleep(8000);
for (int i=0;i<10;++i)
{
JointPos startjointPos = new JointPos(56.205, -117.951, 141.872, -118.149, -94.217, -122.176);
DescPose startdescPose = new DescPose(-97.552, -282.855, 26.675, 174.182, -1.338, -91.707);
ExaxisPos exaxisPos = new ExaxisPos(0, 0, 0, 0);
DescPose offdese = new DescPose(0, 0, 0, 0, 0, 0);
robot.MoveL(startjointPos, startdescPose, 1, 0, 100, 100, 100, -1, exaxisPos, 0, 0, offdese, 0);
robot.LaserSensorRecord1(2, 10);
JointPos endjointPos = new JointPos(68.809, -87.100, 121.120, -127.233, -95.038, -109.555);
DescPose enddescPose = new DescPose(-103.555, -464.234, 13.076, 174.179, -1.344, -91.709);
robot.MoveL(endjointPos, enddescPose, 1, 0, 50, 100, 100, -1, exaxisPos, 0, 0, offdese, 0);
robot.LaserSensorRecord1(0, 10);
robot.MoveToLaserRecordStart(1, 30);
robot.LaserSensorReplay(10, 100);
robot.MoveLTR();
robot.LaserSensorRecord1(0, 10);
Console.WriteLine($"Number of completions : {i+1} ");
}
}
11.92. Laser Positioning and Real-time Tracking Code Example
New in version C#SDK-V1.1.8: Web-3.8.6
public static void testLasertrack()
{
int[] ctrl = new int[20];
int state;
int pressValue;
int error;
robot.OpenLuaUpload("D://zUP/CtrlDev_laser_ruiniu-0117.lua");
System.Threading.Thread.Sleep(2000);
robot.SetCtrlOpenLUAName(0, "CtrlDev_laser_ruiniu-0117.lua");
robot.UnloadCtrlOpenLUA(0);
robot.LoadCtrlOpenLUA(0);
System.Threading.Thread.Sleep(8000);
for (int i = 0; i < 10; ++i)
{
JointPos startjointPos = new JointPos(56.205, -117.951, 141.872, -118.149, -94.217, -122.176);
DescPose startdescPose = new DescPose(-97.552, -282.855, 26.675, 174.182, -1.338, -91.707);
ExaxisPos exaxisPos = new ExaxisPos(0, 0, 0, 0);
DescPose offdese = new DescPose(0, 0, 0, 0, 0, 0);
DescTran directionPoint = new DescTran();
robot.MoveL(startjointPos, startdescPose, 1, 0, 100, 100, 100, -1, exaxisPos, 0, 0, offdese, 0);
robot.LaserTrackingSearchStart_xyz(3, 100, 300, 1000, 3);
robot.LaserTrackingSearchStop();
robot.MoveToLaserSeamPos(1, 30, 0, 0, 0, offdese);
robot.LaserTrackingTrackOnOff(1, 3);
JointPos endjointPos = new JointPos(68.809, -87.100, 121.120, -127.233, -95.038, -109.555);
DescPose enddescPose = new DescPose(-103.555, -464.234, 13.076, 174.179, -1.344, -91.709);
robot.MoveL(endjointPos, enddescPose, 1, 0, 20, 100, 100, -1, exaxisPos, 0, 0, offdese, 0);
robot.LaserTrackingTrackOnOff(0, 3);
Console.WriteLine($"Number of completions : {i + 1} ");
}
}
11.93. Extended Axis and Robot Synchronized Laser Tracking Code Example
New in version C#SDK-V1.1.8: Web-3.8.6
public void TestLaserTrackAndExitAxis()
{
ExaxisPos startexaxisPos = new ExaxisPos(0, 0, 0, 0);
ExaxisPos seamexaxisPos = new ExaxisPos(-10, 0, 0, 0);
ExaxisPos endexaxisPos = new ExaxisPos(-30, 0, 0, 0);
DescPose offdese = new DescPose(0, 0, 0, 0, 0, 0);
JointPos startjointPos = new JointPos(58.337, -119.628, 146.037, -116.358, -92.224, -117.654);
DescPose startdescPose = new DescPose(-53.375, -255.363, 0.919, 178.054, 1.077, -94.026);
for (int i=0;i<10;++i)
{
robot.ExtAxisSyncMoveJ(startjointPos, startdescPose, 1, 0, 100, 100, 100, startexaxisPos, -1, 0, offdese);
Console.WriteLine("11111");
int ret = robot.LaserTrackingSearchStart_xyz(3, 100, 300, 1000, 2);
robot.LaserTrackingSearchStop();
Console.WriteLine("2222");
int tool = 0;
int user = 0;
JointPos seamjointPos = new JointPos();
DescPose seamdescPose = new DescPose();
robot.GetLaserSeamPos(0, offdese, ref seamjointPos, ref seamdescPose, ref tool, ref user, ref startexaxisPos);
Console.WriteLine($"{seamjointPos.jPos[0]}, {seamjointPos.jPos[1]}, {seamjointPos.jPos[2]}, " +
$"{seamjointPos.jPos[3]}, {seamjointPos.jPos[4]}, {seamjointPos.jPos[5]}, " +
$"{seamdescPose.tran.x}, {seamdescPose.tran.y}, {seamdescPose.tran.z}, " +
$"{seamdescPose.rpy.rx}, {seamdescPose.rpy.ry}, {seamdescPose.rpy.rz}");
if (ret == 0)
{
robot.ExtAxisSyncMoveJ(seamjointPos, seamdescPose, 1, 0, 100, 100, 100, seamexaxisPos, -1, 0, offdese);
Console.WriteLine("3333");
robot.LaserTrackingTrackOnOff(1, 2);
JointPos endjointPos = new JointPos(70.580, -90.918, 126.593, -125.154, -92.162, -105.403);
DescPose enddescPose = new DescPose(-53.375, -419.020, 0.920, 178.054, 1.076, -94.026);
robot.ExtAxisSyncMoveL(endjointPos, enddescPose, 1, 0, 20, 100, 100, -1, endexaxisPos, 0, offdese);
robot.LaserTrackingTrackOnOff(0, 2);
}
Console.WriteLine($"Number of completions : {i + 1} ");
}
}