Position flight control going bonkers

Context

Stabilized and Altitude flight modes work great. The drone can hold altitude well during flight in altitude mode.

Problem

Switching to position flight mode makes the drone go nuts (no like really). The drone maintains altitude, but there is considerable motion in the X-Y plane. Controlling pitch and roll results in violent movement, and the drone seems to listen less to what the controls are saying.

Things we tried…

Following some advice from the forums’ other posts (like this post about flight controls not working), we did the following:

  1. Confirmed that Zed Mini’s cable is in the correct orientation and blue light is on.
  2. Confirmed Zed Mini is not bad (we can see its video feed on our laptop by using the Zed Explorer).
  3. QGroundControl shows that we did switch to position flight mode (we know it is capable of rejecting the change to position mode; however we are positive that it changes to position mode)
  4. We are flying on a gym floor, so we attached a lot of cardboard and Apriltags to the floor; the issue persists.
  5. Reflashed VMC, PCC, and reinstalled QGC. Followed all steps again.

Please help

At this point, I am lost as to what to do. I tried following the logs on MQTT, however, I am unable to distinguish between what the drone thinks its position is and what controls it is changing. Please advise on how I can see what input is being fed to the FCC by the VMC that is driving the drone. I will post an MQTT log dump on Monday when I have access to the drone.

Any ideas are well appreciated.

Thanks,
Om

1 Like

Have you tried recalibrating the pixhawk?

I know your issue is for position/xy drift, which is primarily the zed, but the gyroscope on the pixhawk could be interfering with the rotation readout and cause drift.

Thanks for your reply. Yes, we have recalibrated it multiple times. Still the same results.

Om

Can you verify what version of the PX4 firmware you’re running? I’m assuming it’s the one we specified in the Gitbook docs, but please double-check and let us know. Also, when you look at the console output for vio you should see something like:

vio_1        | 2023-11-02 16:26:00.351 | DEBUG    | bell.avr.mqtt.client:on_connect:292 - Connected with result 0
vio_1        | 2023-11-02 16:26:02.624 | SUCCESS  | zed_library:setup:53 - Zed Camera Loaded
vio_1        | 2023-11-02 16:26:02.676 | SUCCESS  | bell.avr.mqtt.client:on_connect:296 - Subscribed to: avr/vio/resync
vio_1        | 2023-11-02 16:26:02.677 | DEBUG    | zed_library:setup:67 - Zed Camera Enabled positional tracking

Let us know and we can take it from there.

Hi,

Thanks for your help.

I can confirm we are running the correct PX4 firmware from the Gitbook. We also see the output that you mentioned.

I was able to collect logs from my flight in position flight mode, please find them below.

Console Output:

# I ran `./start.py run --min`
# <..snip..>
Attaching to avr2022_mqtt_1, avr2022_mavp2p_1, avr2022_fcm_1, avr2022_vio_1, avr2022_fusion_1
fcm_1        | 2023-11-07 23:44:09.198 | DEBUG    | __main__:connect:42 - Telemetry: Connecting to the FCC
fcm_1        | 2023-11-07 23:44:09.207 | DEBUG    | bell.avr.mqtt.client:on_connect:292 - Connected with result 0
fcm_1        | 2023-11-07 23:44:10.258 | SUCCESS  | __main__:connect:51 - Telemetry: Connected to the FCC
fcm_1        | 2023-11-07 23:44:10.261 | DEBUG    | __main__:connected_status_telemetry:104 - connected_status loop started
mavp2p_1     | 2023/11/07 23:43:47 mavp2p v0.7.0
mavp2p_1     | 2023/11/07 23:43:47 router started with 4 endpoints
mavp2p_1     | 2023/11/07 23:43:47 channel opened: serial
mavp2p_1     | 2023/11/07 23:43:47 node appeared: chan=serial sid=1 cid=1
mavp2p_1     | 2023/11/07 23:43:47 channel opened: udp:172.18.0.1:56824
mavp2p_1     | 2023/11/07 23:43:47 node appeared: chan=udp:172.18.0.1:56824 sid=143 cid=190
mavp2p_1     | 2023/11/07 23:43:48 channel opened: tcp:172.18.0.1:38902
mavp2p_1     | 2023/11/07 23:43:48 channel opened: tcp:172.18.0.1:38894
fcm_1        | 2023-11-07 23:44:10.271 | DEBUG    | __main__:battery_telemetry:130 - battery_telemetry loop started
mqtt_1       | 1699400626: mosquitto version 2.0.14 starting
mqtt_1       | 1699400626: Config loaded from /mosquitto/config/mosquitto.conf.
mqtt_1       | 1699400626: Opening ipv4 listen socket on port 18830.
mqtt_1       | 1699400626: Opening ipv6 listen socket on port 18830.
mqtt_1       | 1699400626: mosquitto version 2.0.14 running
mqtt_1       | 1699400627: New connection from 172.18.0.7:55079 on port 18830.
mqtt_1       | 1699400627: New connection from 172.18.0.5:53301 on port 18830.
mqtt_1       | 1699400627: New connection from 172.18.0.1:48362 on port 18830.
mqtt_1       | 1699400627: New connection from 172.18.0.1:48346 on port 18830.
mqtt_1       | 1699400627: New connection from 172.18.0.1:48344 on port 18830.
mqtt_1       | 1699400627: New connection from 172.18.0.1:48330 on port 18830.
mqtt_1       | 1699400627: New connection from 172.18.0.6:57297 on port 18830.
mqtt_1       | 1699400627: New client connected from 172.18.0.7:55079 as auto-857B2624-4B31-C2EC-2D8F-7CE4EDC230BA (p2, c1, k60).
mqtt_1       | 1699400627: New client connected from 172.18.0.5:53301 as auto-6DBA94A9-E361-1F10-E64C-9438CDD21257 (p2, c1, k60).
mqtt_1       | 1699400627: New client connected from 172.18.0.6:57297 as auto-A2731AC1-FD7B-0D3F-DF83-32D26B31DA22 (p2, c1, k60).
mqtt_1       | 1699400627: New client connected from 172.18.0.1:48330 as auto-BC2B1FFF-63C9-073E-832E-2C23F71015F4 (p2, c1, k60).
mqtt_1       | 1699400627: New client connected from 172.18.0.1:48344 as auto-0339FE26-1288-57A7-5E5A-0EE4546C9920 (p2, c1, k60).
mqtt_1       | 1699400627: New client connected from 172.18.0.1:48346 as auto-5CEA842D-7636-BCC6-9804-229B4A78B5D2 (p2, c1, k60).
mqtt_1       | 1699400627: New client connected from 172.18.0.1:48362 as auto-68367FD4-1A14-1E9A-D2FD-F673FA9F8381 (p2, c1, k60).
mavp2p_1     | 2023/11/07 23:43:48 node appeared: chan=tcp:172.18.0.1:38894 sid=141 cid=190
mqtt_1       | 1699400637: Client auto-A2731AC1-FD7B-0D3F-DF83-32D26B31DA22 closed its connection.
fcm_1        | 2023-11-07 23:44:10.275 | DEBUG    | __main__:in_air_telemetry:144 - in_air loop started
fcm_1        | 2023-11-07 23:44:10.279 | DEBUG    | __main__:is_armed_telemetry:154 - is_armed loop started
vio_1        | 2023-11-07 23:44:02.791 | DEBUG    | __main__:run:121 - Setting up camera connection
vio_1        | 2023-11-07 23:44:02.792 | DEBUG    | zed_library:setup:47 - Zed Camera Loading...
vio_1        | 2023-11-07 23:44:05.696 | DEBUG    | bell.avr.mqtt.client:on_connect:292 - Connected with result 0
fcm_1        | 2023-11-07 23:44:10.284 | DEBUG    | __main__:flight_mode_telemetry:222 - flight_mode_telemetry loop started
vio_1        | 2023-11-07 23:44:05.697 | SUCCESS  | zed_library:setup:53 - Zed Camera Loaded
mqtt_1       | 1699400637: Client auto-0339FE26-1288-57A7-5E5A-0EE4546C9920 closed its connection.
fcm_1        | 2023-11-07 23:44:10.292 | DEBUG    | __main__:position_ned_telemetry:248 - position_ned telemetry loop started
vio_1        | 2023-11-07 23:44:05.747 | SUCCESS  | bell.avr.mqtt.client:on_connect:296 - Subscribed to: avr/vio/resync
fcm_1        | 2023-11-07 23:44:10.300 | DEBUG    | __main__:position_lla_telemetry:264 - position_lla telemetry loop started
fcm_1        | 2023-11-07 23:44:10.304 | DEBUG    | __main__:home_lla_telemetry:288 - home_lla telemetry loop started
fcm_1        | 2023-11-07 23:44:10.309 | DEBUG    | __main__:attitude_euler_telemetry:311 - attitude_euler telemetry loop started
mavp2p_1     | 2023/11/07 23:43:48 node appeared: chan=tcp:172.18.0.1:38902 sid=142 cid=190
mavp2p_1     | 2023/11/07 23:43:57 channel closed: tcp:172.18.0.1:38894
mavp2p_1     | 2023/11/07 23:43:57 node disappeared: chan=tcp:172.18.0.1:38894 sid=141 cid=190
mqtt_1       | 1699400637: Client auto-BC2B1FFF-63C9-073E-832E-2C23F71015F4 closed its connection.
mqtt_1       | 1699400637: Client auto-5CEA842D-7636-BCC6-9804-229B4A78B5D2 closed its connection.
mqtt_1       | 1699400637: Client auto-68367FD4-1A14-1E9A-D2FD-F673FA9F8381 closed its connection.
mqtt_1       | 1699400642: New connection from 172.18.0.4:57769 on port 18830.
mqtt_1       | 1699400642: New client connected from 172.18.0.4:57769 as auto-3A057BCD-FDA5-33CB-8926-3C64A17C3D64 (p2, c1, k60).
mqtt_1       | 1699400649: New connection from 172.18.0.1:48374 on port 18830.
fcm_1        | 2023-11-07 23:44:10.313 | DEBUG    | __main__:velocity_ned_telemetry:340 - velocity_ned telemetry loop started
fcm_1        | 2023-11-07 23:44:10.318 | DEBUG    | __main__:gps_info_telemetry:355 - gps_info telemetry loop started
vio_1        | 2023-11-07 23:44:05.747 | DEBUG    | zed_library:setup:67 - Zed Camera Enabled positional tracking
mavp2p_1     | 2023/11/07 23:43:57 channel closed: tcp:172.18.0.1:38902
mavp2p_1     | 2023/11/07 23:43:57 node disappeared: chan=tcp:172.18.0.1:38902 sid=142 cid=190
mavp2p_1     | 2023/11/07 23:44:09 channel opened: tcp:172.18.0.1:38904
mavp2p_1     | 2023/11/07 23:44:09 node appeared: chan=tcp:172.18.0.1:38904 sid=142 cid=190
mqtt_1       | 1699400649: New client connected from 172.18.0.1:48374 as auto-88FDD3D7-E305-5EE7-D705-C6A6D5A8C889 (p2, c1, k60).
mqtt_1       | 1699400652: Client auto-6DBA94A9-E361-1F10-E64C-9438CDD21257 closed its connection.
mqtt_1       | 1699400655: New connection from 172.18.0.1:48378 on port 18830.
mqtt_1       | 1699400655: New client connected from 172.18.0.1:48378 as auto-3FFB1E6D-490C-64AC-30C2-859614A5C181 (p2, c1, k60).
fcm_1        | 2023-11-07 23:44:15.010 | DEBUG    | bell.avr.mqtt.client:on_connect:292 - Connected with result 0
mqtt_1       | 1699400655: New connection from 172.18.0.5:40479 on port 18830.
mqtt_1       | 1699400655: New client connected from 172.18.0.5:40479 as auto-49C53CAE-F3D2-527F-D85A-DC6EA22F998B (p2, c1, k60).
fcm_1        | 2023-11-07 23:44:15.019 | SUCCESS  | bell.avr.mqtt.client:on_connect:296 - Subscribed to: avr/fcm/actions
fusion_1     | 2023-11-07 23:44:15.023 | DEBUG    | bell.avr.mqtt.client:on_connect:292 - Connected with result 0
fusion_1     | 2023-11-07 23:44:15.026 | SUCCESS  | bell.avr.mqtt.client:on_connect:296 - Subscribed to: avr/vio/position/ned
fcm_1        | 2023-11-07 23:44:15.024 | DEBUG    | __main__:connect:115 - FCM Control: Connecting to the FCC
fusion_1     | 2023-11-07 23:44:15.027 | SUCCESS  | bell.avr.mqtt.client:on_connect:296 - Subscribed to: avr/vio/orientation/eul
fusion_1     | 2023-11-07 23:44:15.028 | SUCCESS  | bell.avr.mqtt.client:on_connect:296 - Subscribed to: avr/vio/heading
fusion_1     | 2023-11-07 23:44:15.030 | SUCCESS  | bell.avr.mqtt.client:on_connect:296 - Subscribed to: avr/vio/velocity/ned
fusion_1     | 2023-11-07 23:44:15.031 | SUCCESS  | bell.avr.mqtt.client:on_connect:296 - Subscribed to: avr/fusion/position/ned
fcm_1        | 2023-11-07 23:44:15.036 | SUCCESS  | bell.avr.mqtt.client:on_connect:296 - Subscribed to: avr/fcm/capture_home
fcm_1        | 2023-11-07 23:44:15.037 | SUCCESS  | bell.avr.mqtt.client:on_connect:296 - Subscribed to: avr/fcm/location/global_full
fcm_1        | 2023-11-07 23:44:15.038 | SUCCESS  | bell.avr.mqtt.client:on_connect:296 - Subscribed to: avr/fcm/location/home_full
mavp2p_1     | 2023/11/07 23:44:15 channel opened: tcp:172.18.0.1:38918
fusion_1     | 2023-11-07 23:44:15.083 | DEBUG    | __main__:fuse_att_heading:191 - Empty groundspeed in fuse att heading
fcm_1        | 2023-11-07 23:44:15.102 | SUCCESS  | __main__:connect:120 - Connected to the FCC
fcm_1        | 2023-11-07 23:44:15.104 | DEBUG    | __main__:action_dispatcher:216 - action_dispatcher started
mqtt_1       | 1699400655: New connection from 172.18.0.1:48384 on port 18830.
mqtt_1       | 1699400655: New client connected from 172.18.0.1:48384 as auto-83E68276-B9F3-855A-1CF1-5CC8E1FEC1CC (p2, c1, k60).
fcm_1        | 2023-11-07 23:44:15.108 | DEBUG    | bell.avr.mqtt.client:on_connect:292 - Connected with result 0
fusion_1     | 2023-11-07 23:44:15.123 | DEBUG    | __main__:assemble_hil_gps_message:234 - Waiting for avr/fusion/course message to be populated
mavp2p_1     | 2023/11/07 23:44:15 node appeared: chan=tcp:172.18.0.1:38918 sid=141 cid=190
fcm_1        | 2023-11-07 23:44:15.510 | INFO     | __main__:home_lla_telemetry:202 - FCM Control: home position captured
mavp2p_1     | 2023/11/07 23:44:19 channel opened: udp:172.18.0.1:48384
mavp2p_1     | 2023/11/07 23:44:19 node appeared: chan=udp:172.18.0.1:48384 sid=143 cid=190
fcm_1        | 2023-11-07 23:44:19.232 | DEBUG    | __main__:run_non_blocking:52 - HIL_GPS: Waiting for Mavlink heartbeat
fcm_1        | 2023-11-07 23:44:19.488 | SUCCESS  | __main__:run_non_blocking:56 - HIL_GPS: Mavlink heartbeat received
mqtt_1       | 1699400659: New connection from 172.18.0.1:48400 on port 18830.
mqtt_1       | 1699400659: New client connected from 172.18.0.1:48400 as auto-02EF8BDA-14F9-BCC1-A8E9-18A0F0EB9C83 (p2, c1, k60).
fcm_1        | 2023-11-07 23:44:19.493 | DEBUG    | bell.avr.mqtt.client:on_connect:292 - Connected with result 0
fcm_1        | 2023-11-07 23:44:19.494 | SUCCESS  | bell.avr.mqtt.client:on_connect:296 - Subscribed to: avr/fusion/hil_gps
mavp2p_1     | 2023/11/07 23:44:37 node disappeared: chan=udp:172.18.0.1:56824 sid=143 cid=190
fcm_1        | 2023-11-07 23:44:37.548 | INFO     | __main__:position_lla_telemetry:190 - FCM Control: current position initialized
mavp2p_1     | 2023/11/07 23:44:54 channel opened: tcp:172.18.0.1:57753
mavp2p_1     | 2023/11/07 23:44:55 node appeared: chan=tcp:172.18.0.1:57753 sid=255 cid=190
mavp2p_1     | 2023/11/07 23:44:57 channel closed: udp:172.18.0.1:56824
mqtt_1       | 1699400704: New connection from 172.18.0.1:57754 on port 18830.
mqtt_1       | 1699400704: New client connected from 172.18.0.1:57754 as auto-63E5BFC3-37E0-B34E-1DE8-3543E1A7DA79 (p2, c1, k60).

Please find MQTT logs here: MQTT logs github
It seems to me from the logs that the ned velocity reported by fusion is significantly different than the velocity reported by fcm.
Also, the drone seems to just not drift, but rather take control and go in that specific direction. I think so as it acts the same way as if it was receiving input from the controller to go in that direction (except for the fact that the joysticks are centered so it should be holding position).

A teammate recorded the video of the flight; I will attach it as soon as I get it.

Thank you,
Om