RobotStudio event

CalculateInverseKinematics in PC SDK

Options
Is there a way to do a CalculateInverseKinematics on all set of targets through the PC SDK. i want to know the joint rotation and if the target is reachable through a remote program and not from robot studio.  If not is there a way to remotely send to robot studio a list of targets and get the joint rotation back and null is the target is not reachable. I know I can do this as an add-in in robot studio, but I need to do this from a sperate application that could talk to robot studio. 

I tried even running an instance of robot studio without the gui b opening a station file and connecting to it then trying to do the 
CalculateInverseKinematics bu no matter what task I sent the station I got "null exception" even though nothing was null  

Comments

  • John_Verheij
    Options
    The PC SDK does not provide functions for these calculations. A possible solution is to call RAPID code (with the PC SDK). In this case you can use the RAPID function CalcJointT, which calculates the joint angles from a robtarget. Furthermore, this function can give error constants like ERR_ROBLIMIT (to indicate that at least one axis is outside the joint limits) and ERR_OUTSIDE_REACH (to indicate that the position is outside the robot's working area).
  • cerver
    Options
    thanks for the reply. so if i understand you correct i would

    have a CalcJointT rapid command in my program

    request mastership
    get the calJoint line (GetRapidData() )
    then loop through each target 
    edit the calcJointT for each target 
    run the line ? (would this be Play()??)

    what i do not understand is how do i get the result back?  would you have an example of this? 

  • John_Verheij
    Options
    You can do something like this:

    <div>&nbsp; ! write<br></div><div>&nbsp; PERS bool bCalculatePCSDK := TRUE;<br></div><div>&nbsp; PERS robtarget TargetPCSDK := [[1000,0,400],[0,1,0,0],[0,0,0,0],[9e9,9e9,9e9,9e9,9e9,9e9]];<br></div><div>&nbsp;&nbsp;<br></div><div>&nbsp; ! read<br></div><div>&nbsp; PERS num StatusPCSDK := 0;<br></div><div>&nbsp; PERS jointtarget JointPCSDK := [[0,25.8278,29.6756,0,34.4967,180],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];<br></div><div>&nbsp;&nbsp;<br></div><div>&nbsp; PROC main()<br></div><div>&nbsp; &nbsp; VAR errnum nErrorNum;<br></div><div>&nbsp; &nbsp;&nbsp;<br></div><div>&nbsp; &nbsp; WHILE TRUE DO<br></div><div>&nbsp; &nbsp; &nbsp; IF bCalculatePCSDK THEN<br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; JointPCSDK := CalcJointT(TargetPCSDK, tool0\ErrorNumber:=nErrorNum);<br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; IF nErrorNum = ERR_ROBLIMIT THEN<br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; StatusPCSDK := -1;<br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; ELSEIF nErrorNum = ERR_OUTSIDE_REACH THEN<br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; StatusPCSDK := -2;<br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; ELSE<br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; StatusPCSDK := 0;<br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; ENDIF<br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; bCalculatePCSDK := FALSE;<br></div><div>&nbsp; &nbsp; &nbsp; ENDIF<br></div><div>&nbsp; &nbsp; ENDWHILE<br>&nbsp; ENDPROC</div>


    With the PC-SDK you can set the robtarget and the bool. The Rapid code will calculate the angles and set the status. Afterwards you can read the status and the jointtarget.