convert position register to Joint angles

  • Do you need that cartesian representation anywhere else, or you just want to have the joint representation regardless?


    If the latter, you can just use this code to initialize a posreg in JOINT representation:


    Code
    PR[...]=JPOS-JPOS


    in this case, you get a PR which stores joint coordinates and holds 0 for each of them. Any operation on the coordinates will refer to joints, until you change the type of the PR.


    For example, if you want to store a position in the PR in JOINT and then change one of its coordinates and move to the new position, you write sth like this:


    Code
    PR[1]=JPOS-JPOS
    PR[1]=P[1]
    PR[1,6]=PR[1,6]+60
    J PR[1] 100% FINE


    This will initialize the PR[1] as described above, write the position stored in the P[1] to PR[1], add 60 degrees to the J6's coordinate and then move the robot to that new position stored in PR[1]. The effect will be moving the robot to P1 with +60deg difference in J6.


    If you use the P[1] directly before the coordinate change operation, you can also do it like this:


    Code
    J P[1] 100% FINE
    PR[1]=JPOS
    PR[1,6]=PR[1,6]+60
    J PR[1] 100% FINE


    This will first move the robot to P[1] (FINE is very important here!!!), store the current position of the robot as joints to PR[1], add 60deg to J6's position and then move the robot to that new position. The effect will be a movement to P[1] and then a J6 rotation by exactly +60deg.

    Edited once, last by bidzej ().

  • What I would like to do is take a position that was captured already in Cartesian and then convert that PR to joint angles example:
    PR[1]=LPOS
    convert LPOS to JPOS


    I do realize that you can just read the position directly in the Joint angle format by using
    PR[1]=JPOS


    but I would like to convert the position possible when the robot is not physically at that position


    Thanks

  • :hmmm:


    Then I guess the fastest way is writing a simple KAREL program, as KAREL has a dedicated functions for converting JOINT to XYZWPR and the other way around. It could use an argument to specify which PR you want to convert...


  • :hmmm:


    Then I guess the fastest way is writing a simple KAREL program, as KAREL has a dedicated functions for converting JOINT to XYZWPR and the other way around. It could use an argument to specify which PR you want to convert...


    I found that Karel will convert without the dedicated functions. You can do something like this and it will work:


    Code
    xyz_pos     : XYZWPREXT
    jpos           : JOINTPOS
    -- Next two lines are what the conversion from XYZWPR to JPOS (jpos=lpos) uses.
    $UFRAME = $MOR_GRP[1].$NILPOS
    $UTOOL = $MNUTOOL[1,prog_utool]
    jpos = xyz_pos

    Check out the Fanuc position converter I wrote here! Now open source!

    Check out my example Fanuc Ethernet/IP Explicit Messaging program here!

Advertising from our partners