Items position before pickarea [PickMaster 3]

We have system where is long distance (ca.4 meter) from camera to picking robot (IRB1600). We like to know is there accepted item near pickareas enter-limit or can we start do something else with robot.
I think it’s possible to expand pickarea and move it’s enter-limit 2 meter to -X direction.
If we can then check with Rapid-code is item near? Is this good idea or is there some other way to do this kind of “pre” check?
How i can get item’s position between camera and robot?

Pasi,

You can use some rapid code for that.

First read the baseframe distance:

!***********************************************************
!
! Procedure ReadCnv
!
! Reads the conveyors base frame distance and angle
!
!***********************************************************
PROC ReadCnv1()
VAR orient CnvOrient:=[1,0,0,0];
VAR pos CnvBFPos;
ReadCfgData “/MOC/SINGLE/CNV1”,“base_frame_orient_u0”,CnvOrient.q1;
ReadCfgData “/MOC/SINGLE/CNV1”,“base_frame_orient_u1”,CnvOrient.q2;
ReadCfgData “/MOC/SINGLE/CNV1”,“base_frame_orient_u2”,CnvOrient.q3;
ReadCfgData “/MOC/SINGLE/CNV1”,“base_frame_orient_u3”,CnvOrient.q4;
Cnv1Angle:=EulerZYX(,CnvOrient);
ReadCfgData “/MOC/SINGLE/CNV1”,“base_frame_pos_x”,CnvBFPos.x; ; ;
ReadCfgData “/MOC/SINGLE/CNV1”,“base_frame_pos_y”,CnvBFPos.y; ; ;
IF Abs(CnvBFPos.x) > Abs(CnvBFPos.y) THEN
Cnv1BFdist:=Abs(CnvBFPos.x)*1000;
ELSE
Cnv1BFdist:=Abs(CnvBFPos.y)*1000;
ENDIF
ENDPROC

Then you can check the distance of your item relative to the robot:

!***********************************************************
!
! Function GetRealPos
!
! Reads the item’s position relative the robot center
!
!***********************************************************
FUNC num GetRealPos(num Index, itmtgt ItemTarget)
VAR num CnvPos:=0;
VAR num BFDist:=0;
VAR num RealPos:=0;

IF ItmSrcData{Index}.Wobj.ufmec = “CNV1” THEN
CnvPos:=c1Position1000;
BFDist:=Cnv1BFdist;
ELSEIF ItmSrcData{Index}.Wobj.ufmec = “CNV2” THEN
CnvPos:=c2Position
1000;
BFDist:=Cnv2BFdist;
ELSEIF ItmSrcData{Index}.Wobj.ufmec = “CNV3” THEN
CnvPos:=c3Position1000;
BFDist:=Cnv3BFdist;
ELSEIF ItmSrcData{Index}.Wobj.ufmec = “CNV4” THEN
CnvPos:=c4Position
1000;
BFDist:=Cnv4BFdist;
ELSEIF ItmSrcData{Index}.Wobj.ufmec = “CNV5” THEN
CnvPos:=c5Position1000;
BFDist:=Cnv5BFdist;
ELSEIF ItmSrcData{Index}.Wobj.ufmec = “CNV6” THEN
CnvPos:=c6Position
1000;
BFDist:=Cnv6BFdist;
ENDIF
RealPos:=CnvPos+ItemTarget.RobTgt.trans.x-BFDist;

RETURN RealPos;
ENDFUNC

Good luck!

/Mats

Pasi,

Feel free to use the whole utility module from another thread, which includes the code.

http://forums.robotstudio.com/forum_posts.asp?T ID=1467&KW=utility

/Mats