top of page
New in version C#SDK-v1.0.4.
/**
* @brief Load recognition initialization.
* @return Error code
*/
int LoadIdentifyDynFilterInit();
12.29. Load identification variable initialization
New in version C#SDK-v1.0.4.
/**
* @brief Initialization of load recognition variables.
* @return Error code
*/
int LoadIdentifyDynVarInit();
12.30. Load Identification Main Program
New in version C#SDK-v1.0.4.
/**
* @brief Load recognition main program.
* @param [in] joint_torque Joint torque.
* @param [in] joint_pos Joint position.
* @param [in] t Sampling period.
* @return Error code
*/
int LoadIdentifyMain(double[] joint_torque, double[] joint_pos, double t);
12.31. Get the load identification result
New in version C#SDK-v1.0.4.
/**
* @brief Get load recognition results
* @param [in] gain Gravity term coefficient double[6], centrifugal term coefficient double[6].
* @param [out] weight load weight
* @param [out] cog load center of mass
* @return error code
*/
int LoadIdentifyGetResult(double[] gain, ref double weight, ref DescTran cog);
12.32. Robot Load Identification Code Example
private void button74_Click(object sender, EventArgs e)
{
int rtn;
int retval = 0;
retval = robot.LoadIdentifyDynFilterInit();
Console.WriteLine("LoadIdentifyDynFilterInit retval is: " + retval);
retval = robot.LoadIdentifyDynVarInit();
Console.WriteLine("LoadIdentifyDynVarInit retval is: " + retval);
JointPos posJ = new JointPos(0,0,0,0,0,0);
DescPose posDec = new DescPose(0, 0, 0, 0, 0, 0);
double[] joint_toq = new double[6] { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
robot.GetActualJointPosDegree(0, ref posJ);
posJ.jPos[1] = posJ.jPos[1] + 10;
robot.GetJointTorques(0, joint_toq);
joint_toq[1] = joint_toq[1] + 2;
double[] tmpTorque = new double[6] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
for (int i = 0; i < 6; i++)
{
tmpTorque[i] = joint_toq[i];
}
retval = robot.LoadIdentifyMain(tmpTorque, posJ.jPos, 1);
Console.WriteLine("LoadIdentifyMain retval is: " + retval);
double[] gain = new double[12] { 0, 0.05, 0, 0, 0, 0, 0, 0.02, 0, 0, 0, 0 };
double weight = 0;
DescTran load_pos = new DescTran(0, 0, 0);
retval = robot.LoadIdentifyGetResult(gain, ref weight, ref load_pos);
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);
}
12.33. Force sensor assisted drag
New in version C#SDK-V1.1.4: Web-3.8.3
/**
* @brief Force sensor assisted drag
* @param [in] status control status, 0-off; 1-on
* @param [in] asaptiveFlag Adaptive on flag, 0-off; 1-on
* @param [in] interfereDragFlag Interference area drag flag, 0-off; 1-on
* @param [in] ingularityConstraintsFlag singularity strategy, 0-avoidance; 1-crossing
* @param [in] forceCollisionFlag Robot collision detection flag during auxiliary drag; 0-off; 1-on
* @param [in] M inertia coefficient
* @param [in] B Damping coefficient
* @param [in] K stiffness coefficient
* @param [in] F Drag six-dimensional force threshold
* @param [in] Fmax Maximum drag force limit Nm
* @param [in] Vmax Maximum joint speed limit °/s
* @return Error code
*/
int 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
/**
* @brief Get force sensor drag switch state.
* @param [out] dragState force sensor assist drag control state, 0-off; 1-on
* @param [out] sixDimensionalDragState sixDimensionalForceAssistedDragState, 0-off; 1-on
* @return ErrorCode
*/
int GetForceAndTorqueDragState(ref int dragState, ref int sixDimensionalDragState);
12.35. The force sensor is automatically turned on after the error is cleared
/**
* @brief The force sensor is automatically turned on after an error is cleared.
* @param [in] status Control status, 0-off, 1-on.
* @return Error code
*/
int SetForceSensorDragAutoFlag(int status);
12.36. Force Sensor Assisted Drag Code Example
private void button61_Click(object sender, EventArgs e)
{
robot.SetForceSensorDragAutoFlag(1);
double[] M = { 15.0, 15.0, 15.0, 0.5, 0.5, 0.1 };
double[] B = { 150.0, 150.0, 150.0, 5.0, 5.0, 1.0 };
double[] K = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
double[] F = { 10.0, 10.0, 10.0, 1.0, 1.0, 1.0 };
robot.EndForceDragControl(1, 0, 0, 0, M, B, K, F, 50, 100);
robot.WaitMs(5000);
int dragState = 0;
int sixDimensionalDragState = 0;
robot.GetForceAndTorqueDragState(ref dragState, ref sixDimensionalDragState);
Console.WriteLine($"the drag state is {dragState} {sixDimensionalDragState}");
robot.EndForceDragControl(0, 0, 0, 0, M, B, K, F, 50, 100);
}
12.37. Setting up the six-dimensional force and joint impedance hybrid drag switch and parameters
/**
* @brief Setting up a six-dimensional force and joint impedance hybrid drag switch and parameters.
* @param [in] status Control status, 0-off, 1-on.
* @param [in] impedanceFlag impedance on flag, 0-off; 1-on
* @param [in] lamdeDain drag gain
* @param [in] KGain Stiffness Gain
* @param [in] BGain damping gain
* @param [in] dragMaxTcpVel Drag End Max Linear Velocity Limit
* @param [in] dragMaxTcpOriVel Maximum angular velocity limit at drag end
* @return Error code
*/
int ForceAndJointImpedanceStartStop(int status, impedanceFlag, double[] lamdeDain, double[] KGain, double[] BGain, double dragMaxTcpVel, double dragMaxTcpOriVel);
12.38. Force Sensor Assisted Drag Code Example
private void button62_Click(object sender, EventArgs e)
{
robot.DragTeachSwitch(1);
double[] lambdaGain = { 3.0, 2.0, 2.0, 2.0, 2.0, 3.0 };
double[] kGain = { 0, 0, 0, 0, 0, 0 };
double[] bGain = { 150, 150, 150, 5.0, 5.0, 1.0 };
int rtn = robot.ForceAndJointImpedanceStartStop(1, 0, lambdaGain, kGain, bGain, 1000, 180);
Console.WriteLine($"ForceAndJointImpedanceStartStop rtn is {rtn}");
Thread.Sleep(5000);
robot.DragTeachSwitch(0);
rtn = robot.ForceAndJointImpedanceStartStop(0, 0, lambdaGain, kGain, bGain, 1000, 180);
Console.WriteLine($"ForceAndJointImpedanceStartStop rtn is {rtn}");
}
12.39. Setting up the Wire Seek Expansion IO Port
/**
* @brief Setting up a wire-seeking extended IO port.
* @param searchDoneDINum Successful DO port (0-127) for wire seek.
* @param searchStartDONum The start/stop control DO port (0-127).
* @return Error Code
*/
int SetWireSearchExtDIONum(int searchDoneDINum, int searchStartDONum);
12.40. Impedance Control Start/Stop
New in version C#SDK-V1.1.8: Web-3.8.6
/**
* @brief Impedance Control Start/Stop
* @param [in] status 0: disable; 1-enable
* @param [in] workSpace 0-joint space; 1-Cartesian space
* @param [in] forceThreshold Trigger force threshold (N)
* @param [in] m Mass parameter
* @param [in] b Damping parameter
* @param [in] k Stiffness parameter
* @param [in] maxV Max linear velocity (mm/s)
* @param [in] maxVA Max linear acceleration (mm/s2)
* @param [in] maxW Max angular velocity (°/s)
* @param [in] maxWA Max angular acceleration (°/s2)
* @return Error code
*/
public 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
public void TestImpedanceControl()
{
int[] ctrl = new int[20];
int state;
int pressValue;
int error;
int rtn;
JointPos j1 = new JointPos(102.622, -135.990, 120.769, -73.950, -90.848, 35.507);
JointPos j2 = new JointPos(93.674, -80.062, 82.947, -92.199, -90.967, 26.559);
DescPose desc_pos1 = new DescPose(136.552, -149.799, 449.532, 179.817, -1.172, 157.123);
DescPose desc_pos2 = new DescPose(136.540, -561.048, 449.542, 179.819, -1.172, 157.122);
DescPose offset_pos = new DescPose(0, 0, 0, 0, 0, 0);
ExaxisPos epos = new ExaxisPos(0, 0, 0, 0);
int tool = 0;
int user = 0;
float vel = 100.0f;
float acc = 200.0f;
float ovl = 100.0f;
float blendT = -1.0f;
float blendR = -1.0f;
byte flag = 0;
byte search = 0;
robot.SetSpeed(20);
int company = 17;
int device = 0;
int softversion = 0;
int bus = 1;
robot.FT_SetConfig(company, device, softversion, bus);
Thread.Sleep(1000);
robot.FT_GetConfig(ref company, ref device, ref softversion, ref bus);
Console.WriteLine($"FT config:{company},{device},{softversion},{bus}");
Thread.Sleep(1000);
robot.FT_Activate(0);
Thread.Sleep(1000);
robot.FT_Activate(1);
Thread.Sleep(1000);
Thread.Sleep(1000);
robot.FT_SetZero(0);
Thread.Sleep(1000);
robot.FT_SetZero(1);
Thread.Sleep(1000);
double[] forceThreshold = new double[] { 30, 30, 30, 5, 5, 5 };
double[] m = new double[] { 0.1, 0.1, 0.1, 0.02, 0.02, 0.02 };
double[] b = new double[] { 1, 1, 1, 0.08, 0.08, 0.08 };
double[] k = new double[] { 0, 0, 0, 0, 0, 0 };
rtn = robot.ImpedanceControlStartStop(1, 1, forceThreshold, m, b, k, 1000, 500, 100, 100);
Console.WriteLine($"ImpedanceControlStartStop errcode:{rtn}");
rtn = robot.MoveL(desc_pos1, tool, user, vel, acc, ovl, blendR, 0, epos, search, flag, offset_pos, -1, 0);
rtn = robot.MoveL(desc_pos2, tool, user, vel, acc, ovl, blendR, 0, epos, search, flag, offset_pos, -1, 0);
rtn = robot.MoveL(desc_pos1, tool, user, vel, acc, ovl, blendR, 0, epos, search, flag, offset_pos, -1, 0);
rtn = robot.MoveL(desc_pos2, tool, user, vel, acc, ovl, blendR, 0, epos, search, flag, offset_pos, -1, 0);
rtn = robot.MoveL(desc_pos1, tool, user, vel, acc, ovl, blendR, 0, epos, search, flag, offset_pos, -1, 0);
rtn = robot.MoveL(desc_pos2, tool, user, vel, acc, ovl, blendR, 0, epos, search, flag, offset_pos, -1, 0);
Console.WriteLine($"movel errcode:{rtn}");
robot.ImpedanceControlStartStop(0, 1, forceThreshold, m, b, k, 1000, 500, 100, 100);
}
12.42. Enable torque compensation function and compensation coefficient
/**
* @brief Enable torque compensation function and compensation coefficient
* @param [in] status Switch, 0-Disable; 1-Enable
* @param [in] torqueCoeff J1-J6 torque compensation coefficient [0-1]
* @return Error code
*/
public int SerCoderCompenParams(int status, double[] torqueCoeff)
bottom of page