Loading ...
Sorry, an error occurred while loading the content.
 

Programming Help?

Expand Messages
  • fantizmoe
    My task is to program a robot to slalom around two different colored cups. The cups are blue and yellow, but which is in front and which is in back is a
    Message 1 of 2 , Apr 24, 2006
      My task is to program a robot to slalom around two different colored
      cups. The cups are blue and yellow, but which is in front and which
      is in back is a variable. I am having trouble coding this problem
      with Java. Anyone have any good programming ideas on how to tackle
      this problem?
    • William J Rust
      First, you need to be more specific in the algorithm. You ve written one that a human can understand. But you are trying to get a bot to understand it and it
      Message 2 of 2 , Apr 25, 2006
        First, you need to be more specific in the algorithm. You've written one
        that a human can understand. But you are trying to get a bot to
        understand it and it won't. What I have my students do is an exercise
        called "Be the Bot". The student is required to implement the algorithm
        using only the sensors and motors that the bot has. I usually have the
        kids get up and walk around the room using touch sensors (hands) and
        motors (legs) to implement a maze runner algorithm. This gives them a
        much better understanding of what a bot can and cannot do. It also makes
        them write much more precise algorithms.

        Second, you need to be more precise in your description of the problem
        and the bot. How many cups are there, just two or more? If only two is
        the bot supposed to do a figure 8 or just pass between them? How far
        apart are the cups? Are the cups marked in some way so the bot can tell
        how far around the cup it's gone? Can the bot touch the cups or not?
        Does it have touch sensors or Sharp GPs or an SRF04 or 08? Is its light
        sensor short range or is it like a CMUcam where it can see colors at a
        distance? Does the bot have navigation aides, like a GyroPAK or a
        compass, or distance measurement abilities? Etc.

        My point here is simple: once you carefully define the algorithm, the
        programming is usually pretty obvious. And always remember, on your
        first attempt your objective is not to be elegant or optimal. Your
        objective is to get the d@mn thing to work.

        Just so you won't think I'm being too theoretical, here's a behavior
        paradigm description of a solution to your problem. The three behaviors
        in low to high priority are goForward (default), goAround and foundNext
        (highest priority). goForward simply goes forward and, hopefully, one of
        the higher priority behaviors will find the cone. goAround navigates the
        bot around a found cone. foundNext looks for a cone of the opposite
        color and, once it finds it, moves the bot towards it until the previous
        cone is lost from sight. Obviously, this is only a starting point for
        you thinking about the solution to your problem.

        wjr

        fantizmoe wrote:
        > My task is to program a robot to slalom around two different colored
        > cups. The cups are blue and yellow, but which is in front and which
        > is in back is a variable. I am having trouble coding this problem
        > with Java. Anyone have any good programming ideas on how to tackle
        > this problem?
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.