  DPRG List

 [DPRG] SHARP IR Range Detector Calibration and Conversion: Correction #2 Message index sorted by: [ date ] [ thread ] [ subject ] [ author ] Previous message: [DPRG] SHARP IR Range Detector Calibration and Conversion: Correction! Next message: [DPRG] Reminder: DPRG Meeting Tomorrow and CALL FOR ROBOTS Subject: [DPRG] SHARP IR Range Detector Calibration and Conversion: Correction #2 From: David Anderson davida at smu.edu Date: Fri Mar 7 17:19:04 CST 2014 ```OK, Still not right. Again, the example has it correct. distance = Kg / (X - Ko); some days... dpa On 03/07/2014 01:46 PM, David Anderson wrote: > Oops! Typing to fast. The conversion is Kg * (X - Ko) and NOT Kg * (X > / Ko). The example has it correct. > > sorry about that, > dpa > > > > On 03/07/2014 01:40 PM, David Anderson wrote: >> Hello DPRG Robot Builders, >> >> I was asked last week about the calibration and conversion technique for >> SHARP IR range detectors, like the GP2Y0A02Y and its brothers. For those >> unfamiliar, these are analog devices which use parallax measurements to >> return an analog voltage, usually read with an A/D converter, that >> corresponds to distances out to about 20 inches (more for the higher >> power units). >> >> The calibration and conversion math for all the units is the same. >> Essentially you calibrate by taking measurements at two different >> distances, and plug those into the following equations to get a gain >> (Kg) and an offset (Ko). Those values are then used in turn to convert >> the analog signal to distance in inches, or whatever units you prefer. >> I use 1/10th inches, but that's arbitrary. >> >> The conversion equation is: >> >> distance = Kg(X/Ko) >> >> Where X is the analog valued returned by the A/D converter, Kg >> is gain, and Ko offset. >> >> The calibration equation is: >> >> Kg = (X'-X)* D'D/(D-D') >> Ko = (D'X' - DX)/(D' - D) >> >> Where X is the measurement at distance D, and >> and X' is the second measurement at distance D' >> >> For the GP2Y0A02Y, I usually take a measurement of X where D = 5 inches, >> and a second measurement of X' where D' = 15 inches. >> >> Here is an example from the Left Sharp Sensor on the nBot robot: >> >> D = 5" X = 108 >> D' = 15" X' = 40 >> >> Kg = (40-108)*((5*15)/(5-15)) >> Kg = 510.0 = 5100 for 1/10th inches >> >> Ko = ((15*40) - (5*108))/(15-5) >> Ko = 6.0 >> >> Then in the robot code that uses the left SHARP ranger: >> >> sharp_left_distance = 5100/(sharp_left-6) >> >> where sharp_left is the instantaneous reading of the 8 bit A/D >> channel connected to the left SHARP sensor, >> and sharp_left_distance is the distance of the detection in >> 10th inches. >> >> By way of comparison, for the supposedly identical SHARP right sensor on >> nBot, Kg = 4425 and Ko = 12. >> >> All of the sensors are slightly different, even from the same batch. >> This calibration and conversion not only gives the output in useful >> real-world units, but allows sensors to be swapped and replaced without >> having to change the control code that uses the readings. >> >> Hope this is helpful, >> dpa >> >> >> _______________________________________________ >> DPRGlist mailing list >> DPRGlist at dprg.org >> http://list.dprg.org/mailman/listinfo/dprglist > _______________________________________________ > DPRGlist mailing list > DPRGlist at dprg.org > http://list.dprg.org/mailman/listinfo/dprglist ``` Previous message: [DPRG] SHARP IR Range Detector Calibration and Conversion: Correction! Next message: [DPRG] Reminder: DPRG Meeting Tomorrow and CALL FOR ROBOTS Message index sorted by: [ date ] [ thread ] [ subject ] [ author ] More information about the DPRG mailing list