Skip to main content

Palletizing process related

Palletizing settings

The INEXBOT function library provides interfaces for both complete palletizing and simple palletizing. It should be noted that simple palletizing and complete palletizing share the same palletizing number, and the correct type needs to be set before use.

Before writing a program using palletizing process, it is necessary to set the relevant palletizing parameters. The sequence of palletizing parameter settings is as follows: gripper settings, pallet settings, position settings, workpiece parameters, approach parameters, overlap mode, and plane mode.

Set and get the palletizing type

Call the function NRC_Pallet_SetUsePalletType(int id, int type) to set whether to use simple palletizing or complete palletizing. The parameter "id" is the process number of the palletizing process, with a range of 1 <= id <= 9. The parameter "type" is the type of palletizing used, with 0 indicating simple palletizing and 1 indicating complete palletizing.

Call the function NRC_Pallet_GetUsePalletType(int id) to get whether the simple palletizing or complete palletizing is being used. The parameter "id" is the process number of the palletizing process, with a range of 1 <= id <= 9. The return value indicates the type of palletizing used, with 'retval = 0' indicating simple palletizing and 'retval = 1' indicating complete palletizing.

Set and get the position data of simple palletizing

(1) Call the function NRC_Pallet_SetSimplePosParm(int id, int posType, NRC_Position pos) to set the position data of simple palletizing.

  • The parameter "id" is the process number of the palletizing process, with a range of 1 <= id <= 9.
  • The parameter "posType" is the position type of simple palletizing, 0 means the starting workpiece point, 1 means the column end, 2 means the row end, 3 means the height end, 4 means the starting auxiliary point, and 5 means the starting entry point.
  • The parameter "pos" is the position data of simple palletizing, please refer to NRC_Position for details.

(2) Call the function NRC_Pallet_GetSimplePosParm(int id, int posType, NRC_Position& pos) to get the position data of simple palletizing.

  • The parameter "id" is the process number of the palletizing process, with a range of 1 <= id <= 9.
  • The parameter "posType" is the position type of simple palletizing, 0 means the starting workpiece point, 1 means the column end, 2 means the row end, 3 means the height end, 4 means the starting auxiliary point, and 5 means the starting entry point.
  • The parameter "pos" is the position data of simple palletizing, please refer to NRC_Position for details.

Set and get the number data of simple palletizing

(1) Call the function NRC_Pallet_SetSimpleNumParm(int id, int numX, int numY, int numZ) to set the number data of simple palletizing.

  • The parameter "id" is the process number of the palletizing process, with a range of 1 <= id <= 9.
  • The parameter "numX" represents the number of workpieces in the X direction of the pallet (corresponding to the X direction of user coordinate) in simple palletizing, i.e. the number of rows.
  • The parameter "numY" represents the number of workpieces in the Y direction of the pallet (corresponding to the Y direction of the user coordinate) in simple palletizing, i.e. the number of columns.
  • The parameter "numZ" represents the number of workpieces in the Z direction of the pallet (corresponding to the Z direction of the user coordinate) in simple palletizing, i.e. the number of layers.

(2) Call the function NRC_Pallet_GetSimpleNumParm(int id, int& numX, int& numY, int& numZ) to get the number data of simple palletizing.

  • The parameter "id" is the process number of the palletizing process, with a range of 1 <= id <= 9.
  • The parameter "numX" represents the number of workpieces in the X direction of the pallet (corresponding to the X direction of user coordinate) in simple palletizing, i.e. the number of rows.
  • The parameter "numY" represents the number of workpieces in the Y direction of the pallet (corresponding to the Y direction of the user coordinate) in simple palletizing, i.e. the number of columns.
  • The parameter "numZ" represents the number of workpieces in the Z direction of the pallet (corresponding to the Z direction of the user coordinate) in simple palletizing, i.e. the number of layers.

Clear the current state of palletizing

Call the function NRC_Pallet_ClearCurrentStatus(int id) to clear the current state of palletizing. The parameter "id" is the process number of the palletizing process, with a range of 1 <= id <= 9.

Set and get the number of palletized workpieces

(1) When palletizing is interrupted due to certain reasons or when there are changes in the palletizing-related data, you can use the function NRC_Pallet_SetPalletedWpNum(int id, unsigned int layerNum, unsigned int layerPalletedWpNum) to set the number of palletized workpieces, in order to resume normal palletizing operations.

  • The parameter "id" represents the palletizing process number.
  • The parameter "layerNum" indicates the number of palletized layer to be modified.
  • The parameter "layerPalletdWpNum" represents the number of palletized workpieces on a layer to be modified.

(2) Call the function NRC_Pallet_GetPalletedWpNum(int id, int& curPalletedWpSum, int& curLayerNum, int& curLayerPalletedWpNum, int& totalWpNum, int& totalLayerNum, int& curLayerWpSum) to get the number of palletized workpieces.

  • The parameter "id" is the process number of the palletizing process, with a range of 1 <= id <= 9.
  • The parameter "curPalletedWpSum" represents the current number of palletized workpieces.
  • The parameter "curLayerNum" represents the current number of palletized layers.
  • The parameter "curLayerPalletedWpNum" represents the number of palletized workpieces on the current layer.
  • The parameter "totalWpNum" represents the total number of workpieces in the pallet stack.
  • The parameter "totalLayerNum" represents the total number of layers in the pallet stack.
  • The parameter "curLayerWpSum" represents the total number of workpieces on the current layer. It should be noted that for these 6 parameters, when the return value is -1, it means that the number is unknown

Set and get palletizing gripper data

(1) Call the function NRC_Pallet_SetGripperParm(int id, int gripperSum, int gripper[4]) to set the palletizing gripper data.

  • The parameter "id" is the process number of the palletizing process, with a range of 1 <= id <= 9.
  • The parameter "gripperSum" represents the total number of available grippers, with a range of 1 <= gripperSum <= 4.
  • The parameter "gripper[4]" represents the tool coordinate number bound to each gripper, where 1 <= gripper[i] <= 9. (2) Call the function NRC_Pallet_GetGripperParm(int id, int& gripperSum, int gripper[4]) to get the palletizing gripper data.
  • The parameter "id" is the process number of the palletizing process, with a range of 1 <= id <= 9.
  • The parameter "gripperSum" represents the total number of available grippers obtained.
  • The parameter "gripper[4]" represents the tool coordinate number bound to each gripper obtained.

Palletizing via job files

When inserting the following instructions, please first call NRC_CreateJobfile(std::string jobname) or NRC_OpenJobfile (std::string jobname) to create or open a job file.

Insert PALON

This function is used to judge the start of palletizing. Call the function NRC_JobfileInsertPALON(int line, int id, int type, int var1=0, int var2=0, int var3=0) to insert the PALON instruction in the job file. This function needs to be used in conjunction with NRC_RunqueueInsertPALOFF(int id, int var), otherwise an error will occur.

  • The parameter "line" refers to the line number where the instruction will be inserted, parameter range: 0 < line < (NRC_GetJobfileLineSum()+1)
  • The parameter "id" indicates the process number of the palletizing process, parameter range: 1 <= id <=9
  • The parameter "type" indicates the palletizing type; 0: palletizing, 1: depalletizing
  • The parameter "var1" indicates the total number of currently palletized workpieces; 0 means no storage, 1-100 means variables GI001-GI100, parameter range: 0 <= var1 <= 100
  • The parameter "var2" indicates the current number of palletized layers; 0 means no storage, 1-100 means variables GI001-GI100, parameter range: 0 <= var1 <= 100
  • The parameter "var3" indicates the number of palletized workpieces on the current layer; 0 means no storage, 1-100 means variables GI001-GI100, parameter range: 0 <= var1 <= 100

Insert PALOFF

This function is used to judge the end of palletizing. Call the function NRC_JobfileInsertPALOFF(int line, int id, int var=0) to insert the PALOFF instruction in the job file. This function needs to be used in conjunction with NRC_JobfileInsertPALON(int line, int id, int type, int var1, int var2, int var3).

  • The parameter "line" refers to the line number where the instruction will be inserted, parameter range: 0 < line < (NRC_GetJobfileLineSum()+1)
  • The parameter "id" indicates the process number of the palletizing process, parameter range: 1 <= id <=9
  • The parameter "var" is used for palletizing end judgment, 0 means no storage, 1-100 means variables GA001-GA100, parameter range: 0 <= var <= 100

Insert PALGRIPPER

This function is used to select the gripper. Call the function NRC_JobfileInsertPALGRIPPER(int line, int id, int tool) to insert the PALGRIPPER instruction in the job file.

  • The parameter "line" refers to the line number where the instruction will be inserted, parameter range: 0 < line < (NRC_GetJobfileLineSum()+1).
  • The parameter "id" indicates the process number of the palletizing process, parameter range: 1 <= id <=9
  • The parameter "tool" refers to the number of the gripper to be replaced, parameter range: 1 <= id <= 4

Insert PALCLEAR

This function is used to reset palletizing and clear the palletizing state. Call the function NRC_JobfileInsertPALCLEAR(int line, int id) to insert the PALCLEAR instruction in the job file.

  • The parameter "line" refers to the line number where the instruction will be inserted, parameter range: 0 < line < (NRC_GetJobfileLineSum()+1).
  • The parameter "id" indicates the process number of the palletizing process, parameter range: 1 <= id <=9

Insert PALENTER

Make relevant settings for the palletizing entry point. Call the function NRC_JobfileInsertPALENTER(int line, int id, int moveType, int acc, int dec, int vel, int pl=0) to insert the PALENTER instruction in the job file.

  • The parameter "line" refers to the line number where the instruction will be inserted, parameter range: 0 < line < (NRC_GetJobfileLineSum()+1)
  • The parameter "id" indicates the process number of the palletizing process, parameter range: 1 <= id <=9
  • The parameter "moveType" indicates the interpolation method used by this instruction; 1: Joint interpolation; 2: Linear interpolation; 3: Circular interpolation
  • The parameter "vel" indicates the running speed of the robot; when the interpolation method is joint interpolation, it is the percentage of the maximum speed of the robot, parameter range: 0 < vel <= 100; when the interpolation method is linear interpolation or circular interpolation, it is the absolute running speed of the robot TCP, the unit is mm/s, parameter range: vel > 1
  • The parameter "acc" indicates the robot running acceleration, parameter range: 0 < acc <= 100; when the interpolation method is joint interpolation, it is the percentage of the maximum acceleration of each joint of the robot; when the interpolation method is linear interpolation or circular interpolation, it is the percentage of the robot's maximum Cartesian acceleration
  • The parameter "dec" indicates the robot running deceleration, parameter range: 0 < dec <= 100; when the interpolation method is joint interpolation, it is the percentage of the maximum deceleration of each joint of the robot; when the interpolation method is linear interpolation or circular interpolation, it is the percentage of the robot's maximum Cartesian deceleration
  • The parameter "pl" represents the smoothness, which refers to the smooth transition between the current and the next movement instructions. The higher the value of pl, the smoother the transition, but the greater the trajectory deviation. The range of the parameter is 0 <= pl <= 5

Insert PALSHIFT

Make relevant settings for the palletizing auxiliary point. Call the function NRC_JobfileInsertPALSHIFT(int line, int id, int moveType, int acc, int dec, int vel, int pl=0) to insert the PALSHIFT instruction in the job file.

  • The parameter "line" refers to the line number where the instruction will be inserted, parameter range: 0 < line < (NRC_GetJobfileLineSum()+1).
  • The parameter "id" indicates the process number of the palletizing process, parameter range: 1 <= id <=9
  • The parameter "moveType" indicates the interpolation method used by this instruction; 1: Joint interpolation; 2: Linear interpolation; 3: Circular interpolation
  • The parameter "vel" indicates the running speed of the robot; when the interpolation method is joint interpolation, it is the percentage of the maximum speed of the robot, parameter range: 0 < vel <= 100; when the interpolation method is linear interpolation or circular interpolation, it is the absolute running speed of the robot TCP, the unit is mm/s, parameter range: vel > 1
  • The parameter "acc" indicates the robot running acceleration, parameter range: 0 < acc <= 100; when the interpolation method is joint interpolation, it is the percentage of the maximum acceleration of each joint of the robot; when the interpolation method is linear interpolation or circular interpolation, it is the percentage of the robot's maximum Cartesian acceleration
  • The parameter "dec" indicates the robot running deceleration, parameter range: 0 < dec <= 100; when the interpolation method is joint interpolation, it is the percentage of the maximum deceleration of each joint of the robot; when the interpolation method is linear interpolation or circular interpolation, it is the percentage of the robot's maximum Cartesian deceleration
  • The parameter "pl" represents the smoothness, which refers to the smooth transition between the current and the next movement instructions. The higher the value of pl, the smoother the transition, but the greater the trajectory deviation. The range of the parameter is 0 <= pl <= 5

Insert PALREAL

Make relevant settings for the palletizing workpiece point. Call the function NRC_JobfileInsertPALREAL(int line, int id, int moveType, int acc, int dec, int vel, int pl=0) to insert the PALREAL instruction in the job file.

  • The parameter "line" refers to the line number where the instruction will be inserted, parameter range: 0 < line < (NRC_GetJobfileLineSum()+1)
  • The parameter "id" indicates the process number of the palletizing process, parameter range: 1 <= id <=9
  • The parameter "moveType" indicates the interpolation method used by this instruction; 1: Joint interpolation; 2: Linear interpolation; 3: Circular interpolation
  • The parameter "vel" indicates the running speed of the robot; when the interpolation method is joint interpolation, it is the percentage of the maximum speed of the robot, parameter range: 0 < vel <= 100; when the interpolation method is linear interpolation or circular interpolation, it is the absolute running speed of the robot TCP, the unit is mm/s, parameter range: vel > 1
  • The parameter "acc" indicates the robot running acceleration, parameter range: 0 < acc <= 100; when the interpolation method is joint interpolation, it is the percentage of the maximum acceleration of each joint of the robot; when the interpolation method is linear interpolation or circular interpolation, it is the percentage of the robot's maximum Cartesian acceleration
  • The parameter "dec" indicates the robot running deceleration, parameter range: 0 < dec <= 100; when the interpolation method is joint interpolation, it is the percentage of the maximum deceleration of each joint of the robot; when the interpolation method is linear interpolation or circular interpolation, it is the percentage of the robot's maximum Cartesian deceleration
  • The parameter "pl" represents the smoothness, which refers to the smooth transition between the current and the next movement instructions. The higher the value of pl, the smoother the transition, but the greater the trajectory deviation. The range of the parameter is 0 <= pl <= 5

Demo program for palletizing process with job files

int main()
{
SystemStartup();//System startup, see section 3.3 for details
SetServoMap();//Set the servo mapping relationship, see section 3.5 for details
SettingofRobotRelatedParameters();//Robot-related parameter settings, see section 3.6 for details
//////The above call functions can be found in Appendix I/////
NRC_SetServoReadyStatus(1);//Set servo ready status, see section 3.8 for details
NRC_SetInterpolationMethod(1);//Set to S-shaped interpolation method, see section 3.12 for details
NRC_SetOperationMode(NRC_RUN_);//Set the operation mode to run mode, see section 3.11 for details
NRC_SetAutoRunSpeedPer(80);//Set the auto-run speed to 80, see section 3.11 for details
NRC_Delayms(1000);//Delay 1000ms
//Set four points (using the new version of definition)
double pos1[7] = { 296.71, -66.12, 606.38, 3.06, 0.15, -0.18,0.00 };
double pos2[7] = { 303.3191, 20.0862, 606.3863, 3.1038, 0.1630, -0.4658,0.0000 };
double pos3[7] = { 315.4386, 21.1369, 595.0522, 3.1006, 0.1196, -0.4678,0.0000 };
double pos4[7] = { 315.6836, -16.5291, 595.0751, 3.0866, 0.1140, -0.3479,0.0000 };
NRC_Position inexbot1 = { NRC_MCS,0,0,0,pos1 };
NRC_Position inexbot2 = { NRC_MCS,0,0,0,pos2 };
NRC_Position inexbot3 = { NRC_MCS,0,0,0,pos3 };
NRC_Position inexbot4 = { NRC_MCS,0,0,0,pos4 };
double devPos1[7] = { 10, 20, -10, 10, 0, 0 };
double devPos2[7] = { -50, 50, 10, 0, 0, 0.1 };
NRC_Position dev1 = { NRC_ACS,0,0,0,devPos1 }; //Set the deviation of dev1
NRC_Position dev2 = { NRC_MCS,0,0,0,devPos2 }; //Set the deviation of dev2
NRC_Position inexbot9;//Define the robot position structure object inexbot9
NRC_GetCurrentPos(NRC_MCS, inexbot9);//Assign the Cartesian coordinate system of the current robot to inexbot9
printf("inexbot9.pos=%f,%f,%f,,%f,%f,%f,%f,\n", inexbot9.pos[0], inexbot9.pos[1], inexbot9.pos[2], inexbot9.pos[3], inexbot9.pos[4], inexbot9.pos[5], inexbot9.pos[6]);//Output the current Cartesian coordinate position
int id = 1;
NRC_Pallet_SetUsePalletType(id, 0);//Set to simple palletizing with a process number of 1
cout << "NRC_Pallet_GetUsePalletType : " << NRC_Pallet_GetUsePalletType(1) << endl;
NRC_Position pos[] =
{
{NRC_MCS, {401, 301, 201, 3.14159, 0, 0,0}},
{NRC_MCS, {401, -299, 201, 3.14159, 0, 0,0}},
{NRC_MCS, {201, 301, 201, 3.14159, 0, 0,0}},
{NRC_MCS, {401, 301, 301, 3.14159, 0, 0,0}},
{NRC_MCS, {401, 301, 211, 3.14159, 0, 0,0}},
{NRC_MCS, {401, 301, 221, 3.14159, 0, 0,0}},
};
for (int i = 0; i < 6; i++)
NRC_Pallet_SetSimplePosParm(id, i, pos[i]);//Set the position data of simple palletizing
for (int i = 0; i < 6; i++)
{
NRC_Position pos;
NRC_Pallet_GetSimplePosParm(id, i, pos);
}
NRC_Pallet_SetSimpleNumParm(id, 3, 2, 3);
int x = 0, y = 0, z = 0;
NRC_Pallet_GetSimpleNumParm(id, x, y, z);
cout << "x=" << x << ", y=" << y << ",z=" << z << endl;
NRC_Delayms(2000);
//Implement palletizing process in job file
if (NRC_JudgeJobIsExist("INEXBOT1") == 0)
{
cout << "Job file does not exist" << endl;
NRC_CreateJobfile("INEXBOT1");//Create job file INEXBOT1
NRC_OpenJobfile("INEXBOT1");
}
else
NRC_OpenJobfile("INEXBOT1");//Open job file INEXBOT1
NRC_JobfileInsertPALCLEAR(1, 1);//Clear the previous palletizing data
NRC_JobfileInsertMOVJ(2, 50, 50, 50, inexbot1, 4);//Move to inexbot1 in a point-to-point manner (pickup entry point)
NRC_JobfileInsertMOVL(3, 50, 50, 50, inexbot2, 1);//Move to inexbot2 in a straight line (pickup auxiliary point)
NRC_JobfileInsertMOVJ(4, 50, 50, 50, inexbot3, 1);//Move to inexbot3 in a point-to-point manner (pickup workpiece point)
NRC_JobfileInsertDOUT(5, 4, 1);//Digital output port 4 outputs high level
NRC_JobfileInsertWAIT(6, 5, 1, 3.3);//Wait for the digital input port 5 to input a high level, if the condition is still not met after 3.3 seconds, the instruction ends
NRC_JobfileInsertPALON(7, 1, 0, 0, 0, 0);//Palletizing process 1, palletizing, var1=0, var2=0, var3=0 (palletizing start judgment)
NRC_JobfileInsertPALENTER(8, 1, 1, 100,80,80, 5);//Palletizing process 1, joint interpolation, vel=100mm/s, PL=5 (palletizing entry point)
NRC_JobfileInsertPALSHIFT(9, 1, 1, 50, 80,80,5);//Palletizing process 1, joint interpolation, vel=50mm/s, PL=5 (palletizing auxiliary point)
NRC_JobfileInsertPALREAL(10, 1, 1, 50, 80,80,5);//Palletizing process 1, joint interpolation, vel=50mm/s, PL=5 (palletizing workpiece point)
NRC_JobfileInsertDOUT(11, 3, 1);//Digital output port 3 outputs high level
NRC_JobfileInsertWAIT(12, 3, 1, 3.3);//Wait for the digital input port 3 to input a high level, if the condition is still not met after 3.3 seconds, the instruction ends
NRC_JobfileInsertPALOFF(13, 1, 1);//Palletizing end judgment
cout << "file line sum is " << NRC_GetJobfileLineSum() << endl;
NRC_ServoEnable(); //Servo power on
NRC_StartRunJobfile("INEXBOT1");//Start running the job file
NRC_SetCycleIndex(3);//Cycle 3 times
while (NRC_GetProgramRunStatus() != 0) //Wait for the run to finish
{
NRC_Delayms(500); //Delay 100ms
printf("line=%d,time=%d\n", NRC_GetJobfileCurrentRunLine(), NRC_GetCycleTimeSec());
}
NRC_ServoDisable(); //Servo power off
NRC_Position inexbot7;//Define the robot position structure object inexbot7
NRC_GetCurrentPos(NRC_MCS, inexbot7);//Assign the Cartesian coordinate system of the robot to inexbot7
printf("inexbot7.pos=%f,%f,%f,,%f,%f,%f,%f,\n", inexbot7.pos[0], inexbot7.pos[1], inexbot7.pos[2], inexbot7.pos[3], inexbot7.pos[4], inexbot7.pos[5], inexbot7.pos[6]);//Output the current Cartesian coordinate position
while(1)//Keep the program running
{
NRC_Delayms(1000);
}
}

Implement palletizing process with fileless run queue

Before calling the following function, please call NRC_CreateNoFlieRunqueue() to create a fileless run queue

Insert PALON

This function is used to judge the start of palletizing. Call the function NRC_RunqueueInsertPALON(int id, int type, int var1=0, int var2=0, int var3=0) to insert the PALON instruction in the run queue. This function needs to be used in conjunction with NRC_RunqueueInsertPALOFF(int id, int var).

  • The parameter "id" indicates the process number of the palletizing process, parameter range: 1 <= id <=9
  • The parameter "type" indicates the palletizing type; 0: palletizing, 1: depalletizing
  • The parameter "var1" indicates the total number of currently palletized workpieces; 0 means no storage, 1-100 means variables GI001-GI100, parameter range: 0 <= var1 <= 100
  • The parameter "var2" indicates the current number of palletized layers; 0 means no storage, 1-100 means variables GI001-GI100, parameter range: 0 <= var2 <= 100
  • The parameter "var3" indicates the number of palletized workpieces on the current layer; 0 means no storage, 1-100 means variables GI001-GI100, parameter range: 0 <= var3 <= 100

Insert PALREAL

Make relevant settings for the palletizing workpiece point. Call the function NRC_RunqueueInsertPALREAL(int id, int moveType, int vel, int acc, int dec, int pl=0) to insert the PALREAL instruction in the run queue.

  • The parameter "id" indicates the process number of the palletizing process, parameter range: 1 <= id <=9
  • The parameter "moveType" indicates the interpolation method used by this instruction; 1: Joint interpolation; 2: Linear interpolation; 3: Circular interpolation
  • The parameter "vel" indicates the running speed of the robot; when the interpolation method is joint interpolation, it is the percentage of the maximum speed of the robot, parameter range: 0 < vel <= 100; when the interpolation method is linear interpolation or circular interpolation, it is the absolute running speed of the robot TCP, the unit is mm/s, parameter range: vel > 1
  • The parameter "acc" indicates the robot running acceleration, parameter range: 0 < acc <= 100; when the interpolation method is joint interpolation, it is the percentage of the maximum acceleration of each joint of the robot; when the interpolation method is linear interpolation or circular interpolation, it is the percentage of the robot's maximum Cartesian acceleration
  • The parameter "dec" indicates the robot running deceleration, parameter range: 0 < dec <= 100; when the interpolation method is joint interpolation, it is the percentage of the maximum deceleration of each joint of the robot; when the interpolation method is linear interpolation or circular interpolation, it is the percentage of the robot's maximum Cartesian deceleration
  • The parameter "pl" represents the smoothness, which refers to the smooth transition between the current and the next movement instructions. The higher the value of pl, the smoother the transition, but the greater the trajectory deviation. The range of the parameter is 0 <= pl <= 5

Insert PALOFF

This function is used to judge the end of palletizing. Call the function NRC_RunqueueInsertPALOFF(int id, int var=0) to insert the PALOFF instruction in the run queue. This function needs to be used in conjunction with NRC_RunqueueInsertPALON(int id, int type, int var1, int var2, int var3).

  • The parameter "id" indicates the process number of the palletizing process, parameter range: 1 <= id <=9
  • The parameter "var" is used for palletizing end judgment, 0 means no storage, 1-100 means variables GA001-GA100, parameter range: 0 <= var <= 100

Insert PALGRIPPER

This function is used to select the gripper. Call the function NRC_RunqueueInsertPALGRIPPER(int id, int tool) to insert the PALGRIPPER instruction in the run queue.

  • The parameter "id" indicates the process number of the palletizing process, parameter range: 1 <= id <=9
  • The parameter "tool" refers to the number of the gripper to be replaced, parameter range: 1 <= id <= 4

Insert PALCLEAR

This function is used to reset palletizing and clear the palletizing state. Call the function NRC_RunqueueInsertPALCLEAR(int id) to insert the PALCLEAR instruction in the run queue.

  • The parameter "id" indicates the process number of the palletizing process, parameter range: 1 <= id <=9

Insert PALENTER

Make relevant settings for the palletizing entry point. Call the function NRC_RunqueueInsertPALENTER(int id, int moveType, int vel, int acc, int dec, int pl=0) to insert the PALENTER instruction in the run queue.

  • The parameter "id" indicates the process number of the palletizing process, parameter range: 1 <= id <=9
  • The parameter "moveType" indicates the interpolation method used by this instruction; 1: Joint interpolation; 2: Linear interpolation; 3: Circular interpolation
  • The parameter "vel" indicates the running speed of the robot; when the interpolation method is joint interpolation, it is the percentage of the maximum speed of the robot, parameter range: 0 < vel <= 100; when the interpolation method is linear interpolation or circular interpolation, it is the absolute running speed of the robot TCP, the unit is mm/s, parameter range: vel > 1
  • The parameter "acc" indicates the robot running acceleration, parameter range: 0 < acc <= 100; when the interpolation method is joint interpolation, it is the percentage of the maximum acceleration of each joint of the robot; when the interpolation method is linear interpolation or circular interpolation, it is the percentage of the robot's maximum Cartesian acceleration
  • The parameter "dec" indicates the robot running deceleration, parameter range: 0 < dec <= 100; when the interpolation method is joint interpolation, it is the percentage of the maximum deceleration of each joint of the robot; when the interpolation method is linear interpolation or circular interpolation, it is the percentage of the robot's maximum Cartesian deceleration
  • The parameter "pl" represents the smoothness, which refers to the smooth transition between the current and the next movement instructions. The higher the value of pl, the smoother the transition, but the greater the trajectory deviation. The range of the parameter is 0 <= pl <= 5

Insert PALSHIFT

Make relevant settings for the palletizing auxiliary point. Call the function NRC_RunqueueInsertPALSHIFT(int id, int moveType, int vel, int acc, int dec, int pl=0) to insert the PALSHIFT instruction in the run queue.

  • The parameter "id" indicates the process number of the palletizing process, parameter range: 1 <= id <=9
  • The parameter "moveType" indicates the interpolation method used by this instruction; 1: Joint interpolation; 2: Linear interpolation; 3: Circular interpolation
  • The parameter "vel" indicates the running speed of the robot; when the interpolation method is joint interpolation, it is the percentage of the maximum speed of the robot, parameter range: 0 < vel <= 100; when the interpolation method is linear interpolation or circular interpolation, it is the absolute running speed of the robot TCP, the unit is mm/s, parameter range: vel > 1
  • The parameter "acc" indicates the robot running acceleration, parameter range: 0 < acc <= 100; when the interpolation method is joint interpolation, it is the percentage of the maximum acceleration of each joint of the robot; when the interpolation method is linear interpolation or circular interpolation, it is the percentage of the robot's maximum Cartesian acceleration
  • The parameter "dec" indicates the robot running deceleration, parameter range: 0 < dec <= 100; when the interpolation method is joint interpolation, it is the percentage of the maximum deceleration of each joint of the robot; when the interpolation method is linear interpolation or circular interpolation, it is the percentage of the robot's maximum Cartesian deceleration
  • The parameter "pl" represents the smoothness, which refers to the smooth transition between the current and the next movement instructions. The higher the value of pl, the smoother the transition, but the greater the trajectory deviation. The range of the parameter is 0 <= pl <= 5

Demo program for palletizing process with run queue

#include <iostream>
#include "nrcAPI.h"
#include<stdio.h>
using namespace std;
int main()
{
SystemStartup();//System startup, see section 3.3 for details
RobotMsg();
SetServoMap();//Set the servo mapping relationship, see section 3.5
SettingofRobotRelatedParameters();//Robot-related parameter settings, see section 3.6 for details
//////The above call functions can be found in Appendix I/////
NRC_SetServoReadyStatus(1);//Set servo ready status, see section 3.8 for details
NRC_SetInterpolationMethod(1);//Set to S-shaped interpolation, see section 3.12 for details
NRC_SetOperationMode(NRC_RUN_);//Set the operation mode to run mode, see section 3.11 for details
NRC_SetAutoRunSpeedPer(80);//Set the auto-run speed to 80, see section 3.11 for details
NRC_Delayms(1000);//Delay 1000ms
//Set four points (using the new version of definition)
double pos1[7] = { 296.71, -66.12, 606.38, 3.06, 0.15, -0.18,0.00 };
double pos2[7] = { 303.3191, 20.0862, 606.3863, 3.1038, 0.1630, -0.4658,0.0000 };
double pos3[7] = { 315.4386, 21.1369, 595.0522, 3.1006, 0.1196, -0.4678,0.0000 };
double pos4[7] = { 315.6836, -16.5291, 595.0751, 3.0866, 0.1140, -0.3479,0.0000 };
NRC_Position inexbot1 = { NRC_MCS,0,0,0,pos1 };
NRC_Position inexbot2 = { NRC_MCS,0,0,0,pos2 };
NRC_Position inexbot3 = { NRC_MCS,0,0,0,pos3 };
NRC_Position inexbot4 = { NRC_MCS,0,0,0,pos4 };
NRC_Position dev1 = { NRC_ACS,0,0,0,devPos1 }; //Set the deviation of dev1
NRC_Position dev2 = { NRC_MCS,0,0,0,devPos2 }; //Set the deviation of dev2
NRC_Position inexbot9;//Define the robot position structure object inexbot9
NRC_GetCurrentPos(NRC_MCS, inexbot9);//Assign the Cartesian coordinate system of the current robot to inexbot9
printf("inexbot9.pos=%f,%f,%f,,%f,%f,%f,%f,\n", inexbot9.pos[0], inexbot9.pos[1], inexbot9.pos[2], inexbot9.pos[3], inexbot9.pos[4], inexbot9.pos[5], inexbot9.pos[6]);//Output the current Cartesian coordinate position
int id = 1;
NRC_Pallet_SetUsePalletType(id, 0);//Set to simple palletizing with a process number of 1
cout << "NRC_Pallet_GetUsePalletType : " << NRC_Pallet_GetUsePalletType(1) << endl;
NRC_Position pos[] =
{
{NRC_MCS, {401, 301, 201, 3.14159, 0, 0,0}},
{NRC_MCS, {401, -299, 201,3.14159, 0, 0,0}},
{NRC_MCS, {201, 301, 201, 3.14159, 0, 0,0}},
{NRC_MCS, {401, 301, 301, 3.14159, 0, 0,0}},
{NRC_MCS, {401, 301, 211, 3.14159, 0, 0,0}},
{NRC_MCS, {401, 301, 221, 3.14159, 0, 0,0}},
};
for (int i=0; i<6; i++)
NRC_Pallet_SetSimplePosParm(id, i, pos[i]);//Set the position data of simple palletizing
for (int i=0; i<6; i++)
{
NRC_Position pos;
NRC_Pallet_GetSimplePosParm(id, i, pos);
}
NRC_Pallet_SetSimpleNumParm(id, 3, 2, 3);
int x=0,y=0,z=0;
NRC_Pallet_GetSimpleNumParm(id, x, y, z);
cout << "x=" << x << ", y=" << y << ",z=" << z << endl;
NRC_Delayms(2000);
//Implement palletizing process using run queue
NRC_ServoEnable() ;//Servo power on
NRC_CreateNoFlieRunqueue();
NRC_RunqueueInsertPALCLEAR(1);//Clear previous palletizing data
NRC_RunqueueInsertMOVJ(50, 50,50,inexbot1, 4);//Move to inexbot1 in a point-to-point manner (pickup entry point)
NRC_RunqueueInsertMOVJ(50,50,50, inexbot2, 4);//Move to inexbot2 in a point-to-point manner (pickup auxiliary point)
NRC_RunqueueInsertMOVJ(50,50,50,inexbot3, 4);//Move to inexbot3 in a point-to-point manner (pickup workpiece point)
NRC_RunqueueInsertDOUT(3, 1);//Port 3 outputs high level
NRC_RunqueueInsertPALON(1, 0, 0,0, 0);//Palletizing process 1, palletizing, var1=0, var2=0, var3=0 (palletizing start judgment)
NRC_RunqueueInsertPALENTER(1, 1, 100,80,80,5);//Palletizing process 1, joint interpolation, vel=100mm/s, PL=5 (palletizing entry point)
NRC_RunqueueInsertPALSHIFT(1, 1, 50,80,80,5);//Palletizing process 1, joint interpolation, vel=50mm/s, PL=5 (palletizing auxiliary point)
NRC_RunqueueInsertPALREAL(1, 1, 50,80,80,5);//Palletizing process 1, joint interpolation, vel=50mm/s, PL=5 (palletizing workpiece point)
NRC_RunqueueInsertTIMER(5.5);//Wait 5.5s
NRC_RunqueueInsertPALOFF(1, 0);//Palletizing end judgment
NRC_StartRunNoFlieRunqueue();
NRC_SetCycleIndex(3);//Cycle 3 times
while(NRC_GetProgramRunStatus() != 0) //Wait for the run to finish
{
NRC_Delayms(100); //Delay 100ms
printf("line=%d,time=%d\n",NRC_GetRunqueueCurrentRunLine(),NRC_GetCycleTimeSec());
}
NRC_Delayms(1000);
NRC_ServoDisable(); //Servo power off
NRC_Position inexbot5;//Define the robot position structure object inexbot5
NRC_GetCurrentPos(NRC_MCS, inexbot5);//Assign the Cartesian coordinate system of the current robot to inexbot5
printf("inexbot5.pos=%f,%f,%f,,%f,%f,%f,%f,\n",inexbot5.pos[0],inexbot5.pos[1],inexbot5.pos[2],inexbot5.pos[3],inexbot5.pos[4],inexbot5.pos[5],inexbot5.pos[6]);//Output the current Cartesian coordinate position
while(1)//Keep the program running
{
NRC_Delayms(1000);
}
}

Demo program for palletizing process in append mode

#include <iostream>
#include "nrcAPI.h"
#include<stdio.h>
using namespace std;
int main()
{
SystemStartup();//System startup, see section 3.3 for details
SetServoMap();//Set the servo mapping relationship, see section 3.5 for details
SettingofRobotRelatedParameters();//Robot-related parameter settings, see section 3.6 for details
//////The above call functions can be found in Appendix I/////
NRC_SetServoReadyStatus(1);//Set servo ready status, see section 3.8 for details
NRC_SetInterpolationMethod(1);//Set to S-shaped interpolation method
NRC_SetOperationMode(NRC_RUN_);//Set the operation mode to run mode, see section 3.11 for details
NRC_SetAutoRunSpeedPer(80);//Set the auto-run speed to 80, see section 3.11 for details
NRC_Delayms(1000);//Delay 1000ms
//Set four points (using the new version of definition)
double pos1[7] = { 296.71, -66.12, 606.38, 3.06, 0.15, -0.18,0.00 };
double pos2[7] = { 303.3191, 20.0862, 606.3863, 3.1038, 0.1630, -0.4658,0.0000 };
double pos3[7] = { 315.4386, 21.1369, 595.0522, 3.1006, 0.1196, -0.4678,0.0000 };
double pos4[7] = { 315.6836, -16.5291, 595.0751, 3.0866, 0.1140, -0.3479,0.0000 };
NRC_Position inexbot1 = { NRC_MCS,0,0,0,pos1 };
NRC_Position inexbot2 = { NRC_MCS,0,0,0,pos2 };
NRC_Position inexbot3 = { NRC_MCS,0,0,0,pos3 };
NRC_Position inexbot4 = { NRC_MCS,0,0,0,pos4 };
double devPos1[7] = { 10, 20, -10, 10, 0, 0 };
double devPos2[7] = { -50, 50, 10, 0, 0, 0.1 };
NRC_Position dev1 = { NRC_ACS,0,0,0,devPos1 }; //Set the deviation of dev1
NRC_Position dev2 = { NRC_MCS,0,0,0,devPos2 }; //Set the deviation of dev2
NRC_Position inexbot9;//Define the robot position structure object inexbot9
NRC_GetCurrentPos(NRC_MCS, inexbot9);//Assign the Cartesian coordinate system of the current robot to inexbot9
printf("inexbot9.pos=%f,%f,%f,,%f,%f,%f,%f,\n", inexbot9.pos[0], inexbot9.pos[1], inexbot9.pos[2], inexbot9.pos[3], inexbot9.pos[4], inexbot9.pos[5], inexbot9.pos[6]);//Output the current Cartesian coordinate position
int id = 1;
NRC_Pallet_SetUsePalletType(id, 0);//Set to simple palletizing with a process number of 1
cout << "NRC_Pallet_GetUsePalletType : " << NRC_Pallet_GetUsePalletType(1) << endl;
NRC_Position pos[] =
{
{NRC_MCS, {401, 301, 201, 3.14159, 0, 0,0}},
{NRC_MCS, {401, -299, 201,3.14159, 0, 0,0}},
{NRC_MCS, {201, 301, 201, 3.14159, 0, 0,0}},
{NRC_MCS, {401, 301, 301, 3.14159, 0, 0,0}},
{NRC_MCS, {401, 301, 211, 3.14159, 0, 0,0}},
{NRC_MCS, {401, 301, 221, 3.14159, 0, 0,0}},
};
for (int i=0; i<6; i++)
NRC_Pallet_SetSimplePosParm(id, i, pos[i]);//Set the position data of simple palletizing
for (int i=0; i<6; i++)
{
NRC_Position pos;
NRC_Pallet_GetSimplePosParm(id, i, pos);
}
NRC_Pallet_SetSimpleNumParm(id, 3, 2, 3);
int x=0,y=0,z=0;
NRC_Pallet_GetSimpleNumParm(id, x, y, z);
cout << "x=" << x << ", y=" << y << ",z=" << z << endl;
NRC_Delayms(2000);

//Implement palletizing in append mode
NRC_OpenInstrAppendRunMode();//Turn on the append run mode, and the robot is automatically enabled
std::vector<NRC_InstrDataBase*> inexbot;
inexbot.push_back(new NRC_InstrDataMOVJ(100,50,50, inexbot1, 5));//Move to inexbot1 in a point-to-point manner (pickup entry point)
inexbot.push_back(new NRC_InstrDataMOVJ(100, 50,50,inexbot2, 5));//Move to inexbot2 in a point-to-point manner (pickup auxiliary point)
inexbot.push_back(new NRC_InstrDataMOVJ(100,50,50, inexbot3, 5));//Move to inexbot3 in a point-to-point manner (pickup workpiece point)
inexbot.push_back(new NRC_InstrDataPALON(1, 0, 1, 2, 3));//Palletizing process 1, palletizing, var1=1, var2=2, var3=3
inexbot.push_back(new NRC_InstrDataPALENTER(1, 1, 50,80,80,3));//Palletizing process 1, vel=50mm/s, PL=3 (palletizing entry point)
inexbot.push_back(new NRC_InstrDataPALSHIFT(1, 1, 50,80,80,3));//Palletizing process 1, joint interpolation, vel=50mm/s, PL=3 (palletizing auxiliary point)
inexbot.push_back(new NRC_InstrDataPALREAL(1, 2, 100,80,80,3));//Palletizing process 1, joint interpolation, vel=50mm/s, PL=3 (palletizing workpiece point)
inexbot.push_back(new NRC_InstrDataTIMER(1));
inexbot.push_back(new NRC_InstrDataPALOFF(1, 1));//Palletizing end judgment
NRC_AppendRunInstr(inexbot);//A set of instruction data to be inserted into the queue. After adding the queue, the robot will run the added queue directly.
while(NRC_GetProgramRunStatus() != 0) //Wait for the run to finish
{
NRC_Delayms(1000); //Delay 1000ms
}
NRC_Position inexbot8;//Define the robot position structure object inexbot8
NRC_GetCurrentPos(NRC_MCS, inexbot8);//Assign the Cartesian coordinate system of the current robot to inexbot8
printf("inexbot8.pos=%f,%f,%f,%f,%f,%f,%f,\n",inexbot8.pos[0],inexbot8.pos[1],inexbot8.pos[2],inexbot8.pos[3],inexbot8.pos[4],inexbot8.pos[5],inexbot8.pos[6]);//Output the current Cartesian coordinate position
NRC_StopInstrAppendRun();//Stop append run
while(1)//Keep the program running
{
NRC_Delayms(1000);
}
}