KAREL to Write Robot I/O Comment

  • So I am starting out with KAREL-

    I have the programming and reference bibles (manuals)

    I am looking at a couple of the built-ins for writing the comment for a robot I/O. I change EOATs often and their nomenclature is never the same to actuate the grippers, vacuum generators, etc.

    I have seen these two built-ins;



    I am struggling to follow which one is more suitable for what I am attempting to accomplish.

    I want to be able to call the procedure/routine (I have seen this used both terms in the manual)

    AR[1]- type of i/o (DI,RI,DO,RO,AI, etc)

    AR[2]- number of the i/o

    AR[3]- comment of i/o as a string

    I feel like the SET_PORT_CMT is the appropriate one to use- am I on the right path?

  • I'm by no means a Karel Expert, but I've dabbled.

    Yes you are on the right path.

    SET_PORT_CMT can be used to set I/O comments

    You may also want to look at SET_REG_CMT, SET_PREG_CMT, SET_SREG_CMT for registers, Position Registers, and String Registers.

    Reading Arguments can be accomplished with GET_TPE_PRM.

  • Oof-

    Ok I am guessing that I will need to write much more code to accomplish this.

    I will continue reading the manual as much as I can.

    My code is a jumbled up mess at the moment. I am wishing I could find examples of passing multiple arguments in the manual. I haven't read the whole thing yet- that will take a bit.

    • Helpful

    Honestly, It probably sounds like more than it really is. Curiosity got to me, so I tried it myself, and it wasn't that much code.

    If you're interested, below is how I accomplished it.

    I'm sure there is probably more error checking that can be done with the STATUS variables, but I don't know much about them, I got them out of another source code I had a copy of.

    I followed the AR[] structure from your original post; AR[1] = IO_type, AR[2] = IO_Num, AR[3] = IO_cmt.

    The IO_type variable gets passed as an integer who's value comes from KLIOTYPS.KL (See the list below) and then I have a SELECT CASE setup for the Registers; pass a 1000, 1001, or 1002 for Num-Reg, Pos-Reg, or String-Reg respectively.

    (Setting this program up in ARGDISPEG01.DT would also be a good idea)

    io_din = 1 -- Digital input

    io_dout = 2 -- Digital output
    io_anin = 3 -- Analog input
    io_anout = 4 -- Analog output

    io_rdi = 8 -- Robot digital input
    io_rdo = 9 -- Robot digital output

    io_gpin = 18 -- Grouped inputs
    io_gpout = 19 -- Grouped outputs

    io_flag = 35 -- Flag (F[ ])
    io_marker = 36 -- Marker (M[ ])

  • Energy addict-

    Thank you a very much. This does help out.

    I was reading in my manual yesterday about KLIOTYPS.KL. I was unable to find any of this when I searched in my manual. I was really hoping there was more about it in the appendix.

    I definitely have some studying to do here.

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