This paper describes the obstacle avoidance architecture to walk safely around in factory and home environment, and presents methods for path planning and obstacle avoidance for the humanoid robot. Solving the problem of obstacle avoidance for a humanoid robot in an unstructured environment is a big challenge, because the robot can easily lose its stability or fall down if it hits or steps on an obstacle. We briefly overview the general software architecture composed of perception, short and long term memory, behavior control, and motion control, and emphasize on our methods for obstacle detection by plane extraction, occupancy grid mapping, and path planning. A main technological target is to autonomously explore and wander around in home environments as well as to communicate with humans.