IR sensor does not work well on carpets I have facing a problem since long and cannot solve it. I built Arduino car and place 2 IR sensors shown in image, to check down distance to avoid falling from stairs. One is at back and other at front. On hard surface they work well but on carpet always give wrong reading like no object there which translates unsafe to move and my car stops. How can we solve this problem? I also tried Ultrasonic but it has same problem on carpets or fabric. 

I tested this that on carpet it was giving a big distance reading but when I place a white paper, suddenly it was fixed and detected surface.
You may have noticed that this product is no longer available from well known parts distributors like adafruit.com, sparkfun.com or trossenrobotics.com. I would recommend using a Sharp distance sensor designed for the distances you are interested in:

It is about 10 times the price, but produces a variable voltage that you can read with the Arduino's ADC.  Then you can compensate for floor irregularities in your code.  

If you care to experiment, I obsurved that the better distance measurement devices angle the emitter and sensor to light up &amp; observe the same spot at the desired operating distance:


You might try this with your current sensor.  However, it does not appear the manufacture left you enough lead length to make such an adjustment.