A Problem about Drone Drift

Hello, I am using an onboard computer to control Pixhawk outside the board. I am preparing to conduct a simple test by using optical flow sensors indoors to fly the drone into the air at a height of 0.5m from the ground. But after takeoff, the drone began to drift and eventually hit the protective net. I would like to ask what may be the reason for this, and is it necessary to adjust the pid parameters? Or is there a problem with my optical flow sensor? Will the ground of the experimental site affect the data acquisition of optical flow sensors?
I hope to receive your help. Thank you.

Due to the inability to send the video, I took a rough screenshot of the video, from top to bottom, showing the drone taking off to drifting to the impact protection net.

Best to upload a log to logs.px4.io, otherwise it’s hard to say.

Thank you for your help. I have downloaded the drone flight log and parsed it in logs. px4. io. Through analysis, I feel that I may need to adjust the pid parameters. In addition, I asked other people on other forums and they told me that it may be due to interference with the magnetic compass or inaccurate optical flow positioning.
I would like to ask, if the optical flow positioning is not accurate, how should I analyze and handle it? I hope you can provide me with some solutions. Thank you again!

This is the flight log I downloaded and found that the estimated flight rate based on optical flow is almost zero. I feel like it’s mostly a problem with the ground, or there’s a problem with the light flow

What optical flow sensor are you using? I have a similar issue which still is unsolved but seems to be sensor related and not due to any parameter / setup settings. You can find a detailed description about the issue and any troubleshooting done so far here: UAV drifts away when hovering based on optical flow

Thank you for your help。
I have preliminarily solved my problem. Firstly, I added stripes on the ground to facilitate the positioning of the optical flow sensor. Secondly, I changed the parameter SENS_FLOW_ROT to 0, and the default parameter for QGC is 270, which does not match the direction of my installation. After adjustment, the drone can take off, although there is still drift, it is acceptable.