For autonomous indoor flight, My first try is using optitrack motion capture system to simulate GPS coordinates to copter. The basic idea is to transform motion capture system local coordinate to GPS WGS84 coordinate and use GPS_TYPE=MAV(14) to feed GPS data to copter. The test result is here, it works ok. However there is a problem with this approach. It still need magnetometer/compass onboard copter to navigate. But compass performance could be very unstable due to many indoor interference, for example, air condition. and loudspeaker.
Thanks to @priseborough and @peterbarker really great work, we can feed both position and orientation data to copter from external source. So that copter can fly autonomously without magnetometer. I use use mavlink message ATT_POS_MOCAP to send external nav data to copter through wifi (COMPASS_USE = COMPASS_USE2 = COMPASS_USE3 = 0, EK2_GPS_TYPE=3). The reason why I use ATT_POS_MOCAP instead of VISION_POSITION_ESTIMATE is that former accept quaternion and later accept euler angles. Because optitrack data API ouput quaternion. I do not need to convert it to euler angles.
Here is my test flight video. It is a parrot bebop running ardupilot master. It is auto takeoff in loiter mode and then switch to circle mode. The result is quite well and reliable (no magnetic interference from indoor environment)