RobotStudio event

2 Home positions



Need to make dual home positions using current system setup, but im not used to the way the current home position is done. "What is CJointT() ??????"
 
!
PROC control_reposo()
! Verificacion robot en posicion reposo y mantenimiento
! Reposo robot
jposActual_rob:=CJointT();
nDif_pos1:=Abs(jpos_Home_rob.robax.rax_1-jposActual_rob.robax.rax_1)+Abs(jpos_Home_rob.robax.rax_2-jposActual_rob.robax.rax_2);
nDif_pos2:=Abs(jpos_Home_rob.robax.rax_3-jposActual_rob.robax.rax_3)+Abs(jpos_Home_rob.robax.rax_4-jposActual_rob.robax.rax_4);
nDif_pos3:=Abs(jpos_Home_rob.robax.rax_5-jposActual_rob.robax.rax_5)+Abs(jpos_Home_rob.robax.rax_6-jposActual_rob.robax.rax_6);
nDif_pos:=nDif_pos1+nDif_pos2+nDif_pos3;
IF Abs(nDif_pos)<1 THEN
Set do_Home;
b_robot_home:=TRUE;
ELSE
Reset do_Home;
b_robot_home:=FALSE;
ENDIF
! Posicio mantenimiento
jposActual_rob:=CJointT();
nDif_pos1:=Abs(jpos_Mainten_rob.robax.rax_1-jposActual_rob.robax.rax_1)+Abs(jpos_Mainten_rob.robax.rax_2-jposActual_rob.robax.rax_2);
nDif_pos2:=Abs(jpos_Mainten_rob.robax.rax_3-jposActual_rob.robax.rax_3)+Abs(jpos_Mainten_rob.robax.rax_4-jposActual_rob.robax.rax_4);
nDif_pos3:=Abs(jpos_Mainten_rob.robax.rax_5-jposActual_rob.robax.rax_5)+Abs(jpos_Mainten_rob.robax.rax_6-jposActual_rob.robax.rax_6);
nDif_pos:=nDif_pos1+nDif_pos2+nDif_pos3;
IF Abs(nDif_pos)<1 THEN
Set do_Maintenance;
ELSE
Reset do_Maintenance;
ENDIF
WaitTime 0.05;
ENDPROC
ENDMODULE
Regards
Rob

Comments

  • Hi,
     

    Definition from the RAPID manual:

    This function (CJointT) reads the current angle of the robot axes and external axes.

     

    So what the program is doing is getting the current angle of each axis and subtracting this from the home postions axis angles.

    If the over all result for all 6 axis is less than 1 the robot is said to be at the home postion, if it is greater than 1 it is not at home.

     

    Hope this helps

    Graeme
    graemepaulin2011-08-09 02:33:13


  • thankyou Graeme
     
    is it possible to have 2 defined home positions in that way
    or can you only use the function once?
     
    Thanks Rob 
    Regards
    Rob
  • Hi,
     

    I have updated my post above as I gave the definition for CRobT (reads current position)not CJointT (reads current axes angle). The functionality of the code is the same.

     

    You can use the CRobT function as often as you want.

     

    If you have 2 home postions, and you do not care which one the robot is at you can add another calculation for the second postion then nest a second IF statement to check if the robot is at the second home postion if it is not at the first.

    For example (I have assumed the result of the calculation for the second home postion is called nDif_pos2):

    IF Abs(nDif_pos)<1 THEN<?: prefix = o ns = "urn:schemas-microsoft-com:office:office" />

    Set do_Home;

    b_robot_home:=TRUE;

    ELSEIF Abs(nDif_pos2)<1 THEN

    Set do_Home;

    b_robot_home:=TRUE;

    ESLE

    Reset do_Home;

    b_robot_home:=FALSE;

    ENDIF

     

    Regards

    Graeme