Flight is all over the place

I’m using a Pixhawk Cube Black with PX4, and the flight is all over the place. It keeps pulling to the right and forward and I can’t figure out why, I have recalibrated sensors multiple times. This is in Stabilised and Altitude flight modes.

I also have visual inertial odometry set up for the drone to enter Position flight mode which I feel would work perfectly fine if the drone system was stable, has anyone got any suggestions or helpful tips?

I have attached the two flight logs links below:

1st flight log

2nd flight log

It just seems to drift in every and any direction it deems fit. I understand that in Altitude mode there will be drift but not that I need to give constant input from the transmitter just so it doesn’t hit a wall every 5 seconds.

I feel like this is a flight controller issue and it doesn’t matter how many times I calibrate sensors, doesn’t change anything. I have multiple more flight logs below:

3
4
5
6

I think that’s pretty much expected. You need to add something like a flow module or VIO.

So no matter how much I calibrate the sensors, the drone is incapable of holding somewhat still? It’s drifting at a speed of at least 1 m/s, which seems extreme.

I have also added VIO, but the Position mode won’t hold steady and acts erratic and all over the place, which I can’t seem to pinpoint why as the X,Y,Z data from the stereovision camera is consistent enough. I’m using ROS to publish the VIO data to the Pixhawk.

I have been trying this for weeks and am completely stuck.

I have reset the firmware onboard and its flying better now somewhat in Altitude mode, however when in Position mode, it’s still not holding a stable position at all, does anyone have any input on this for using VIO data through ROS?

I’m sorry but how am I supposed to help you with your VIO setup without any logs or information about what VIO you’re using and how.

I have 6 logs attached as hyperlinks above?

I’m using VIO through ROS from a ZED 2i stereovision camera. I’m taking the data from the /zed/zed_node/odom and publishing it to the /mavros/odometry/out node, which I can see in QGroundControl. I can enter POSITION flight mode but it doesn’t hold stable at all.

I don’t have the parameter on my PX4 for MAV_ODOM_LP to set it to 1, not sure why and there’s nothing online about it.

When I go into the MAVLink console and type “vehicle_visual_odometry”, I do get a reading however, but I can’t monitor these readings in the MAVLink Inspector, and I can’t see the MAV_COMP_ID_VISUAL_INERTIAL_ODOMETRY of 197 for the heartbeat anywhere either, even though I’m sending it through ROS

I have another 4 logs here that I have tried out…so with just using the LiDAR distance sensor for absolute height above ground (this log: altitude mode only log) it seemed pretty good for holding a height above ground…but when I introduce the VIO data to the EKF2 estimator where I have EKF2_HGT set to for the distance sensor, the drone flies fast up (see this log here).

I’m not sure why, however upon inspection of ROS nodes “mavros/vision_pose/pose” and “mavros/local_position/pose” I have noticed that the Z value can be fairly different when compared to X and Y values. I understand that the first node is the data from the stereovision camera itself and the second node is the fused data within the EKF2 estimator…I have another two flight logs here when I tried setting the vision to EKF2_HGT, not ideal as I can see!: no.1; no.2.

I meant there are no logs with VIO enabled, right?

There is, the logs that enter Position flight mode are using the VIO, as they wouldn’t enter Position flight mode unless the flight controller had some way of estimating its local position, I have no GPS onboard. I have the PX4 parameter EKF2_EV_CTRL set to 15 to use Horozontal position, Vertical position, 3D velocity, and Yaw as EKF2_AID_MASK is deprecated.

Did I miss a parameter?

This is another flight I did VIO Position mode flight log. I put the drone into Altitude and it’s fine and controllable. But in Position mode using the VIO, it was as if I was pushing the joysticks on my transmitter (which the trims are zeroed) it was moving that fast, it was also erratic at the end, doing crazy rotations and wanting to fly at full tilt in one direction.

Are you sure your transformations from ROS to PX4 are correct?

See this as an example. We have flown it a decent amount.

I’m not 100% sure no, for what I have, my code does look different to yours so I have definetely done something wrong/different where I’m not quite there with it.

Can I ask what device you are using for the VIO?

I’m using ROS1 for it, my code might have few things in there not necessary but this is just as I’ve been troubleshooting etc, I have deleted as much commented stuff as I could and my code can be seen here: zed_odom_publisher.cpp

Just to add, do you have the px4_msgs folder with the .h files? I can’t find them anywhere online, I can’t install anything from ROS2 as the guides online are pretty bad, all I get is errors that something in the setup files doesn’t work, with the installation of FastDDS-2.0.0, I’ve tried 10 times, different ways, no prevail