Author Topic: sharp ir sensor and grid mapping!!  (Read 1206 times)

0 Members and 1 Guest are viewing this topic.

Offline spartyTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
sharp ir sensor and grid mapping!!
« on: March 22, 2012, 09:48:27 AM »
I have been trying to implement admin's wavefront algorithm. I am facing a problem with the sharp ir sensors.

The algorithm is :
To check if a cell contains an obstacle I sweep the motor and take readings from the sensor. I compare the sensor values for eac angle with a minimum and maximum threshold to check if an obstacle is present. If the reading from the senor is within the thresholds I mark the grid as occupied.

The problem is that the readings from the sensors aren't accurate as the servo sweeps and it detects objects even outside the cell being scanned. I saw admin's irobot create code and there is part for edge detection. I was wondering if there is some other method to check if the cell being scanned contains an obstacle or not.

 

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,657
  • Helpful? 169
    • Society of Robots
Re: sharp ir sensor and grid mapping!!
« Reply #1 on: March 23, 2012, 05:40:27 AM »
Quote
it detects objects even outside the cell being scanned
ummmm but if you aren't scanning outside of that cell, then how can it detect stuff outside of the cell? :o

Offline vipersnh

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
Re: sharp ir sensor and grid mapping!!
« Reply #2 on: March 23, 2012, 01:25:58 PM »
Try sonar with probabilistic sonar sensor model as described in the project rossum.
http://rossum.sourceforge.net/

Offline spartyTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: sharp ir sensor and grid mapping!!
« Reply #3 on: March 24, 2012, 11:59:06 AM »
@ admin:
err....I am trying to scan only the next cell that the robot is facing. I have been trying to figure out how you did it on the irobot. Could you please give me a hint? :)

@vipersnh:
I switched to sharp ir as the sonar made things complicated but thanks for sharing :)

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,657
  • Helpful? 169
    • Society of Robots
Re: sharp ir sensor and grid mapping!!
« Reply #4 on: March 24, 2012, 11:44:31 PM »
I'm still not quite sure what problem you are having . . .

I simply pointed the sharp IR in that cell direction, and if it detected anything, I'd record the location it was found in. If you are using the *exact* code I am, perhaps you are using a different SharpIR model and hence you need to change the threshold constants.

if these links aren't good hints then I don't know what is :P
http://www.societyofrobots.com/sensors_sharpirrange.shtml
http://www.societyofrobots.com/programming_wavefront.shtml

Offline spartyTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: sharp ir sensor and grid mapping!!
« Reply #5 on: March 25, 2012, 12:14:15 AM »
admin,
The sharp sensor that I am using is this http://www.pololu.com/catalog/product/136

I've kept my cell size as 20x20 cm2 as the size of my robot is small. The problem that I am face if I point the sensor in a cell direction is that the width of the ir beam is 6cms at 20cms from the robot. The sensor detects objects at other cells too. Moreover, the input voltage from the sensor increases if the beam detects an edge far away from the robot and hence records the object to be present in the cell nearby (I really don't know what's wrong and I suspect that the sensor might be at fault as I soldered the wires to the back of the sensor as I couldn't get 3 pin jst wires anywhere).

I saw your code to figure out how you did the scanning part and I have my own code :) I started off with those links when I started building the robot :)

I have found a crude way to detect obstacles and it works most of the time but the motion of the servo is quite jerky and not continuous as the one in your video :(

Another question is does your code consider objects that appear while the robot is moving from one cell to another?(something like a bump sensor as I saw your robot stop in the middle when you placed a cereal box before it).   

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,657
  • Helpful? 169
    • Society of Robots
Re: sharp ir sensor and grid mapping!!
« Reply #6 on: March 25, 2012, 01:42:27 AM »
The sharp sensor that I am using is this http://www.pololu.com/catalog/product/136

I think that's the one I used, if my memory is right . . .


Quote
I've kept my cell size as 20x20 cm2 as the size of my robot is small. The problem that I am face if I point the sensor in a cell direction is that the width of the ir beam is 6cms at 20cms from the robot. The sensor detects objects at other cells too.

The simple way to avoid this is to decrease your scan angle. Or if you don't mind complicating things and slowing down the scan, you can do fancy trigonometry to figure out where everything is during the scan. I preferred to keep it simple in my code.

Quote
Moreover, the input voltage from the sensor increases if the beam detects an edge far away from the robot and hence records the object to be present in the cell nearby (I really don't know what's wrong and I suspect that the sensor might be at fault as I soldered the wires to the back of the sensor as I couldn't get 3 pin jst wires anywhere).

Your output should look like this below chart. The peak represents the minimum distance the sensor can detect, in which case is 10cm for your sensor. So if you're trying to detect something less than 10cm in front of your robot, the reading will be wrong.



If that's the case, move the sensor back on your robot like this:



Or you can use two sharp IR, one model for long distance scans and the other model for very short distance scans.

Quote
I have found a crude way to detect obstacles and it works most of the time but the motion of the servo is quite jerky and not continuous as the one in your video :(

The jerkiness is probably because you have a large delay between each scan angle. A single accurate SharpIR reading takes up to 40ms, so jerkiness is hard to avoid. A scan that's too fast won't be very accurate. I had noticeable errors in my fast scans, but nothing major.

Quote
Another question is does your code consider objects that appear while the robot is moving from one cell to another?(something like a bump sensor as I saw your robot stop in the middle when you placed a cereal box before it).

My code didn't account for it simply because that complicated the code. I like to keep things simple. But if you had time and your basic code already works, I'd encourage you to try it. The advantage of having it detect objects while the robot is in motion is that the robot doesn't need to stop-start-stop-start-stop-start-stop-start.

Offline spartyTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: sharp ir sensor and grid mapping!!
« Reply #7 on: March 25, 2012, 09:14:27 AM »
Quote
The simple way to avoid this is to decrease your scan angle

If I decrease the scan angle the sensor doesn't detect objects at lower edges of the cell and the motion of my robot goes awry if it hits anything :(

Quote
you can do fancy trigonometry to figure out where everything is during the scan

I stored the maximum and minimum range for each angle in a look-up table to avoid the geometry :P

I am using a 6.5v lead acid battery and I think the voltage fluctuations are causing the problems. I think that the input voltage from the sensor depends upon the output voltage from the board to the sensor. I am going to try to connect a 10uf between vcc and gnd to see how things work.

Quote
But if you had time and your basic code already works, I'd encourage you to try it.

I don't have much time left but I'd love to try it again after this is over. Thank you very much for all the help :)

 


Get Your Ad Here