Lynxmotion Tech Support

www.lynxmotion.com
It is currently Sat May 25, 2013 4:07 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Thu Sep 27, 2012 7:30 pm 
Offline
Roboteer

Joined: Mon Jun 18, 2012 7:42 pm
Posts: 13
I'm sure this must have been asked before, but I can't find any solution for detecting variation in horizontal surface distance say for a BRAT. What I'm looking for is to be able to scan and detect a change in distance, say using an IR sensor, that is pointing down and ahead (and could be applied with multiple sensors on back and sides) of the BRAT, e.g. so that it can detect and avoid a slope or edge of the surface before it gets to it.

Thanks


Top
 Profile  
 
PostPosted: Fri Sep 28, 2012 2:27 am 
Offline
Roboteer
User avatar

Joined: Fri Aug 26, 2011 12:20 pm
Posts: 85
Location: South Africa
hello

i have made a program for my boebot and ping sensor that will do that but because i only have 1 ping there is blind spots which makes it dangrous i therefore found that you will need 8 sensors to cover the perimeter and most of the blindspots but i have not tryed this because of the cost

regards,
codemaster


Top
 Profile  
 
PostPosted: Fri Sep 28, 2012 10:31 am 
Offline
Roboteer

Joined: Wed Mar 16, 2011 2:22 pm
Posts: 173
Location: Chicago, IL
Do you have a way of reading the sensor outputs in realtime? Like an LCD that you can print the output on? My advice would be to mount the sensor at your desired angle, depending on how far away you want to detect something, then read the output of the sensor. Use that value as a base line and add a bit of hysteresis on both sides; because from my observations the BRAT body doesn't stay completely level while walking and you don't want your bot to react when there isn't an object or drop off in the way. In your program if the voltage drops below your level of hysteresis then there's and edge or a drop, if the voltage rises above the level of hysteresis then there's a slope or an object.

If you need to know the actual distance then it might take a little more work. The output from a sharp sensor isn't linear. You could use your sensor to take voltage measurements at small distance intervals. Then, pop those values into a graphing program and ask the program to produce an approximate best fit eqauation. The equation should closely model the distance/output relationship for that sensor.


Top
 Profile  
 
PostPosted: Fri Sep 28, 2012 11:17 am 
Offline
Robot Guru
User avatar

Joined: Sat Apr 15, 2006 1:42 pm
Posts: 4414
I think there are several places up on the forum that show how to convert the IR values into things like cms... Here is some code from one of my Rover programs:
(I am not sure, but this code may have come originally from Xan)

Code:
; This table is used to convert Sharp IR readings into CM
IRCMTable bytetable     80,80,80,80,80,80,80,80,80,78, |
                        76,74,72,70,68,66,64,62,60,59, |
                        58,57,55,53,52,51,50,49,48,47, |
                        45,43,42,41,40,39,38,37,35,33, |
                        32,31,30,30,29,29,28,28,27,27, |
                        26,26,26,25,25,25,24,24,24,23, |
                        23,22,22,21,21,20,20,20,19,19, |
                        18,18,18,17,17,16,16,16,15,15, |
                        15,14,14,13,13,13,12,12,11,11, |
                        11,10,10,10,10,10,10,10,10,10

;--------------------------------------------------------------------
;[GetIRSensorInCM]
IRPin      var byte
scanrange    var word                 ' A/D result variable


GetIRScanInCM[IRPIN]
                       
   ; first read in the IRvalue.
   adin IRPin,scanrange
   
   ; If it is greater than 512 it is out of range we will return 0
   IF scanrange > 512 THEN      ; outside our table so return 0 to signal too close
      return 0
   ENDIF
   
   ; now convert entry to cm from table.  Old program
   ; divided value by 5.12 using floating point, but could simply multiply by 100 and divide by 512
   ; in integer math, which should be a lot quicker.  512*100 < 65536 so fits in word...
   return IRCMTable((scanrange*100)/512)

Kurt


Top
 Profile  
 
PostPosted: Mon Oct 01, 2012 10:21 pm 
Offline
Roboteer

Joined: Mon Jun 18, 2012 7:42 pm
Posts: 13
This is a good start...many thanks for the info!


Top
 Profile  
 
PostPosted: Mon Oct 22, 2012 2:59 pm 
Offline
Arduino Wizard-in-Training
User avatar

Joined: Thu Sep 09, 2010 4:56 pm
Posts: 252
Location: I don't even know
Like what everyone mentioned above,

All you need to do is figure out how to convert the ir sensor readings into something meaningful(like cm or in) or take measurements at different distances and make a table of the values. Then just react to different readings in your code. For example if the reading is very high(looking over an edge), the robot perhaps should stop walking or even turn around.

_________________
Devon Simmons, Former Programmer for Lynxmotion.
I can try to help, but I can only offer you my best effort.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group