In the last decade, unmanned aerial vehicle gained popularity and started to be used in different tasks most of which are performed in outdoor environments. Still, there is a great potential to use quadrotors in indoor tasks such as urban relief and disasteroperations. In this paper, we developed a framework and a novel target-based navigationalgorithm for mapping of an unknown 2D environment with a quadrotor using an ultrawideband system. The target-based navigation algorithm aims to explore map of the environment by moving the border between the discovered and undiscovered areas. It usesA* search algorithm for path planning if there is an obstacle present in the environment.The target-based navigation algorithm is implemented on Gazebo simulator and its performance is compared with the well-known wall following algorithm and exploration algorithm in terms of task completion time and distance travelled. The target-based navigationalgorithm outperforms the other two algorithms especially in environments with obstacles.