Hi.I have 2 robots working together putting 1 sheet each on a conveyor. Im trying to figure out how to place the sheets on a conveyor with as high accuracy as possible. The sheets can be out of angle and position from each other. Today im solving this with 3 sensors mounted on the conveyor, and some searchL and math to calculate the angle and XY position offset. It works pretty good but it takes to much time since the robots has to wait for their turn to do the search routines over the conveyor which is the common working area. My wish is that each robot has to figure out the angle and position offset outside of the conveyor area. Either by installing 3 sensors for each robot doing the same search routines or by a vision camera. My question is how would you approach my problem. As you can see in my code i use XYZ offset in the end but that wont work with my new plan.
My code summarized:
!*** Finding Angle ***!
!Distance between the anglesensors (Adjacent side)
nDistance_Sensors_Adjacent_Side := 2000;
!Moving to start position and starting the search
MoveL pCheckAngle_L_Start, vmedium, fine, tLaminateRobot2;
SearchL\Stop, giAngleSensors, pCheckAngle_L_Pos1, pCheckAngle_L_End, vSearch, tLaminateRobot2;
IF diAngleSensor1=1 AND diAngleSensor2=0 THEN
SearchL\Stop, diAngleSensor2, pCheckAngle_L_Pos2, pCheckAngle_L_End, vSearch, tLaminateRobot2;
nAngle_Rotation:=-1;
ELSEIF diAngleSensor1=0 AND diAngleSensor2=1 THEN
SearchL\Stop, diAngleSensor1, pCheckAngle_L_Pos2, pCheckAngle_L_End, vSearch, tLaminateRobot2;
nAngle_Rotation:=1;
ELSEIF diAngleSensor1=1 AND diAngleSensor2=1 THEN
pCheckAngle_L_Pos2:=pCheckAngle_L_Pos1;
ENDIF
!Calculating opposite side
nLength_Opposite_Side := pCheckAngle_L_Pos1.trans.x-pCheckAngle_L_Pos2.trans.x;
!Calulating the angle with the atan function
nLaminate_Angle := Atan(nLength_Opposite_Side/nDistance_Sensors_Adjacent_Side);
nLaminate_Angle:=nLaminate_Angle*nAngle_Rotation;
pCurrent_Laminate_Position:=CRobT(\Tool:=tLaminateRobot2);
!*** Finding position in X ***!
pCheckPosition_L_START := RelTool(pCurrent_Laminate_Position,0,0,0\Rz:=nLaminate_Angle);
pCheckPosition_L_START := Offs(pCheckPosition_L_START,150,0,0);
pCheckPosition_L_END_X := Offs(pCheckPosition_L_START,-200,0,0);
MoveL pCheckPosition_L_START, vfast, fine, tLaminateRobot2;
SearchL\Stop, giAngleSensors, pCheckPosition_L_PosX, pCheckPosition_L_END_X, vSearch, tLaminateRobot2;
!*** Finding position in Y ***!
pCurrent_Laminate_Position:=CRobT(\Tool:=tLaminateRobot2);
pCheckPosition_L_END_Y := Offs(pCurrent_Laminate_Position,0,200,0);
SearchL\Stop, diTableSensor_Y, pCheckPosition_L_PosY, pCheckPosition_L_END_Y, vSearch, tLaminateRobot2;
pCurrent_Laminate_Position:=CRobT(\Tool:=tLaminateRobot2);
!*** Placing laminate ***!
nPlace_L_OffsetZ:=pCurrent_Laminate_Position.trans.z-pPLACE_L_ZERO.trans.z;
MoveL Offs(pCurrent_Laminate_Position,150,150,0), vmedium, fine, tLaminateRobot2;
MoveL Offs(pCurrent_Laminate_Position,150,150,-100), vmedium, fine, tLaminateRobot2;
Release_Laminate;