I am having troubles trying to properly setup\calibrate Optical flow using PX4Flow. Now, I am following the document in the link below and I am at the point where I am currently trying to calibrate the PX4Flow.
Right now, my problem is the OF.flowX and OF.bodyX do not see to be correlating. I am also having the same issue with flowY\bodyY. Now, I understand that I can use the FLOW_FXSCALER\FLOWFYSCALER. But I do not understand how this will help if the data points do not really line up.
below are screenshots of my logs from Mission Planner. Notice that the GrX and GrY are align to the flowX\flowY.
In my case this was improved by setting Flow_pos_x,y,z to set the position offset from the center of the flight controller. and, even more effective is to set Flow_Orient to set any yaw difference between the px4flow board and the flight controller. These settings are very sensitive, so just ballpark them and continue to do tests on the bench, adjust the settings, and test again, until the settings line up. I would work first to have the imu_gyro graphs agree with the of_body graphs, once the graphs look close you can start adjusting the scale settings.
Thank you for your response. I did not realize there was an offset position for the optical flow. Considering that my PX4Flow is mounted at one side of my Q450, I would say this may very well be the issue. Let me give it a try.
Just a quick update. It has been a busy week so just had sometime today to try to work on the offset. And I believe I have it where now the imu_gyro and of_body graphs line up. Also, the of flowx and flowy seem to be correlating. I am going to start modifying the scale factor.
Well, I was never able to get my flowx\bodyx and floy\body to align properly. Changing the scale factor for both X and Y did not contribute to any scaling during my setup. However, I suspected that maybe the PX4Flow was not picking up proper readings from the camera. I forgot to mention the fact that I was doing all by setup\calibration indoors. And even with my windows open, I notice that the PX4flow camera video stream was still dark.
So, I tried the PX4Flow testing outdoors and low and behold - I was able to get proper alignment on my flow and body.
@Hquarter - have you had much success with indoor flight setup? I suspect it is the lighting that is in my office but is there certain variables that will assist in low-lighting conditions? Especially for indoors?
I even checked the PX4Flow configurations. Ex. IMAGE_L_LIGHT which if enabled, presumably sets the sensor in low-light mode. I tried setting this via Mission Planner\write params but on bootup of the PX4flow, it seems that the values are not set.
@drone_dev your log seems to be ok (at least it looks similar to mine :-))
Question: how does your NKF5.rng values look like? I do have an offset of roundabout 0.5m which looks strange to me…
hi @mtbsteve - to be honest, I disabled most of log types other than the IMU and OF. Just was trying to reduce my log size while debugging my bodyx\flowx issue. That is interesting to see that you have a ~0.5m offset on your rng.
I am still kind of new to Ardupilot. What log bit should I enable to log out NKF? I’ll probably log everything and send you the screenshot of NKF5.rng
Also, just curious, what type of rangefinder are you using?
In terms of flow\body correlation, your screenshot looks really good. IS that log sample from you running it indoors or outdoors?
I am having difficulties in obtaining good correlation when I am doing my setup indoors.
I don’t fly indoors, but I did my calibration of the px4flow indoors with logging while disarmed. Brightness and surface texture certainly have a big effect on the results. Your results are looking really Good!! Have you attempted to fly yet?
Thank you for your advice. I believe setting the body position offset really help tighten the correlation of flow\body. I have tried flying yet with the range finder\optical flow. I was hoping to do it indoors. Big picture, I have a realsense D435 that I want to do some autonomous AI navigation with. So, just was trying to get my copter to the point where it can hopefully stay fixed in an indoor environment.
But seeing that this may not be the case, I may look at other alternatives to the PX4Flow.
How has your experience been with the PX4Flow with hold position, loiter mode?
@drone_dev I solved the offset issue in the meantime by adjusting the RNGFND_OFFSET parameter.
I am using a Lidarlite rangefinder connected by PPM.
I have the LOG_BITMASK set to 176126
Hope this helps
Being a velocity estimator, Optical Flow is subject to drift. If you are looking for indoor absolute localization, you can use UWB triangulation or try the RealSense T265 Visual Positioning System
Evan, indoor environment is very different from flying outdoors with a gps lock. You rely need to choose if you will fly with a gps lock (outdoor) or without gps lock (indoors) then develop your settings and hardware just for that purpose. I haven’t tried, just read lots of posts on the topic.
hi @ppoirier. Thank you for your reply. I definitely understand that there can be drift but I have seen videos using PX4flow where the drift is minimal. I also have seen videos where the OF position hold had constant drift.
On your setup, are you able to obtain position hold with minor drift using OF? NOTE: I am not sure what your setup is compared to mine. To be honest, I have not tested indoors yet because I have not been able to properly calibrate my body\flow settings for OF.
My end goal is to be able to properly setup indoors so I can perform a position hold with the aid of OF (with minor drifting). Not sure yet if that is possible with my current setup.
OF properly calibrated with good PID tuning and fast motor control (DSHOT) can make stable loiter over well textured surface (rug), but drift will invariably occur
Results of my optical flow implementation.
I exchanged the original PX4FLOW lens by a 6mm wide angle lens.
Stability even under windy conditions in Flowhold and Loiter is pretty impressive.