Code Review for KRC2 2005ed and Other Questions

  • Gents,


    I'm outside of my comfort zone, and working on a small job programming a KRC2 2005 edition with a KR 30 arm. It is running V5.5.10. This robot is essentially a demo robot that will live in a conference room, and mirror the user's right hand motions which are streamed in via RS232. Hand coordinates are produced by a C# application interfacing with a Azure Kinect depth camera. The robot has no tool on it.


    I've got it up and running and figured I would ask the experts here for their opinion on ball of code I've managed to produce in the last few days. The core of it built around @SkyeFire's code in this thread. Just to get the warm and fuzzies that I am not doing anything drastically wrong.


    Here is the .scr module:


    and the .dat file:


    One thing I am running into (in teach high speed) is that when the robot reaches the shift point, it engages the brakes, then releases them when it jumps back up and reads in another position. Is there a way to prevent that behavior? AKA keep the brakes released.


    Also, if anyone has any suggestions on how to speed up the code so the robot is more responsive I am all ears. I've had to slow the streaming down on the computer side to about 1Hz. Otherwise I get buffer overflow errors. Also if anyone knows how to clear the buffer, that would be helpful.

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

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

  • Don't open/close serial port in every loop, just open once at beginning.

    Change the format of the string that you don't have to convert strings to commas.

    The behavior of the brakes seems curious, normally they should be released at least for about 10 seconds after one movement.

  • Code
    $BASE = $POS_ACT

    Is a bold and daring line- I would change it to some constant, maybe the same homepos.


    Don't use GOTO, KRL provides functionality to write functions, procedures, loops, if and case statements- use those instead.


    Limiting the values like this leaves them overly dependent on the homepos; also instead of a cube I would limit to a sphere- less jarring, at least for me.

  • Hi,


    I also have a Suggestion:

    Do not send your data as string, send them in binary format and receive them like this:

    CREAD(HANDLE,SR_T,MR_T,TIMEOUT,OFFSET_CR,"%r%.6r",IPOSNO,POSV[],PARMS[])


    This will also speed up the communication and will not cause any problem by converting to float or double (you have to check first), afterwards it will be working pervectly.


    With this I never had problems as you described.


    Regards


    MOM

  • Finally back on this job, as I've has some free time appear in my schedule.

    One thing I am running into (in teach high speed) is that when the robot reaches the shift point, it engages the brakes, then releases them when it jumps back up and reads in another position. Is there a way to prevent that behavior? AKA keep the brakes released

    Found out that the previous owner of this robot had set $BRK_DEL_PRO to 200. That was causing the odd brake behavior.


    Currently working on getting it up and running in auto.

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

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

  • Had the same issue of buffer overflow when we were working on robotic Air Hockey .

    We used rsi and a krc4 agilus.

    we did 2 things to fix it.

    1. we clear the buffer after receiving a data. (which i dont know how to do it on krc2)

    2. from C# code we are limiting the sent data. its either the the first point or the last point detected from the camera.(robot is runs at full speed).

  • While it is pretty easy to get the robot up and running in AUT, I'd like to have it so the end user only has to press a single start button. I was hoping to do this by monitoring the fence circuit and then resetting the messages and starting the program once it is clear. In Fanuc world this is fairly easy, but the more I dig into this, it looks like at the minimum I would have to wire some outputs to inputs.


    Is there a way to map the EXT AUT signals to a virtual signal?

    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