Cheerson CX-OF low cost optical flow sensor testing

@ppoirier, OK so that was the vehicle trying to hold position with no pilot input? Not bad… it gives us an indication of what level of performance people should expect.

1 Like

@sevet, re the crazyflie flow sensor, I suspect it will work but it hasn’t been tested yet. One thing to note though is that as far asI know it doesn’t use I2C but rather SPI. Only the original Pixhawk1 board has the SPI port exposed I think.

1 Like

@rmackay9 to my knowledge other board with SPI port exposed are: Pixracer (needs change in hwdef.dat to use esp8266 port as SPI), RevoMini (needs change in hwdef.dat to use OPLink port as SPI) and Omnibus F4 (this has SPI port but I don’t see relevant config in hwdef.dat for it)

2 Likes

True, but the pixhawk 4 does have a port labeled SPI (witch is why i expected it to have an external SPI port) but it doesn’t work, even when you remove some of the # in the sourcecode it doesn’t have a CS pin. (or at least not one that I could find in hw.def)

1 Like

@rmackay9 working on a new build of Mini Quad (180 Size) with a MatekF405 + TFMINI + Cheerson OF

Bad optflow health

Edit: This problem is related to MatekF405 as I can make it work with a PixHawk. I will investigate on the chibios gitter and report back.

1 Like

@ppoirier,

There’s an issue in the Copter-3.6 issues list which sounds like what you’ve found:

I was not sure if this issue was real or not so I haven’t pushed it but I’ll bring it up on next Tuesday’s dev call

1 Like

Randy, please note that i can use the range finder on any ports at different speeds, but I cannot connect the OpticalFlow on any port either with or without rangefinder present. So for me the problem looks like a driver incompatibility (or inconsistency).

Question why do you set speed within the driver, shouldn’t it be through configuration ?

1 Like

@ppoirier, OK, not sure what the issue is then - I guess it’s a lower level board specific issue.

I think forcing the baud rate to 19200 is OK in this case because it ensures the user doesn’t accidentally set the baud rate incorrectly and saves the user some time in the setup. If it’s necessary that it’s configurable then we can change the driver to use the parameter.

1 Like

OK Thanks to @OXINARF ,
I forced the Cheerson Driver on ‘‘other boards’’
https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_OpticalFlow/OpticalFlow.cpp#L108

Please note that I had to use EKF3 for making it fly stable… EKF2 was diverging and spitting EKF stop aiding every 5 secs.

So here is the result on a 190 Size frame & Matek F405 (sorry for the rotation)

Here are some pics of the installation:

2 Likes

Thank you for that so roughly moving about 30/35cm did you manage to get a serial benewake TF mini working with it,many thank’s,Marty.

Yes altitude holds by tfmini
Set ekf3 altitude source to rangefinder

1 Like

Nicely done. Strange that EK2 didn’t work, it should.

I just want to be clear to others reading this thread that I recommend EKx_ALT_SOURCE be left at the default of 0 (for barometer). It should not be set to “1” for Rangefinder.

In @ppoirier’s test environment which is indoors with a flat floor it’s perhaps OK but in 99% of situations I do not recommend setting the altitude source to range finder. I dealt with yet another user support issue yesterday caused by a user setting this parameter to range finder. I feel like I’m constantly fighting a battle to stop people from changing this parameter because it rarely goes well.

2 Likes

Yes I agree about usage of the rangefinder as the primary altitude source is not recommended for normal flights.

I generally start tests in stabilize , doing the usual trim and PID land, check the logs, confirm rangefinder reading and stability and then use it as primary source.

Start in stabilize, takeoff and then switch to alt hold, check for stability and response. Land and takeoff in alt hold mode to confirm.

As for loiter, set ekf home , hold quad a simulate a flight , confirm that vehicle movements ate showned on map. Takeoff in AltHold , make sure vehicle is stable and switch to Loiter, get ready to switch back.

Last test I did is takeoff in guided an did different guided “fly to” and land.

2 Likes

Any kind soul able to nudge me in the correct direction for downloading 3.7 Dev?
I have a few CX-OF sensors that I would love to integrate to a pixracer to offer more test results.

Thanks yall! (Happy 2019 everyone!)

1 Like

@catalyst1,

We included CX-OF support in Copter-3.6.4 so it’s available in the stable release. I’ll update the notes above, thanks!

1 Like

awesome sir!
I’ll load it up to get it tested!

1 Like

What I described above as a strange behavior:

… when I switch from Loiter to FlowHold I see the Copter oscillate quickly in roll and pitch (like if the Roll / Pitch PID was bad tuned), then if I move the quad a little bit around (with RC) the oscillation disappear and the Copter remain stable.

should be a normal behavior from what I read in the wiki:

Because no Lidar is used in this mode, the optical flow sensor is used both to estimate the vehicle’s height above the surface and the vehicle’s speed. Soon after takeoff or after there have been large changes in the height above the surface the vehicle may wobble as it learns the new height and velocity.

Well, that is a proof that the wiki is pretty complete , thanks to @rmackay9

BTW I see you can adjust parameters

1 Like

hi @ppoirier could kindly explain me how to force the drivers to “other board”…thx in advanced!

In order to force the sensor on these board, you have to copy and paste line 108 to line 122

2 Likes