lin_rel movements and variable assignment of magnitude

  • Is KRL capable of doing lin_rel movements with a variable assigned to the distance moved?


    I am programming in work visual. When I do the following:


    $tool = tool_data[x]
    lin_rel {A 3} #tool


    work visual handles this with no problems. The robot (KRC4) executes this with no problems and rotates 3 degrees in axis A bout the TCP. Easy stuff. If I try to assign a variable where the "3" is
    example:


    decl real a_rot


    a_rot = 3


    $tool = tool_data[x]
    lin_rel {A a_rot} #tool



    work visual doesn't like this and throws out error messages because of the a_rot.


    Ultimately, I want to be able to take user input, and rotate a number of degrees which is not hard coded. I want this to be user-definable. In my particular case, I could do absolute rotations, but relative rotations would be much easier. Any ideas?


    Thanks for your help.

  • Sorry, I don't know why the forum is doing this, but it is breaking up my code weirdly. Here is a 2nd attempt without the huge page breaks


    "$tool = tool_data[x]"
    lin_rel {A 3} #tool


    and


    ecl real a_rot


    a_rot = 3


    "$tool = tool_data[x]"


    lin_rel {A a_rot} #tool

Advertising from our partners