The Curved Openspace Algorithm and Neuromorphic Mechanisms for Sonar-Based Obstacle Avoidance