Rotating a User Frame by its own Z axis

  • I am trying to rotate a user frame around its own Z axis using TP. I know this is easy to do in Karel, but I do not have the luxury. Has anyone done anything like this before?

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

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

  • Place your Ad here!
  • That works if the the user frame's z axis is lined up with the robot's z axis, but I need to rotate around the user frame's z axis for a frame in any orientation relative to the robot's coordinate system. A general solution.

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

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

  • I have found two ways to do this, a good way and a hacky way.


    Good way: If you purchase the vision support tool option, which is cheap, it includes a matrix math function. Done.


    Hacky way: Move the robot to the origin point, with an R offset applied. Set UFrame_num=0, then record LPOS into a PR. Finally, set your UF = to that PR. (In fact it doesn't even have to be at the origin, but that reduces the math you need to do.)


    Sent from my VS985 4G using Tapatalk

    Edited once, last by HawkME ().


  • Hacky way: Move the robot to the origin point, with an R offset applied. Set UFrame_num=0, then record LPOS into a PR. Finally, set your UF = to that PR. (In fact it doesn't even have to be at the origin, but that reduces the math you need to do.)


    I was originally considering going this way, but while manipulating the $MCR_GRP[1].$MACHINELOCK to lock motion while I did the move, so it was hidden from the user. I didn't as it felt really hacky, as you said.


    I did find a way to do it without buying anything, and in TP. I do it by using the matrix representation of a PR to do matrix multiplication manually. Nice thing about this code, is that with two line changes, you can tell it to rotate about a user frame's X or Y axis as well.


    Here is my code:

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

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

    Edited once, last by Nation ().

  • Nice bit of code there and free is always good!


    The Vision Support Tools is about $200 list price and includes some other nice functions. If you are interested here is what the same code looks like with that option.



    Simple case of rotating 90 degrees.


    Code
    :  PR[3:A MATRIX]=UFRAME[1] ; <-could use Argument here
    :;
    :  PR[4]=PR[4]-PR[4];
    :  PR[4,3]=90; <-could use argument here
    :;
    :  !PR5 = PR3*PR4, R6=ERR CODE ;
    :  CALL MATRIX(3,4,5,6) ;
    :  UFRAME[1]=PR[5:C MATRIX] ;
  • Ha, pretty amazing to see the ~70 lines of code reduced to 6.


    For $200 I should have just went that route. Probably a wash at that price. I assumed it would be the Fanuc standard of $500.


    Kinda of annoying that on the R30iA controller I could have just dropped in the matrix.pc file and been done. At least this was an interesting challenge.

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

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

  • I know this is easy to do in Karel, but I do not have the luxury.

    I do have the luxury, but am wondering how you would achieve this in an easy way in Karel? I can handle rotation matrices, but I'm new to computations/manipulations with rotations expressed in euler angles.


    My approach would be:

    1) manually express the user frame's WPR rotation as a rotation matrix R_uf

    2) multiplying matrix R_uf by a rotation matrix around the specified axis (R_z in your example) to get R_uf' = R_uf*Rz

    3) translating R_uf' back into WPR/euler angle representation.


    I'm interested to know if I can save some complexity here


    EDIT:

    The penny might just have dropped.. Would this work:

    1) create a new XYZWPR P at the user frame's origin, with the desired rotation around Z (all elements 0, except P.R=[angle])

    2) express the position in world coordinates (UF : P)

    3) set the outcome as a user frame


    and it's as simple as that?

    EDIT2: yes it is! just tested it

    Edited 2 times, last by hoitzing: tested ().

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now

Advertising from our partners