Sonar v. IR

I'm not clear how one should choose between Sonar and IR sensors. We seem to use either for detecting distance, but there must be operating characteristics that argue for one over another depending on circumstances.

Sonar

Uses sound waves to determin distance

Doesn't detect curved or soft surfaces well

 

IR

Uses light (infra-red) to determine distance

Doesn't work well in bright daylight

Some apparently opaque substances are not opaque to IR

 

What have I missed - there must be loads?

Thanks for that, i was just

Thanks for that, i was just wondering what kind of sensor i’ll use in my next robot, and needed a pros/cons… and here it is! (and a sonar should be perfect for me) (and they indeed really look cool ^^ )

 

But i have a (maybe not so) stupid question, are ultrasound rangers dangerous (or at least painful) for animals? As they can hear frequencies we can’t… It’s pretty important, i don’t think my girlfriend will really appreciate if my robot hurts her cat!