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 / 23100
23099  |  23101
Subject: 
Re: Light seeker
Newsgroups: 
lugnet.robotics
Date: 
Mon, 6 Dec 2004 19:33:34 GMT
Viewed: 
1170 times
  
Ahh- I think he is using two so he can minimise seek time-or run it stationary (which he mentions).
What I suspect he is trying to do is get the difference between the two sensors, so he can see which is Brighter, and use (as he says) a single rotation sensor for reference.

The pseudo-code algorithm for seeking with a motorised head, and two sensors:

global iPosition=0;
#this value defines how far the motor will step during seeking.
#Too low- and it will always be seeking,
#too high and you will lose accuracy
global iAngleStep=90;
def task seek():
while(true)
wait suitable delay;
if left_sensor < right_sensor:
iPosition += iAngleStep;
else if left_sensor > right_sensor:
iPosition -= iAngleStep;
global motorscale = 8 / iAngleStep + 1
def task movestep():
if currentsensorangle  <  iPosition:
motordir = right
motorpower = (iPosition - currentangle) * motorscale
else if currentsensorangle  >  iPosition:
motordir = left
motorpower = (currentangle - iPosition) * motorscale
else
motorbrake()

Let me explain. The first task will tell the head to check the left and right sensors at suitable times and set an angle acordingly.

The other task operates the motor in a closed loop rather like a servo using the rotation sensor. I have set the angle step to 90 as I think that is what you get without gearing.

If you do gear down the transfer to the rotation sensor then remember your angle is now going to be relative- as you are getting more than one sensor revolution per head revolution.

Good luck
Danny Staple
-=-
http://orionrobots.co.uk - inspiring creativity and building robot communities
-----Original Message-----
From: "Ralph Toepper"<ralph.toepper@t-online.de>
Sent: 02/12/04 23:28:48
To: "lugnet.robotics@lugnet.com"<lugnet.robotics@lugnet.com>
Subject: Re: Light seeker

in lugnet.robotics John Jordan wrote:

Hi, I was wondering if anyone has any experience programming (NQC) a stationary
light seeking head? I have one made using a rotation sensor for reference, and 2
light sensors but can't seem to get the programming down.
Thanks
John Jordan

Why do you use two light sensors? I have made experience with one light sensor
mounted on top of a motor driven and rotation sensored turret. The mechanics has
two drawbacks.

First, the geartrain between motor and light sensor is somewhat relatively
loose.

Second, the light sensor cable adds mechanical random momentum, which is the
most impact of influence to the somewhat loose geartrain.

To avoid the two drawbacks, i have forced the light sensor to look into a
direction, that is preselected by a given rotation sensor number. To perform a
scan, a "for" loop is executed, forcing the light head to look in each
direction, he can look into.

Imagine, you have a given number of rotation to move onto. You read your current
number and decide, in which direction to move the motor. While the motor is
moving, you read the rotation sensor values, and stop the motor, if sensor value
exceeds the given number. After you have stopped the motor, you look, where you
are now. If the given number is not precisely reached, you switch on the motor
again. Doing this endlessly, until the final position is reached. This algorithm
terminates on a lego robot, as my experience says, as the energy applied to the
motor is getting smaller with iteration steps.

If your robot is moving on the ground, as my lighteye robot does, such a
precision measurement of the light environment must be done, after the robot has
been stopped. It takes some seconds to perform the scan.

My lighteye robot searches for the direction of the maximum light, while he is
stopped. Then he is heading into that direction. Thats another special algorithm
called "tractor beam". While sitting on its place, the robot turns direction.
The value of the maximum light is used, to keep the lighthead pointing into
direction. If the axis of the robot and the light head agree to be looking
absolutely forward, the robot starts to move forward, until he finds the light
is getting too dark. He stops and does a new maximum light scan. I use a bumper,
until he hits the light source.

Note, that you can use the NQC errorlog, to dump values to the PC. Regarding
this, you can understand the robot decisions.

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