To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 23136
23135  |  23137
Subject: 
Re: Light seeker
Newsgroups: 
lugnet.robotics
Date: 
Fri, 10 Dec 2004 00:07:53 GMT
Viewed: 
880 times
  
in lugnet.robotics Danny Staple wrote:

global iPosition=0;
def task seek():
      while(true)
              wait suitable delay;
              if left_sensor < right_sensor:
                      iPosition += iAngleStep;
               else if left_sensor > right_sensor:
                      iPosition -= iAngleStep;

Wow, i guess i understand your robot. It seems to be a stationary light seeker.
Imagine, you point a pocketlamp between the light sensors, such, that it is in
the middle position between them. Such, that at the start condition

    left_sensor is equal to the right_sensor is true,

no motor movement of the light seeking head would result with the other task.

But if the pocketlamp is removed from that position, the initial iPosition=0,
causing no movement, is never reached again. So the motor will never be switched
off, after he had been switch on. And, third, there is no reason, to slow down
computer speed.

So i think, task seek should look like that:

def task seek():
          while(true)
                if left_sensor < right_sensor:
                        iPosition += iAngleStep;
                elsif left_sensor > right_sensor:
                        iPosition -= iAngleStep;
                else
                        iPosition = 0;

I think, your design pattern is very interresting. I did not use tasks with my
lighteye robot, as i think, there is no reason to use them. Of course, that is a
question of intelligent software design.

But the algorithm of a light seeking robot moving on the ground can be easily
expressed in an old fashiond procedural hierarchically structured program. One
task. As it is not a big program.

At first, you need a control program. Of course, a control program can be a
seperate task. In any case, you should use a state machine (automaton) to
describe the operation of the robot, and use separators, to communicate between
tasks (as you do).

Greetings
Ralph



1 Message in This Thread:

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

Custom Search

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