TransL and RotX function behavior?

  • I've been trying to emulate the behavior of a real-world KUKA KR16 in RoboDK, and run into something very strange (at least, to me).


    This robot moves to several hand-taught positions, and then runs a mathematically-generated several-hundred-point motion pattern. The motion is a sort of "corkscrew" motion along the Tool X axis and rotating around the Tool X axis. The corkscrew pattern is a series of offsets from the hand-taught Start Position.


    In my RoboDK cell, I've been able to establish the Base, Tool, and hand-teach the starting points. I've also hand-taught a few of the mathematically-generated points, just as a sanity check.


    To carry out the corkscrew pattern, I have a Python script that, when called from the RDK program, takes the robot pose (using robot.Pose()) and uses transl and rotx in a simple FOR loop.


    The strange behavior I'm seeing is that, when I execute target_i = target_ref * transl(LinOffset,0,0) * rotx(-RotOffset) with a LinOffset value of 0, the TCP rotates in the correct direction. But, if LinOffset has any non-zero value, the TCP rotates in the opposite direction, even though RotOffset is the same value for every test. I've tested this extensively, and the behavior is consistent.


    Is there any full documentation of the transl and rotx functions that explain their behavior in-depth?

  • I've attached a zip containing my current test cell.


    ...and now, I can't get the reversing behavior to repeat. :wallbash:


    Even so, there's something not right with how the rotx is behaving.


    In the simulated cell, if I move to the position RP1_Enter, and then execute the Python script ToolRotateX+, the TCP rotates clockwise around X when the rotx value is positive. But that's backward -- a positive rotation should result in a counterclockwise rotation.


    If I make the rotx value negative, the TCP rotates counterclockwise.

  • Hi SkyeFire,


    I took a quick look at your code and I think that the problem comes from the usage of degrees with rotx. You should be using radians instead.


    Adding angle/180*pi should help you.


    Anyway, here's the link to the online documentation on the API:
    API Online Documentation


    Hope it helps.
    Jeremy

    RoboDK - Simulation and Offline programming software for industrial and collaborative robots.

    Visit us at RoboDK.com
    Take a look at our tutorial videos on our YouTube channel.

    Edited once, last by Jeremy RoboDK ().

  • Bingo! That was it! Never occurred to me that it might be using radians.


    Hm... so, I'm guessing that the rotx function "wraps" rotations larger than 360deg around, and just tries to move the robot to the equivalent endpoint? That would make sense, and emulates what the robot's organic function would do.

  • Happy that it worked.


    Yeah, pretty much.
    If needed, you can also manage the configuration linked to a certain Cartesian target for MoveJ using the API, but that's a whole other subject.

    Considering that your path is composed of a series of MoveL, I would recommend manually creating the first point of the program (or the approach point) as a Joints target and reaching it with a MoveJ before starting the MoveL sequence. This way, you will ensure a known configuration for the starting point of your program. The sequence of MoveL will then be calculated considering that initial configuration.


    Have a great day.

    Jeremy

    RoboDK - Simulation and Offline programming software for industrial and collaborative robots.

    Visit us at RoboDK.com
    Take a look at our tutorial videos on our YouTube channel.

Advertising from our partners