Menu Utility and Karel

  • Hi guys/gals.

    Just looking into the menu utility option (using a current R30iB) and also Karel with a view to:


    1. Copying an existing program and modifying a couple of steps with new text instruction.

    a. I can use Karel to create a copy and rename a program no problem.

    b. What I would like to do in addition is to use Karel to (for example) rewrite a specific step no. that contains DO[20]=off, to DO[21]=off.

    Is b. possible using Karel without using the Teach Pendant?


    2. Adding new text options and selections contained with the Menu Utility structures using Karel.

    a. In the list menu, modify existing selections or create new lists.

    b. In the Operator entry, modify existing options/parameters or create new operator interface options.

    Is a. or b. possible using Karel without using the Teach Pendant?


    If anyone has an example, that would be great, but I much prefer doing my own coding, so if anyone has any specific pointers to look at, it would be very much appreciated.

  • 1b:

    I think it should be possible to do that. I use

    Code
    SET_TEXT_TPE(prog_name, line_nr, 1, line_data, status)

    to write tp programms from scratch but I think if you give it the right line number you can alter existing lines.

    I got this builtin to work in RoboGuide but not on our real Robots. The difference is probably that our real robots don't have the ASCII Upload option but I am not quite sure.

  • TomTom
    If you're saying that code example can be used to explicitly write a TP program from scratch (or with some variations), then it's certainly in the right direction for me.

    I'll certainly cross reference what you've suggested and see if I can make it work, many thanks.....:top:

  • I couldn't find much documentation on SET_TEXT_TPE but the most important thing is probably that all lines have to end with ";". If you get a "failed to load error" or something like that, then what you are writting is not a valid .tp line.

    The only info I've found is from here:

    Create a TP program with KAREL



    Can't help you much with 2) there are custom user forms that you can make but I've never gotten it to work.

    Edited once, last by TomTom ().

  • Thanks for the link, yes I came across that before I posted the thread and it ties up with your suggestion too.....:top:


    Yes, I think no.2 maybe a bust.


    The intention is to programmatically:

    Copy an existing program and adjust some steps.

    Update some of the prompts/lists or create new ones.


    I shall progress with it all the same (on a steep learning curve with Karel) so would like to explore just how much it could influence/replace some of the TP functionality.

  • TomTom


    Do you have a small example/shippet of your implementation of:

    SET_TEXT_TPE(prog_name, line_nr, 1, line_data, status)

    - I'm experiencing runtime errors and crashing Roboguide


    Also, what do you mean about the ';' after each line?

    - I didn't think this was a requirement for a TP Program only LS

  • Here's a Karel program that clears and writtes a tp programm called MY_FILE when you execute it.

    For some reason I need to put a blank line with just ";" in line 1 in every new TP program. Then I start writting and just start at line 1 again and continue incrementing my line number like normaly.


    I thought the ";" was required since it goes through the ASCII Upload option but it seems I was mistaken. Looks like it is optional..... sometimes... when I took it out of the first line that just writtes an empty line it didn't work. The MESSAGE[3] line works fine though.... I'd recommend adding it to every line, never gave me any problems atleast.


    Anyway hope that helps you getting started.


    PS. This doesn't work if the programm is currently selected or running.

    Edited once, last by TomTom ().

  • Perfect...………:top:


    Your file loads in and executes straight off the bat, which rules out any issues within my version of Roboguide (I was wondering if the command itself was causing the runtime error and it's not).

    It's going to be down to my syntax now.....


    Many thanks for that, your example will assist me with debugging my monkey code now and locate where my mistake(s) are.


    Very much appreciated...…..:beerchug:

  • Super......


    I had the following:

    SET_TEXT_TPE('TESTING1', 4, 1, 'DO[21]=ON', result)

    The missing semicolon after the TP command is what's was causing my runtime issue.


    Modified below:

    SET_TEXT_TPE('TESTING1', 4, 1, 'DO[21]=ON;', result)

    It executes fine, so it obviously requires the semicolon as the terminator of the line.


    However, I noticed though in your example on Line 24:

    You've omitted the semicolon there and it works ok, maybe something to do with the acceptable characters for the TP instruction perhaps.

    I'll keep my eye open for this, but I think if I follow the rule of always semicolon it, then it'll be good.


    Cheers buddy, much appreciated...………:top:

    Happy Friday...………………:away:

  • I thought it was required but started to second guess myself when line 24 seemed to proof me wrong. Yeah maybe it's because after MESSAGE[] the line always ends, other commands have a ton of optional stuff.


    Glad it's working now, have a nice weekend :beerchug:

  • You could well be correct there.....


    In addition to this, that command:

    SET_TEXT_TPE()

    If used on a program that contains information on the specified line already will 'insert' at the specified line no. and increment the successive lines.

    This may have a bearing on why you have to initially create a 'blank' line when there is no existing line, to actually create 2 lines (one for termination of the program - END).


    Progress made though thanks to your information, so that's the main thing.....you too...……:top:

Advertising from our partners