Think about it in steps:
1) can you measure the copter's spacial positions?
2) can you control individual motor's lift?
3) can you stablize the copter based on 1) and 2)?
4) can you move the copter based on 1), 2) and 3)?
5) can you measure the distance using the sonar?
6) can you work the measurements into the decision to move the copter?
Once you have those individual steps done, you are literally done with the project.