12. Machine Manpower Control

12.1. Force Sensor Configuration

1 /**
2 * @brief Configuring force sensors
3 * @param [in] company Force Sensor Manufacturer, 17 - Quintessence Technologies
4 * @param [in] device device number, not used, default is 0
5 * @param [in] softvesion software version number, not used, the default is 0
6 * @param [in] bus device hangs on the end of the bus position, do not use, the default is 0
7 * @return Error code
8 */
9 int FT_SetConfig(int company, int device, int softvesion, int bus);

12.2. Get the force transducer configuration

1 /**
2 * @brief Get force sensor configuration
3 * @param [out] deviceID force sensor number
4 * @param [out] company Force Sensor Manufacturer,, Force Sensor Manufacturer, 17-Kunwei Technology, 19-Aerospace 11th Academy, 20-ATI Sensors, 21-Zhongke MiDot, 22-Weihang Minxin
5 * @param [out] device device number, Kunwei (0-KWR75B), Aisino Eleven (0-MCS6A-200-4), ATI (0-AXIA80 -M8), Zhongke MiDot (0-MST2010), Weihang Minxin (0-WHC6L-YB-10A)
6 * @param [out] softvesion software version number, not used, the default is 0
7 * @return Error code
8 */
9 int FT_GetConfig(ref int deviceID, ref int company, ref int device, ref int softvesion);

12.3. Force sensor activation

1 /**
2 * @brief Force sensor activation
3 * @param [in] act 0-reset, 1-activate
4 * @return Error code.
5 */
6 int FT_Activate(byte act).

12.4. Force Transducer Zeroing

1/**
2* @brief Force sensor zeroing
3* @param [in] act 0-remove zero, 1-zero correction
4* @return Error code
5*/
6int FT_SetZero(byte act).

12.5. Set the force transducer reference coordinate system

1/**
2* @brief Set the force sensor reference coordinate system.
3* @param [in] ref 0-tool coordinate system, 1-base coordinate system
4* @return Error code.
5*/
6int FT_SetRCS(byte type).

12.6. Set the force transducer lower load weight

1/**
2* @brief Set the load weight under the force sensor.
3* @param [in] weight load weight kg
4* @return Error code.
5*/
6int SetForceSensorPayLoad(double weight);

12.7. Set the force sensor payload center of mass

1/**
2* @brief Setting the center of mass of a load under a force sensor.
3* @param [in] x load center of mass x mm
4* @param [in] y load center of mass y mm
5* @param [in] z load center of mass z mm
6* @return Error code
7*/
8int SetForceSensorPayLoadCog(double x, double y, double z);

12.8. Get the force sensor pay load weight

1/**
2* @brief Get the load weight under the force sensor.
3* @param [in] weight load weight kg
4* @return Error code.
5*/
6int GetForceSensorPayLoad(ref double weight).

12.9. Get force sensor payload center of mass

1/**
2* @brief Get the center of mass of the load under the force transducer.
3* @param [out] x load center of mass x mm
4* @param [out] y load center of mass y mm
5* @param [out] z load center of mass z mm
6* @return Error code
7*/
8int GetForceSensorPayLoadCog(ref double x, ref double y, ref double z);

12.10. Automatic zeroing of the force sensor.

1/**
2* @brief Force sensor auto-zero
3* @param [out] weight Sensor mass kg
4* @param [out] pos sensor center of mass mm
5* @return Error code
6*/
7int ForceSensorAutoComputeLoad(ref double weight, ref DescTran pos);

12.11. Get force/torque data in reference coordinate system.

1/**
2* @brief Get force/torque data in reference coordinate system.
3* @param [out] ft force/torque, fx,fy,fz,tx,ty,tz
4* @return Error code
5*/
6int FT_GetForceTorqueRCS(byte flag, ref ForceTorque ft);

12.12. Get force sensor raw force/torque data

1/**
2* @brief Get force sensor raw force/torque data.
3* @param [out] ft force/torque, fx,fy,fz,tx,ty,tz
4* @return Error code.
5*/
6int FT_GetForceTorqueOrigin(byte flag, ref ForceTorque ft);

12.13. Force Transducer Configuration and Auto-Zero Code Example

 1 private void button54_Click(object sender, EventArgs e)
 2{
 3    int company = 24;
 4    int device = 0;
 5    int softversion = 0;
 6    int bus = 1;
 7    int index = 1;
 8
 9    robot.FT_SetConfig(company, device, softversion, bus);
10    Thread.Sleep(1000);
11    robot.FT_GetConfig(ref company, ref device, ref softversion, ref bus);
12    Console.WriteLine($"FT config:{company},{device},{softversion},{bus}");
13    Thread.Sleep(1000);
14
15    robot.FT_Activate(0);
16    Thread.Sleep(1000);
17    robot.FT_Activate(1);
18    Thread.Sleep(1000);
19
20    Thread.Sleep(1000);
21    robot.FT_SetZero(0);
22    Thread.Sleep(1000);
23
24    ForceTorque ft = new ForceTorque(0, 0, 0, 0, 0, 0);
25    robot.FT_GetForceTorqueOrigin(0, ref ft);
26    Console.WriteLine($"ft origin:{ft.fx},{ft.fy},{ft.fz},{ft.tx},{ft.ty},{ft.tz}");
27    robot.FT_SetZero(1);
28    Thread.Sleep(1000);
29
30    DescPose ftCoord = new DescPose(0, 0, 0, 0, 0, 0);
31    robot.FT_SetRCS(0, ftCoord);
32
33    robot.SetForceSensorPayLoad(0.824);
34    robot.SetForceSensorPayLoadCog(0.778, 2.554, 48.765);
35    double weight = 0;
36    double x = 0, y = 0, z = 0;
37    robot.GetForceSensorPayLoad(ref weight);
38    robot.GetForceSensorPayLoadCog(ref x, ref y, ref z);
39    Console.WriteLine($"the FT load is {weight}, {x} {y} {z}");
40
41    robot.SetForceSensorPayLoad(0);
42    robot.SetForceSensorPayLoadCog(0, 0, 0);
43
44    double computeWeight = 0;
45    DescTran tran = new DescTran(0, 0, 0);
46    robot.ForceSensorAutoComputeLoad(ref weight, ref tran);
47    Console.WriteLine($"the result is weight {weight} pos is {tran.x} {tran.y} {tran.z}");
48
49}

12.14. Load Weight Recognition Record

1/**
2* @brief Load weight recognition record.
3* @param [in] id Sensor coordinate system number in the range [1~14].
4* @return Error code.
5*/
6int FT_PdIdenRecord(int id).

12.15. Load weight recognition calculation

1/**
2* @brief Load Weight Recognition Calculation
3* @param [out] weight Weight of load in kg.
4* @return Error code
5*/
6int FT_PdIdenCompute(ref double weight).

12.16. Load center of mass identification record

1/**
2* @brief Load center-of-mass identification record.
3* @param [in] id Sensor coordinate system number, range [1~14].
4* @param [in] index point number, range [1~3].
5* @return Error code
6*/
7int FT_PdCogIdenRecord(int id, int index).

12.17. Load center of mass identification calculation

1/**
2* @brief Load center of mass identification calculation.
3* @param [out] cog load center of mass in mm.
4* @return Error code.
5*/
6int FT_PdCogIdenCompute(ref DescTran cog);

12.18. Force Transducer Load Recognition Code Example

 1 private void btnFTPdCog_Click(object sender, EventArgs e)
 2{
 3    int company = 24, device = 0, softversion = 0, bus = 1;
 4
 5    robot.FT_SetConfig(company, device, softversion, bus);
 6    Thread.Sleep(1000);
 7    robot.FT_GetConfig(ref company, ref device, ref softversion, ref bus);
 8    Console.WriteLine($"FT config: {company}, {device}, {softversion}, {bus}");
 9    Thread.Sleep(1000);
10
11    robot.FT_Activate(0);
12    Thread.Sleep(1000);
13    robot.FT_Activate(1);
14    Thread.Sleep(1000);
15
16    Thread.Sleep(1000);
17    robot.FT_SetZero(0);
18    Thread.Sleep(1000);
19
20    ForceTorque ft = new ForceTorque(0,0,0,0,0,0);
21    robot.FT_GetForceTorqueOrigin(0, ref ft);
22    Console.WriteLine($"ft origin: {ft.fx}, {ft.fy}, {ft.fz}, {ft.tx}, {ft.ty}, {ft.tz}");
23    robot.FT_SetZero(1);
24    Thread.Sleep(1000);
25
26    DescPose tcoord = new DescPose(0, 0, 35.0, 0, 0, 0);
27    robot.SetToolCoord(10, tcoord, 1, 0, 0, 0);
28
29    robot.FT_PdIdenRecord(10);
30    Thread.Sleep(1000);
31
32    double weight = 0.0f;
33    robot.FT_PdIdenCompute(ref weight);
34    Console.WriteLine($"payload weight: {weight}");
35
36    DescPose desc_p1 = new DescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
37    DescPose desc_p2 = new DescPose(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
38    DescPose desc_p3 = new DescPose(-327.622, 402.230, 320.402, -178.067, 2.127, -46.207);
39
40    robot.MoveCart( desc_p1, 0, 0, 100.0f, 100.0f, 100.0f, -1.0f, -1);
41    Thread.Sleep(1000);
42    robot.FT_PdCogIdenRecord(10, 1);
43    robot.MoveCart( desc_p2, 0, 0, 100.0f, 100.0f, 100.0f, -1.0f, -1);
44    Thread.Sleep(1000);
45    robot.FT_PdCogIdenRecord(10, 2);
46    robot.MoveCart( desc_p3, 0, 0, 100.0f, 100.0f, 100.0f, -1.0f, -1);
47    Thread.Sleep(1000);
48    robot.FT_PdCogIdenRecord(10, 3);
49
50    DescTran cog = new DescTran(0,0,0);
51    robot.FT_PdCogIdenCompute(ref cog);
52    Console.WriteLine($"cog: {cog.x}, {cog.y}, {cog.z}");
53}

12.19. Collision Guard

 1/**
 2* @brief collision guarding
 3* @param [in] flag 0- turn off collision guarding, 1- turn on collision guarding
 4* @param [in] sensor_id Force sensor number.
 5* @param [in] select Whether to detect collision in six degrees of freedom, 0-no detection, 1-detection.
 6* @param [in] ft collision force/torque, fx,fy,fz,tx,ty,tz
 7* @param [in] max_threshold max_threshold
 8* @param [in] min_threshold min_threshold
 9* @note Force/torque detection range: (ft-min_threshold, ft+max_threshold)
10* @return Error code
11*/
12int FT_Guard(int flag, int sensor_id, int[] select, ForceTorque ft, double[] max_threshold, double[] min_threshold);

12.20. Collision Guard Code Example

 1 private void btnFTGuard_Click(object sender, EventArgs e)
 2{
 3    int company = 24, device = 0, softversion = 0, bus = 1;
 4
 5    robot.FT_SetConfig(company, device, softversion, bus);
 6    Thread.Sleep(1000);
 7    robot.FT_GetConfig(ref company, ref device, ref softversion, ref bus);
 8    Console.WriteLine($"FT config: {company}, {device}, {softversion}, {bus}");
 9    Thread.Sleep(1000);
10
11    robot.FT_Activate(0);
12    Thread.Sleep(1000);
13    robot.FT_Activate(1);
14    Thread.Sleep(1000);
15
16    Thread.Sleep(1000);
17    robot.FT_SetZero(0);
18    Thread.Sleep(1000);
19
20    byte sensor_id = 1;
21    int[] select = { 1, 1, 1, 1, 1, 1 };
22    double[] max_threshold = { 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f };
23    double[] min_threshold = { 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f };
24
25    ForceTorque ft = new ForceTorque();
26    DescPose desc_p1 = new DescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
27    DescPose desc_p2 = new DescPose(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
28    DescPose desc_p3 = new DescPose(-327.622, 402.230, 320.402, -178.067, 2.127, -46.207);
29
30    robot.FT_Guard(1, sensor_id, select,  ft, max_threshold, min_threshold);
31    robot.MoveCart( desc_p1, 0, 0, 100.0f, 100.0f, 100.0f, -1.0f, -1);
32    robot.MoveCart( desc_p2, 0, 0, 100.0f, 100.0f, 100.0f, -1.0f, -1);
33    robot.MoveCart( desc_p3, 0, 0, 100.0f, 100.0f, 100.0f, -1.0f, -1);
34
35    robot.FT_Guard(0, sensor_id, select, ft, max_threshold, min_threshold);
36}

12.21. Constant force control

New in version C#SDK-V1.1.9: Web-3.8.7

 1/**
 2* @brief  Constant Force Control
 3* @param  [in] flag 0-Disable constant force control, 1-Enable constant force control
 4* @param  [in] sensor_id Force sensor ID
 5* @param  [in] select  Select whether to detect collision for the six degrees of freedom, 0-Do not detect, 1-Detect
 6* @param  [in] ft  Collision force/torque, fx,fy,fz,tx,ty,tz
 7* @param  [in] ft_pid Force PID parameters, torque PID parameters
 8* @param  [in] adj_sign Adaptive start/stop control, 0-Disable, 1-Enable
 9* @param  [in] ILC_sign ILC start/stop control, 0-Stop, 1-Training, 2-Operation
10* @param  [in] max_dis Maximum adjustment distance, unit mm
11* @param  [in] max_ang Maximum adjustment angle, unit deg
12* @param  [in] M rx, ry mass parameters [0.1-10], default 2
13* @param  [in] B rx, ry damping parameters [0.1-50], default 8
14* @param  [in] threshold rx, ry activation thresholds [0-10], default 0.2
15* @param  [in] adjustCoeff rx, ry torque adjustment coefficients [0-1], default 1
16* @param  [in] polishRadio Polishing radius, unit mm
17* @param  [in] filter_Sign Filter enable flag 0-Off; 1-On, default off
18* @param  [in] posAdapt_sign Pose compliance enable flag 0-Off; 1-On, default off
19* @param  [in] isNoBlock Blocking flag, 0-Blocking; 1-Non-blocking
20* @return  Error code
21*/
22public int FT_Control(byte flag, int sensor_id, byte[] select, ForceTorque ft, float[] ft_pid,byte adj_sign, byte ILC_sign, float max_dis, float max_ang,double[] M, double[] B, double[] threshold, double[] adjustCoeff,double polishRadio, int filter_Sign, int posAdapt_sign, int isNoBlock)

12.22. Constant force control with damping code example

New in version C#SDK-V1.1.9: Web-3.8.7

 1public void TestFTControlWithAdjustCoeff()
 2{
 3    int rtn;
 4    int sensor_id = 10;
 5    byte[] select = new byte[6] { 0, 0, 1, 0, 0, 0 };
 6    float[] ft_pid = new float[6] { 0.0008f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
 7    byte adj_sign = 0;
 8    byte ILC_sign = 0;
 9    float max_dis = 1000.0f;
10    float max_ang = 20.0f;
11    ForceTorque ft = new ForceTorque();
12    ft.fz = -10.0f;
13    ExaxisPos epos = new ExaxisPos(0, 0, 0, 0);
14    JointPos j1 = new JointPos(80.765f, -98.795f, 106.548f, -97.734f, -89.999f, 94.842f);
15    JointPos j2 = new JointPos(43.067f, -84.429f, 92.620f, -98.175f, -90.011f, 57.144f);
16    DescPose desc_p1 = new DescPose(5.009f, -547.463f, 262.053f, -179.999f, -0.019f, 75.923f);
17    DescPose desc_p2 = new DescPose(-347.966f, -547.463f, 262.048f, -180.000f, -0.019f, 75.923f);
18    DescPose offset_pos = new DescPose(0, 0, 0, 0, 0, 0);
19    double[] M = new double[2] { 2.0, 2.0 };
20    double[] B = new double[2] { 15.0, 15.0 };
21    double[] threshold = new double[2] { 1.0, 1.0 };
22    double[] adjustCoeff = new double[2] { 1.0, 0.8 };
23    double polishRadio = 0.0;
24    int filter_Sign = 0;
25    int posAdapt_sign = 1;
26    int isNoBlock = 0;
27    while (true)
28    {
29        rtn = robot.FT_Control(1, sensor_id, select, ft, ft_pid, adj_sign, ILC_sign, max_dis, max_ang, M, B, threshold, adjustCoeff, 0, 0, 1, 0);
30        Console.WriteLine($"FT_Control start rtn is {rtn}");
31        robot.MoveL(j1, desc_p1, 1, 0, 100, 100, 100, -1, 0, epos, 0, 0, offset_pos, 0, 0, 10);
32        robot.MoveL(j2, desc_p2, 1, 0, 100, 100, 100, -1, 0, epos, 0, 0, offset_pos, 0, 0, 10);
33        rtn = robot.FT_Control(0, sensor_id, select, ft, ft_pid, adj_sign, ILC_sign, max_dis, max_ang, M, B, threshold, adjustCoeff, 0, 0, 1, 0);
34        Console.WriteLine($"FT_Control end rtn is {rtn}");
35    }
36}

12.23. Rotational Insertion

 1/**
 2* @brief Rotational Insertion
 3* @param [in] rcs Reference coordinate system, 0 - Tool coordinate system, 1 - Base coordinate system
 4* @param [in] angVelRot Rotational angular velocity, unit deg/s
 5* @param [in] ft Force/Torque threshold, fx,fy,fz,tx,ty,tz, range [0~100]
 6* @param [in] max_angle Maximum rotation angle, unit deg
 7* @param [in] orn Force/Torque direction, 1 - Along Z-axis direction, 2 - Around Z-axis direction
 8* @param [in] max_angAcc Maximum rotational acceleration, unit deg/s^2, currently unused, default is 0
 9* @param [in] rotorn Rotation direction, 1 - Clockwise, 2 - Counterclockwise
10* @param [in] strategy Processing strategy for undetected force/torque, 0 - Error; 1 - Warning, continue motion
11* @return Error code
12*/
13public int FT_RotInsertion(int rcs, double angVelRot, double ft, double max_angle, int orn, double max_angAcc, int rotorn, int strategy)

12.24. Robot Force Sensor Rotational Insertion Code Example

 1public void TestMove()
 2{
 3    int rtn;
 4    JointPos j1 = new JointPos(-11.904f, -99.669f, 117.473f, -108.616f, -91.726f, 74.256f);
 5    JointPos j2 = new JointPos(-45.615f, -106.172f, 124.296f, -107.151f, -91.282f, 74.255f);
 6    JointPos j3 = new JointPos(-29.777f, -84.536f, 109.275f, -114.075f, -86.655f, 74.257f);
 7    JointPos j4 = new JointPos(-31.154f, -95.317f, 94.276f, -88.079f, -89.740f, 74.256f);
 8    DescPose desc_pos1 = new DescPose(-419.524f, -13.000f, 351.569f, -178.118f, 0.314f, 3.833f);
 9    DescPose desc_pos2 = new DescPose(-321.222f, 185.189f, 335.520f, -179.030f, -1.284f, -29.869f);
10    DescPose desc_pos3 = new DescPose(-487.434f, 154.362f, 308.576f, 176.600f, 0.268f, -14.061f);
11    DescPose desc_pos4 = new DescPose(-443.165f, 147.881f, 480.951f, 179.511f, -0.775f, -15.409f);
12    DescPose offset_pos = new DescPose(0, 0, 0, 0, 0, 0);
13    ExaxisPos epos = new ExaxisPos(0, 0, 0, 0);
14    int tool = 0;
15    int user = 0;
16    float vel = 100.0f;
17    float acc = 100.0f;
18    float ovl = 100.0f;
19    float oacc = 100.0f;
20    float blendT = 0.0f;
21    float blendR = 0.0f;
22    byte flag = 0;
23    byte search = 0;
24    int blendMode = 0;
25    int velAccMode = 0;
26    robot.SetSpeed(20);
27    rtn = robot.MoveJ(j1, desc_pos1, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
28    Console.WriteLine($"movej errcode:{rtn}");
29    rtn = robot.MoveL(j2, desc_pos2, tool, user, vel, acc, ovl, blendR, blendMode, epos, search, flag, offset_pos, oacc, velAccMode,0,10);
30    Console.WriteLine($"movel errcode:{rtn}");
31    rtn = robot.MoveC(j3, desc_pos3, tool, user, vel, acc, epos, flag, offset_pos,j4, desc_pos4, tool, user, vel, acc, epos, flag, offset_pos, ovl, blendR, oacc, velAccMode);
32    Console.WriteLine($"movec errcode:{rtn}");
33    rtn = robot.MoveJ(j2, desc_pos2, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
34    Console.WriteLine($"movej errcode:{rtn}");
35    rtn = robot.Circle(j3, desc_pos3, tool, user, vel, acc, epos,j1, desc_pos1, tool, user, vel, acc, epos,ovl, flag, offset_pos, oacc, -1, velAccMode);
36    Console.WriteLine($"circle errcode:{rtn}");
37    rtn = robot.MoveCart(desc_pos4, tool, user, vel, acc, ovl, blendT, -1);
38    Console.WriteLine($"MoveCart errcode:{rtn}");
39    rtn = robot.MoveJ(j1, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
40    Console.WriteLine($"movej errcode:{rtn}");
41    rtn = robot.MoveL(desc_pos2, tool, user, vel, acc, ovl, blendR, blendMode, epos, search, flag, offset_pos, -1, velAccMode);
42    Console.WriteLine($"movel errcode:{rtn}");
43    rtn = robot.MoveC(desc_pos3, tool, user, vel, acc, epos, flag, offset_pos,desc_pos4, tool, user, vel, acc, epos, flag, offset_pos,ovl, blendR, -1, velAccMode);
44    Console.WriteLine($"movec errcode:{rtn}");
45    rtn = robot.MoveJ(j2, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
46    Console.WriteLine($"movej errcode:{rtn}");
47    rtn = robot.Circle(desc_pos3, tool, user, vel, acc, epos, desc_pos1, tool, user, vel, acc, epos,ovl, flag, offset_pos, oacc, blendR, -1, velAccMode);
48    Console.WriteLine($"circle errcode:{rtn}");
49}

12.25. Flex control on

1/**
2* @brief Smooth control on
3* @param [in] p Position adjustment coefficient or softening coefficient.
4* @param [in] force Soft opening force threshold in N
5* @return Error Code
6*/
7int FT_ComplianceStart(float p, float force);

12.26. Flex control off

1/**
2* @brief Soft control off
3* @return Error code
4*/
5int FT_ComplianceStop();

12.27. Sample Flex Control Code

 1 private void btnComplience_Click(object sender, EventArgs e)
 2{
 3    int company = 24, device = 0, softversion = 0, bus = 1;
 4    robot.FT_SetConfig(company, device, softversion, bus);
 5    Thread.Sleep(1000);
 6    robot.FT_GetConfig(ref company, ref device, ref softversion, ref bus);
 7    Console.WriteLine($"FT config: {company}, {device}, {softversion}, {bus}");
 8    Thread.Sleep(1000);
 9
10    robot.FT_Activate(0);
11    Thread.Sleep(1000);
12    robot.FT_Activate(1);
13    Thread.Sleep(1000);
14
15    robot.FT_SetZero(0);
16    Thread.Sleep(1000);
17
18    byte flag = 1;
19    int sensor_id = 1;
20    int[] select = { 1, 1, 1, 0, 0, 0 };
21    double[] ft_pid = { 0.0005f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
22    byte adj_sign = 0, ILC_sign = 0;
23    float max_dis = 100.0f, max_ang = 0.0f;
24
25    ForceTorque ft = new ForceTorque { fx = -10.0, fy = -10.0, fz = -10.0 };
26    DescPose offset_pos = new DescPose(0, 0, 0, 0, 0, 0);
27    ExaxisPos epos = new ExaxisPos(0, 0, 0, 0);
28
29    JointPos j1 = new JointPos(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
30    JointPos j2 = new JointPos(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);
31    DescPose desc_p1 = new DescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
32    DescPose desc_p2 = new DescPose(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
33
34    robot.FT_Control(flag, (byte)sensor_id, select, ft, ft_pid, adj_sign, ILC_sign, max_dis, max_ang);
35    float p = 0.00005f;
36    float force = 30.0f;
37    int rtn = robot.FT_ComplianceStart(p, force);
38    Console.WriteLine($"FT_ComplianceStart rtn is {rtn}");
39
40    int count = 5;
41    while (count-- > 0)
42    {
43    robot.MoveL(j1, desc_p1, 0, 0, 100.0f, 180.0f, 100.0f, -1.0f, epos, 0, 1, offset_pos);
44    robot.MoveL(j2, desc_p2, 0, 0, 100.0f, 180.0f, 100.0f, -1.0f, epos, 0, 0, offset_pos);
45    }
46
47    robot.FT_ComplianceStop();
48    Console.WriteLine($"FT_ComplianceStop rtn is {rtn}");
49
50    flag = 0;
51    robot.FT_Control(flag, (byte)sensor_id, select, ft, ft_pid, adj_sign, ILC_sign, max_dis, max_ang);
52}

12.28. Load recognition initialization

New in version C#SDK-v1.0.4.

1/**
2* @brief Load recognition initialization.
3* @return Error code
4*/
5int LoadIdentifyDynFilterInit();

12.29. Load identification variable initialization

New in version C#SDK-v1.0.4.

1/**
2* @brief Initialization of load recognition variables.
3* @return Error code
4*/
5int LoadIdentifyDynVarInit();

12.30. Load Identification Main Program

New in version C#SDK-v1.0.4.

1/**
2* @brief Load recognition main program.
3* @param [in] joint_torque Joint torque.
4* @param [in] joint_pos Joint position.
5* @param [in] t Sampling period.
6* @return Error code
7*/
8int LoadIdentifyMain(double[] joint_torque, double[] joint_pos, double t);

12.31. Get the load identification result

New in version C#SDK-v1.0.4.

1/**
2* @brief Get load recognition results
3* @param [in] gain Gravity term coefficient double[6], centrifugal term coefficient double[6].
4* @param [out] weight load weight
5* @param [out] cog load center of mass
6* @return error code
7*/
8int LoadIdentifyGetResult(double[] gain, ref double weight, ref DescTran cog);

12.32. Robot Load Identification Code Example

 1private void button74_Click(object sender, EventArgs e)
 2{
 3    int rtn;
 4    int retval = 0;
 5
 6    retval = robot.LoadIdentifyDynFilterInit();
 7    Console.WriteLine("LoadIdentifyDynFilterInit retval is: " + retval);
 8
 9    retval = robot.LoadIdentifyDynVarInit();
10    Console.WriteLine("LoadIdentifyDynVarInit retval is: " + retval);
11
12    JointPos posJ = new JointPos(0,0,0,0,0,0);
13    DescPose posDec = new DescPose(0, 0, 0, 0, 0, 0);
14    double[] joint_toq = new double[6] { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
15    robot.GetActualJointPosDegree(0, ref posJ);
16    posJ.jPos[1] = posJ.jPos[1] + 10;
17    robot.GetJointTorques(0, joint_toq);
18    joint_toq[1] = joint_toq[1] + 2;
19
20    double[] tmpTorque = new double[6] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
21    for (int i = 0; i < 6; i++)
22    {
23        tmpTorque[i] = joint_toq[i];
24    }
25
26    retval = robot.LoadIdentifyMain(tmpTorque, posJ.jPos, 1);
27    Console.WriteLine("LoadIdentifyMain retval is: " + retval);
28
29    double[] gain = new double[12] { 0, 0.05, 0, 0, 0, 0, 0, 0.02, 0, 0, 0, 0 };
30    double weight = 0;
31    DescTran load_pos = new DescTran(0, 0, 0);
32    retval = robot.LoadIdentifyGetResult(gain, ref weight, ref load_pos);
33    Console.WriteLine("LoadIdentifyGetResult retval is: {0}; weight is {1} cog is {2} {3} {4}", retval, weight, load_pos.x, load_pos.y, load_pos.z);
34}

12.33. Force sensor assisted drag

New in version C#SDK-V1.1.4: Web-3.8.3

 1/**
 2* @brief Force sensor assisted drag
 3* @param [in] status control status, 0-off; 1-on
 4* @param [in] asaptiveFlag Adaptive on flag, 0-off; 1-on
 5* @param [in] interfereDragFlag Interference area drag flag, 0-off; 1-on
 6* @param [in] ingularityConstraintsFlag singularity strategy, 0-avoidance; 1-crossing
 7* @param [in] forceCollisionFlag Robot collision detection flag during auxiliary drag; 0-off; 1-on
 8* @param [in] M inertia coefficient
 9* @param [in] B Damping coefficient
10* @param [in] K stiffness coefficient
11* @param [in] F Drag six-dimensional force threshold
12* @param [in] Fmax Maximum drag force limit Nm
13* @param [in] Vmax Maximum joint speed limit °/s
14* @return Error code
15*/
16int EndForceDragControl(int status, int asaptiveFlag, int interfereDragFlag,int ingularityConstraintsFlag,int forceCollisionFlag, double[] M , double[] B, double[] K, double[] F, double Fmax, double Vmax);

12.34. Get the state of the force sensor drag switch

1/**
2* @brief Get force sensor drag switch state.
3* @param [out] dragState force sensor assist drag control state, 0-off; 1-on
4* @param [out] sixDimensionalDragState sixDimensionalForceAssistedDragState, 0-off; 1-on
5* @return ErrorCode
6*/
7int GetForceAndTorqueDragState(ref int dragState, ref int sixDimensionalDragState);

12.35. The force sensor is automatically turned on after the error is cleared

1/**
2* @brief The force sensor is automatically turned on after an error is cleared.
3* @param [in] status Control status, 0-off, 1-on.
4* @return Error code
5*/
6int SetForceSensorDragAutoFlag(int status);

12.36. Force Sensor Assisted Drag Code Example

 1 private void button61_Click(object sender, EventArgs e)
 2{
 3    robot.SetForceSensorDragAutoFlag(1);
 4    double[] M = { 15.0, 15.0, 15.0, 0.5, 0.5, 0.1 };
 5    double[] B = { 150.0, 150.0, 150.0, 5.0, 5.0, 1.0 };
 6    double[] K = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
 7    double[] F = { 10.0, 10.0, 10.0, 1.0, 1.0, 1.0 };
 8
 9    robot.EndForceDragControl(1, 0, 0, 0, M, B, K, F, 50, 100);
10    robot.WaitMs(5000);
11
12    int dragState = 0;
13    int sixDimensionalDragState = 0;
14    robot.GetForceAndTorqueDragState(ref dragState, ref sixDimensionalDragState);
15    Console.WriteLine($"the drag state is {dragState} {sixDimensionalDragState}");
16
17    robot.EndForceDragControl(0, 0, 0, 0, M, B, K, F, 50, 100);
18}

12.37. Setting up the six-dimensional force and joint impedance hybrid drag switch and parameters

 1/**
 2* @brief Setting up a six-dimensional force and joint impedance hybrid drag switch and parameters.
 3* @param [in] status Control status, 0-off, 1-on.
 4* @param [in] impedanceFlag impedance on flag, 0-off; 1-on
 5* @param [in] lamdeDain drag gain
 6* @param [in] KGain Stiffness Gain
 7* @param [in] BGain damping gain
 8* @param [in] dragMaxTcpVel Drag End Max Linear Velocity Limit
 9* @param [in] dragMaxTcpOriVel Maximum angular velocity limit at drag end
10* @return Error code
11*/
12int ForceAndJointImpedanceStartStop(int status, impedanceFlag, double[] lamdeDain, double[] KGain, double[] BGain, double dragMaxTcpVel, double dragMaxTcpOriVel);

12.38. Force Sensor Assisted Drag Code Example

 1 private void button62_Click(object sender, EventArgs e)
 2{
 3    robot.DragTeachSwitch(1);
 4    double[] lambdaGain = { 3.0, 2.0, 2.0, 2.0, 2.0, 3.0 };
 5    double[] kGain = { 0, 0, 0, 0, 0, 0 };
 6    double[] bGain = { 150, 150, 150, 5.0, 5.0, 1.0 };
 7    int rtn = robot.ForceAndJointImpedanceStartStop(1, 0, lambdaGain, kGain, bGain, 1000, 180);
 8    Console.WriteLine($"ForceAndJointImpedanceStartStop rtn is {rtn}");
 9    Thread.Sleep(5000);
10    robot.DragTeachSwitch(0);
11    rtn = robot.ForceAndJointImpedanceStartStop(0, 0, lambdaGain, kGain, bGain, 1000, 180);
12    Console.WriteLine($"ForceAndJointImpedanceStartStop rtn is {rtn}");
13}

12.39. Setting up the Wire Seek Expansion IO Port

1/**
2* @brief Setting up a wire-seeking extended IO port.
3* @param searchDoneDINum Successful DO port (0-127) for wire seek.
4* @param searchStartDONum The start/stop control DO port (0-127).
5* @return Error Code
6*/
7int SetWireSearchExtDIONum(int searchDoneDINum, int searchStartDONum);

12.40. Impedance Control Start/Stop

New in version C#SDK-V1.1.8: Web-3.8.6

 1/**
 2* @brief Impedance Control Start/Stop
 3* @param [in] status 0: disable; 1-enable
 4* @param [in] workSpace 0-joint space; 1-Cartesian space
 5* @param [in] forceThreshold Trigger force threshold (N)
 6* @param [in] m Mass parameter
 7* @param [in] b Damping parameter
 8* @param [in] k Stiffness parameter
 9* @param [in] maxV Max linear velocity (mm/s)
10* @param [in] maxVA Max linear acceleration (mm/s2)
11* @param [in] maxW Max angular velocity (°/s)
12* @param [in] maxWA Max angular acceleration (°/s2)
13* @return Error code
14*/
15public int ImpedanceControlStartStop(int status, int workSpace, double[] forceThreshold, double[] m, double[] b, double[] k, double maxV, double maxVA, double maxW, double maxWA)

12.41. Robot Impedance Control Start/Stop Code Example

New in version C#SDK-V1.1.8: Web-3.8.6

 1public void TestImpedanceControl()
 2{
 3    int[] ctrl = new int[20];
 4    int state;
 5    int pressValue;
 6    int error;
 7    int rtn;
 8    JointPos j1 = new JointPos(102.622, -135.990, 120.769, -73.950, -90.848, 35.507);
 9    JointPos j2 = new JointPos(93.674, -80.062, 82.947, -92.199, -90.967, 26.559);
10    DescPose desc_pos1 = new DescPose(136.552, -149.799, 449.532, 179.817, -1.172, 157.123);
11    DescPose desc_pos2 = new DescPose(136.540, -561.048, 449.542, 179.819, -1.172, 157.122);
12
13    DescPose offset_pos = new DescPose(0, 0, 0, 0, 0, 0);
14    ExaxisPos epos = new ExaxisPos(0, 0, 0, 0);
15
16    int tool = 0;
17    int user = 0;
18    float vel = 100.0f;
19    float acc = 200.0f;
20    float ovl = 100.0f;
21    float blendT = -1.0f;
22    float blendR = -1.0f;
23
24    byte flag = 0;
25
26    byte search = 0;
27    robot.SetSpeed(20);
28    int company = 17;
29    int device = 0;
30    int softversion = 0;
31    int bus = 1;
32    robot.FT_SetConfig(company, device, softversion, bus);
33    Thread.Sleep(1000);
34    robot.FT_GetConfig(ref company, ref device, ref softversion, ref bus);
35    Console.WriteLine($"FT config:{company},{device},{softversion},{bus}");
36    Thread.Sleep(1000);
37
38    robot.FT_Activate(0);
39    Thread.Sleep(1000);
40    robot.FT_Activate(1);
41    Thread.Sleep(1000);
42    Thread.Sleep(1000);
43    robot.FT_SetZero(0);
44    Thread.Sleep(1000);
45    robot.FT_SetZero(1);
46    Thread.Sleep(1000);
47
48    double[] forceThreshold = new double[] { 30, 30, 30, 5, 5, 5 };
49    double[] m = new double[] { 0.1, 0.1, 0.1, 0.02, 0.02, 0.02 };
50    double[] b = new double[] { 1, 1, 1, 0.08, 0.08, 0.08 };
51    double[] k = new double[] { 0, 0, 0, 0, 0, 0 };
52    rtn = robot.ImpedanceControlStartStop(1, 1, forceThreshold, m, b, k, 1000, 500, 100, 100);
53    Console.WriteLine($"ImpedanceControlStartStop errcode:{rtn}");
54    rtn = robot.MoveL(desc_pos1, tool, user, vel, acc, ovl, blendR, 0, epos, search, flag, offset_pos, -1, 0);
55    rtn = robot.MoveL(desc_pos2, tool, user, vel, acc, ovl, blendR, 0, epos, search, flag, offset_pos, -1, 0);
56    rtn = robot.MoveL(desc_pos1, tool, user, vel, acc, ovl, blendR, 0, epos, search, flag, offset_pos, -1, 0);
57    rtn = robot.MoveL(desc_pos2, tool, user, vel, acc, ovl, blendR, 0, epos, search, flag, offset_pos, -1, 0);
58    rtn = robot.MoveL(desc_pos1, tool, user, vel, acc, ovl, blendR, 0, epos, search, flag, offset_pos, -1, 0);
59    rtn = robot.MoveL(desc_pos2, tool, user, vel, acc, ovl, blendR, 0, epos, search, flag, offset_pos, -1, 0);
60    Console.WriteLine($"movel errcode:{rtn}");
61    robot.ImpedanceControlStartStop(0, 1, forceThreshold, m, b, k, 1000, 500, 100, 100);
62}

12.42. Enable torque compensation function and compensation coefficient

1/**
2* @brief Enable torque compensation function and compensation coefficient
3* @param [in] status Switch, 0-Disable; 1-Enable
4* @param [in] torqueCoeff J1-J6 torque compensation coefficient [0-1]
5* @return Error code
6*/
7public int SerCoderCompenParams(int status, double[] torqueCoeff)