To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.robolabOpen lugnet.robotics.rcx.robolab in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / ROBOLAB / 366
365  |  367
Subject: 
Re: Today's Challenge
Newsgroups: 
lugnet.robotics.rcx.robolab
Date: 
Tue, 4 Jan 2005 16:23:33 GMT
Viewed: 
9720 times
  
In lugnet.robotics.rcx.robolab, Andrew Jackson wrote:
A cry for help:

I am trying to implement Ben Williamson’s Fetchbot
<http://ozbricks.com/benw/lego/fetchbot/index.html>.

I am happy that I have the mechanics right.

The problem is that I want to emulate Ben’s code in Robolab. (Yes, there are
reasons I use Robolab which include me being a teacher and a very poor
programmer)

The ‘bot has to find the object, pick it up and then carry it to a drop off
point and errr… drop it off.

I have tried using:

     Tasks (How do you continue the program once a task has ended?)
     Conditional Loops (Too slow – must wait for the routine to complete before
re-testing)
     Events (only one allowed per program and I need one to find the object and
one to find the drop off)

Your apologizing to be a teacher is accepted  ;-)

However, you must not apologize to work with ROBOLAB ! Anybody who followed the
development of great LEGO robots has seen that ROBOLAB allows easy programming
from beginners to absolute specialists. This is a great flexibility that brought
several international awards to the wonderful software as being a great
didactical environment. On the other hand using ROBOLAB never excludes prefering
other software environments like the marvelous nqc for common LEGO Mindstormers
or the brillant brickOS or pbForth - for highly advanced masterminds. But, if
you are in an educational situation, nothing better than ROBOLAB.

Now to your questions :

1. There is no "while(true)" icon in ROBOLAB. Instead you can use the arrows
(lands and jumps) to tell the program to jump to a certain place in a task.
According to good programming practice, those jumps and lands (good - hmm no :
bad old GOTOs) should be used very carefully only to build the eternal loop, or
some rare cases, where you want to exit something. In fact the ROBOLAB authors
could think about implementing an "eternal loop" . Most of the loops can easily
be done with whiles, for-loops rather than using ifs. By the way, perhaps the
ROBOLAB programmers also could create a repeat-until structure?

2. A faster solution to conditional loops is to include only very few code lines
into the code or even none. So, you could have a "loop while touch sensor is
released" immediately followed by the end-loop. In this case the program waits
for the sensor to be pressed, then it continues. You add some code, what you
want the robot to do after the button being pressed and close this code by a
"loop while touch sensor is pressed" (plus end-loop). If the program reaches
this loop, it does nothing else but wait until you have a button release.
Imagine now that you wrap everything into an "eternal loop" that you build by
using one of the jump-land arrows couples. And that's it.

3. In fact more events may defined. There only might be a problem that you are
landing at the same location, in the case of an event, and you need to discuss
which event-source generated the event. This is not the easiest thing to do. An
easier solution could be to have two tasks, each one dealing with one event
only. Use the task split feature to obtain this.

Claude



Message has 1 Reply:
  Re: Today's Challenge
 
(...) <snippage> (...) Thankyou, Claude. Now as to your further comments: I think that there is likely to be much merit in your words. I have not been able to transfer them into code as yet and so beg your further indulgence. In (very) pseudocode I (...) (20 years ago, 20-Jan-05, to lugnet.robotics.rcx.robolab)

Message is in Reply To:
  Today's Challenge
 
A cry for help: I am trying to implement Ben Williamson’s Fetchbot (URL). I am happy that I have the mechanics right. The problem is that I want to emulate Ben’s code in Robolab. (Yes, there are reasons I use Robolab which include me being a teacher (...) (20 years ago, 4-Jan-05, to lugnet.robotics.rcx.robolab)

3 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR