
robotmaker
USA
Asked
— Edited
how can i add offset to sonars or IR sensors ,some sensors dont read the distance correct ,like sonars its 6 inches
how can i add offset to sonars or IR sensors ,some sensors dont read the distance correct ,like sonars its 6 inches
The LV-MaxSonar-EZ1T
detects objects from 0-inches to 254-inches
(6.45-meters) and provides sonar range
information from 6-inches out to 254-inches
with 1-inch resolution. Objects from 0-
inches to 6-inches range as 6-inches
how would i add that to your control under sonar distance
like 1 inch from sonar is read as 1 inch and 2 inch is read as 2 inch and so on
and do you have a example for the math and formula for the ping distance
lv-maxsonar-ez1 has both analog output and ping output
from the data sheet it says 147us/inch for pwm (ping)
Do it like we did for Leaf. Just measure the distance every foot or so. and make the notes to what value from 0-255 you get. Then you can pretty well tell what is two feet, four feet, eight feet,
six inches, etc.
plus some was done in lispworks too
So let's say you take a tape measure and measure the distance between the sensor and a wall. Let's speculate the distance is 50 cm and the value is 100.
One would assume that a value of 200 would be the distance of 100 cm, and the value of 50 would be a distance of 25 cm.
So it's easy to see the multiplier (scalar) for the returned value would be 0.5 (50 divided by 100).
So you could make a C# function like this...
Code:
also thats in cm ,i forgot formula for inches
Coding is always hard for me and thinking for most of the rest of the guys in the forum ,thats one reason you made the EZB
If it is EZ-Script, than you will do this...
Code:
First you just need to figure out your scalar. And use the tape measure like my prevoius response
The ADC Value control does have the option to type in your unit of measurement (for our visual purposes only) and a multiplier feature, which if set to 0 should represent 1 inch for each displayed number.
You may not need a scaler (multiplier) but if you do then the math is the same, just do the calibration steps @DJ mentioned using inches, and enter the scaler number in the multiplier field (i.e. 0.5 using @DJ's example).
Hope this helps.
pwm is very stable