top of page
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,