OCCRA
Go to Post When we stop asking ourselves the hard questions, whether as team leaders or in life, then we are failing. - Al Skierkiewicz [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Events   CD-Media   CD-Spy   FRC-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 03-09-2004, 03:39 PM
wun's Avatar
wun wun is offline
Registered User
AKA: David Wolever
#0865 (Warp7)
Team Role: Programmer
 
Join Date: Dec 2003
Rookie Year: 2001
Location: Toronto
Posts: 84
wun will become famous soon enough
Send a message via AIM to wun Send a message via MSN to wun
Strange IR sensor movement with default tracker code

Hey,
I have been fighting with the default IR sensing code (both frc_tracker and navigate) for the last couple of weeks, and I just cant seem to figure out whats wrong. I have set up the IR sensors the same way Kevin has on his page and read through all the comments in the code related to how to plug in the IR sensors/PWMs. The problem comes when I try and run the code. If the emitter is turned off, both servos turn in unison looking for the beacon (exactly the way they should), but then when I turn it off, any number of things can happen. Sometimes nothing happens, and its like the beacon is non-existent (I have set it to both field settings), sometimes one sensor stops and looks at it (just like it should), but the other one keeps turning, and sometimes one or both of the servos slows down, but keeps trying to find it.
I have shown it of the engineers who have been helping out our team, but none of them can come up with a solution, and the only thing I can think of is that I killed one of the receivers when I was soldering it (it was the second thing I ever touched a soldering iron to).
Has anyone had this problem or know what could be causing it?
Your help would be much appreciated by all of 865!
Thanks!
__________________
Help Microsoft stop piracy. Use Linux!

I have three gmail invitations, message me if you want one
  #2   Spotlight this post!  
Unread 03-09-2004, 04:16 PM
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: Strange IR sensor movement with default tracker code

you can tell if the sensor is working by putting a scope prob on the signal pin and pointing it at the beacon

or if you dont have a scope, some digital volt meters have a frequency function - when the sensor sees the signal it should register 100Hz

and if not, put it on DC volts - you should get a slightly lower voltage on the signal pin when it sees the beacon (because it pulses low for 10 or 20% of its duty cycle) that when it doesnt see it (flat 5V output).

at least this will give you some indication that your sensors are working
  #3   Spotlight this post!  
Unread 03-09-2004, 05:56 PM
wun's Avatar
wun wun is offline
Registered User
AKA: David Wolever
#0865 (Warp7)
Team Role: Programmer
 
Join Date: Dec 2003
Rookie Year: 2001
Location: Toronto
Posts: 84
wun will become famous soon enough
Send a message via AIM to wun Send a message via MSN to wun
Re: Strange IR sensor movement with default tracker code

Quote:
Originally Posted by KenWittlief
at least this will give you some indication that your sensors are working
Ya, if Im going to be going through and checking each one with an oscilloscope tomorro (or when I have time). I have checked a couple of them thou, and they work, so I dont think its hardware (but I could very well be rong)
__________________
Help Microsoft stop piracy. Use Linux!

I have three gmail invitations, message me if you want one
  #4   Spotlight this post!  
Unread 03-09-2004, 06:48 PM
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: Strange IR sensor movement with default tracker code

something else we observed and that other teams have commented on

the sensors are very sensitive, and the beacons are very powerful. if you try to use them in a small room the IR will reflect off the walls and ceiling - you need a big open space to avoid tracking the reflections

and you might want to think about enclosing your sensors better - they pick up light from all directions. We found the little black plastic project boxes from radio shack work very well - we cleaned out their supply of 1x2x4" boxes here.
  #5   Spotlight this post!  
Unread 03-19-2004, 12:59 AM
wun's Avatar
wun wun is offline
Registered User
AKA: David Wolever
#0865 (Warp7)
Team Role: Programmer
 
Join Date: Dec 2003
Rookie Year: 2001
Location: Toronto
Posts: 84
wun will become famous soon enough
Send a message via AIM to wun Send a message via MSN to wun
Re: Strange IR sensor movement with default tracker code

Well, our robotics room is pretty big, so I dont think that is the issue.
Even if it was, why would one stop, but the other keep tracking? Could it be I dont understand how the code works properly, and its doing exactly what it should, and I just dont know it?
__________________
Help Microsoft stop piracy. Use Linux!

I have three gmail invitations, message me if you want one
  #6   Spotlight this post!  
Unread 03-19-2004, 09:51 AM
gnormhurst's Avatar
gnormhurst gnormhurst is offline
Norm Hurst
AKA: gnorm
#0381 (The Tornadoes)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Trenton, NJ
Posts: 138
gnormhurst will become famous soon enoughgnormhurst will become famous soon enough
Re: Strange IR sensor movement with default tracker code

When I first fired up the trackers I found it helpful to print out the sensor pulse counts. In tracker.c, just before "switch(TRACKER_STATUS)", try printing out the values of LEFT_SENSOR and RIGHT_SENSOR:

Code:
  if ( Tracker == LEFT )
    printf( "L: %d, %d\n" , (int)LEFT_SENSOR, (int)RIGHT_SENSOR );
  else
    printf( "R: %d, %d\n" , (int)LEFT_SENSOR, (int)RIGHT_SENSOR );

Since the beacon pulses at 100 Hz and the machine cycles at about 38 Hz, a good sensor will see 2 or 3 beacon pulses per cycle. A value of 0 or 1 indicates no IR or "on the edge". That should help you decide if the sensors are working.

I've had a lot of issues with the tracker code, and I am now trying a different approach to tracking the beacon. The approach of the default tracker is to try to get both sensors seeing IR. There's at least two problems with this.

First, imagine the beacon is on our right at about one or two o'clock, and the moveable goal is dead ahead at 12:00. The 2X ball is this big, shiny, spherical reflector, so it makes a nice IR reflection. The tracker looks forward to 12:00. The left sensor sees the beacon's reflection in the ball; the right sensor, because it is completely open on the right side, sees the beacon itself to its right. The algorithm is satisfied (both sensors see IR). But the tracker is pointing at 12:00, not at the beacon at 2:00. Oops. I have watched our robot push the moveable goal straight downfield during the autonomous mode, thinking it was heading for the beacon.

The other problem is that the sensors will register IR over a very wide range of angles, especially when near the beacon. With a 1" length of heat shrink on the sensors (not cut away but a complete tube), at a range of about three feet the sensors see the IR over more than half the range of the servo. With the default approach ("both sensors see IR" means it's pointed at the beacon), the trackers will be satisfied over a very wide range of angles.

I am working on a new approach where the left tracker constantly dithers back and forth across the left EDGE of the beacon beam pattern, and the right tracker dithers across the right edge of the beacon pattern. When a sensor goes from light to dark, the servo reverses until it goes from dark to light. Each time it reverses it notes the servo position. The average of the dark-to-light and the light-to-dark servo angles is considered the angle to the edge of the beacon beam pattern. The average of these values for left and right trackers should point at the beacon itself. Note that this approach requires only one sensor per tracker.

A similar approach to finding the edge of the beam pattern is to use two sensors on each tracker, and adjust the servo until they straddle the "edge of darkness". If both see it, move away from the light. If neither sees it, move towards the light. If one does and the other doesn't, you're good, just stay there. (If the other does and the one doesn't, you're lost!)

I have experimented with both approaches and decided that the constant dither is better because it is constantly re-measuring, and can register a small change in angle, whereas the straddling approach can be satisfied over some range of angles and think nothing has changed.

But reflections are still a problem. My solution is to first "scan the horizon" over the entire servo range. I wrote test code to step the servo from left to right and print out the sensor pulse count. I get outputs like this:

Code:
    ___1233_____12332322323323232321_______1323223____
This shows two reflections at the sides and the direct IR in the middle. Before starting to dither, I point the tracker at the edge of the direct IR source, so it doesn't dither on the edge of a reflection.

My code is still experimental -- I hope to get it fully functional before the next regional!

-Norm
__________________
Trenton Tornadoes 381
2004 Philadelphia Regional Winners
2006 Xerox Creativity Award
---
My corner of the USPTO.
My favorite error message from gcc: main is usually a function
My favorite error message from Windows: There is not enough disk space available to delete this file.

Last edited by gnormhurst : 03-19-2004 at 01:25 PM.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bringing in Navigate.zip into the Default code alexrobotics Programming 1 02-24-2004 08:42 PM
Tracker Code Yellow Eyes Programming 3 02-21-2004 10:14 AM
Is default code already loaded? quickie25 Electrical 8 02-19-2004 09:51 PM
default code and the actual robot tml240 Programming 15 01-24-2004 10:31 AM
2003 PBasic default code from Innovation First ttedrow Programming 0 01-06-2003 10:18 AM


All times are GMT -5. The time now is 02:54 PM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi