4. Robot Motion

4.1. jog point motion

 1/**
 2* @brief jog pointing
 3* @param [in] refType Type of pointing: 0-joint pointing, 2-pointing in base coordinate system, 4-pointing in tool coordinate system, 8-pointing in artifact coordinate system.
 4* @param [in] nb 1-joint 1 (or x-axis), 2-joint 2 (or y-axis), 3-joint 3 (or z-axis), 4-joint 4 (or rotate around x-axis), 5-joint 5 (or rotate around y-axis), 6-joint 6 (or rotate around z-axis)
 5* @param [in] dir 0-negative direction, 1-positive direction
 6* @param [in] vel velocity percentage, [0~100]
 7* @param [in] acc acceleration percentage, [0~100]
 8* @param [in] max_dis Maximum angle of a single tap, in [°] or distance, in [mm]
 9* @return Error code
10*/
11int StartJOG(byte refType, byte nb, byte dir, float vel, float acc, float max_dis);

4.2. jog nudging deceleration stop

1/**
2* @brief jog pointwise deceleration stops.
3* @param [in] ref 1-joint-point deceleration stop, 3-point deceleration stop in base coordinate system, 5-point deceleration stop in tool coordinate system, 9-point deceleration stop in workpiece coordinate system
4* @return Error code
5*/
6int StopJOG(byte stopType).

4.3. jog pointing stops immediately

1/**
2* @brief jog tapping stops immediately.
3* @return Error code
4*/
5int ImmStopJOG();

4.4. Sample Robot Tap Control Code

 1private void btnJOG_Click(object sender, EventArgs e)
 2{
 3    for (int i = 0; i < 6; i++)
 4    {
 5        robot.StartJOG(0, i + 1, 0, 20.0f, 20.0f, 30.0f);
 6        Thread.Sleep(1000);
 7        robot.ImmStopJOG();
 8        Thread.Sleep(1000);
 9    }
10
11    for (int i = 0; i < 6; i++)
12    {
13        robot.StartJOG(2, i + 1, 0, 20.0f, 20.0f, 30.0f);
14        Thread.Sleep(1000);
15        robot.ImmStopJOG();
16        Thread.Sleep(1000);
17    }
18
19    for (int i = 0; i < 6; i++)
20    {
21        robot.StartJOG(4, i + 1, 0, 20.0f, 20.0f, 30.0f);
22        Thread.Sleep(1000);
23        robot.StopJOG(5);
24        Thread.Sleep(1000);
25    }
26
27    for (int i = 0; i < 6; i++)
28    {
29        robot.StartJOG(8, i + 1, 0, 20.0f, 20.0f, 30.0f);
30        Thread.Sleep(1000);
31        robot.StopJOG(9);
32        Thread.Sleep(1000);
33    }
34}

4.5. Joint space motion

 1/**
 2* @brief Joint space motion.
 3* @param [in] joint_pos Target joint position in degrees.
 4* @param [in] desc_pos Target Cartesian position.
 5* @param [in] tool Tool coordinate number, range [0~14].
 6* @param [in] user Workpiece coordinate number, range [0~14].
 7* @param [in] vel velocity percentage, range [0~100] * @param [in] acc.
 8* @param [in] acc Acceleration percentage, range [0~100], not available yet.
 9* @param [in] ovl Velocity scaling factor, range [0~100].
10* @param [in] epos Extended axis position in mm.
11* @param [in] blendT [-1.0]-motion in place (blocking), [0~500.0]-smoothing time (non-blocking) in ms
12* @param [in] offset_flag 0-no offset, 1-offset in base/work coordinate system, 2-offset in tool coordinate system
13* @param [in] offset_pos Bit position offset
14* @return Error code
15*/
16int MoveJ(JointPos joint_pos, DescPose desc_pos, int tool, int user, float vel, float acc, float ovl, ExaxisPos epos, float blendT, byte offset_flag, DescPose offset_pos);

4.6. Joint space motion (automatic forward kinematics calculation)

New in version C#SDK-V1.1.7: Web-3.8.5

 1/**
 2* @brief Joint space motion (automatic forward kinematics calculation)
 3* @param [in] joint_pos  Target joint position, unit deg
 4* @param [in] tool  Tool coordinate number, range [0~14]
 5* @param [in] user  Workpiece coordinate number, range [0~14]
 6* @param [in] vel  Velocity percentage, range [0~100]
 7* @param [in] acc  Acceleration percentage, range [0~100], not open yet
 8* @param [in] ovl  Velocity scaling factor, range [0~100]
 9* @param [in] epos  Extended axis position, unit mm
10* @param [in] blendT [-1.0]-move to position (blocking), [0~500.0]-smoothing time (non-blocking), unit ms
11* @param [in] offset_flag  0-no offset, 1-offset in base/workpiece coordinate system, 2-offset in tool coordinate system
12* @param [in] offset_pos  Pose offset
13* @return Error code
14*/
15int MoveJ(JointPos joint_pos, int tool, int user, double vel, double acc, double ovl, ExaxisPos epos, double blendT, int offset_flag, DescPose offset_pos)

4.7. Linear motion in Cartesian space

 1/**
 2* @brief Cartesian space linear motion
 3* @param [in] joint_pos Target joint position, unit deg
 4* @param [in] desc_pos Target Cartesian pose
 5* @param [in] tool Tool coordinate number, range [0~14]
 6* @param [in] user Workpiece coordinate number, range [0~14]
 7* @param [in] vel Speed percentage, range [0~100]
 8* @param [in] acc Acceleration percentage, range [0~100], currently not available
 9* @param [in] ovl Speed scaling factor [0~100]/Physical speed (mm/s)
10* @param [in] blendR [-1.0]-Motion to position (blocking), [0~1000.0]-Blend radius (non-blocking), unit mm
11* @param [in] blendMode Transition mode; 0-Inscribed transition; 1-Corner transition
12* @param [in] epos Extended axis position, unit mm
13* @param [in] search 0-No wire seam tracking, 1-Wire seam tracking
14* @param [in] offset_flag 0-No offset, 1-Offset in base/workpiece coordinate system, 2-Offset in tool coordinate system
15* @param [in] offset_pos Pose offset
16* @param [in] oacc Acceleration scaling factor [0-100]/Physical acceleration (mm/s²)
17* @param [in] velAccParamMode Speed/acceleration parameter mode; 0-Percentage; 1-Physical speed (mm/s) and acceleration (mm/s²)
18* @param [in] overSpeedStrategy Overspeed handling strategy, 1-Standard; 2-Error and stop on overspeed; 3-Adaptive speed reduction, default is 0
19* @param [in] speedPercent Allowable speed reduction threshold percentage [0-100], default 10%
20* @return Error code
21*/
22public int MoveL(JointPos joint_pos, DescPose desc_pos, int tool, int user, float vel, float acc, float ovl, float blendR, int blendMode, ExaxisPos epos, int search, int offset_flag, DescPose offset_pos, float oacc, int velAccParamMode, int overSpeedStrategy = 0, int speedPercent = 10)

4.8. Cartesian space linear motion (automatic inverse kinematics calculation)

New in version C#SDK-V1.1.7: Web-3.8.5

 1/**
 2* @brief Cartesian space linear motion (automatic inverse kinematics calculation)
 3* @param [in] desc_pos  Target cartesian pose
 4* @param [in] tool  Tool coordinate number, range [1~15]
 5* @param [in] user  Workpiece coordinate number, range [1~15]
 6* @param [in] vel  Velocity percentage, range [0~100]
 7* @param [in] acc  Acceleration percentage, range [0~100], not open yet
 8* @param [in] ovl  Velocity 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* @param [in] blendMode Transition mode; 0-tangent transition; 1-corner transition
11* @param [in] epos  Extended axis position, unit mm
12* @param [in] search  0-no wire search, 1-wire search
13* @param [in] offset_flag  0-no offset, 1-offset in base/workpiece coordinate system, 2-offset in tool coordinate system
14* @param [in] offset_pos  Pose offset
15* @param [in] config Inverse kinematics joint space configuration, [-1]-calculate based on current joint position, [0~7]-solve according to specific joint space configuration
16* @param [in] overSpeedStrategy  Overspeed handling strategy, 1-standard; 2-stop on error when overspeed; 3-adaptive speed reduction, default is 0
17* @param [in] speedPercent  Allowed speed reduction threshold percentage [0-100], default 10%
18* @return Error code
19*/
20int MoveL(DescPose desc_pos, int tool, int user, double vel, double acc, double ovl, double blendR, int blendMode, ExaxisPos epos, int search, int offset_flag, DescPose offset_pos, int config, int overSpeedStrategy, int speedPercent)

4.9. Cartesian Space Linear Motion (Added velAccParamMode parameter for velocity and acceleration modes)

New in version C#SDK-V1.1.7: Web-3.8.5

 1/**
 2* @brief  Cartesian Space Linear Motion (Added velAccParamMode parameter for velocity and acceleration modes)
 3* @param  [in] joint_pos  Target joint position, unit deg
 4* @param  [in] desc_pos   Target Cartesian pose
 5* @param  [in] tool  Tool coordinate number, range [1~15]
 6* @param  [in] user  Workpiece coordinate number, range [1~15]
 7* @param  [in] vel  Velocity percentage, range [0~100]
 8* @param  [in] acc  Acceleration percentage, range [0~100], not yet open
 9* @param  [in] ovl  Velocity scaling factor, range [0~100]
10* @param  [in] blendR [-1.0]-Motion complete (blocking), [0~1000.0]-Blending radius (non-blocking), unit mm
11* @param  [in] epos  Extended axis position, unit mm
12* @param  [in] search  0-No wire search, 1-Wire search
13* @param  [in] offset_flag  0-No offset, 1-Offset in base/workpiece coordinate system, 2-Offset in tool coordinate system
14* @param  [in] offset_pos  Pose offset
15* @param  [in] velAccParamMode Velocity and acceleration parameter mode; 0-Percentage; 1-Physical velocity (mm/s) and acceleration (mm/s^2)
16* @param  [in] overSpeedStrategy  Overspeed handling strategy, 1-Standard; 2-Stop with error on overspeed; 3-Adaptive deceleration, default is 0
17* @param  [in] speedPercent  Allowed deceleration threshold percentage [0-100], default 10%
18* @return  Error code
19*/
20public int MoveL(JointPos joint_pos, DescPose desc_pos, int tool, int user, double vel, double acc, double ovl, double blendR, ExaxisPos epos, int search, int offset_flag, DescPose offset_pos, int velAccParamMode, int overSpeedStrategy, int speedPercent)

4.10. Cartesian Space Linear Motion (Overload Function 1, Added blendMode)

New in version C#SDK-V1.1.7: Web-3.8.5

 1/**
 2* @brief  Cartesian Space Linear Motion (Overload Function 1, Added blendMode)
 3* @param  [in] joint_pos  Target joint position, unit deg
 4* @param  [in] desc_pos   Target Cartesian pose
 5* @param  [in] tool  Tool coordinate number, range [1~15]
 6* @param  [in] user  Workpiece coordinate number, range [1~15]
 7* @param  [in] vel  Velocity percentage, range [0~100]
 8* @param  [in] acc  Acceleration percentage, range [0~100], not yet open
 9* @param  [in] ovl  Velocity scaling factor, range [0~100]
10* @param  [in] blendR [-1.0]-Motion complete (blocking), [0~1000.0]-Blending radius (non-blocking), unit mm
11* @param  [in] blendMode Transition mode; 0-Tangent transition; 1-Corner transition
12* @param  [in] epos  Extended axis position, unit mm
13* @param  [in] search  0-No wire search, 1-Wire search
14* @param  [in] offset_flag  0-No offset, 1-Offset in base/workpiece coordinate system, 2-Offset in tool coordinate system
15* @param  [in] offset_pos  Pose offset
16* @param  [in] velAccParamMode Velocity and acceleration parameter mode; 0-Percentage; 1-Physical velocity (mm/s) and acceleration (mm/s^2)
17* @param  [in] overSpeedStrategy  Overspeed handling strategy, 1-Standard; 2-Stop with error on overspeed; 3-Adaptive deceleration, default is 0
18* @param  [in] speedPercent  Allowed deceleration threshold percentage [0-100], default 10%
19* @return  Error code
20*/
21public int MoveL(JointPos joint_pos, DescPose desc_pos, int tool, int user, double vel, double acc, double ovl, double blendR, int blendMode, ExaxisPos epos, int search, int offset_flag, DescPose offset_pos, int velAccParamMode, int overSpeedStrategy, int speedPercent)

4.11. Cartesian Space Linear Motion (Overload Function 2, No Joint Position Input Required)

New in version C#SDK-V1.1.7: Web-3.8.5

 1/**
 2* @brief  Cartesian Space Linear Motion (Overload Function 2, No Joint Position Input Required)
 3* @param  [in] desc_pos   Target Cartesian pose
 4* @param  [in] tool  Tool coordinate number, range [1~15]
 5* @param  [in] user  Workpiece coordinate number, range [1~15]
 6* @param  [in] vel  Velocity percentage, range [0~100]
 7* @param  [in] acc  Acceleration percentage, range [0~100], not yet open
 8* @param  [in] ovl  Velocity scaling factor, range [0~100]
 9* @param  [in] blendR [-1.0]-Motion complete (blocking), [0~1000.0]-Blending radius (non-blocking), unit mm
10* @param  [in] blendMode Transition mode; 0-Tangent transition; 1-Corner transition
11* @param  [in] epos  Extended axis position, unit mm
12* @param  [in] search  0-No wire search, 1-Wire search
13* @param  [in] offset_flag  0-No offset, 1-Offset in base/workpiece coordinate system, 2-Offset in tool coordinate system
14* @param  [in] offset_pos  Pose offset
15* @param  [in] config Inverse kinematic joint space configuration, [-1]-Reference current joint position for calculation, [0~7]-Solve based on specific joint space configuration
16* @param  [in] velAccParamMode Velocity and acceleration parameter mode; 0-Percentage; 1-Physical velocity (mm/s) and acceleration (mm/s^2)
17* @param  [in] overSpeedStrategy  Overspeed handling strategy, 1-Standard; 2-Stop with error on overspeed; 3-Adaptive deceleration, default is 0
18* @param  [in] speedPercent  Allowed deceleration threshold percentage [0-100], default 10%
19* @return  Error code
20*/
21public int MoveL(DescPose desc_pos, int tool, int user, double vel, double acc, double ovl, double blendR, int blendMode, ExaxisPos epos, int search, int offset_flag, DescPose offset_pos, int config, int velAccParamMode, int overSpeedStrategy, int speedPercent)

4.12. Circular motion in Cartesian space

 1/**
 2* @brief Cartesian circular motion.
 3* @param [in] joint_pos_p Pathpoint joint position in deg.
 4* @param [in] desc_pos_p Path point Cartesian position.
 5* @param [in] ptool tool coordinate number, range [0~14].
 6* @param [in] puser workpiece coordinate number, range [0~14]
 7* @param [in] pvel speed percentage, range [0~100]
 8* @param [in] pacc Acceleration percentage, range [0~100], not available yet.
 9* @param [in] epos_p Extended axis position, in mm
10* @param [in] poffset_flag 0-no offset, 1-offset in base/work coordinate system, 2-offset in tool coordinate system
11* @param [in] offset_pos_p Positional offset
12* @param [in] joint_pos_t Joint position of target point, in deg.
13* @param [in] desc_pos_t Cartesian position of target point.
14* @param [in] ttool tool coordinate number, range [0~14].
15* @param [in] tuser Workpiece coordinate number, range [0~14].
16* @param [in] tvel Velocity percentage, range [0~100]
17* @param [in] tacc Acceleration percentage, range [0~100], not available yet.
18* @param [in] epos_t Extended axis position in mm.
19* @param [in] toffset_flag 0-no offset, 1-offset in base/work coordinate system, 2-offset in tool coordinate system
20* @param [in] offset_pos_t Bit position offset
21* @param [in] ovl velocity scaling factor, range [0~100]
22* @param [in] blendR [-1.0]-motion in place (blocking), [0~1000.0]-smoothing radius (non-blocking) in mm
23* @param  [in] oacc Acceleration scaling factor [0-100]/Physical acceleration (mm/s²)
24* @param  [in] velAccParamMode Speed/acceleration parameter mode; 0-Percentage; 1-Physical speed (mm/s) and acceleration (mm/s²)
25* @return  Error code
26*/
27public int MoveC(JointPos joint_pos_p, DescPose desc_pos_p, int ptool, int puser, float pvel, float pacc,ExaxisPos epos_p, int poffset_flag, DescPose offset_pos_p,JointPos joint_pos_t, DescPose desc_pos_t, int ttool, int tuser, float tvel, float tacc,ExaxisPos epos_t, int toffset_flag, DescPose offset_pos_t,float ovl, float blendR, float oacc, int velAccParamMode)

4.13. Cartesian space circular motion (automatic inverse kinematics calculation)

New in version C#SDK-V1.1.7: Web-3.8.5

 1/**
 2* @brief Cartesian space circular motion (automatic inverse kinematics calculation)
 3* @param [in] desc_pos_p  Path point cartesian pose
 4* @param [in] ptool  Tool coordinate number, range [1~15]
 5* @param [in] puser  Workpiece coordinate number, range [1~15]
 6* @param [in] pvel  Velocity percentage, range [0~100]
 7* @param [in] pacc  Acceleration percentage, range [0~100], not open yet
 8* @param [in] epos_p  Extended axis position, unit mm
 9* @param [in] poffset_flag  0-no offset, 1-offset in base/workpiece coordinate system, 2-offset in tool coordinate system
10* @param [in] offset_pos_p  Pose offset
11* @param [in] desc_pos_t  Target point cartesian pose
12* @param [in] ttool  Tool coordinate number, range [1~15]
13* @param [in] tuser  Workpiece coordinate number, range [1~15]
14* @param [in] tvel  Velocity percentage, range [0~100]
15* @param [in] tacc  Acceleration percentage, range [0~100], not open yet
16* @param [in] epos_t  Extended axis position, unit mm
17* @param [in] toffset_flag  0-no offset, 1-offset in base/workpiece coordinate system, 2-offset in tool coordinate system
18* @param [in] offset_pos_t  Pose offset
19* @param [in] ovl  Velocity scaling factor, range [0~100]
20* @param [in] blendR [-1.0]-move to position (blocking), [0~1000.0]-smoothing radius (non-blocking), unit mm
21* @param [in] config Inverse kinematics joint space configuration, [-1]-calculate based on current joint position, [0~7]-solve according to specific joint space configuration
22* @return Error code
23*/
24int MoveC(DescPose desc_pos_p, int ptool, int puser, double pvel, double pacc, ExaxisPos epos_p, int poffset_flag, DescPose offset_pos_p, DescPose desc_pos_t, int ttool, int tuser, double tvel, double tacc, ExaxisPos epos_t, int toffset_flag, DescPose offset_pos_t, double ovl, double blendR, int config)

4.14. Cartesian Space Arc Motion (Added velAccParamMode parameter for velocity and acceleration modes)

New in version C#SDK-V1.1.7: Web-3.8.5

 1/**
 2* @brief  Cartesian Space Arc Motion (Added velAccParamMode parameter for velocity and acceleration modes)
 3* @param  [in] joint_pos_p  Path point joint position, unit deg
 4* @param  [in] desc_pos_p   Path point Cartesian pose
 5* @param  [in] ptool  Tool coordinate number, range [1~15]
 6* @param  [in] puser  Workpiece coordinate number, range [1~15]
 7* @param  [in] pvel  Velocity percentage, range [0~100]
 8* @param  [in] pacc  Acceleration percentage, range [0~100], not yet open
 9* @param  [in] epos_p  Extended axis position, unit mm
10* @param  [in] poffset_flag  0-No offset, 1-Offset in base/workpiece coordinate system, 2-Offset in tool coordinate system
11* @param  [in] offset_pos_p  Pose offset
12* @param  [in] joint_pos_t  Target point joint position, unit deg
13* @param  [in] desc_pos_t   Target point Cartesian pose
14* @param  [in] ttool  Tool coordinate number, range [1~15]
15* @param  [in] tuser  Workpiece coordinate number, range [1~15]
16* @param  [in] tvel  Velocity percentage, range [0~100]
17* @param  [in] tacc  Acceleration percentage, range [0~100], not yet open
18* @param  [in] epos_t  Extended axis position, unit mm
19* @param  [in] toffset_flag  0-No offset, 1-Offset in base/workpiece coordinate system, 2-Offset in tool coordinate system
20* @param  [in] offset_pos_t  Pose offset
21* @param  [in] ovl  Velocity scaling factor, range [0~100]
22* @param  [in] blendR [-1.0]-Motion complete (blocking), [0~1000.0]-Blending radius (non-blocking), unit mm
23* @param  [in] velAccParamMode Velocity and acceleration parameter mode; 0-Percentage; 1-Physical velocity (mm/s) and acceleration (mm/s^2)
24* @return  Error code
25*/
26public int MoveC(JointPos joint_pos_p, DescPose desc_pos_p, int ptool, int puser, double pvel, double pacc, ExaxisPos epos_p, int poffset_flag, DescPose offset_pos_p, JointPos joint_pos_t, DescPose desc_pos_t, int ttool, int tuser, double tvel, double tacc, ExaxisPos epos_t, int toffset_flag, DescPose offset_pos_t, double ovl, double blendR, int velAccParamMode)

4.15. Cartesian Space Arc Motion (Overload Function 1, No Joint Position Input Required)

New in version C#SDK-V1.1.7: Web-3.8.5

 1/**
 2* @brief  Cartesian Space Arc Motion (Overload Function 1, No Joint Position Input Required)
 3* @param  [in] desc_pos_p   Path point Cartesian pose
 4* @param  [in] ptool  Tool coordinate number, range [1~15]
 5* @param  [in] puser  Workpiece coordinate number, range [1~15]
 6* @param  [in] pvel  Velocity percentage, range [0~100]
 7* @param  [in] pacc  Acceleration percentage, range [0~100], not yet open
 8* @param  [in] epos_p  Extended axis position, unit mm
 9* @param  [in] poffset_flag  0-No offset, 1-Offset in base/workpiece coordinate system, 2-Offset in tool coordinate system
10* @param  [in] offset_pos_p  Pose offset
11* @param  [in] desc_pos_t   Target point Cartesian pose
12* @param  [in] ttool  Tool coordinate number, range [1~15]
13* @param  [in] tuser  Workpiece coordinate number, range [1~15]
14* @param  [in] tvel  Velocity percentage, range [0~100]
15* @param  [in] tacc  Acceleration percentage, range [0~100], not yet open
16* @param  [in] epos_t  Extended axis position, unit mm
17* @param  [in] toffset_flag  0-No offset, 1-Offset in base/workpiece coordinate system, 2-Offset in tool coordinate system
18* @param  [in] offset_pos_t  Pose offset
19* @param  [in] ovl  Velocity scaling factor, range [0~100]
20* @param  [in] blendR [-1.0]-Motion complete (blocking), [0~1000.0]-Blending radius (non-blocking), unit mm
21* @param  [in] config Inverse kinematic joint space configuration, [-1]-Reference current joint position for calculation, [0~7]-Solve based on specific joint space configuration
22* @param  [in] velAccParamMode Velocity and acceleration parameter mode; 0-Percentage; 1-Physical velocity (mm/s) and acceleration (mm/s^2)
23* @return  Error code
24*/
25public int MoveC(DescPose desc_pos_p, int ptool, int puser, double pvel, double pacc, ExaxisPos epos_p, int poffset_flag, DescPose offset_pos_p, DescPose desc_pos_t, int ttool, int tuser, double tvel, double tacc, ExaxisPos epos_t, int toffset_flag, DescPose offset_pos_t, double ovl, double blendR, int config, int velAccParamMode)

4.16. Point-to-point motion in Cartesian space

 1/**
 2* @brief Cartesian space point-to-point motion.
 3* @param [in] desc_pos Cartesian position of target in base coordinate system.
 4* @param [in] tool tool coordinate number, range [0~14]
 5* @param [in] user Workpiece coordinate number, range [0~14].
 6* @param [in] vel velocity percentage, range [0~100] * @param [in] acc [in] tool coordinate number, range [0~14]
 7* @param [in] acc Acceleration percentage, range [0~100], not available yet.
 8* @param [in] ovl velocity scaling factor, range [0~100]
 9* @param [in] blendT [-1.0]-motion in place (blocking), [0~500.0]-smoothing time (non-blocking) in ms
10* @param [in] config Joint space configuration, [-1]-Refer to current joint position, [0~7]-Refer to specific joint space configuration, default is -1.
11* @return Error code
12*/
13int MoveCart(DescPose desc_pos, int tool, int user, float vel, float acc, float ovl, float blendT, int config);

4.17. Whole circle motion in Cartesian space

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

 1/**
 2* @brief Whole circle motion in Cartesian space.
 3* @param [in] joint_pos_p path point 1 joint position in deg.
 4* @param [in] desc_pos_p path point 1 Cartesian position.
 5* @param [in] ptool tool coordinate number, range [0~14].
 6* @param [in] puser workpiece coordinate number, range [0~14]
 7* @param [in] pvel velocity percentage, range [0~100]
 8* @param [in] pacc Acceleration percentage, range [0~100], not available yet.
 9* @param [in] epos_p extended axis position in mm
10* @param [in] joint_pos_t Path point 2 joint position in deg.
11* @param [in] desc_pos_t Path point 2 Cartesian position in deg.
12* @param [in] ttool tool coordinate number, range [0~14].
13* @param [in] tuser Workpiece coordinate number, range [0~14]
14* @param [in] tvel Velocity percentage, range [0~100]
15* @param [in] tacc Acceleration percentage, range [0~100], not available yet.
16* @param [in] epos_t Extended axis position in mm.
17* @param [in] ovl  Speed scaling factor [0~100]/Physical speed (mm/s)
18* @param [in] offset_flag  0-No offset, 1-Offset in base/workpiece coordinate system, 2-Offset in tool coordinate system
19* @param [in] offset_pos  Pose offset
20* @param [in] oacc Acceleration scaling factor [0-100]/Physical acceleration (mm/s²)
21* @param [in] blendR -1: Blocking; 0~1000: Blend radius
22* @param [in] velAccParamMode Speed/acceleration parameter mode; 0-Percentage; 1-Physical speed (mm/s) and acceleration (mm/s²)
23* @return  Error code
24*/
25public int Circle(JointPos joint_pos_p, DescPose desc_pos_p, int ptool, int puser, float pvel, float pacc,ExaxisPos epos_p, JointPos joint_pos_t, DescPose desc_pos_t, int ttool, int tuser,float tvel, float tacc, ExaxisPos epos_t, float ovl, int offset_flag,DescPose offset_pos, double oacc, double blendR, int velAccParamMode)

4.18. Cartesian space full circle motion (automatic inverse kinematics calculation)

New in version C#SDK-V1.1.7: Web-3.8.5

 1/**
 2* @brief Cartesian space full circle motion (automatic inverse kinematics calculation)
 3* @param [in] desc_pos_p  Path point 1 cartesian pose
 4* @param [in] ptool  Tool coordinate number, range [0~14]
 5* @param [in] puser  Workpiece coordinate number, range [0~14]
 6* @param [in] pvel  Velocity percentage, range [0~100]
 7* @param [in] pacc  Acceleration percentage, range [0~100], not open yet
 8* @param [in] epos_p  Extended axis position, unit mm
 9* @param [in] desc_pos_t  Path point 2 cartesian pose
10* @param [in] ttool  Tool coordinate number, range [0~14]
11* @param [in] tuser  Workpiece coordinate number, range [0~14]
12* @param [in] tvel  Velocity percentage, range [0~100]
13* @param [in] tacc  Acceleration percentage, range [0~100], not open yet
14* @param [in] epos_t  Extended axis position, unit mm
15* @param [in] ovl  Velocity scaling factor, range [0~100]
16* @param [in] offset_flag  0-no offset, 1-offset in base/workpiece coordinate system, 2-offset in tool coordinate system
17* @param [in] offset_pos  Pose offset
18* @param [in] oacc Acceleration percentage
19* @param [in] blendR -1: blocking; 0~1000: smoothing radius
20* @param [in] config Inverse kinematics joint space configuration, [-1]-calculate based on current joint position, [0~7]-solve according to specific joint space configuration
21* @return Error code
22*/
23int Circle(DescPose desc_pos_p, int ptool, int puser, double pvel, double pacc, ExaxisPos epos_p, DescPose desc_pos_t, int ttool, int tuser, double tvel, double tacc, ExaxisPos epos_t, double ovl, int offset_flag, DescPose offset_pos, double oacc, double blendR,int config)

4.19. Cartesian Space Full Circle Motion (Added velAccParamMode parameter for velocity and acceleration modes)

New in version C#SDK-V1.1.7: Web-3.8.5

 1/**
 2*@brief  Cartesian Space Full Circle Motion (Added velAccParamMode parameter for velocity and acceleration modes)
 3*@param  [in] joint_pos_p  Path point 1 joint position, unit deg
 4*@param  [in] desc_pos_p   Path point 1 Cartesian pose
 5*@param  [in] ptool  Tool coordinate number, range [1~15]
 6*@param  [in] puser  Workpiece coordinate number, range [1~15]
 7*@param  [in] pvel  Velocity percentage, range [0~100]
 8*@param  [in] pacc  Acceleration percentage, range [0~100], not yet open
 9*@param  [in] epos_p  Extended axis position, unit mm
10*@param  [in] joint_pos_t  Path point 2 joint position, unit deg
11*@param  [in] desc_pos_t   Path point 2 Cartesian pose
12*@param  [in] ttool  Tool coordinate number, range [1~15]
13*@param  [in] tuser  Workpiece coordinate number, range [1~15]
14*@param  [in] tvel  Velocity percentage, range [0~100]
15*@param  [in] tacc  Acceleration percentage, range [0~100], not yet open
16*@param  [in] epos_t  Extended axis position, unit mm
17*@param  [in] ovl  Velocity scaling factor, range [0~100]
18*@param  [in] offset_flag  0-No offset, 1-Offset in base/workpiece coordinate system, 2-Offset in tool coordinate system
19*@param  [in] offset_pos  Pose offset
20*@param  [in] oacc Acceleration percentage
21*@param  [in] blendR -1: Blocking; 0~1000: Blending radius
22*@param  [in] velAccParamMode Velocity and acceleration parameter mode; 0-Percentage; 1-Physical velocity (mm/s) and acceleration (mm/s^2)
23*@return  Error code
24*/
25public int Circle(JointPos joint_pos_p, DescPose desc_pos_p, int ptool, int puser, double pvel, double pacc, ExaxisPos epos_p, JointPos joint_pos_t, DescPose desc_pos_t, int ttool, int tuser, double tvel, double tacc, ExaxisPos epos_t, double ovl, int offset_flag, DescPose offset_pos, double oacc, double blendR, int velAccParamMode)

4.20. Cartesian Space Full Circle Motion (Overload Function 1, No Joint Position Input Required)

New in version C#SDK-V1.1.7: Web-3.8.5

 1/**
 2* @brief  Cartesian Space Full Circle Motion (Overload Function 1, No Joint Position Input Required)
 3* @param  [in] desc_pos_p   Path point 1 Cartesian pose
 4* @param  [in] ptool  Tool coordinate number, range [0~14]
 5* @param  [in] puser  Workpiece coordinate number, range [0~14]
 6* @param  [in] pvel  Velocity percentage, range [0~100]
 7* @param  [in] pacc  Acceleration percentage, range [0~100], not yet open
 8* @param  [in] epos_p  Extended axis position, unit mm
 9* @param  [in] desc_pos_t   Path point 2 Cartesian pose
10* @param  [in] ttool  Tool coordinate number, range [0~14]
11* @param  [in] tuser  Workpiece coordinate number, range [0~14]
12* @param  [in] tvel  Velocity percentage, range [0~100]
13* @param  [in] tacc  Acceleration percentage, range [0~100], not yet open
14* @param  [in] epos_t  Extended axis position, unit mm
15* @param  [in] ovl  Velocity scaling factor, range [0~100]
16* @param  [in] offset_flag  0-No offset, 1-Offset in base/workpiece coordinate system, 2-Offset in tool coordinate system
17* @param  [in] offset_pos  Pose offset
18* @param  [in] oacc Acceleration percentage
19* @param  [in] blendR -1: Blocking; 0~1000: Blending radius
20* @param  [in] config Inverse kinematic joint space configuration, [-1]-Reference current joint position for calculation, [0~7]-Solve based on specific joint space configuration
21* @param  [in] velAccParamMode Velocity and acceleration parameter mode; 0-Percentage; 1-Physical velocity (mm/s) and acceleration (mm/s^2)
22* @return  Error code
23*/
24public int Circle(DescPose desc_pos_p, int ptool, int puser, double pvel, double pacc, ExaxisPos epos_p, DescPose desc_pos_t, int ttool, int tuser, double tvel, double tacc, ExaxisPos epos_t, double ovl, int offset_flag, DescPose offset_pos, double oacc, double blendR, int config, int velAccParamMode)

4.21. Sample code for basic robot motion instructions

New in version C#SDK-V1.1.7: Web-3.8.5

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

4.22. Spiral motion in Cartesian space

 1/**
 2* @brief Cartesian spiral motion.
 3* @param [in] joint_pos target joint position in deg
 4* @param [in] desc_pos target cartesian position in deg
 5* @param [in] tool Tool coordinate number, range [0~14].
 6* @param [in] user Workpiece coordinate number, range [0~14].
 7* @param [in] vel velocity percentage, range [0~100] * @param [in] acc [in] tool coordinate number, range [0~14]
 8* @param [in] acc Acceleration percentage, range [0~100], not available yet.
 9* @param [in] epos extended axis position in mm
10* @param [in] ovl Velocity scaling factor, range [0~100].
11* @param [in] offset_flag 0-no offset, 1- offset in base/work coordinate system, 2- offset in tool coordinate system
12* @param [in] offset_pos Bit position offset
13* @param [in] spiral_param spiral_param
14* @return Error code
15*/
16int NewSpiral(JointPos joint_pos, DescPose desc_pos, int tool, int user, float vel, float acc, ExaxisPos epos, float ovl, byte offset_flag, DescPose offset_pos, SpiralParam spiral_param);

4.23. Cartesian space spiral motion (automatic inverse kinematics calculation)

New in version C#SDK-V1.1.7: Web-3.8.5

 1/**
 2* @brief Cartesian space spiral motion (automatic inverse kinematics calculation)
 3* @param [in] desc_pos  Target cartesian pose
 4* @param [in] tool  Tool coordinate number, range [0~14]
 5* @param [in] user  Workpiece coordinate number, range [0~14]
 6* @param [in] vel  Velocity percentage, range [0~100]
 7* @param [in] acc  Acceleration percentage, range [0~100], not open yet
 8* @param [in] epos  Extended axis position, unit mm
 9* @param [in] ovl  Velocity scaling factor, range [0~100]
10* @param [in] offset_flag  0-no offset, 1-offset in base/workpiece coordinate system, 2-offset in tool coordinate system
11* @param [in] offset_pos  Pose offset
12* @param [in] spiral_param  Spiral parameters
13* @param [in] config Inverse kinematics joint space configuration, [-1]-calculate based on current joint position, [0~7]-solve according to specific joint space configuration
14* @return Error code
15*/
16int NewSpiral(DescPose desc_pos, int tool, int user, double vel, double acc, ExaxisPos epos, double ovl, int offset_flag, DescPose offset_pos, SpiralParam spiral_param,int config)

4.24. Sample code for spiral motion

 1private void btnDescSpiral_Click(object sender, EventArgs e)
 2{
 3    int rtn;
 4    JointPos j = new JointPos(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
 5    DescPose desc_pos = new DescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
 6    DescPose offset_pos1 = new DescPose(50, 0, 0, -30, 0, 0);
 7    DescPose offset_pos2 = new DescPose(50, 0, 0, -5, 0, 0);
 8    ExaxisPos epos = new ExaxisPos(0, 0, 0, 0);
 9    SpiralParam sp;
10    sp.circle_num = 5;
11    sp.circle_angle = 5.0f;
12    sp.rad_init = 50.0f;
13    sp.rad_add = 10.0f;
14    sp.rotaxis_add = 10.0f;
15    sp.rot_direction = 0;
16
17    int tool = 0;
18    int user = 0;
19    float vel = 100.0f;
20    float acc = 100.0f;
21    float ovl = 100.0f;
22    float blendT = 0.0f;
23    byte flag = 2;
24
25    robot.SetSpeed(20);
26
27    rtn = robot.MoveJ(j, desc_pos, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos1);
28    Console.WriteLine($"MoveJ errcode:{rtn}");
29
30    rtn = robot.NewSpiral(j, desc_pos, tool, user, vel, acc, epos, ovl, flag, offset_pos2, sp);
31    Console.WriteLine($"NewSpiral errcode:{rtn}");
32}

4.25. Servo Motion Start

1/**
2* @brief Start servo motion, used with ServoJ and ServoCart commands
3* @param[in] comType Command sending type; 0-xmlrpc; 1-UDP (corresponding to robot port 20007)
4* @return Error code
5*/
6public int ServoMoveStart (int comType = 0)

4.26. Servo Motion End

1/**
2* @brief End servo motion, used with ServoJ and ServoCart commands
3* @param[in] comType Command sending type; 0-xmlrpc; 1-UDP (corresponding to robot port 20007)
4* @return Error code
5*/
6public int ServoMoveEnd (int comType = 0)

4.27. Joint Space Servo Mode Motion

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

 1/**
 2* @brief  Joint space servo mode motion
 3* @param  [in] joint_pos  Target joint position, unit deg
 4* @param  [in] axisPos  External axis position, unit mm
 5* @param  [in] acc  Acceleration percentage, range [0~100], temporarily not open, default is 0
 6* @param  [in] vel  Velocity percentage, range [0~100], temporarily not open, default is 0
 7* @param  [in] cmdT  Command sending period, unit s, recommended range [0.001~0.0016]
 8* @param  [in] filterT Filter time, unit s, temporarily not open, default is 0
 9* @param  [in] gain  Proportional amplifier for target position, temporarily not open, default is 0
10* @param  [in] id ServoJ command ID, default is 0
11* @param  [in] comType Command sending type; 0-xmlrpc; 1-UDP (corresponding to robot port 20007)
12* @return  Error code
13*/
14public int ServoJ(JointPos joint_pos, ExaxisPos axisPos, float acc, float vel, float cmdT, float filterT, float gain, int id = 0, int comType = 0)

4.28. UDP Communication-Based ServoJ, ServoMoveStart, ServoMoveEnd SDK Code Example

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

 1public void TestServoJUDP()
 2{
 3    // Subscribe to callback
 4    robot.OnUdpFrameReceived += (comType, frameCount, frameCmdID, contentLen, content) =>
 5    {
 6        Console.WriteLine($"[] comType={comType}, count={frameCount}, cmdID={frameCmdID}, content={content}");
 7    };
 8
 9    ROBOT_STATE_PKG pkg = new ROBOT_STATE_PKG();
10
11    float vel = 0.0f;
12    float acc = 0.0f;
13    float cmdT = 0.008f;
14    float filterT = 0.0f;
15    float gain = 0.0f;
16    byte flag = 0;
17    int count = 300;
18    float dt = 0.1f;
19    int cmdID = 0;
20
21    while (true)
22    {
23        JointPos j = new JointPos(0, -90, 90, 0, 0, 0);
24        ExaxisPos epos = new ExaxisPos(0, 0, 0, 0);
25        DescPose offset_pos = new DescPose(0, -90, 90, 0, 0, 0);
26        robot.MoveJ(j, 0, 0, 100, 100, 100, epos, -1, 0, offset_pos);
27        int ret = robot.GetActualJointPosDegree(flag, ref j);
28        if (ret == 0)
29        {
30            count = 300;
31            cmdID += 1;
32            robot.ServoMoveStart(1);
33
34            while (count > 0)
35            {
36                robot.ServoJ(j, epos, acc, vel, cmdT, filterT, gain, cmdID, 1);
37                j.jPos[0] += dt;
38                j.jPos[1] += dt;
39                j.jPos[3] += dt;
40                j.jPos[4] += dt;
41                j.jPos[5] += dt;
42                epos.ePos[0] += dt;
43                count -= 1;
44                Thread.Sleep(1);
45                robot.GetRobotRealTimeState(ref pkg);
46            }
47            robot.ServoMoveEnd(1);
48
49            Thread.Sleep(1000);
50            count = 300;
51            robot.ServoMoveStart(1);
52            while (count > 0)
53            {
54                robot.ServoJ(j, epos, acc, vel, cmdT, filterT, gain, cmdID, 1);
55                j.jPos[0] -= dt;
56                j.jPos[1] -= dt;
57                j.jPos[3] -= dt;
58                j.jPos[4] -= dt;
59                j.jPos[5] -= dt;
60                epos.ePos[0] -= dt;
61                count -= 1;
62                Thread.Sleep(1);
63                robot.GetRobotRealTimeState(ref pkg);
64            }
65            robot.ServoMoveEnd(1);
66        }
67        else
68        {
69            Console.WriteLine($"GetActualJointPosDegree errcode:{ret}");
70        }
71    }
72}

4.29. Joint space servo mode motion code example

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

 1private void btnJointServoMove_Click(object sender, EventArgs e)
 2{
 3    JointPos j = new JointPos(0, 0, 0, 0, 0, 0);
 4    ExaxisPos epos = new ExaxisPos(0, 0, 0, 0);
 5
 6    float vel = 0.0f;
 7    float acc = 0.0f;
 8    float cmdT = 0.008f;
 9    float filterT = 0.0f;
10    float gain = 0.0f;
11    byte flag = 0;
12    int count = 500;
13    float dt = 0.1f;
14    int cmdID = 0;
15    int ret = robot.GetActualJointPosDegree(flag, ref j);
16    if (ret == 0)
17    {
18        robot.ServoMoveStart();
19
20        try
21        {
22            while (count > 0)
23            {
24
25                robot.ServoJ(j, epos, acc, vel, cmdT, filterT, gain, cmdID);
26
27
28                j.jPos[0] += dt;
29                count--;
30
31
32                robot.WaitMs((int)(cmdT * 1000));
33            }
34        }
35        finally
36        {
37
38            robot.ServoMoveEnd();
39        }
40    }
41    else
42    {
43        Console.WriteLine($"GetActualJointPosDegree error code: {ret}");
44
45    }
46}

4.30. Joint Torque Control Start

1/**
2* @brief Start joint torque control
3* @param [in] comType Command sending type; 0-xmlrpc; 1-UDP (corresponding to robot port 20007)
4* @return Error code
5*/
6public int ServoJTStart (int comType = 0)

4.31. Joint Torque Control

 1/**
 2* @brief Joint torque control
 3* @param [in] torque j1~j6 joint torque, unit Nm
 4* @param [in] interval Command period, unit s, range [0.001~0.008]
 5* @param [in] checkFlag Detection strategy 0-no restriction; 1-power limitation; 2-velocity limitation; 3-both power and velocity limitation
 6* @param [in] jPowerLimit Joint maximum power limit (W)
 7* @param [in] jVelLimit Joint maximum velocity (°/s)
 8* @param [in]  comType Command sending type; 0-xmlrpc; 1-UDP (corresponding to robot port 20007)
 9* @return Error code
10*/
11public int ServoJT(double[] torque, double interval, int checkFlag, double[] jPowerLimit, double[] jVelLimit, int comType = 0)

4.32. Joint Torque Control End

1/**
2* @brief End joint torque control
3* @param[in] comType Command sending type; 0-xmlrpc; 1-UDP (corresponding to robot port 20007)
4* @return Error code
5*/
6public int ServoJTEnd (int comType = 0)

4.33. UDP Communication-Based ServoJT, ServoJTStart, ServoJTEnd SDK Code Example

 1public int ServoJTWithSafetyUDP()
 2{
 3    // Subscribe to callback
 4    robot.OnUdpFrameReceived += (comType, frameCount, frameCmdID, contentLen, content) =>
 5    {
 6        Console.WriteLine($"[UDP Response] comType={comType}, count={frameCount}, cmdID={frameCmdID}, content={content}");
 7    };
 8    while (true)
 9    {
10        robot.ResetAllError();
11        Thread.Sleep(500);
12
13        JointPos j = new JointPos(7.053, -89.699, 156.141, -72.751, 7.829, 1.889);
14        ExaxisPos epos = new ExaxisPos(0, 0, 0, 0);
15        DescPose offset_pos = new DescPose(-151.288, -321.186, 221.989, 89.140, 4.361, -0.795);
16        robot.MoveJ(j, 0, 0, 100, 100, 100, epos, -1, 0, offset_pos);
17
18        double[] torques = new double[6] { 0, 0, 0, 0, 0, 0 };
19        robot.GetJointTorques(1, torques);
20
21        robot.ServoJTStart(1);
22        ROBOT_STATE_PKG pkg = new ROBOT_STATE_PKG();
23        robot.DragTeachSwitch(1);
24
25        int checkFlag = 0;
26        double[] jPowerLimit = new double[6] { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
27        double[] jVelLimit = new double[6] { 50, 50, 50, 50, 50, 50 };
28        int error = 0;
29        while (true)
30        {
31
32            torques[0] = 0.1;
33            error = robot.ServoJT(torques, 0.008, checkFlag, jPowerLimit, jVelLimit, 1);
34
35            Console.WriteLine($"ServoJT rtn is {error}");
36            Thread.Sleep(1);
37
38            robot.GetRobotRealTimeState(ref pkg);
39            Console.WriteLine($"maincode {pkg.main_code}, subcode {pkg.sub_code}");
40            if (pkg.jt_cur_pos[0] > 30)
41            {
42                break;
43            }
44        }
45
46        while (true)
47        {
48
49            torques[0] = -0.1;
50            error = robot.ServoJT(torques, 0.008, checkFlag, jPowerLimit, jVelLimit, 1);
51
52            Console.WriteLine($"ServoJT rtn is {error}");
53            Thread.Sleep(1);
54
55            robot.GetRobotRealTimeState(ref pkg);
56            Console.WriteLine($"maincode {pkg.main_code}, subcode {pkg.sub_code}");
57            if (pkg.jt_cur_pos[0] < 0)
58            {
59                break;
60            }
61        }
62
63        robot.DragTeachSwitch(0);
64        error = robot.ServoJTEnd(1);
65    }
66    return 0;
67}

4.34. Joint Torque Control Code Example

 1private void button27_Click(object sender, EventArgs e)
 2{
 3    robot.DragTeachSwitch(1);
 4    robot.SetPowerLimit(1, 200);
 5    double[] torques = { 0, 0, 0, 0, 0, 0 };
 6    robot.GetJointTorques(1, torques);
 7
 8    int count = 100;
 9    robot.ServoJTStart();
10    int error = 0;
11    while (count > 0)
12    {
13        error = robot.ServoJT(torques, 0.001f);
14        count--;
15        Thread.Sleep(1);
16    }
17    error = robot.ServoJTEnd();
18    robot.DragTeachSwitch(0);
19}

4.35. Joint Torque Control Code Example with Overspeed Protection

 1public int ServoJTWithSafety()
 2{
 3    while (true)
 4    {
 5        robot.ResetAllError();
 6        Thread.Sleep(500);
 7
 8        JointPos j = new JointPos(7.053, -89.699, 156.141, -72.751, 7.829, 1.889);
 9        ExaxisPos epos = new ExaxisPos(0, 0, 0, 0);
10        DescPose offset_pos = new DescPose(-151.288, -321.186, 221.989, 89.140, 4.361, -0.795);
11        robot.MoveJ(j, 0, 0, 100, 100, 100, epos, -1, 0, offset_pos);
12
13        double[] torques = new double[6] { 0, 0, 0, 0, 0, 0 };
14        robot.GetJointTorques(1, torques);
15
16        robot.ServoJTStart(0);
17        ROBOT_STATE_PKG pkg = new ROBOT_STATE_PKG();
18        robot.DragTeachSwitch(1);
19
20        int checkFlag = 0;
21        double[] jPowerLimit = new double[6] { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
22        double[] jVelLimit = new double[6] { 50, 50, 50, 50, 50, 50 };
23        int error = 0;
24        while (true)
25        {
26
27            torques[0] = 0.1;
28            error = robot.ServoJT(torques, 0.008, checkFlag, jPowerLimit, jVelLimit, 0);
29
30            Console.WriteLine($"ServoJT rtn is {error}");
31            Thread.Sleep(1);
32
33            robot.GetRobotRealTimeState(ref pkg);
34            Console.WriteLine($"maincode {pkg.main_code}, subcode {pkg.sub_code}");
35            if (pkg.jt_cur_pos[0] > 30)
36            {
37                break;
38            }
39        }
40
41        while (true)
42        {
43
44            torques[0] = -0.1;
45            error = robot.ServoJT(torques, 0.008, checkFlag, jPowerLimit, jVelLimit, 0);
46
47            Console.WriteLine($"ServoJT rtn is {error}");
48            Thread.Sleep(1);
49
50            robot.GetRobotRealTimeState(ref pkg);
51            Console.WriteLine($"maincode {pkg.main_code}, subcode {pkg.sub_code}");
52            if (pkg.jt_cur_pos[0] < 0)
53            {
54                break;
55            }
56        }
57
58        robot.DragTeachSwitch(0);
59        error = robot.ServoJTEnd(0);
60    }
61}

4.36. Servo mode motion in Cartesian space

1

4.37. Cartesian Space Servo Mode Motion

 1/**
 2* @brief Cartesian space servo mode motion
 3* @param [in] mode 0-Absolute motion (base coordinate system), 1-Incremental motion (base coordinate system), 2-Incremental motion (tool coordinate system)
 4* @param [in] desc_pos Target Cartesian pose or pose increment
 5* @param [in] exaxis Extended axis position
 6* @param [in] pos_gain Pose increment proportionality coefficient, only effective in incremental motion, range [0~1]
 7* @param [in] acc Acceleration percentage, range [0~100], temporarily not available, default 0
 8* @param [in] vel Velocity percentage, range [0~100], temporarily not available, default 0
 9* @param [in] cmdT Command transmission period, unit s, recommended range [0.001~0.016]
10* @param [in] filterT Filter time, unit s, temporarily not available, default 0
11* @param [in] gain Proportional amplifier for target position, temporarily not available, default 0
12* @return Error code
13*/
14public int ServoCart(int mode, DescPose desc_pose, ExaxisPos exaxis, double[] pos_gain, double acc, double vel, double cmdT, double filterT, double gain);

4.38. Example of servo mode motion code in Cartesian space

 1public void TestServoCart()
 2{
 3    ROBOT_STATE_PKG pkg = new ROBOT_STATE_PKG();
 4
 5    int rtn;
 6    DescPose desc_pos_dt = new DescPose(83.00800f, 50.525000f, 29.246f, 179.629f, -7.138f, -166.975f);
 7    ExaxisPos exaxis = new ExaxisPos(100.0f, 0.0f, 0.0f, 0.0f);
 8    double[] pos_gain = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
 9    int mode = 0;
10    float vel = 0.0f;
11    float acc = 0.0f;
12    float cmdT = 0.001f;
13    float filterT = 0.0f;
14    float gain = 0.0f;
15    byte flag = 0;
16    int count = 5000;
17
18    robot.SetSpeed(20);
19
20    while (count > 0)
21    {
22        rtn = robot.ServoCart(mode, desc_pos_dt, exaxis, pos_gain, acc, vel, cmdT, filterT, gain);
23        Console.WriteLine($"ServoCart rtn is {rtn}");
24        count -= 1;
25        desc_pos_dt.tran.x += 0.01f;
26        exaxis.ePos[0] += 0.01f;
27    }
28}

4.39. Spline motion starts

1/**
2* @brief Spline start
3* @return Error code.
4*/
5int SplineStart();

4.40. Spline motion PTP

 1/**
 2* @brief Joint space spline motion.
 3* @param [in] joint_pos Target joint position in degrees.
 4* @param [in] desc_pos Target Cartesian position.
 5* @param [in] tool Tool coordinate number, range [0~14].
 6* @param [in] user Workpiece coordinate number, range [0~14].
 7* @param [in] vel velocity percentage, range [0~100] * @param [in] acc.
 8* @param [in] acc Acceleration percentage, range [0~100], not available yet.
 9* @param [in] ovl velocity scaling factor, range [0~100].
10* @return Error code
11*/
12int SplinePTP(JointPos joint_pos, DescPose desc_pos, int tool, int user, float vel, float acc, float ovl);

4.41. Joint space spline motion (automatic forward kinematics calculation)

New in version C#SDK-V1.1.7: Web-3.8.5

 1/**
 2* @brief Joint space spline motion (automatic forward kinematics calculation)
 3* @param [in] joint_pos  Target joint position, unit deg
 4* @param [in] tool  Tool coordinate number, range [0~14]
 5* @param [in] user  Workpiece coordinate number, range [0~14]
 6* @param [in] vel  Velocity percentage, range [0~100]
 7* @param [in] acc  Acceleration percentage, range [0~100], not open yet
 8* @param [in] ovl  Velocity scaling factor, range [0~100]
 9* @return Error code
10*/
11int SplinePTP(JointPos joint_pos, int tool, int user, double vel, double acc, double ovl)

4.42. End of spline motion

1/**
2* @brief End of spline motion.
3* @return Error code.
4*/
5int SplineEnd();

4.43. Sample code for spline motion

 1private void btnSplineMove_Click(object sender, EventArgs e)
 2{
 3    JointPos j1 = new JointPos(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
 4    JointPos j2 = new JointPos(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);
 5    JointPos j3 = new JointPos(-61.954, -84.409, 108.153, -116.316, -91.283, 74.260);
 6    JointPos j4 = new JointPos(-89.575, -80.276, 102.713, -116.302, -91.284, 74.267);
 7    DescPose desc_pos1 = new DescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
 8    DescPose desc_pos2 = new DescPose(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
 9    DescPose desc_pos3 = new DescPose(-327.622, 402.230, 320.402, -178.067, 2.127, -46.207);
10    DescPose desc_pos4 = new DescPose(-104.066, 544.321, 327.023, -177.715, 3.371, -73.818);
11    DescPose offset_pos = new DescPose(0, 0, 0, 0, 0, 0);
12    ExaxisPos epos = new ExaxisPos(0, 0, 0, 0);
13
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 blendT = -1.0f;
20    byte flag = 0;
21
22    robot.SetSpeed(20);
23
24    int err = -1;
25    err = robot.MoveJ(j1, desc_pos1, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
26    Console.WriteLine($"movej errcode:  {err}");
27
28    robot.SplineStart();
29    robot.SplinePTP(j1, desc_pos1, tool, user, vel, acc, ovl);
30    robot.SplinePTP(j2, desc_pos2, tool, user, vel, acc, ovl);
31    robot.SplinePTP(j3, desc_pos3, tool, user, vel, acc, ovl);
32    robot.SplinePTP(j4, desc_pos4, tool, user, vel, acc, ovl);
33    robot.SplineEnd();
34}

4.44. Starting new spline motion

Changed in version C#SDK-v1.0.6.

1/**
2* @brief New spline motion start
3* @param [in] type 0-circular transition, 1-given point as path point
4* @param [in] averageTime global average articulation time (ms) (10 ~ ), default 2000
5* @return ErrorCode
6*/
7int NewSplineStart(int type, int averageTime=2000);

4.45. New spline instruction point

 1/**
 2* @brief Add spline command point.
 3* @param [in] joint_pos Target joint position, in deg.
 4* @param [in] desc_pos Target Cartesian position.
 5* @param [in] tool Tool coordinate number, range [0~14].
 6* @param [in] user Tool coordinate number, range [0~14].
 7* @param [in] vel Speed percentage, range [0~100].
 8* @param [in] acc Acceleration Percentage, range [0~100], not available yet.
 9* @param [in] ovl velocity scaling factor, range [0~100]
10* @param [in] blendR [-1.0]-motion in place (blocking), [0~1000.0]-smoothing radius (non-blocking), unit mm
11* @param [in] lastFlag whether it is the last point, 0-no, 1-yes
12* @return error code
13*/
14int NewSplinePoint(JointPos joint_pos, DescPose desc_pos, int tool, int user, float vel, float acc, float ovl, float blendR, int lastFlag);;

4.46. New spline command point (automatic inverse kinematics calculation)

New in version C#SDK-V1.1.7: Web-3.8.5

 1/**
 2* @brief New spline command point (automatic inverse kinematics calculation)
 3* @param [in] desc_pos  Target cartesian pose
 4* @param [in] tool  Tool coordinate number, range [0~14]
 5* @param [in] user  Workpiece coordinate number, range [0~14]
 6* @param [in] vel  Velocity percentage, range [0~100]
 7* @param [in] acc  Acceleration percentage, range [0~100], not open yet
 8* @param [in] ovl  Velocity 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* @param [in] lastFlag Whether it is the last point, 0-no, 1-yes
11* @param [in] config Inverse kinematics joint space configuration, [-1]-calculate based on current joint position, [0~7]-solve according to specific joint space configuration
12* @return Error code
13*/
14int NewSplinePoint(DescPose desc_pos, int tool, int user, double vel, double acc, double ovl, double blendR, int lastFlag,int config)

4.47. End of new spline motion

1/**
2* @brief Start of new spline motion
3* @return Error code.
4*/
5int NewSplineEnd();

4.48. Sample code for new spline motion

 1private void btnNewSpline_Click(object sender, EventArgs e)
 2{
 3    JointPos j1 = new JointPos(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
 4    JointPos j2 = new JointPos(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);
 5    JointPos j3 = new JointPos(-61.954, -84.409, 108.153, -116.316, -91.283, 74.260);
 6    JointPos j4 = new JointPos(-89.575, -80.276, 102.713, -116.302, -91.284, 74.267);
 7    JointPos j5 = new JointPos(-95.228, -54.621, 73.691, -112.245, -91.280, 74.268);
 8    DescPose desc_pos1 = new DescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
 9    DescPose desc_pos2 = new DescPose(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
10    DescPose desc_pos3 = new DescPose(-327.622, 402.230, 320.402, -178.067, 2.127, -46.207);
11    DescPose desc_pos4 = new DescPose(-104.066, 544.321, 327.023, -177.715, 3.371, -73.818);
12    DescPose desc_pos5 = new DescPose(-33.421, 732.572, 275.103, -177.907, 2.709, -79.482);
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 = 100.0f;
20    float ovl = 100.0f;
21    float blendT = -1.0f;
22    byte flag = 0;
23
24    robot.SetSpeed(20);
25
26    int err = -1;
27    err = robot.MoveJ(j1, desc_pos1, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
28    Console.WriteLine($"movej errcode:  {err}");
29
30    robot.NewSplineStart(1, 2000);
31    robot.NewSplinePoint(j1, desc_pos1, tool, user, vel, acc, ovl, -1, 0);
32    robot.NewSplinePoint(j2, desc_pos2, tool, user, vel, acc, ovl, -1, 0);
33    robot.NewSplinePoint(j3, desc_pos3, tool, user, vel, acc, ovl, -1, 0);
34    robot.NewSplinePoint(j4, desc_pos4, tool, user, vel, acc, ovl, -1, 0);
35    robot.NewSplinePoint(j5, desc_pos5, tool, user, vel, acc, ovl, -1, 0);
36    robot.NewSplineEnd();
37}

4.49. Terminate the motion

1/**
2* @brief Terminate the campaign.
3* @return Error code
4*/
5int StopMotion();

4.50. Pause the motion.

1/**
2* @brief Pause motion
3* @return Error code
4*/
5int PauseMotion();

4.51. Resumes motion.

1/**
2* @brief Resume movement
3* @return Error code
4*/
5int ResumeMotion();

4.52. Motion Pause, Resume, Stop Code Example

 1private void btnMotionPause_Click(object sender, EventArgs e)
 2{
 3    int rtn;
 4    JointPos j1 = new JointPos(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
 5    JointPos j5 = new JointPos(-95.228, -54.621, 73.691, -112.245, -91.280, 74.268);
 6    DescPose desc_pos1 = new DescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
 7    DescPose desc_pos5 = new DescPose(-33.421, 732.572, 275.103, -177.907, 2.709, -79.482);
 8    DescPose offset_pos = new DescPose(0, 0, 0, 0, 0, 0);
 9    ExaxisPos epos = new ExaxisPos(0, 0, 0, 0);
10
11    int tool = 0;
12    int user = 0;
13    float vel = 100.0f;
14    float acc = 100.0f;
15    float ovl = 100.0f;
16    float blendT = -1.0f;
17    byte flag = 0;
18
19    robot.SetSpeed(20);
20
21    rtn = robot.MoveJ(j1, desc_pos1, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
22    rtn = robot.MoveJ(j5, desc_pos5, tool, user, vel, acc, ovl, epos, 1, flag, offset_pos);
23    Thread.Sleep(1000);
24    robot.PauseMotion();
25
26    Thread.Sleep(1000);
27    robot.ResumeMotion();
28
29    Thread.Sleep(1000);
30    robot.StopMotion();
31
32    Thread.Sleep(1000);
33
34}

4.53. Start the overall point offset

1/**
2* @brief Start of overall point offset.
3* @param [in] flag 0 - offset in base/workpiece coordinate system, 2 - offset in tool coordinate system
4* @param [in] offset_pos Positional Offset
5* @return Error code
6*/
7int PointsOffsetEnable(int flag, DescPose offset_pos);

4.54. Points overall offset end

1/**
2* @brief End of point offset.
3* @return Error code
4*/
5int PointsOffsetDisable();

4.55. Points Offset Code Example

 1private void btnPointOffect_Click(object sender, EventArgs e)
 2{
 3    JointPos j1, j2;
 4    DescPose desc_pos1, desc_pos2, offset_pos, offset_pos1;
 5    ExaxisPos epos = new ExaxisPos(0, 0, 0, 0);
 6
 7    j1 = new JointPos(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
 8    desc_pos1 = new DescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
 9
10    j2 = new JointPos(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);
11
12    desc_pos2 = new DescPose(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
13
14    offset_pos = new DescPose(0, 0, 0, 0, 0, 0);
15    offset_pos1 = new DescPose(50.0, 50.0, 50.0, 5.0, 5.0, 5.0);
16
17    int tool = 0;
18    int user = 0;
19    float vel = 100.0f;
20    float acc = 100.0f;
21    float ovl = 100.0f;
22    float blendT = -1.0f;
23    byte flag = 0;
24    int type = 0;
25
26    robot.SetSpeed(20);
27
28    robot.MoveJ(j1, desc_pos1, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
29    robot.MoveJ(j2, desc_pos2, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
30    Thread.Sleep(1000);
31    robot.PointsOffsetEnable(type, offset_pos1);
32    Thread.Sleep(1000);
33    robot.MoveJ(j1, desc_pos1, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
34    robot.MoveJ(j2, desc_pos2, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
35    Thread.Sleep(1000);
36    robot.PointsOffsetDisable();
37}

4.56. Control box AO flytap start

New in version C#SDK-v1.0.7.

1/**
2* @brief Control box AO flyswatter start.
3* @param [in] AONum control box AO number
4* @param [in] maxTCPSpeed maxTCPSpeed value [1-5000mm/s], default 1000
5* @param [in] maxAOPercent Percentage of AO corresponding to the maximum TCP speed value, default 100%
6* @param [in] zeroZoneCmp AO percentage for dead zone compensation value, shaped, default 20%, range [0-100]
7* @return Error code.
8*/
9int MoveAOStart(int AONum, int maxTCPSpeed, int maxAOPercent, int zeroZoneCmp);

4.57. Control box AO flytap stop

New in version C#SDK-v1.0.7.

1/**
2* @brief Control box AO flytap stops
3* @return Error code.
4*/
5int MoveAOStop();

4.58. End AO flyswatter start

New in version C#SDK-v1.0.7.

1/**
2* @brief End AO flytap start
3* @param [in] AONum The end AO number.
4* @param [in] maxTCPSpeed maxTCPSpeed value [1-5000mm/s], default 1000
5* @param [in] maxAOPercent Percentage of AOs corresponding to the maximum TCP speed value, default 100%
6* @param [in] zeroZoneCmp AO percentage for dead zone compensation value, shaped, default 20%, range [0-100]
7* @return Error code.
8*/
9int MoveToolAOStart(int AONum, int maxTCPSpeed, int maxAOPercent, int zeroZoneCmp);

4.59. End AO flytap stop

New in version C#SDK-v1.0.7.

1/**
2* @brief End AO flyswatter stops
3* @return Error code
4*/
5int MoveToolAOStop();

4.60. AO flyswatter code example

 1private void btnMoveAO_Click(object sender, EventArgs e)
 2{
 3    JointPos j1 = new JointPos(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
 4    JointPos j2 = new JointPos(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);
 5    DescPose desc_pos1 = new DescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
 6    DescPose desc_pos2 = new DescPose(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
 7    DescPose offset_pos = new DescPose(0, 0, 0, 0, 0, 0);
 8    ExaxisPos epos = new ExaxisPos(0, 0, 0, 0);
 9
10    int tool = 0;
11    int user = 0;
12    float vel = 100.0f;
13    float acc = 100.0f;
14    float ovl = 100.0f;
15    float blendT = 0.0f;
16    float blendR = 0.0f;
17    byte flag = 0;
18    byte search = 0;
19
20    robot.SetSpeed(5);
21
22    robot.MoveAOStart(0,100,100,20);
23    robot.MoveJ(j1, desc_pos1, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
24    robot.MoveJ(j2, desc_pos2, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
25    robot.MoveAOStop();
26
27    robot.MoveToolAOStart(0, 100, 100, 20);
28    robot.MoveJ(j1, desc_pos1, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
29    robot.MoveJ(j2, desc_pos2, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
30    robot.MoveToolAOStop();
31}

4.61. Start Ptp motion FIR filtering

New in version C#SDK-V1.1.3: Web-3.8.2

1/**
2* @brief Start Ptp motion FIR filtering.
3* @param [in] maxAcc Maximum Acceleration Extreme (deg/s2)
4* @param [in] maxJek Uniform Joint Acuity Extreme (deg/s3)
5* @return Error code.
6*/
7int PtpFIRPlanningStart(double maxAcc, double maxJek=1000);

4.62. Turn off Ptp motion FIR filtering

1/**
2* @brief Turn off Ptp motion FIR filtering.
3* @return Error code
4*/
5int PtpFIRPlanningEnd();

4.63. Start LIN, ARC motion FIR filtering.

1/**
2* @brief Start LIN, ARC motion FIR filtering.
3* @param [in] maxAccLin Linear Acceleration Extreme (mm/s2)
4* @param [in] maxAccDeg angular acceleration extreme (deg/s2)
5* @param [in] maxJerkLin Linear plus Acceleration Extreme (mm/s3)
6* @param [in] maxJerkDeg Angle plus acceleration extreme (deg/s3)
7* @return Error code
8*/
9int LinArcFIRPlanningStart(double maxAccLin, double maxAccDeg, double maxJerkLin, double maxJerkDeg);

4.64. Turn off LIN, ARC motion FIR filtering

1/**
2* @brief Turn off LIN, ARC motion FIR filtering.
3* @return Error code
4*/
5int LinArcFIRPlanningEnd();

4.65. FIR filtering code example

New in version C#SDK-V1.1.3: Web-3.8.2

 1private void button69_Click(object sender, EventArgs e)
 2{
 3    int rtn;
 4    JointPos startjointPos = new JointPos(-11.904f, -99.669f, 117.473f, -108.616f, -91.726f, 74.256f);
 5    JointPos midjointPos = new JointPos(-45.615f, -106.172f, 124.296f, -107.151f, -91.282f, 74.255f);
 6    JointPos endjointPos = new JointPos(-29.777f, -84.536f, 109.275f, -114.075f, -86.655f, 74.257f);
 7
 8    DescPose startdescPose = new DescPose(-419.524f, -13.000f, 351.569f, -178.118f, 0.314f, 3.833f);
 9    DescPose middescPose = new DescPose(-321.222f, 185.189f, 335.520f, -179.030f, -1.284f, -29.869f);
10    DescPose enddescPose = new DescPose(-487.434f, 154.362f, 308.576f, 176.600f, 0.268f, -14.061f);
11
12    ExaxisPos exaxisPos = new ExaxisPos(0, 0, 0, 0);
13    DescPose offdese = new DescPose(0, 0, 0, 0, 0, 0);
14
15    rtn = robot.PtpFIRPlanningStart(1000, 1000);
16    Console.WriteLine("PtpFIRPlanningStart rtn is " + rtn);
17    robot.MoveJ(startjointPos, startdescPose, 0, 0, 100, 100, 100, exaxisPos, -1, 0, offdese);
18    robot.MoveJ(endjointPos, enddescPose, 0, 0, 100, 100, 100, exaxisPos, -1, 0, offdese);
19    robot.PtpFIRPlanningEnd();
20    Console.WriteLine("PtpFIRPlanningEnd rtn is " + rtn);
21
22    robot.LinArcFIRPlanningStart(1000, 1000, 1000, 1000);
23    Console.WriteLine("LinArcFIRPlanningStart rtn is " + rtn);
24    robot.MoveL(startjointPos, startdescPose, 0, 0, 20, 100, 100, -1,0, exaxisPos, 0, 0, offdese, 1, 50);
25    robot.MoveC(midjointPos, middescPose, 0, 0, 100, 100, exaxisPos, 0, offdese, endjointPos, enddescPose, 0, 0, 100, 100, exaxisPos, 0, offdese, 100, -1, 100, 0);
26    robot.LinArcFIRPlanningEnd();
27    Console.WriteLine("LinArcFIRPlanningEnd rtn is " + rtn);
28}

4.66. Acceleration smoothing on

1/**
2* @brief Acceleration smoothing on
3* @param [in] saveFlag Whether to power down and save.
4* @return ErrorCode
5*/
6int AccSmoothStart(bool saveFlag);

4.67. Acceleration SmoothStart(bool saveFlag); int AccSmoothStart

1/**
2* @brief Accelerate smooth shutdown
3* @param [in] saveFlag whether to power down and save
4* @return ErrorCode
5*/
6int AccSmoothEnd(bool saveFlag);

4.68. Code example

 1private void button1_Click(object sender, EventArgs e)
 2{
 3
 4    int rtn;
 5    JointPos startjointPos = new JointPos(-11.904f, -99.669f, 117.473f, -108.616f, -91.726f, 74.256f);
 6    JointPos endjointPos = new JointPos(-45.615f, -106.172f, 124.296f, -107.151f, -91.282f, 74.255f);
 7
 8    DescPose startdescPose = new DescPose(-419.524f, -13.000f, 351.569f, -178.118f, 0.314f, 3.833f);
 9    DescPose enddescPose = new DescPose(-321.222f, 185.189f, 335.520f, -179.030f, -1.284f, -29.869f);
10
11    ExaxisPos exaxisPos = new ExaxisPos(0, 0, 0, 0);
12    DescPose offdese = new DescPose(0, 0, 0, 0, 0, 0);
13    rtn = robot.AccSmoothStart(false);
14    Console.WriteLine("AccSmoothStart rtn is " + rtn);
15    robot.MoveJ( startjointPos,  startdescPose, 0, 0, 100, 100, 100,  exaxisPos, -1, 0,  offdese);
16    robot.MoveJ( endjointPos,  enddescPose, 0, 0, 100, 100, 100,  exaxisPos, -1, 0,  offdese);
17    rtn = robot.AccSmoothEnd(false);
18    Console.WriteLine("AccSmoothEnd rtn is " + rtn);
19}

4.69. Specify the attitude speed to turn on

1/**
2* @brief Specify that Attitude Speed is on
3* @param [in] ratio Attitude Speed Percentage [0-300]
4* @return Error code
5*/
6int AngularSpeedStart(int ratio).

4.70. Specifies that the attitude speed is off

1/**
2* @brief Specify attitude speed off
3* @return Error code
4*/
5int AngularSpeedEnd();

4.71. Robot Specify Angular Speed Code Example

 1private void button71_Click(object sender, EventArgs e)
 2{
 3    int rtn;
 4    JointPos startjointPos = new JointPos(-11.904f, -99.669f, 117.473f, -108.616f, -91.726f, 74.256f);
 5    JointPos endjointPos = new JointPos(-45.615f, -106.172f, 124.296f, -107.151f, -91.282f, 74.255f);
 6
 7    DescPose startdescPose = new DescPose(-419.524f, -13.000f, 351.569f, -178.118f, 0.314f, 3.833f);
 8    DescPose enddescPose = new DescPose(-321.222f, 185.189f, 335.520f, -179.030f, -1.284f, -29.869f);
 9
10    ExaxisPos exaxisPos = new ExaxisPos(0, 0, 0, 0);
11    DescPose offdese = new DescPose(0, 0, 0, 0, 0, 0);
12    rtn = robot.AngularSpeedStart(50);
13    Console.WriteLine("AngularSpeedStart rtn is " + rtn);
14    robot.MoveJ( startjointPos,  startdescPose, 0, 0, 100, 100, 100,  exaxisPos, -1, 0,  offdese);
15    robot.MoveJ( endjointPos,  enddescPose, 0, 0, 100, 100, 100,  exaxisPos, -1, 0,  offdese);
16    rtn = robot.AngularSpeedEnd();
17    Console.WriteLine("AngularSpeedEnd rtn is " + rtn);
18}

4.72. Starting singular position protection

New in version C#SDK-v1.0.9.

1/**
2* @brief Starting singular bitmap protection.
3* @param [in] protectMode Singular protection mode, 0: articulation mode; 1 - Cartesian mode
4* @param [in] minShoulderPos shoulder singularity adjustment range (mm), default 100
5* @param [in] minElbowPos Elbow singularity adjustment range (mm), default 50
6* @param [in] minWristPos Wrist singularity range (°), default 10
7* @return Error code
8*/
9int SingularAvoidStart(int protectMode, double minShoulderPos, double minElbowPos, double minWristPos);

4.73. Stop singular attitude protection

New in version C#SDK-v1.0.9.

1/**
2* @brief Stop odd-bit pose protection.
3* @return Error code
4*/
5int SingularAvoidEnd();

4.74. Code example

New in version C#SDK-v1.0.9.

 1private void btnTestSingularAvoidEArc_Click(object sender, EventArgs e)
 2{
 3    int rtn;
 4    JointPos startjointPos = new JointPos(-11.904f, -99.669f, 117.473f, -108.616f, -91.726f, 74.256f);
 5    JointPos endjointPos = new JointPos(-45.615f, -106.172f, 124.296f, -107.151f, -91.282f, 74.255f);
 6
 7    DescPose startdescPose = new DescPose(-419.524f, -13.000f, 351.569f, -178.118f, 0.314f, 3.833f);
 8    DescPose enddescPose = new DescPose(-321.222f, 185.189f, 335.520f, -179.030f, -1.284f, -29.869f);
 9
10    ExaxisPos exaxisPos = new ExaxisPos(0, 0, 0, 0);
11    DescPose offdese = new DescPose(0, 0, 0, 0, 0, 0);
12
13    rtn = robot.SingularAvoidStart(2, 10, 5, 5);
14    Console.WriteLine("SingularAvoidStart rtn is " + rtn);
15    robot.MoveJ( startjointPos,  startdescPose, 0, 0, 100, 100, 100,  exaxisPos, -1, 0,  offdese);
16    robot.MoveJ( endjointPos,  enddescPose, 0, 0, 100, 100, 100,  exaxisPos, -1, 0,  offdese);
17    rtn = robot.SingularAvoidEnd();
18    Console.WriteLine("SingularAvoidEnd rtn is " + rtn);
19}

4.75. Safety Stop Trigger

1/**
2* @brief Safe stop trigger signal
3* @return Error code
4*/
5int GetSafetyCode();

4.76. Clear the motion command queue

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

1/**
2* @brief Clear the motion command queue
3* @return Error code
4*/
5public int MotionQueueClear();

4.77. Move to Intersecting Line Start Point

 1/**
 2* @brief Move to intersecting line start point
 3* @param [in] mainPoint Cartesian poses of 6 taught points on the main pipe
 4* @param [in] mainExaxisPos Extended axis positions for 6 taught points on the main pipe
 5* @param [in] piecePoint Cartesian poses of 6 taught points on the branch pipe
 6* @param [in] pieceExaxisPos Extended axis positions for 6 taught points on the branch pipe
 7* @param [in] extAxisFlag Whether to enable extended axis; 0-Disable; 1-Enable
 8* @param [in] exaxisPos Start point extended axis position
 9* @param [in] tool Tool coordinate system number
10* @param [in] wobj Workpiece coordinate system number
11* @param [in] vel Velocity percentage
12* @param [in] acc Acceleration percentage
13* @param [in] ovl Velocity scaling factor
14* @param [in] oacc Acceleration scaling factor
15* @param [in] moveType Motion type; 0-PTP; 1-LIN
16* @param [in] moveDirection Motion direction; 0-Clockwise; 1-Counterclockwise
17* @param [in] offset Offset value
18* @return Error code
19*/
20public int MoveToIntersectLineStart(DescPose[] mainPoint, ExaxisPos[] mainExaxisPos, DescPose[] piecePoint, ExaxisPos[] pieceExaxisPos, int extAxisFlag, ExaxisPos exaxisPos, int tool, int wobj, double vel, double acc, double ovl, double oacc, int moveType, int moveDirection, DescPose offset);

4.78. Intersecting Line Motion

 1/**
 2* @brief Intersecting line motion
 3* @param [in] mainPoint Cartesian poses of 6 taught points on the main pipe
 4* @param [in] mainExaxisPos Extended axis positions for 6 taught points on the main pipe
 5* @param [in] piecePoint Cartesian poses of 6 taught points on the branch pipe
 6* @param [in] pieceExaxisPos Extended axis positions for 6 taught points on the branch pipe
 7* @param [in] extAxisFlag Whether to enable extended axis; 0-Disable; 1-Enable
 8* @param [in] exaxisPos Start point extended axis positions
 9* @param [in] tool Tool coordinate system number
10* @param [in] wobj Workpiece coordinate system number
11* @param [in] vel Velocity percentage
12* @param [in] acc Acceleration percentage
13* @param [in] ovl Velocity scaling factor
14* @param [in] oacc Acceleration scaling factor
15* @param [in] moveDirection Motion direction; 0-Clockwise; 1-Counterclockwise
16* @param [in] offset Offset value
17* @return Error code
18*/
19public int MoveIntersectLine(DescPose[] mainPoint, ExaxisPos[] mainExaxisPos, DescPose[] piecePoint, ExaxisPos[] pieceExaxisPos, int extAxisFlag, ExaxisPos[] exaxisPos, int tool, int wobj, double vel, double acc, double ovl, double oacc, int moveDirection, DescPose offset);

4.79. Robot Intersecting Line Motion Code Example

 1void TestIntersectLineMove()
 2{
 3    ROBOT_STATE_PKG pkg = {};
 4    FRRobot robot;
 5    robot.LoggerInit();
 6    robot.SetLoggerLevel(3);
 7    int rtn = robot.RPC("192.168.58.2");
 8    if (rtn != 0)
 9    {
10        return ;
11    }
12    robot.SetReConnectParam(true, 30000, 500);
13    DescPose mainPoint[6] = {};
14    DescPose piecePoint[6] = {};
15    ExaxisPos mainExaxisPos[6] = {};
16    ExaxisPos pieceExaxisPos[6] = {};
17    int extAxisFlag = 1;
18    ExaxisPos exaxisPos[4] = {};
19    DescPose offset = { 0.0, 2.0 ,30.0, -2.0, 0.0, 0.0 };
20    mainPoint[0] = {490.004, -383.194, 402.735, -9.332, -1.528, 69.594};
21    mainPoint[1] = {444.950, -407.117, 389.011, -5.546, -2.196, 65.279};
22    mainPoint[2] = {445.168, -463.605, 355.759, -1.544, -10.886, 57.104};
23    mainPoint[3] = {507.529, -485.385, 343.013, -0.786, -4.834, 61.799};
24    mainPoint[4] = {554.390, -442.647, 367.701, -4.761, -10.181, 64.925};
25    mainPoint[5] = {532.552, -394.003, 396.467, -13.732, -13.592, 67.411};
26    mainExaxisPos[0] = { -29.996, 0.000, 0.000, 0.000 };
27    mainExaxisPos[1] = { -29.996, 0.000, 0.000, 0.000 };
28    mainExaxisPos[2] = { -29.996, 0.000, 0.000, 0.000 };
29    mainExaxisPos[3] = { -29.996, 0.000, 0.000, 0.000 };
30    mainExaxisPos[4] = { -29.996, 0.000, 0.000, 0.000 };
31    mainExaxisPos[5] = { -29.996, 0.000, 0.000, 0.000 };
32    piecePoint[0] = { 505.571, -192.408, 316.759, 38.098, 37.051, 139.447 };
33    piecePoint[1] = {533.837, -201.558, 332.340, 34.644, 42.339, 137.748};
34    piecePoint[2] = {530.386, -225.085, 373.808, 35.431, 45.111, 137.560};
35    piecePoint[3] = {485.646, -229.195, 383.778, 33.870, 45.173, 137.064};
36    piecePoint[4] = {460.551, -212.161, 354.256, 28.856, 45.602, 135.930};
37    piecePoint[5] = {474.217, -197.124, 324.611, 42.469, 41.133, 148.167};
38    pieceExaxisPos[0] = { -29.996, -0.000, 0.000, 0.000 };
39    pieceExaxisPos[1] = { -29.996, -0.000, 0.000, 0.000 };
40    pieceExaxisPos[2] = { -29.996, -0.000, 0.000, 0.000 };
41    pieceExaxisPos[3] = { -29.996, -0.000, 0.000, 0.000 };
42    pieceExaxisPos[4] = { -29.996, -0.000, 0.000, 0.000 };
43    pieceExaxisPos[5] = { -29.996, -0.000, 0.000, 0.000 };
44    exaxisPos[0] = {-29.996, -0.000, 0.000, 0.000};
45    exaxisPos[1] = {-44.994, 90.000, 0.000, 0.000};
46    exaxisPos[2] = {-59.992, 0.002, 0.000, 0.000};
47    exaxisPos[3] = {-44.994, -89.997, 0.000, 0.000};
48    int tool = 2;
49    int wobj = 0;
50    double vel = 100.0;
51    double acc = 100.0;
52    double ovl = 12.0;
53    double oacc = 12.0;
54    int moveType = 1;
55    int moveDirection = 1;
56    rtn = robot.MoveToIntersectLineStart(mainPoint, mainExaxisPos, piecePoint, pieceExaxisPos, extAxisFlag, exaxisPos[0], tool, wobj, vel, acc, ovl, oacc, moveType, moveDirection, offset);
57    printf("MoveToIntersectLineStart rtn is %d\n", rtn);
58    rtn = robot.MoveIntersectLine(mainPoint, mainExaxisPos, piecePoint, pieceExaxisPos, extAxisFlag, exaxisPos, tool, wobj, vel, acc, 5.0, 5.0, moveDirection, offset);
59    printf("MoveIntersectLine rtn is %d\n", rtn);
60    robot.CloseRPC();
61    return ;
62}

4.80. Stationary Air Motion

1/**
2* @brief Stationary Air Motion
3* @return Error code
4*/
5public int MoveStationary()

4.81. Stationary Air Motion Code Example

1public void LaserSensorRecordandReplay()
2{
3    int rtn = robot.LaserSensorRecordandReplay(0, 10, 1, 0, 0.1, 1, 1, 10, 100);
4    Console.WriteLine($"LaserSensorRecordandReplay rtn is {rtn}");
5    rtn = robot.MoveStationary();
6    Console.WriteLine($"MoveStationary rtn is {rtn}");
7    rtn = robot.LaserSensorRecord1(0, 10);
8    Console.WriteLine($"LaserSensorRecord1 rtn is {rtn}");
9}

4.82. Fixed-Point Swing Start

1/**
2* @brief Start fixed-point swing
3* @param [in] weaveNum Swing number [0-7]
4* @param [in] mode 0-Tool coordinate system; 1-Reference point
5* @param [in] refPoint Reference point Cartesian coordinates [x,y,z,a,b,c]
6* @param [in] weaveTime Swing time [s]
7* @return Error code
8*/
9public int OriginPointWeaveStart(int weaveNum, int mode, DescPose refPoint, double weaveTime);

4.83. Fixed-Point Swing End

1/**
2* @brief End fixed-point swing
3* @return Error code
4*/
5public int OriginPointWeaveEnd();

4.84. Fixed-Point Swing SDK Code Example

 1void TestOriginPointWeave()
 2{
 3    // Create joint position object
 4    JointPos j = new JointPos(39.886, -98.580, -124.032, -47.393, 90.000, 40.842);
 5    ExaxisPos epos = new ExaxisPos(0, 0, 0, 0);
 6    DescPose offset_pos = new DescPose(0, 0, 0, 0, 0, 0);
 7
 8    // Reference point coordinates
 9    DescPose refPoint = new DescPose(400.021, 300.022, 299.996, 179.997, -0.003, -90.956);
10
11    //// First motion
12    robot.MoveJ(j, 1, 0, 100, 100, 100, epos, -1, 0, offset_pos);
13
14    // Start fixed-point swing (mode 0)
15    robot.OriginPointWeaveStart(0, 0, refPoint, 3);
16    robot.MoveStationary();   // Execute stationary motion (assuming this method exists)
17    robot.OriginPointWeaveEnd();
18
19    Thread.Sleep(2000);         // Wait 2 seconds
20
21    // Second motion
22    robot.MoveJ(j, 1, 0, 100, 100, 100, epos, -1, 0, offset_pos);
23
24    // Start fixed-point swing (mode 1)
25    robot.OriginPointWeaveStart(0, 1, refPoint, 3);
26    robot.MoveStationary();
27    robot.OriginPointWeaveEnd();
28
29}

4.85. Fixed-Point Swing (Including Laser and Extension Axis) SDK Code Example

 1void TestOriginPointWeave2()
 2{
 3    // Create joint position object
 4    JointPos j = new JointPos(39.886, -98.580, -124.032, -47.393, 90.000, 40.842);
 5    ExaxisPos epos1 = new ExaxisPos(0, 0, 0, 0);
 6    DescPose offset_pos = new DescPose(0, 0, 0, 0, 0, 0);
 7    ExaxisPos epos2 = new ExaxisPos(5, 0.000, 0.000, 0.000);
 8
 9    // Reference point coordinates
10    DescPose refPoint = new DescPose(400.021, 300.022, 299.996, 179.997, -0.003, -90.956);
11
12    int rtn = 0;
13    robot.LaserTrackingSensorConfig("192.168.58.20", 5020);
14    robot.LaserTrackingSensorSamplePeriod(20);
15    robot.LoadPosSensorDriver(101);
16
17    // Load UDP driver
18    robot.ExtDevLoadUDPDriver();
19
20    // Set extension axis command completion time
21    rtn = robot.SetExAxisCmdDoneTime(5000.0);
22    Console.WriteLine("SetExAxisCmdDoneTime rtn is " + rtn);
23
24    // Enable extension axes 1 and 2
25    rtn = robot.ExtAxisServoOn(1, 1);
26    Console.WriteLine("ExtAxisServoOn axis id 1 rtn is " + rtn);
27    rtn = robot.ExtAxisServoOn(2, 1);
28    Console.WriteLine("ExtAxisServoOn axis id 2 rtn is " + rtn);
29    Thread.Sleep(2000);
30
31    // Set extension axis homing
32    robot.ExtAxisSetHoming(1, 0, 10, 2);
33    robot.LaserTrackingLaserOnOff(1);
34
35
36    //// 1---Without extension axis
37    robot.LaserTrackingTrackOnOff(1, 4);
38    robot.Sleep(200);
39    // Start fixed-point swing
40    robot.OriginPointWeaveStart(0, 0, refPoint, 10);
41    robot.MoveStationary();   // Execute stationary motion
42    robot.OriginPointWeaveEnd();
43    robot.LaserTrackingTrackOnOff(0, 4);
44
45    Thread.Sleep(2000);         // Wait 2 seconds
46
47    //// 2---With extension axis
48    robot.ExtAxisMove(epos1, 100, -1);
49    robot.LaserTrackingTrackOnOff(1, 4);
50    // Start fixed-point swing
51    robot.OriginPointWeaveStart(0, 0, refPoint, 20);
52    robot.ExtAxisMove(epos2, 100, -1);
53    robot.OriginPointWeaveEnd();
54    robot.LaserTrackingTrackOnOff(0, 4);
55}

4.86. Joint Space Velocity Servo Mode Motion

 1/**
 2* @brief  Joint space velocity servo mode motion
 3* @param  [in] joint_pos  6 target joint velocities, unit deg/s
 4* @param  [in] axisPos  4 external axis velocities, unit deg/s
 5* @param  [in] acc  Acceleration percentage, range [0~100], temporarily not open, default is 0
 6* @param  [in] vel  Velocity percentage, range [0~100], temporarily not open, default is 0
 7* @param  [in] cmdT  Command sending period, unit s, recommended range [0.001~0.0016]
 8* @param  [in] filterT Filter time, unit s, temporarily not open, default is 0
 9* @param  [in] gain  Proportional amplifier for target position, temporarily not open, default is 0
10* @param  [in] id ServoJ command ID, default is 0
11* @param[in] comType Command sending type; 0-xmlrpc; 1-UDP (corresponding to robot port 20007)
12* @return  Error code
13*/
14public int ServoJV(double[] joint_vel, double[] exis_vel, float acc, float vel, float cmdT, float filterT, float gain, int id = 0, int comType = 0)

4.87. Joint Space Velocity Servo Mode Motion Code Example

 1public int ServoJVtest()
 2{
 3    double[] joint_vel = new double[6] { 10, 0, 0, 0, 0, 0 };
 4    double[] exis_vel = new double[4] { 0, 0, 0, 0 };
 5    float acc = 0.0f;
 6    float vel = 0.0f;
 7    float cmdT = 0.01f;
 8    float filterT = 0.0f;
 9    float gain = 0.0f;
10    int cnt = 0;
11    while (cnt < 200)
12    {
13        int error = robot.ServoJV(joint_vel, exis_vel, acc, vel, cmdT, filterT, gain);
14        Console.WriteLine($"ServoJV rtn is {error}");
15        cnt++;
16    }
17    return 0;
18}

4.88. Joint MIT Control Start

1/**
2* @brief Joint MIT control start
3* @param [in] comType Command sending type; 0-xmlrpc; 1-UDP (corresponding to robot port 20007)
4* @return Error code
5*/
6public int ServoMITStart(int comType = 0)

4.89. Joint MIT Control End

1/**
2* @brief Joint MIT control end
3* @param [in] comType Command sending type; 0-xmlrpc; 1-UDP (corresponding to robot port 20007)
4* @return Error code
5*/
6public int ServoMITEnd(int comType = 0)

4.90. Joint MIT Control

 1/**
 2* @brief Joint MIT control
 3* @param [in] posGain j1~j6 joint position gain
 4* @param [in] desPos j1~j6 joint desired position, unit: deg
 5* @param [in] velGain j1~j6 joint velocity gain
 6* @param [in] desVel j1~j6 joint desired velocity, unit: deg/s
 7* @param [in] torque_ff j1~j6 feedforward torque, unit: Nm
 8* @param [in] interval Command period, unit s, range [0.001~0.008]
 9* @param [in] comType Command sending type; 0-xmlrpc; 1-UDP (corresponding to robot port 20007)
10* @return Error code
11*/
12public int ServoMIT(double[] posGain, double[] desPos, double[] velGain, double[] desVel, double[] torque_ff, double interval, int comType = 0)

4.91. Joint MIT Control Motion Code Example

 1public int ServoMITtest()
 2{
 3    // Subscribe to callback
 4    robot.OnUdpFrameReceived += (comType, frameCount, frameCmdID, contentLen, content) =>
 5    {
 6        Console.WriteLine($"[UDP Response] comType={comType}, count={frameCount}, cmdID={frameCmdID}, content={content}");
 7    };
 8    while (true)
 9    {
10        robot.ResetAllError();
11        Thread.Sleep(500);
12
13        double[] posGain = new double[6] { 0, 0, 0, 0, 0, 0 };
14        double[] desPos = new double[6] { 0, 0, 0, 0, 0, 0 };
15        double[] velGain = new double[6] { 0, 0, 0, 0, 0, 0 };
16        double[] desVel = new double[6] { 0, 0, 0, 0, 0, 0 };
17        double[] torques = new double[6] { 0, 0, 0, 0, 0, 0 };
18        robot.GetJointTorques(1, torques);
19        Console.WriteLine($"111111");
20        //robot.ServoMITEnd(0);
21        robot.ServoMITStart(0);
22        Console.WriteLine($"ServoMITStart");
23        ROBOT_STATE_PKG pkg = new ROBOT_STATE_PKG();
24        robot.DragTeachSwitch(1);
25        Console.WriteLine($"DragTeachSwitch");
26        double intev = 0.008;
27        double[] jPowerLimit = new double[6] { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
28        double[] jVelLimit = new double[6] { 50, 50, 50, 50, 50, 50 };
29        int error = 0;
30        while (true)
31        {
32
33            torques[5] = 0.03;
34            Console.WriteLine($"ServoMIT call ");
35            error = robot.ServoMIT(posGain, desPos, velGain, desVel, torques, intev, 0);
36
37            Console.WriteLine($"ServoMIT111111 rtn is {error}");
38            Thread.Sleep(1);
39
40            robot.GetRobotRealTimeState(ref pkg);
41            //Console.WriteLine($"maincode {pkg.main_code}, subcode {pkg.sub_code}");
42            Console.WriteLine($"pkg.jt_cur_pos[5]:{pkg.jt_cur_pos[5]}");
43            if (pkg.jt_cur_pos[5] > 30)
44            {
45                break;
46            }
47        }
48
49        while (true)
50        {
51
52            torques[5] = -0.03;
53            error = robot.ServoMIT(posGain, desPos, velGain, desVel, torques, intev, 0);
54
55            Console.WriteLine($"ServoJT222222 rtn is {error}");
56            Thread.Sleep(1);
57
58            robot.GetRobotRealTimeState(ref pkg);
59            //Console.WriteLine($"maincode {pkg.main_code}, subcode {pkg.sub_code}");
60            Console.WriteLine($"pkg.jt_cur_pos[5]:{pkg.jt_cur_pos[5]}");
61            if (pkg.jt_cur_pos[5] < 0)
62            {
63                break;
64            }
65        }
66
67        robot.DragTeachSwitch(0);
68        error = robot.ServoMITEnd(0);
69    }
70    return 0;
71}