I’m currently working on a project with a quadcopter to make it fly indoors with the help of a Motion Capture System (MCS). I use Qualisys motion capture system as a replacement for GPS and a Pixhawk 4 as the autopilot system. The Pixhawk is flashed to ArduCopter 4.1.1.
The position data from the MCS is retrieved in a ROS node that publishes the pose to a dedicated topic. After this I use ros1_bridge to enable the exchange of messages between ROS 1 and ROS 2. Then the position data is fed to the PixHawk 4 via MavLink by launching the ROS 2 node.
I first fly in alt_hold mode, then loiter mode using a radio controller (Radioking TX18S) and monitor the position data in the mission planner QGroundControl. In QGroundControl I see that the position data is successfully received and the drone will arm using the data from MCS for position and orientation.
I followed this article for configuration of the drone: Optitrack for Non-GPS Navigation — Copter documentation.
My problem is that once i switch over to loiter mode, I loose control of the drone. It drifts to one side, and when i try to get it back to the origin, it overshoots (see video down below). It seems like the altitude is fine, but when i roll to either side it overshoots. To save it from crashing I have to switch to stabilize mode and land.
Could anyone lead me on the right way to proceed ?
How I send the data via mavlink: mocap_feedback/qualisys_subscriber.py at main · AscendNTNU/mocap_feedback · GitHub
Complete parameter list: elvind_params.param (29.8 KB)
Log from flying with mocap: elvind_log_mocap.bin (804.3 KB) (ATT_POS_MOCAP message)
Video example of what is happening when I don’t switch to stabilize: elvind_flying_mocap.MOV — Kapwing