4. Robot Motion
4.1. JOG Motion
1/**
2* @brief JOG motion
3* @param [in] ref 0-Joint JOG, 2-Base coordinate JOG, 4-Tool coordinate JOG, 8-Workpiece coordinate JOG
4* @param [in] nb 1-Joint1 (or x-axis), 2-Joint2 (or y-axis), 3-Joint3 (or z-axis), 4-Joint4 (or rotation about x-axis), 5-Joint5 (or rotation about y-axis), 6-Joint6 (or rotation about z-axis)
5* @param [in] dir 0-Negative direction, 1-Positive direction
6* @param [in] vel Speed percentage [0~100]
7* @param [in] acc Acceleration percentage [0~100]
8* @param [in] max_dis Maximum single JOG angle in [°] or distance in [mm]
9* @return Error code
10*/
11errno_t StartJOG(uint8_t ref, uint8_t nb, uint8_t dir, float vel, float acc, float max_dis);
4.2. JOG Deceleration Stop
1/**
2* @brief JOG deceleration stop
3* @param [in] ref 1-Joint JOG stop, 3-Base coordinate JOG stop, 5-Tool coordinate JOG stop, 9-Workpiece coordinate JOG stop
4* @return Error code
5*/
6errno_t StopJOG(uint8_t ref);
4.3. JOG Immediate Stop
1/**
2* @brief JOG immediate stop
3* @return Error code
4*/
5errno_t ImmStopJOG();
4.4. Robot JOG Control Example
1int TestJOG(void)
2{
3 ROBOT_STATE_PKG pkg = {};
4 FRRobot robot;
5 robot.LoggerInit();
6 robot.SetLoggerLevel(1);
7 int rtn = robot.RPC("192.168.58.2");
8 if (rtn != 0)
9 {
10 return -1;
11 }
12 robot.SetReConnectParam(true, 30000, 500);
13 for (int i = 0; i < 6; i++)
14 {
15 robot.StartJOG(0, i + 1, 0, 20.0, 20.0, 30.0);
16 robot.Sleep(1000);
17 robot.ImmStopJOG();
18 robot.Sleep(1000);
19 }
20 for (int i = 0; i < 6; i++)
21 {
22 robot.StartJOG(2, i + 1, 0, 20.0, 20.0, 30.0);
23 robot.Sleep(1000);
24 robot.ImmStopJOG();
25 robot.Sleep(1000);
26 }
27 for (int i = 0; i < 6; i++)
28 {
29 robot.StartJOG(4, i + 1, 0, 20.0, 20.0, 30.0);
30 robot.Sleep(1000);
31 robot.StopJOG(5);
32 robot.Sleep(1000);
33 }
34 for (int i = 0; i < 6; i++)
35 {
36 robot.StartJOG(8, i + 1, 0, 20.0, 20.0, 30.0);
37 robot.Sleep(1000);
38 robot.StopJOG(9);
39 robot.Sleep(1000);
40 }
41 robot.CloseRPC();
42 return 0;
43}
4.5. Joint Space Motion
1/**
2* @brief Joint space motion
3* @param [in] joint_pos Target joint position in deg
4* @param [in] desc_pos Target Cartesian pose
5* @param [in] tool Tool coordinate number [0~14]
6* @param [in] user Workpiece coordinate number [0~14]
7* @param [in] vel Speed percentage [0~100]
8* @param [in] acc Acceleration percentage [0~100] (not yet available)
9* @param [in] ovl Speed scaling factor [0~100]
10* @param [in] epos Extended axis position in mm
11* @param [in] blendT [-1.0]-Move to position (blocking), [0~500.0]-Smoothing time (non-blocking) in ms
12* @param [in] offset_flag 0-No offset, 1-Offset in base/workpiece coordinate, 2-Offset in tool coordinate
13* @param [in] offset_pos Pose offset
14* @return Error code
15*/
16errno_t MoveJ(JointPos *joint_pos, DescPose *desc_pos, int tool, int user, float vel, float acc, float ovl, ExaxisPos *epos, float blendT, uint8_t offset_flag, DescPose *offset_pos);
4.6. Joint Space Motion (Automatic Forward Kinematics Calculation)
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], temporarily not available
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 coordinate system/workpiece coordinate system, 2-Offset in tool coordinate system
12* @param [in] offset_pos Pose offset value
13* @return Error code
14*/
15errno_t MoveJ(JointPos* joint_pos, int tool, int user, float vel, float acc, float ovl, ExaxisPos* epos, float blendT, uint8_t offset_flag, DescPose* offset_pos);
4.7. Cartesian Space Linear Motion
1/**
2* @brief Cartesian Space Linear Motion
3* @param [in] joint_pos Target joint positions, unit: deg
4* @param [in] desc_pos Target Cartesian pose
5* @param [in] tool Tool coordinate system index, range [0~14]
6* @param [in] user Workpiece/user coordinate system index, range [0~14]
7* @param [in] vel Velocity percentage, range [0~100]
8* @param [in] acc Acceleration percentage, range [0~100] (currently unavailable)
9* @param [in] ovl Velocity scaling factor [0~100] / physical velocity (mm/s)
10* @param [in] blendR [-1.0]-block until motion completes (blocking), [0~1000.0]-blend radius (non-blocking), unit: mm
11* @param [in] blendMode Transition method; 0-tangent blend; 1-corner blend
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 value
16* @param [in] oacc Acceleration scaling factor [0-100] / physical acceleration (mm/s²)
17* @param [in] velAccParamMode Velocity/acceleration parameter mode; 0-percentage; 1-physical velocity (mm/s) and acceleration (mm/s²)
18* @param [in] overSpeedStrategy Overspeed handling strategy; 1-standard; 2-stop with error on overspeed; 3-adaptive speed reduction, default 0
19* @param [in] speedPercent Allowable speed reduction threshold percentage [0-100], default 10%
20* @return Error code
21*/
22errno_t MoveL(JointPos *joint_pos, DescPose *desc_pos, int tool, int user, float vel, float acc, float ovl, float blendR, int blendMode, ExaxisPos *epos, uint8_t search, uint8_t offset_flag, DescPose *offset_pos, float oacc = 100.0, int velAccParamMode = 0, int overSpeedStrategy = 0, int speedPercent = 10);
4.8. Cartesian Space Linear Motion (Automatic Inverse Kinematics Calculation)
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 [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], temporarily not available
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 method; 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 coordinate system/workpiece coordinate system, 2-Offset in tool coordinate system
14* @param [in] offset_pos Pose offset value
15* @param [in] config Inverse kinematics joint space configuration, [-1]-Calculate based on current joint position, [0~7]-Solve based on specific joint space configuration
16* @param [in] overSpeedStrategy Overspeed handling strategy, 1-Standard; 2-Error stop when overspeed; 3-Adaptive speed reduction, default is 0
17* @param [in] speedPercent Allowable speed reduction threshold percentage [0-100], default 10%
18* @return Error code
19*/
20errno_t MoveL(DescPose* desc_pos, int tool, int user, float vel, float acc, float ovl, float blendR, int blendMode, ExaxisPos* epos, uint8_t search, uint8_t offset_flag, DescPose* offset_pos, int config = -1, int overSpeedStrategy = 0, int speedPercent = 10);
4.9. Cartesian Space Circular Motion
1/**
2* @brief Cartesian Space Circular Motion
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 [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], temporarily not available
9* @param [in] epos_p Extended axis position, unit: mm
10* @param [in] poffset_flag 0-No offset, 1-Offset in base coordinate system/workpiece coordinate system, 2-Offset in tool coordinate system
11* @param [in] offset_pos_p Pose offset value
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 [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], temporarily not available
18* @param [in] epos_t Extended axis position, unit: mm
19* @param [in] toffset_flag 0-No offset, 1-Offset in base coordinate system/workpiece coordinate system, 2-Offset in tool coordinate system
20* @param [in] offset_pos_t Pose offset value
21* @param [in] ovl Velocity scaling factor [0~100] / Physical velocity (mm/s)
22* @param [in] blendR [-1.0]-Block until motion completes (blocking), [0~1000.0]-Blend radius (non-blocking), unit: mm
23* @param [in] oacc Acceleration scaling factor [0-100] / Physical acceleration (mm/s²)
24* @param [in] velAccParamMode Velocity/acceleration parameter mode; 0-Percentage; 1-Physical velocity (mm/s) acceleration (mm/s²)
25* @return Error code
26*/
27errno_t MoveC(JointPos *joint_pos_p, DescPose *desc_pos_p, int ptool, int puser, float pvel, float pacc, ExaxisPos *epos_p, uint8_t 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, uint8_t toffset_flag, DescPose *offset_pos_t, float ovl, float blendR, float oacc = 100.0, int velAccParamMode = 0);
4.10. Cartesian Space Circular Motion (Automatic Inverse Kinematics Calculation)
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 [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], temporarily not available
8* @param [in] epos_p Extended axis position, unit: mm
9* @param [in] poffset_flag 0-No offset, 1-Offset in base coordinate system/workpiece coordinate system, 2-Offset in tool coordinate system
10* @param [in] offset_pos_p Pose offset value
11* @param [in] desc_pos_t Target point Cartesian pose
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], temporarily not available
16* @param [in] epos_t Extended axis position, unit: mm
17* @param [in] toffset_flag 0-No offset, 1-Offset in base coordinate system/workpiece coordinate system, 2-Offset in tool coordinate system
18* @param [in] offset_pos_t Pose offset value
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 based on specific joint space configuration
22* @return Error code
23*/
24errno_t MoveC(DescPose* desc_pos_p, int ptool, int puser, float pvel, float pacc, ExaxisPos* epos_p, uint8_t poffset_flag, DescPose* offset_pos_p, DescPose* desc_pos_t, int ttool, int tuser, float tvel, float tacc, ExaxisPos* epos_t, uint8_t toffset_flag, DescPose* offset_pos_t, float ovl, float blendR, int config = -1);
4.11. Cartesian Space Full Circle Motion
1/**
2 *@brief Cartesian Space Full Circle Motion
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], temporarily not available
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], temporarily not available
16 *@param [in] epos_t Extended axis position, unit: mm
17 *@param [in] ovl Velocity scaling factor [0~100] / Physical velocity (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 value
20 *@param [in] oacc Acceleration scaling factor [0-100] / Physical acceleration (mm/s²)
21 *@param [in] blendR -1: Blocking; 0~1000: Smoothing radius
22* @param [in] velAccParamMode Velocity/acceleration parameter mode; 0-Percentage; 1-Physical velocity (mm/s) acceleration (mm/s²)
23* @return Error code
24*/
25errno_t 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, uint8_t offset_flag, DescPose* offset_pos, double oacc = 100.0, double blendR = -1, int velAccParamMode = 0);
4.12. Cartesian Space Full Circle Motion (Automatic Inverse Kinematics Calculation)
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], temporarily not available
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], temporarily not available
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 coordinate system/workpiece coordinate system, 2-Offset in tool coordinate system
17* @param [in] offset_pos Pose offset value
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 based on specific joint space configuration
21* @return Error code
22*/
23errno_t Circle(DescPose* desc_pos_p, int ptool, int puser, float pvel, float pacc, ExaxisPos* epos_p, DescPose* desc_pos_t, int ttool, int tuser, float tvel, float tacc, ExaxisPos* epos_t, float ovl, uint8_t offset_flag, DescPose* offset_pos, double oacc = 100.0, double blendR = -1, int config = -1);
4.13. Cartesian Space Point-to-Point Motion
1/**
2* @brief Cartesian Space Point-to-Point Motion
3* @param [in] desc_pos Target Cartesian pose or pose increment
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], temporarily not available
8* @param [in] ovl Velocity scaling factor, range [0~100]
9* @param [in] blendT [-1.0]-Move to position (blocking), [0~500.0]-Smoothing time (non-blocking), unit: ms
10* @param [in] config Joint space configuration, [-1]-Calculate based on current joint position, [0~7]-Calculate based on specific joint space configuration, default is -1
11* @return Error code
12*/
13errno_t MoveCart(DescPose *desc_pos, int tool, int user, float vel, float acc, float ovl, float blendT, int config);
4.14. Robot Basic Motion Instruction Code Example
1int TestMove(void)
2{
3 ROBOT_STATE_PKG pkg = {};
4 FRRobot robot;
5
6 robot.LoggerInit();
7 robot.SetLoggerLevel(1);
8 int rtn = robot.RPC("192.168.58.2");
9 if (rtn != 0)
10 {
11 return -1;
12 }
13 robot.SetReConnectParam(true, 30000, 500);
14
15 JointPos j1(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
16 JointPos j2(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);
17 JointPos j3(-29.777, -84.536, 109.275, -114.075, -86.655, 74.257);
18 JointPos j4(-31.154, -95.317, 94.276, -88.079, -89.740, 74.256);
19 DescPose desc_pos1(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
20 DescPose desc_pos2(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
21 DescPose desc_pos3(-487.434, 154.362, 308.576, 176.600, 0.268, -14.061);
22 DescPose desc_pos4(-443.165, 147.881, 480.951, 179.511, -0.775, -15.409);
23 DescPose offset_pos(0, 0, 0, 0, 0, 0);
24 ExaxisPos epos(0, 0, 0, 0);
25 int tool = 0;
26 int user = 0;
27 float vel = 100.0;
28 float acc = 100.0;
29 float ovl = 100.0;
30 float oacc = 100.0;
31 float blendT = 0.0;
32 float blendR = 0.0;
33 uint8_t flag = 0;
34 uint8_t search = 0;
35 int blendMode = 0;
36 int velAccMode = 0;
37 robot.SetSpeed(20);
38 rtn = robot.MoveJ(&j1, &desc_pos1, tool, user, vel, acc, ovl, &epos, blendT, flag, &offset_pos);
39 printf("movej errcode:%d\n", rtn);
40 rtn = robot.MoveL(&j2, &desc_pos2, tool, user, vel, acc, ovl, blendR, blendMode, &epos, search, flag, &offset_pos, oacc, velAccMode);
41 printf("movel errcode:%d\n", rtn);
42 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);
43 printf("movec errcode:%d\n", rtn);
44 rtn = robot.MoveJ(&j2, &desc_pos2, tool, user, vel, acc, ovl, &epos, blendT, flag, &offset_pos);
45 printf("movej errcode:%d\n", rtn);
46 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);
47 printf("circle errcode:%d\n", rtn);
48 rtn = robot.MoveCart(&desc_pos4, tool, user, vel, acc, ovl, blendT, -1);
49 printf("MoveCart errcode:%d\n", rtn);
50 rtn = robot.MoveJ(&j1, tool, user, vel, acc, ovl, &epos, blendT, flag, &offset_pos);
51 printf("movej errcode:%d\n", rtn);
52 rtn = robot.MoveL(&desc_pos2, tool, user, vel, acc, ovl, blendR, blendMode, &epos, search, flag, &offset_pos, -1, velAccMode);
53 printf("movel errcode:%d\n", rtn);
54 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);
55 printf("movec errcode:%d\n", rtn);
56 rtn = robot.MoveJ(&j2, tool, user, vel, acc, ovl, &epos, blendT, flag, &offset_pos);
57 printf("movej errcode:%d\n", rtn);
58 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);
59 printf("circle errcode:%d\n", rtn);
60 robot.CloseRPC();
61 return 0;
62}
4.15. Cartesian Space Spiral Motion
1/**
2* @brief Cartesian Space Spiral 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 Velocity percentage, range [0~100]
8* @param [in] acc Acceleration percentage, range [0~100], temporarily not available
9* @param [in] epos Extended axis position, unit: mm
10* @param [in] ovl Velocity scaling factor, range [0~100]
11* @param [in] offset_flag 0-No offset, 1-Offset in base coordinate system/workpiece coordinate system, 2-Offset in tool coordinate system
12* @param [in] offset_pos Pose offset value
13* @param [in] spiral_param Spiral parameters
14* @return Error code
15*/
16errno_t NewSpiral(JointPos *joint_pos, DescPose *desc_pos, int tool, int user, float vel, float acc, ExaxisPos *epos, float ovl, uint8_t offset_flag, DescPose *offset_pos, SpiralParam spiral_param);
4.16. Cartesian Space Spiral Motion (Automatic Inverse Kinematics Calculation)
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], temporarily not available
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 coordinate system/workpiece coordinate system, 2-Offset in tool coordinate system
11* @param [in] offset_pos Pose offset value
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 based on specific joint space configuration
14* @return Error code
15*/
16errno_t NewSpiral(DescPose* desc_pos, int tool, int user, float vel, float acc, ExaxisPos* epos, float ovl, uint8_t offset_flag, DescPose* offset_pos, SpiralParam spiral_param, int config = -1);
4.17. Spiral Motion Code Example
1int TestSpiral(void)
2{
3 ROBOT_STATE_PKG pkg = {};
4 FRRobot robot;
5 robot.LoggerInit();
6 robot.SetLoggerLevel(1);
7 int rtn = robot.RPC("192.168.58.2");
8 if (rtn != 0)
9 {
10 return -1;
11 }
12 robot.SetReConnectParam(true, 30000, 500);
13 JointPos j(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
14 DescPose desc_pos(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
15 DescPose offset_pos1(50, 0, 0, -30, 0, 0);
16 DescPose offset_pos2(50, 0, 0, -5, 0, 0);
17 ExaxisPos epos(0, 0, 0, 0);
18 SpiralParam sp;
19 sp.circle_num = 5;
20 sp.circle_angle = 5.0;
21 sp.rad_init = 50.0;
22 sp.rad_add = 10.0;
23 sp.rotaxis_add = 10.0;
24 sp.rot_direction = 0;
25 int tool = 0;
26 int user = 0;
27 float vel = 100.0;
28 float acc = 100.0;
29 float ovl = 100.0;
30 float blendT = 0.0;
31 uint8_t flag = 2;
32 robot.SetSpeed(20);
33 rtn = robot.MoveJ(&j, tool, user, vel, acc, ovl, &epos, blendT, flag, &offset_pos1);
34 printf("movej errcode:%d\n", rtn);
35 rtn = robot.NewSpiral(&desc_pos, tool, user, vel, acc, &epos, ovl, flag, &offset_pos2, sp);
36 printf("newspiral errcode:%d\n", rtn);
37 robot.CloseRPC();
38 return 0;
39}
4.18. 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*/
6errno_t ServoMoveStart(int comType = 0);
4.19. 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*/
6errno_t ServoMoveEnd(int comType = 0);
4.20. Joint Space Servo Mode Motion
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*/
14errno_t ServoJ(JointPos *joint_pos, ExaxisPos* axisPos, float acc, float vel, float cmdT, float filterT, float gain, int id = 0, int comType = 0);
4.21. Joint Space Servo Mode Motion Example Program
1int TestServoJ(void)
2{
3 ROBOT_STATE_PKG pkg = {};
4 FRRobot robot;
5 robot.LoggerInit();
6 robot.SetLoggerLevel(1);
7 int rtn = robot.RPC("192.168.58.2");
8 if (rtn != 0)
9 {
10 return -1;
11 }
12 robot.SetReConnectParam(true, 30000, 500);
13 JointPos j(0, 0, 0, 0, 0, 0);
14 ExaxisPos epos(0, 0, 0, 0);
15 float vel = 0.0;
16 float acc = 0.0;
17 float cmdT = 0.008;
18 float filterT = 0.0;
19 float gain = 0.0;
20 uint8_t flag = 0;
21 int count = 500;
22 float dt = 0.1;
23 int cmdID = 0;
24 int ret = robot.GetActualJointPosDegree(flag, &j);
25 if (ret == 0)
26 {
27 robot.ServoMoveStart();
28 while (count)
29 {
30 robot.ServoJ(&j, &epos, acc, vel, cmdT, filterT, gain, cmdID);
31 j.jPos[0] += dt;
32 count -= 1;
33 robot.WaitMs(cmdT * 1000);
34 }
35 robot.ServoMoveEnd();
36 }
37 else
38 {
39 printf("GetActualJointPosDegree errcode:%d\n", ret);
40 }
41 robot.CloseRPC();
42 return 0;
43}
4.22. Code Example for Robot Joint Space Servo Mode Motion Based on UDP Communication
1void UDPFrameCallBack(int srcType, int count, int cmdID, int len, std::string content)
2{
3 cout << "recv cmd: cmdID: " << to_string(cmdID) << " content is " << content << " count is " << count << endl;;
4 return;
5}
6
7int TestServoJUDP(void)
8{
9 ROBOT_STATE_PKG pkg = {};
10 FRRobot robot;
11 int rtn = 0;
12 robot.LoggerInit();
13 robot.SetLoggerLevel(1);
14 rtn = robot.SetCmdRpyCallback(UDPFrameCallBack);
15 printf("SetCmdRpyCallback rtn is %d\n", rtn);
16 rtn = robot.RPC("192.168.58.2");
17 if (rtn != 0)
18 {
19 return -1;
20 }
21 robot.SetReConnectParam(true, 30000, 50);
22 JointPos j(0, -90, 90, 0, 0, 0);
23 ExaxisPos epos(0, 0, 0, 0);
24 DescPose offset_pos(0, 0, 0, 0, 0, 0);
25 while (true)
26 {
27 robot.MoveJ(&j, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
28 float vel = 0.0;
29 float acc = 0.0;
30 float cmdT = 0.016;
31 float filterT = 0.0;
32 float gain = 0.0;
33 uint8_t flag = 0;
34 float dt = 0.1;
35 int cmdID = 0;
36 int ret = robot.GetActualJointPosDegree(flag, &j);
37 if (ret != 0)
38 {
39 printf("GetActualJointPosDegree errcode:%d\n", ret);
40 }
41 int comType = 1;
42 int count = 300;
43 rtn = robot.ServoMoveStart(comType);
44 printf("ServoMoveStart rtn is %d\n", rtn);
45 while (count)
46 {
47 rtn = robot.ServoJ(&j, &epos, acc, vel, cmdT, filterT, gain, cmdID, comType);
48 printf("ServoJ rtn is %d\n", rtn);
49 j.jPos[0] += dt;
50 j.jPos[1] += dt;
51 j.jPos[2] += dt;
52 j.jPos[3] += dt;
53 j.jPos[4] += dt;
54 j.jPos[5] += dt;
55 epos.ePos[0] += dt;
56 count -= 1;
57 robot.Sleep(15);
58 }
59 robot.ServoMoveEnd(comType);
60 printf("ServoMoveEnd rtn is %d\n", rtn);
61 count = 300;
62 robot.ServoMoveStart(comType);
63 printf("ServoMoveStart rtn is %d\n", rtn);
64 while (count)
65 {
66 robot.ServoJ(&j, &epos, acc, vel, cmdT, filterT, gain, cmdID, comType);
67 printf("ServoJ rtn is %d\n", rtn);
68 j.jPos[0] -= dt;
69 j.jPos[1] -= dt;
70 j.jPos[2] -= dt;
71 j.jPos[3] -= dt;
72 j.jPos[4] -= dt;
73 j.jPos[5] -= dt;
74 epos.ePos[0] -= dt;
75 count -= 1;
76 robot.Sleep(15);
77 }
78 robot.ServoMoveEnd(comType);
79 printf("ServoMoveEnd rtn is %d\n", rtn);
80 }
81 robot.Sleep(4000);
82 robot.CloseRPC();
83 return 0;
84}
4.23. Joint Torque Control Start
New in version C++SDK-v2.1.5.0.
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*/
6errno_t ServoJTStart(int comType = 0);
4.24. Joint Torque Control
New in version C++SDK-v2.1.5.0.
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*/
11errno_t ServoJT(float torque[], double interval, int checkFlag, double jPowerLimit[6], double jVelLimit[6], int comType = 0);
4.25. Joint Torque Control End
New in version C++SDK-v2.1.5.0.
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*/
6errno_t ServoJTEnd(int comType = 0);
4.26. Joint Torque Control
New in version C++SDK-v2.1.5.0.
1/**
2* @brief Joint Torque Control 1
3* @param [in] torque Torque for joints j1~j6, unit: Nm
4* @param [in] interval Command cycle, unit: s, range: [0.001~0.008]
5* @param [in] checkFlag Detection strategy 0-No restrictions; 1-Power limit; 2-Velocity limit; 3-Both power and velocity limits
6* @param [in] jPowerLimit Maximum joint power limit (W)
7* @param [in] jVelLimit Maximum joint velocity (°/s)
8* @return Error code
9*/
10errno_t ServoJT(float torque[], double interval);
4.27. Joint Torque Control End
New in version C++SDK-v2.1.5.0.
1/**
2* @brief Joint torque control end
3* @return Error code
4*/
5errno_t ServoJTEnd();
4.28. Joint Torque Control Example
New in version C++SDK-v2.1.5.0.
1int TestServoJT(void)
2{
3 ROBOT_STATE_PKG pkg = {};
4 FRRobot robot;
5 robot.LoggerInit();
6 robot.SetLoggerLevel(1);
7 int rtn = robot.RPC("192.168.58.2");
8 if (rtn != 0)
9 {
10 return -1;
11 }
12 robot.SetReConnectParam(true, 30000, 500);
13 robot.DragTeachSwitch(1);
14 float torques[] = { 0, 0, 0, 0, 0, 0 };
15 robot.GetJointTorques(1, torques);
16 int count = 100;
17 robot.ServoJTStart();
18 int error = 0;
19 while (count > 0)
20 {
21 error = robot.ServoJT(torques, 0.001);
22 count = count - 1;
23 robot.Sleep(1);
24 }
25 error = robot.ServoJTEnd();
26 robot.DragTeachSwitch(0);
27 robot.CloseRPC();
28 return 0;
29}
4.29. Joint Torque Control Code Example with Overspeed Protection
1int ServoJTWithSafety(FRRobot* robot)
2{
3 robot->ResetAllError();
4 robot->Sleep(500);
5 float torques[] = { 0, 0, 0, 0, 0, 0 };
6 robot->GetJointTorques(1, torques);
7 robot->ServoJTStart();
8 ROBOT_STATE_PKG pkg = {};
9 robot->DragTeachSwitch(1);
10 int checkFlag = 3;
11 //double jPowerLimit[6] = {1, 1, 1, 1, 1, 1};
12 double jPowerLimit[6] = { 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 };
13 double jVelLimit[6] = { 181, 80, 80, 80, 80, 80 };
14 int count = 800000;
15 int error = 0;
16 while (count > 0)
17 {
18 torques[2] = torques[2] + 0.01;
19 error = robot->ServoJT(torques, 0.008, checkFlag, jPowerLimit, jVelLimit);
20 if (error != 0)
21 {
22 robot->ServoJTEnd();
23 }
24 printf("ServoJT rtn is %d\n", error);
25 count = count - 1;
26 robot->Sleep(1);
27 robot->GetRobotRealTimeState(&pkg);
28 printf("maincode %d, subcode %d\n", pkg.main_code, pkg.sub_code);
29 }
30 robot->DragTeachSwitch(0);
31 error = robot->ServoJTEnd();
32 return 0;
33}
4.30. 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*/
14errno_t ServoCart(int mode, DescPose *desc_pose, ExaxisPos exaxis, float pos_gain[6], float acc, float vel, float cmdT, float filterT, float gain);
4.31. Cartesian Space Servo Mode Motion Code Example
1int TestServoCart(void)
2{
3 ROBOT_STATE_PKG pkg = {};
4 FRRobot robot;
5 robot.LoggerInit();
6 robot.SetLoggerLevel(1);
7 int rtn = robot.RPC("192.168.58.2");
8 if (rtn != 0)
9 {
10 return -1;
11 }
12 robot.SetReConnectParam(true, 30000, 500);
13 DescPose desc_pos_dt = { 83.00800, 50.525000 , 29.246 , 179.629 , -7.138 , -166.975 };
14 ExaxisPos exaxis = { 100.0, 0.0, 0.0, 0.0 };
15 float pos_gain[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
16 int mode = 0;
17 float vel = 0.0;
18 float acc = 0.0;
19 float cmdT = 0.001;
20 float filterT = 0.0;
21 float gain = 0.0;
22 uint8_t flag = 0;
23 int count = 5000;
24 robot.SetSpeed(20);
25 while (count)
26 {
27 rtn = robot.ServoCart(mode, &desc_pos_dt, exaxis, pos_gain, acc, vel, cmdT, filterT, gain);
28 printf("ServoCart rtn is %d\n", rtn);
29 count -= 1;
30 desc_pos_dt.tran.x += 0.01;
31 exaxis.ePos[0] += 0.01;
32 }
33 robot.CloseRPC();
34 return 0;
35}
4.32. Spline Motion Start
1/**
2* @brief Spline motion start
3* @return Error code
4*/
5errno_t SplineStart();
4.33. Joint Space Spline Motion (Auto Forward Kinematics Calculation)
1/**
2* @brief Joint space spline motion (auto forward kinematics calculation)
3* @param [in] joint_pos Target joint position, unit: deg
4* @param [in] tool Tool coordinate system number, range [0~14]
5* @param [in] user User coordinate system number, range [0~14]
6* @param [in] vel Velocity percentage, range [0~100]
7* @param [in] acc Acceleration percentage, range [0~100], currently not open
8* @param [in] ovl Velocity scaling factor, range [0~100]
9* @return Error code
10*/
11errno_t SplinePTP(JointPos* joint_pos, int tool, int user, float vel, float acc, float ovl);
4.34. Spline PTP Motion
1/**
2* @brief Joint space spline motion
3* @param [in] joint_pos Target joint position in deg
4* @param [in] desc_pos Target Cartesian pose
5* @param [in] tool Tool coordinate number [0~14]
6* @param [in] user Workpiece coordinate number [0~14]
7* @param [in] vel Speed percentage [0~100]
8* @param [in] acc Acceleration percentage [0~100] (not yet available)
9* @param [in] ovl Speed scaling factor [0~100]
10* @return Error code
11*/
12errno_t SplinePTP(JointPos *joint_pos, DescPose *desc_pos, int tool, int user, float vel, float acc, float ovl);
4.35. Spline Motion End
1/**
2* @brief Spline motion end
3* @return Error code
4*/
5errno_t SplineEnd();
4.36. Spline Motion Example
1int TestSpline(void)
2{
3 ROBOT_STATE_PKG pkg = {};
4 FRRobot robot;
5 robot.LoggerInit();
6 robot.SetLoggerLevel(1);
7 int rtn = robot.RPC("192.168.58.2");
8 if (rtn != 0)
9 {
10 return -1;
11 }
12 robot.SetReConnectParam(true, 30000, 500);
13 JointPos j1(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
14 JointPos j2(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);
15 JointPos j3(-61.954, -84.409, 108.153, -116.316, -91.283, 74.260);
16 JointPos j4(-89.575, -80.276, 102.713, -116.302, -91.284, 74.267);
17 DescPose desc_pos1(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
18 DescPose desc_pos2(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
19 DescPose desc_pos3(-327.622, 402.230, 320.402, -178.067, 2.127, -46.207);
20 DescPose desc_pos4(-104.066, 544.321, 327.023, -177.715, 3.371, -73.818);
21 DescPose offset_pos(0, 0, 0, 0, 0, 0);
22 ExaxisPos epos(0, 0, 0, 0);
23 int tool = 0;
24 int user = 0;
25 float vel = 100.0;
26 float acc = 100.0;
27 float ovl = 100.0;
28 float blendT = -1.0;
29 uint8_t flag = 0;
30 robot.SetSpeed(20);
31 int err1 = robot.MoveJ(&j1, &desc_pos1, tool, user, vel, acc, ovl, &epos, blendT, flag, &offset_pos);
32 printf("movej errcode:%d\n", err1);
33 robot.SplineStart();
34 robot.SplinePTP(&j1, &desc_pos1, tool, user, vel, acc, ovl);
35 robot.SplinePTP(&j2, &desc_pos2, tool, user, vel, acc, ovl);
36 robot.SplinePTP(&j3, &desc_pos3, tool, user, vel, acc, ovl);
37 robot.SplinePTP(&j4, &desc_pos4, tool, user, vel, acc, ovl);
38 robot.SplineEnd();
39 err1 = robot.MoveJ(&j1, tool, user, vel, acc, ovl, &epos, blendT, flag, &offset_pos);
40 printf("movej errcode:%d\n", err1);
41 robot.SplineStart();
42 robot.SplinePTP(&j1, tool, user, vel, acc, ovl);
43 robot.SplinePTP(&j2, tool, user, vel, acc, ovl);
44 robot.SplinePTP(&j3, tool, user, vel, acc, ovl);
45 robot.SplinePTP(&j4, tool, user, vel, acc, ovl);
46 robot.SplineEnd();
47 robot.CloseRPC();
48 return 0;
49}
4.37. New Spline Motion Start
Changed in version C++SDK-v2.1.3.0.
1/**
2* @brief New spline motion start
3* @param [in] type 0-Circular transition, 1-Given points as path points
4* @param [in] averageTime Global average transition time in ms (10 ~ ), default 2000
5* @return Error code
6*/
7errno_t NewSplineStart(int type, int averageTime=2000);
4.38. New Spline Command Point
1/**
2* @brief New spline command point
3* @param [in] joint_pos Target joint position in deg
4* @param [in] desc_pos Target Cartesian pose
5* @param [in] tool Tool coordinate number [0~14]
6* @param [in] user Workpiece coordinate number [0~14]
7* @param [in] vel Speed percentage [0~100]
8* @param [in] acc Acceleration percentage [0~100] (not yet available)
9* @param [in] ovl Speed scaling factor [0~100]
10* @param [in] blendR [-1.0]-Move to position (blocking), [0~1000.0]-Smoothing radius (non-blocking) in mm
11* @param [in] lastFlag Whether it's the last point, 0-No, 1-Yes
12* @return Error code
13*/
14errno_t NewSplinePoint(JointPos *joint_pos, DescPose *desc_pos, int tool, int user, float vel, float acc, float ovl, float blendR, int lastFlag);
4.39. New Spline Command Point (Auto Inverse Kinematics Calculation)
1/**
2* @brief New spline command point (auto inverse kinematics calculation)
3* @param [in] desc_pos Target Cartesian pose
4* @param [in] tool Tool coordinate system number, range [0~14]
5* @param [in] user User coordinate system number, range [0~14]
6* @param [in] vel Velocity percentage, range [0~100]
7* @param [in] acc Acceleration percentage, range [0~100], currently not open
8* @param [in] ovl Velocity scaling factor, range [0~100]
9* @param [in] blendR [-1.0]-Move to position (blocking), [0~1000.0]-Blending 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*/
14errno_t NewSplinePoint(DescPose* desc_pos, int tool, int user, float vel, float acc, float ovl, float blendR, int lastFlag, int config = -1);
4.40. New Spline Motion End
1/**
2* @brief New spline motion end
3* @return Error code
4*/
5errno_t NewSplineEnd();
4.41. New Spline Motion Example
1int TestNewSpline(void)
2{
3 ROBOT_STATE_PKG pkg = {};
4 FRRobot robot;
5 robot.LoggerInit();
6 robot.SetLoggerLevel(1);
7 int rtn = robot.RPC("192.168.58.2");
8 if (rtn != 0)
9 {
10 return -1;
11 }
12 robot.SetReConnectParam(true, 30000, 500);
13 JointPos j1(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
14 JointPos j2(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);
15 JointPos j3(-61.954, -84.409, 108.153, -116.316, -91.283, 74.260);
16 JointPos j4(-89.575, -80.276, 102.713, -116.302, -91.284, 74.267);
17 JointPos j5(-95.228, -54.621, 73.691, -112.245, -91.280, 74.268);
18 DescPose desc_pos1(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
19 DescPose desc_pos2(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
20 DescPose desc_pos3(-327.622, 402.230, 320.402, -178.067, 2.127, -46.207);
21 DescPose desc_pos4(-104.066, 544.321, 327.023, -177.715, 3.371, -73.818);
22 DescPose desc_pos5(-33.421, 732.572, 275.103, -177.907, 2.709, -79.482);
23 DescPose offset_pos(0, 0, 0, 0, 0, 0);
24 ExaxisPos epos(0, 0, 0, 0);
25 int tool = 0;
26 int user = 0;
27 float vel = 100.0;
28 float acc = 100.0;
29 float ovl = 100.0;
30 float blendT = -1.0;
31 uint8_t flag = 0;
32 robot.SetSpeed(20);
33 int err1 = robot.MoveJ(&j1, &desc_pos1, tool, user, vel, acc, ovl, &epos, blendT, flag, &offset_pos);
34 printf("movej errcode:%d\n", err1);
35 robot.NewSplineStart(1, 2000);
36 robot.NewSplinePoint(&j1, &desc_pos1, tool, user, vel, acc, ovl, -1, 0);
37 robot.NewSplinePoint(&j2, &desc_pos2, tool, user, vel, acc, ovl, -1, 0);
38 robot.NewSplinePoint(&j3, &desc_pos3, tool, user, vel, acc, ovl, -1, 0);
39 robot.NewSplinePoint(&j4, &desc_pos4, tool, user, vel, acc, ovl, -1, 0);
40 robot.NewSplinePoint(&j5, &desc_pos5, tool, user, vel, acc, ovl, -1, 0);
41 robot.NewSplineEnd();
42 err1 = robot.MoveJ(&j1, tool, user, vel, acc, ovl, &epos, blendT, flag, &offset_pos);
43 printf("movej errcode:%d\n", err1);
44 robot.NewSplineStart(1, 2000);
45 robot.NewSplinePoint(&desc_pos1, tool, user, vel, acc, ovl, -1, 0);
46 robot.NewSplinePoint(&desc_pos2, tool, user, vel, acc, ovl, -1, 0);
47 robot.NewSplinePoint(&desc_pos3, tool, user, vel, acc, ovl, -1, 0);
48 robot.NewSplinePoint(&desc_pos4, tool, user, vel, acc, ovl, -1, 0);
49 robot.NewSplinePoint(&desc_pos5, tool, user, vel, acc, ovl, -1, 0);
50 robot.NewSplineEnd();
51 robot.CloseRPC();
52 return 0;
53}
4.42. Stop Motion
1/**
2* @brief Stop motion
3* @return Error code
4*/
5errno_t StopMotion();
4.43. Pause Motion
1/**
2* @brief Pause motion
3* @return Error code
4*/
5errno_t PauseMotion();
4.44. Resume Motion
1/**
2* @brief Resume motion
3* @return Error code
4*/
5errno_t ResumeMotion();
4.45. Motion Pause, Resume, Stop Example
1int TestPause(void)
2{
3 ROBOT_STATE_PKG pkg = {};
4 FRRobot robot;
5 robot.LoggerInit();
6 robot.SetLoggerLevel(1);
7 int rtn = robot.RPC("192.168.58.2");
8 if (rtn != 0)
9 {
10 return -1;
11 }
12 robot.SetReConnectParam(true, 30000, 500);
13 JointPos j1(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
14 JointPos j5(-95.228, -54.621, 73.691, -112.245, -91.280, 74.268);
15 DescPose desc_pos1(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
16 DescPose desc_pos5(-33.421, 732.572, 275.103, -177.907, 2.709, -79.482);
17 DescPose offset_pos(0, 0, 0, 0, 0, 0);
18 ExaxisPos epos(0, 0, 0, 0);
19 int tool = 0;
20 int user = 0;
21 float vel = 100.0;
22 float acc = 100.0;
23 float ovl = 100.0;
24 float blendT = -1.0;
25 uint8_t flag = 0;
26 robot.SetSpeed(20);
27 rtn = robot.MoveJ(&j1, &desc_pos1, tool, user, vel, acc, ovl, &epos, blendT, flag, &offset_pos);
28 rtn = robot.MoveJ(&j5, &desc_pos5, tool, user, vel, acc, ovl, &epos, 1, flag, &offset_pos);
29 robot.Sleep(1000);
30 robot.PauseMotion();
31 robot.Sleep(1000);
32 robot.ResumeMotion();
33 robot.Sleep(1000);
34 robot.StopMotion();
35 robot.Sleep(1000);
36 robot.CloseRPC();
37 return 0;
38}
4.46. Point Global Offset Start
1/**
2* @brief Point global offset start
3* @param [in] flag 0-Offset in base/workpiece coordinate, 2-Offset in tool coordinate
4* @param [in] offset_pos Pose offset
5* @return Error code
6*/
7errno_t PointsOffsetEnable(int flag, DescPose *offset_pos);
4.47. Point Global Offset End
1/**
2* @brief Point global offset end
3* @return Error code
4*/
5errno_t PointsOffsetDisable();
4.48. Point Offset Example
1int TestOffset(void)
2{
3 ROBOT_STATE_PKG pkg = {};
4 FRRobot robot;
5 robot.LoggerInit();
6 robot.SetLoggerLevel(1);
7 int rtn = robot.RPC("192.168.58.2");
8 if (rtn != 0)
9 {
10 return -1;
11 }
12 robot.SetReConnectParam(true, 30000, 500);
13 JointPos j1(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
14 JointPos j2(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);
15 DescPose desc_pos1(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
16 DescPose desc_pos2(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
17 DescPose offset_pos(0, 0, 0, 0, 0, 0);
18 DescPose offset_pos1(0, 0, 50, 0, 0, 0);
19 ExaxisPos epos(0, 0, 0, 0);
20 int tool = 0;
21 int user = 0;
22 float vel = 100.0;
23 float acc = 100.0;
24 float ovl = 100.0;
25 float blendT = -1.0;
26 uint8_t flag = 0;
27 robot.SetSpeed(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.Sleep(1000);
31 robot.PointsOffsetEnable(0, &offset_pos1);
32 robot.MoveJ(&j1, &desc_pos1, tool, user, vel, acc, ovl, &epos, blendT, flag, &offset_pos);
33 robot.MoveJ(&j2, &desc_pos2, tool, user, vel, acc, ovl, &epos, blendT, flag, &offset_pos);
34 robot.PointsOffsetDisable();
35 robot.CloseRPC();
36 return 0;
37}
4.49. Control Box AO Flying Start
New in version C++SDK-v2.1.4.0.
1/**
2* @brief Control box AO flying start
3* @param [in] AONum Control box AO number
4* @param [in] maxTCPSpeed Maximum TCP speed value [1-5000mm/s], default 1000
5* @param [in] maxAOPercent AO percentage corresponding to maximum TCP speed, default 100%
6* @param [in] zeroZoneCmp Dead zone compensation value AO percentage, integer, default 20%, range [0-100]
7* @return Error code
8*/
9errno_t MoveAOStart(int AONum, int maxTCPSpeed, int maxAOPercent, int zeroZoneCmp);
4.50. Control Box AO Flying Stop
New in version C++SDK-v2.1.4.0.
1/**
2* @brief Control box AO flying stop
3* @return Error code
4*/
5errno_t MoveAOStop();
4.51. End AO Flying Start
New in version C++SDK-v2.1.4.0.
1/**
2* @brief End AO flying start
3* @param [in] AONum End AO number
4* @param [in] maxTCPSpeed Maximum TCP speed value [1-5000mm/s], default 1000
5* @param [in] maxAOPercent AO percentage corresponding to maximum TCP speed, default 100%
6* @param [in] zeroZoneCmp Dead zone compensation value AO percentage, integer, default 20%, range [0-100]
7* @return Error code
8*/
9errno_t MoveToolAOStart(int AONum, int maxTCPSpeed, int maxAOPercent, int zeroZoneCmp);
4.52. End AO Flying Stop
New in version C++SDK-v2.1.4.0.
1/**
2* @brief End AO flying stop
3* @return Error code
4*/
5errno_t MoveToolAOStop();
4.53. AO Flying Example
1int TestMoveAO(void)
2{
3 ROBOT_STATE_PKG pkg = {};
4 FRRobot robot;
5 robot.LoggerInit();
6 robot.SetLoggerLevel(1);
7 int rtn = robot.RPC("192.168.58.2");
8 if (rtn != 0)
9 {
10 return -1;
11 }
12 robot.SetReConnectParam(true, 30000, 500);
13 JointPos j1(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
14 JointPos j2(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);
15 DescPose desc_pos1(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
16 DescPose desc_pos2(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
17 DescPose offset_pos(0, 0, 0, 0, 0, 0);
18 DescPose offset_pos1(0, 0, 50, 0, 0, 0);
19 ExaxisPos epos(0, 0, 0, 0);
20 int tool = 0;
21 int user = 0;
22 float vel = 20.0;
23 float acc = 20.0;
24 float ovl = 100.0;
25 float blendT = -1.0;
26 uint8_t flag = 0;
27 robot.SetSpeed(20);
28 robot.MoveAOStart(0, 100, 100, 20);
29 robot.MoveJ(&j1, &desc_pos1, tool, user, vel, acc, ovl, &epos, blendT, flag, &offset_pos);
30 robot.MoveJ(&j2, &desc_pos2, tool, user, vel, acc, ovl, &epos, blendT, flag, &offset_pos);
31 robot.MoveAOStop();
32 robot.Sleep(1000);
33 robot.MoveToolAOStart(0, 100, 100, 20);
34 robot.MoveJ(&j1, &desc_pos1, tool, user, vel, acc, ovl, &epos, blendT, flag, &offset_pos);
35 robot.MoveJ(&j2, &desc_pos2, tool, user, vel, acc, ovl, &epos, blendT, flag, &offset_pos);
36 robot.MoveToolAOStop();
37 robot.CloseRPC();
38 return 0;
39}
4.54. Start Ptp Motion FIR Filter
New in version V3.7.7.
1/**
2* @brief Start Ptp motion FIR filter
3* @param [in] maxAcc Maximum acceleration limit (deg/s2)
4* @param [in] maxJek Unified joint jerk limit (deg/s3), default 1000
5* @return Error code
6*/
7errno_t PtpFIRPlanningStart(double maxAcc, double maxJek = 1000);
4.55. Close Ptp Motion FIR Filter
New in version V3.7.7.
1/**
2* @brief Close Ptp motion FIR filter
3* @return Error code
4*/
5errno_t PtpFIRPlanningEnd();
4.56. Start LIN, ARC Motion FIR Filter
New in version V3.7.7.
1/**
2* @brief Start LIN, ARC motion FIR filter
3* @param [in] maxAccLin Linear acceleration limit (mm/s2)
4* @param [in] maxAccDeg Angular acceleration limit (deg/s2)
5* @param [in] maxJerkLin Linear jerk limit (mm/s3)
6* @param [in] maxJerkDeg Angular jerk limit (deg/s3)
7* @return Error code
8*/
9errno_t LinArcFIRPlanningStart(double maxAccLin, double maxAccDeg, double maxJerkLin, double maxJerkDeg);
4.57. Close LIN, ARC Motion FIR Filter
New in version V3.7.7.
1/**
2* @brief Close LIN, ARC motion FIR filter
3* @return Error code
4*/
5errno_t LinArcFIRPlanningEnd();
4.58. FIR Filter Example
1int TestFIR(void)
2{
3 ROBOT_STATE_PKG pkg = {};
4 FRRobot robot;
5 robot.LoggerInit();
6 robot.SetLoggerLevel(1);
7 int rtn = robot.RPC("192.168.58.2");
8 if (rtn != 0)
9 {
10 return -1;
11 }
12 robot.SetReConnectParam(true, 30000, 500);
13 JointPos startjointPos(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
14 JointPos midjointPos(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);
15 JointPos endjointPos(-29.777, -84.536, 109.275, -114.075, -86.655, 74.257);
16 DescPose startdescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
17 DescPose middescPose(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
18 DescPose enddescPose(-487.434, 154.362, 308.576, 176.600, 0.268, -14.061);
19 ExaxisPos exaxisPos(0, 0, 0, 0);
20 DescPose offdese(0, 0, 0, 0, 0, 0);
21 rtn = robot.PtpFIRPlanningStart(1000, 1000);
22 cout << "PtpFIRPlanningStart rtn is " << rtn << endl;
23 robot.MoveJ(&startjointPos, &startdescPose, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
24 robot.MoveJ(&endjointPos, &enddescPose, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
25 robot.PtpFIRPlanningEnd();
26 cout << "PtpFIRPlanningEnd rtn is " << rtn << endl;
27 robot.LinArcFIRPlanningStart(1000, 1000, 1000, 1000);
28 cout << "LinArcFIRPlanningStart rtn is " << rtn << endl;
29 robot.MoveL(&startjointPos, &startdescPose, 0, 0, 100, 100, 100, -1, &exaxisPos, 0, 0, &offdese, 1, 1);
30 robot.MoveC(&midjointPos, &middescPose, 0, 0, 100, 100, &exaxisPos, 0, &offdese, &endjointPos, &enddescPose, 0, 0, 100, 100, &exaxisPos, 0, &offdese, 100, -1);
31 robot.LinArcFIRPlanningEnd();
32 cout << "LinArcFIRPlanningEnd rtn is " << rtn << endl;
33 robot.CloseRPC();
34 return 0;
35}
4.59. Acceleration Smoothing Start
New in version C++SDK-v2.2.1-3.8.1.
1/**
2* @brief Acceleration smoothing start
3* @param [in] saveFlag Whether to save after power off
4* @return Error code
5*/
6errno_t AccSmoothStart(bool saveFlag);
4.60. Acceleration Smoothing End
New in version C++SDK-v2.2.1-3.8.1.
1/**
2* @brief Acceleration smoothing end
3* @param [in] saveFlag Whether to save after power off
4* @return Error code
5*/
6errno_t AccSmoothEnd(bool saveFlag);
4.61. Acceleration Smoothing Example
1int TestAccSmooth(void)
2{
3 ROBOT_STATE_PKG pkg = {};
4 FRRobot robot;
5 robot.LoggerInit();
6 robot.SetLoggerLevel(1);
7 int rtn = robot.RPC("192.168.58.2");
8 if (rtn != 0)
9 {
10 return -1;
11 }
12 robot.SetReConnectParam(true, 30000, 500);
13 JointPos startjointPos(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
14 JointPos endjointPos(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);
15 DescPose startdescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
16 DescPose enddescPose(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
17 ExaxisPos exaxisPos(0, 0, 0, 0);
18 DescPose offdese(0, 0, 0, 0, 0, 0);
19 rtn = robot.AccSmoothStart(0);
20 cout << "AccSmoothStart rtn is " << rtn << endl;
21 robot.MoveJ(&startjointPos, &startdescPose, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
22 robot.MoveJ(&endjointPos, &enddescPose, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
23 rtn = robot.AccSmoothEnd(0);
24 cout << "AccSmoothEnd rtn is " << rtn << endl;
25 robot.CloseRPC();
26 return 0;
27}
4.62. Specified Pose Speed Start
New in version C++SDK-v2.1.5.0.
1/**
2* @brief Specified pose speed start
3* @param [in] ratio Pose speed percentage [0-300]
4* @return Error code
5*/
6errno_t AngularSpeedStart(int ratio);
4.63. Specified Pose Speed End
New in version C++SDK-v2.1.5.0.
1/**
2* @brief Specified pose speed end
3* @return Error code
4*/
5errno_t AngularSpeedEnd();
4.64. Robot Specified Pose Speed Example
1int TestAngularSpeed(void)
2{
3 ROBOT_STATE_PKG pkg = {};
4 FRRobot robot;
5 robot.LoggerInit();
6 robot.SetLoggerLevel(1);
7 int rtn = robot.RPC("192.168.58.2");
8 if (rtn != 0)
9 {
10 return -1;
11 }
12 robot.SetReConnectParam(true, 30000, 500);
13 JointPos startjointPos(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
14 JointPos endjointPos(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);
15 DescPose startdescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
16 DescPose enddescPose(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
17 ExaxisPos exaxisPos(0, 0, 0, 0);
18 DescPose offdese(0, 0, 0, 0, 0, 0);
19 rtn = robot.AngularSpeedStart(50);
20 cout << "AngularSpeedStart rtn is " << rtn << endl;
21 robot.MoveJ(&startjointPos, &startdescPose, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
22 robot.MoveJ(&endjointPos, &enddescPose, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
23 rtn = robot.AngularSpeedEnd();
24 cout << "AngularSpeedEnd rtn is " << rtn << endl;
25 robot.CloseRPC();
26 return 0;
27}
4.65. Start Singular Pose Protection
New in version C++SDK-v2.1.5.0.
1/**
2* @brief Start singular pose protection
3* @param [in] protectMode Singular protection mode, 0: Joint mode; 1-Cartesian mode
4* @param [in] minShoulderPos Shoulder singular adjustment range (mm), default 100
5* @param [in] minElbowPos Elbow singular adjustment range (mm), default 50
6* @param [in] minWristPos Wrist singular adjustment range (°), default 10
7* @return Error code
8*/
9errno_t SingularAvoidStart(int protectMode, double minShoulderPos, double minElbowPos, double minWristPos);
4.66. Stop Singular Pose Protection
New in version C++SDK-v2.1.5.0.
1/**
2* @brief Stop singular pose protection
3* @return Error code
4*/
5errno_t SingularAvoidEnd();
4.67. Robot Singular Pose Protection Example
1int TestAngularSpeed(void)
2{
3 ROBOT_STATE_PKG pkg = {};
4 FRRobot robot;
5 robot.LoggerInit();
6 robot.SetLoggerLevel(1);
7 int rtn = robot.RPC("192.168.58.2");
8 if (rtn != 0)
9 {
10 return -1;
11 }
12 robot.SetReConnectParam(true, 30000, 500);
13 JointPos startjointPos(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
14 JointPos endjointPos(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);
15 DescPose startdescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
16 DescPose enddescPose(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
17 ExaxisPos exaxisPos(0, 0, 0, 0);
18 DescPose offdese(0, 0, 0, 0, 0, 0);
19 rtn = robot.SingularAvoidStart(2, 10, 5, 5);
20 cout << "SingularAvoidStart rtn is " << rtn << endl;
21 robot.MoveJ(&startjointPos, &startdescPose, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
22 robot.MoveJ(&endjointPos, &enddescPose, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
23 rtn = robot.SingularAvoidEnd();
24 cout << "SingularAvoidEnd rtn is " << rtn << endl;
25 robot.CloseRPC();
26 return 0;
27}
4.68. Clear the motion command queue
1/**
2* @brief Clear the motion command queue
3* @return error code
4*/
5errno_t MotionQueueClear();
4.69. 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*/
20errno_t MoveToIntersectLineStart(DescPose mainPoint[6], ExaxisPos mainExaxisPos[6], DescPose piecePoint[6], ExaxisPos pieceExaxisPos[6], int extAxisFlag, ExaxisPos exaxisPos, int tool, int wobj, double vel, double acc, double ovl, double oacc, int moveType, int moveDirection, DescPose offset);
4.70. 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*/
19errno_t MoveIntersectLine(DescPose mainPoint[6], ExaxisPos mainExaxisPos[6], DescPose piecePoint[6], ExaxisPos pieceExaxisPos[6], int extAxisFlag, ExaxisPos exaxisPos[4], int tool, int wobj, double vel, double acc, double ovl, double oacc, int moveDirection, DescPose offset);
4.71. 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.72. Stationary Air Motion
1/**
2* @brief Stationary Air Motion
3* @return Error code
4*/
5errno_t MoveStationary();
4.73. Stationary Air Motion Code Example
1int TestLaserStationary(void)
2{
3 ROBOT_STATE_PKG pkg = {};
4 FRRobot robot;
5 robot.LoggerInit();
6 robot.SetLoggerLevel(1);
7 int rtn = robot.RPC("192.168.58.2");
8 if (rtn != 0)
9 {
10 return 0;
11 }
12 robot.SetReConnectParam(true, 30000, 500);
13 rtn = robot.LaserSensorRecordandReplay(0, 10, 1, 0, 0.1, 1, 0, 10, 100);
14 printf("LaserSensorRecordandReplay rtn is %d\n", rtn);
15 rtn = robot.MoveStationary();
16 printf("MoveStationary rtn is %d\n", rtn);
17 rtn = robot.LaserSensorRecord1(0, 10);
18 printf("LaserSensorRecordandReplay rtn is %d\n", rtn);
19 robot.CloseRPC();
20 robot.Sleep(9999999);
21 return 0;
22}
4.74. 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*/
9errno_t OriginPointWeaveStart(int weaveNum, int mode, DescPose refPoint, double weaveTime);
4.75. Fixed-Point Swing End
1/**
2* @brief End fixed-point swing
3* @return Error code
4*/
5errno_t OriginPointWeaveEnd();
4.76. Fixed-Point Swing SDK Code Example
1int TestOriginPointWeave()
2{
3 ROBOT_STATE_PKG pkg = {};
4 FRRobot robot;
5 robot.LoggerInit();
6 robot.SetLoggerLevel(1);
7 int rtn = robot.RPC("192.168.58.2");
8 if (rtn != 0)
9 {
10 return -1;
11 }
12 robot.SetReConnectParam(true, 30000, 500);
13 JointPos j(39.886, -98.580, -124.032, -47.393, 90.000, 40.842);
14 ExaxisPos epos(0, 0, 0, 0);
15 DescPose offset_pos(0, 0, 0, 0, 0, 0);
16 DescPose refPoint = { 400.021,300.022,299.996,179.997,-0.003,-90.956 };
17 robot.MoveJ(&j, 1, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
18 robot.OriginPointWeaveStart(0, 0, refPoint, 3);
19 robot.MoveStationary();
20 robot.OriginPointWeaveEnd();
21 robot.Sleep(2000);
22 robot.MoveJ(&j, 1, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
23 robot.OriginPointWeaveStart(0, 1, refPoint, 3);
24 robot.MoveStationary();
25 robot.OriginPointWeaveEnd();
26 robot.CloseRPC();
27 robot.Sleep(1000);
28 return 0;
29}
4.77. Fixed-Point Swing (Including Laser Sensor and Extension Axis) Code Example
1int TestOriginPointWeave()
2{
3 ROBOT_STATE_PKG pkg = {};
4 FRRobot robot;
5 robot.LoggerInit();
6 robot.SetLoggerLevel(1);
7 int rtn = robot.RPC("192.168.58.2");
8 if (rtn != 0)
9 {
10 return -1;
11 }
12 robot.SetReConnectParam(true, 30000, 500);
13 JointPos j(39.886, -98.580, -124.032, -47.393, 90.000, 40.842);
14 ExaxisPos epos1(0, 0, 0, 0);
15 DescPose offset_pos(0, 0, 0, 0, 0, 0);
16 ExaxisPos epos2(5, 0.000, 0.000, 0.000);
17 DescPose refPoint(400.021, 300.022, 299.996, 179.997, -0.003, -90.956);
18 robot.LaserTrackingSensorConfig("192.168.58.20", 5020);
19 robot.LaserTrackingSensorSamplePeriod(20);
20 robot.LoadPosSensorDriver(101);
21 robot.ExtDevLoadUDPDriver();
22 rtn = robot.SetExAxisCmdDoneTime(5000.0);
23 printf("SetExAxisCmdDoneTime rtn is %d\n" , rtn);
24 rtn = robot.ExtAxisServoOn(1, 1);
25 printf("ExtAxisServoOn axis id 1 rtn is %d\n" , rtn);
26 rtn = robot.ExtAxisServoOn(2, 1);
27 printf("ExtAxisServoOn axis id 2 rtn is %d\n" , rtn);
28 robot.Sleep(2000);
29 robot.ExtAxisSetHoming(1, 0, 10, 2);
30 rtn = robot.LaserTrackingLaserOnOff(1, 0);
31 printf("LaserTrackingLaserOnOff id 2 rtn is %d\n", rtn);
32 robot.LaserTrackingTrackOnOff(1, 4);
33 robot.Sleep(200);
34 robot.OriginPointWeaveStart(0, 0, refPoint, 10);
35 robot.MoveStationary();
36 robot.OriginPointWeaveEnd();
37 robot.LaserTrackingTrackOnOff(0, 4);
38
39 robot.Sleep(2000);
40
41 robot.ExtAxisMove(epos1, 100, -1);
42 robot.LaserTrackingTrackOnOff(1, 4);
43 robot.OriginPointWeaveStart(0, 0, refPoint, 20);
44 robot.ExtAxisMove(epos2, 100, -1);
45 robot.OriginPointWeaveEnd();
46 robot.LaserTrackingTrackOnOff(0, 4);
47 robot.CloseRPC();
48 robot.Sleep(1000);
49 return 0;
50}