nhatnmse61103:
My question is how to avoid Ultrasonic sensor detect a hill as a obstacle. And is there anyway to do this project?
Set a distance threshold in your code. Ignore detected objects above that distance (it's probably a hill). Below that distance, it's probably an obstacle.
Assuming a horizontally-aimed sonar, this will work best if the sensor is placed high on the robot (though this will hurt your ability to sense short obstacles). Alternatively, put the sensor low on the robot and aim it upwards a bit.
If you are driving a car your brain is the computer that decides the difference between a hill and an obstacle. While we do it unconsciously I suspect it requires a lot of sophisticated processing. Part of our ability is based on the improbability of something that looks like a hill being a wall with a hill painted onto it.
Obviously one of the inputs is the steepness of the hill - some hills are too steep to drive up and then come into the "obstacle" box. But even detecting steepness with a camera must be very difficult.
And one can't just do a "suck it and see" by having the car try to climb an obstacle - it might damage the obstacle or the car.
I would be surprised if an Arduino can manage this problem.