Position Hold with Optical Flow sensor - done
Re: Position Hold with Optical Flow sensor - done
Excellent work Alexmos ! Your SONAR code works like a dream, many thanks for your contributions to Multiwii.
I've been trying for a while to get sonar working on my quad and at last I've managed it with your Multiwi R23 version. It holds quad incredibely steady up to almost 3 meters. I've tested with 2 sonar sensors (HC-SR04 and DYP-ME007) and both gave almost same good results.
To make life easier for the new testers I made a sort of 'to do' list:
- Sonar uses ALT PID values (VEL PID values are not used)
- I tested with Drotek 10DOFIMU with MS5611 Baro and I used the PID's 5 , 010, 020
- You need to follow the improved 6 position ACC Calibration
- You need to place the sonar at a place away from the motors. I've placed it under the center plate and works just fine.
- I disabled the THROTTLE_EXPO in config.h for better response of throttle
- I changed the value of #define SONAR_BARO_PID_GAIN from 1 to 3 for a better gain of sonar
- I disabled the #define THROTTLE_ANGLE_CORRECTION by setting it to 0
- I changed #define THROTTLE_WIND_CORRECTION from 250 to 200
- Rest of ALT HOLD command and values in config.h are not changed
- Caution: This version of Multiwii comes with already enabled serial sum receiver defined in config.h. If your receiver is not that type you should command the #define SERIAL_SUM_PPM line
- I just start flying in MAG mode and at a certain height I activate the ALT HOLD by just activating BARO (you should see the BARO green in GUI)
- DEBUG 1 shows the sonar altitude in cm/10 (not in cm as I was expecting to see, a bit confusing)
My next test step is the position hold with optical flow sensor ADNS-5050. I've already received the sensor from KRST and will make the breakout board soon to test. I'll again post here later on for the results.
Regards,
Feridun
I've been trying for a while to get sonar working on my quad and at last I've managed it with your Multiwi R23 version. It holds quad incredibely steady up to almost 3 meters. I've tested with 2 sonar sensors (HC-SR04 and DYP-ME007) and both gave almost same good results.
To make life easier for the new testers I made a sort of 'to do' list:
- Sonar uses ALT PID values (VEL PID values are not used)
- I tested with Drotek 10DOFIMU with MS5611 Baro and I used the PID's 5 , 010, 020
- You need to follow the improved 6 position ACC Calibration
- You need to place the sonar at a place away from the motors. I've placed it under the center plate and works just fine.
- I disabled the THROTTLE_EXPO in config.h for better response of throttle
- I changed the value of #define SONAR_BARO_PID_GAIN from 1 to 3 for a better gain of sonar
- I disabled the #define THROTTLE_ANGLE_CORRECTION by setting it to 0
- I changed #define THROTTLE_WIND_CORRECTION from 250 to 200
- Rest of ALT HOLD command and values in config.h are not changed
- Caution: This version of Multiwii comes with already enabled serial sum receiver defined in config.h. If your receiver is not that type you should command the #define SERIAL_SUM_PPM line
- I just start flying in MAG mode and at a certain height I activate the ALT HOLD by just activating BARO (you should see the BARO green in GUI)
- DEBUG 1 shows the sonar altitude in cm/10 (not in cm as I was expecting to see, a bit confusing)
My next test step is the position hold with optical flow sensor ADNS-5050. I've already received the sensor from KRST and will make the breakout board soon to test. I'll again post here later on for the results.
Regards,
Feridun
Re: Position Hold with Optical Flow sensor - done
cencen , wich Acc did you use ?
did you have also make a test in a altitude >= 10m ?
did you have also make a test in a altitude >= 10m ?
Re: Position Hold with Optical Flow sensor - done
LuFa wrote:cencen , wich Acc did you use ?
did you have also make a test in a altitude >= 10m ?
ACC I've used is BMA180. I've only tested the altitude hold with SONAR up to 3m. I've not yet completed my tests with optical flow sensor. Lenses I tested were not suitable for the job therefore I ordered some new lenses with different focus lengths and looking forward to receive them. Then hopefully will continue my tests with position hold up to 10m !! I'll post here again when I have results.
Regards,
Feridun
Re: Position Hold with Optical Flow sensor - done
Hi ,
have anyone try to move the "SONAR_PING" to pin A3 ?
will that work ?
bg
have anyone try to move the "SONAR_PING" to pin A3 ?
will that work ?
bg
Position Hold with Optical Flow sensor Test
Hi ,
After a long while, at last I've found time to test my quad with optical sensor (ADNS-5050) and sonar (HC-SR04) and YES IT WORKS !!
Working with both sensors activated was not really easy as of with only sonar. Adjusting the parameters for the optical flow sensor is quite tricky I must say.
I had ordered a lens set of 6 with 2.8mm to 16mm focus lenghts. Took me hours to figure out the best values for the lenses with different focus lenghts. 6 and 8mm lenses gave me the best results.
* It works very well up to about 3m (max. sonar distance range) with high accuracy
* It works reasonably well up to about 6-7m with lower accuracy
* I couldn't test good results higher than 6-7m YET. I need to find a suitable place to test.
I've made the attached video with the following optical flow parameters:
#define OPTFLOW 5050
#define OF_SCLK A0
#define OF_SDIO A1
#define OF_NCS 8
/* Lense focal distance, mm (set it for your own lense)
(How to check: debug4 in GUI should not react on ROLL tilt, but react on ROLL slide) */
#define OF_FOCAL_DIST 8
/* Deadband for ROLL,PITCH sticks where position hold is enabled. Max value 100 */
#define OF_DEADBAND 10
/* Rotate I-term with heading rotation. It will well compensate wind */
#define OF_ROTATE_I
/* Low-pass filter factor to prevent shaking. Possible values 1..8. Default is 5. */
#define OF_LPF_FACTOR 2
/* Debug to GUI */
#define OF_DEBUG
My GUI values for VEL is P:3 I:10
Here is a test video https://vimeo.com/51222543
Alexmos, thanks again for your wonderful implemantation and code.
I think this is an interesting and really working function/addon for multiwii and your really working code should be added to multiwii V2.2
Are you considering to release another version for Multiwii V2.1 or implement to Mega? That will really be interesting!
Regards,
Feridun
After a long while, at last I've found time to test my quad with optical sensor (ADNS-5050) and sonar (HC-SR04) and YES IT WORKS !!
Working with both sensors activated was not really easy as of with only sonar. Adjusting the parameters for the optical flow sensor is quite tricky I must say.
I had ordered a lens set of 6 with 2.8mm to 16mm focus lenghts. Took me hours to figure out the best values for the lenses with different focus lenghts. 6 and 8mm lenses gave me the best results.
* It works very well up to about 3m (max. sonar distance range) with high accuracy
* It works reasonably well up to about 6-7m with lower accuracy
* I couldn't test good results higher than 6-7m YET. I need to find a suitable place to test.
I've made the attached video with the following optical flow parameters:
#define OPTFLOW 5050
#define OF_SCLK A0
#define OF_SDIO A1
#define OF_NCS 8
/* Lense focal distance, mm (set it for your own lense)
(How to check: debug4 in GUI should not react on ROLL tilt, but react on ROLL slide) */
#define OF_FOCAL_DIST 8
/* Deadband for ROLL,PITCH sticks where position hold is enabled. Max value 100 */
#define OF_DEADBAND 10
/* Rotate I-term with heading rotation. It will well compensate wind */
#define OF_ROTATE_I
/* Low-pass filter factor to prevent shaking. Possible values 1..8. Default is 5. */
#define OF_LPF_FACTOR 2
/* Debug to GUI */
#define OF_DEBUG
My GUI values for VEL is P:3 I:10
Here is a test video https://vimeo.com/51222543
Alexmos, thanks again for your wonderful implemantation and code.
I think this is an interesting and really working function/addon for multiwii and your really working code should be added to multiwii V2.2
Are you considering to release another version for Multiwii V2.1 or implement to Mega? That will really be interesting!
Regards,
Feridun
Re: Position Hold with Optical Flow sensor - done
I have dyp-me007 and a mega2560, could someone tell me what pin I must use and what kind of software modification I must implement to test sonar on mega2560. Alexmos, could you suggest me?
Position Hold with Optical Flow sensor - done
It works great with my adns 5020.
But I have a question, for example, when the quad goes forwards, and then I restore the sticks, but the quad drift backward a little. It looks like the sensor record the movement (actually this is stick input) as errors and try to correct it.
So I checked the code, shall we discard the delta x/y when the sticks are not in dead band?
But I have a question, for example, when the quad goes forwards, and then I restore the sticks, but the quad drift backward a little. It looks like the sensor record the movement (actually this is stick input) as errors and try to correct it.
So I checked the code, shall we discard the delta x/y when the sticks are not in dead band?
Position Hold with Optical Flow sensor - done
Is it possible to enlarge the hole in the sensor to increase its performance in dark environment?
As it is designed to work with the assistant of an led and we could not change the shuttle speed of adns 5050 or 5020. We can enlarge the hole so that more light goes into the sensor.
As it is designed to work with the assistant of an led and we could not change the shuttle speed of adns 5050 or 5020. We can enlarge the hole so that more light goes into the sensor.
Re: Position Hold with Optical Flow sensor - done
Hi Eric,
Enlarging the hole on the chip sounds quite logical to me, thought it is risky! You may try to do that if you have any spare one(s). Please post your results if you do so..
Enlarging the hole on the chip sounds quite logical to me, thought it is risky! You may try to do that if you have any spare one(s). Please post your results if you do so..
Re: Position Hold with Optical Flow sensor - done
has anybody imported the optical flow code to version 2.3?
-
- Posts: 1
- Joined: Tue May 13, 2014 11:57 am
Re: Position Hold with Optical Flow sensor - done
sir,,if I may ask,,is optical flow sensors compatible to "HK/Holybro MultiWii 328P Flight Controller w/FTDI & DSM2 Port"? I want to perform position hold also and I am to use optical sensor from an optical mouse. Is this possible? if so, can you help me with this problem? Sorry for asking, I am not so good with this one.
and I am still a newbie."(

-
- Posts: 2
- Joined: Fri May 30, 2014 5:03 pm
Re: Position Hold with Optical Flow sensor - done
hi there.
i went and read all 5 pages of this post and one thing i didnt get
where can i get the sensor from...
1. laser pointer
2. USB mouse
3. camera
4. buy is for 40$ from http://store.3drobotics.com/products/op ... low-sensor
i have 3 sonars on the way from aliexpress http://www.aliexpress.com/item/HC-SR04- ... 85689.html
for 1.2$ each... and would like to know how much difference there is using the optical flow method.
thanks
Jonathan
i went and read all 5 pages of this post and one thing i didnt get
where can i get the sensor from...
1. laser pointer
2. USB mouse
3. camera
4. buy is for 40$ from http://store.3drobotics.com/products/op ... low-sensor
i have 3 sonars on the way from aliexpress http://www.aliexpress.com/item/HC-SR04- ... 85689.html
for 1.2$ each... and would like to know how much difference there is using the optical flow method.
thanks

Jonathan
Re: Position Hold with Optical Flow sensor - done
I have been testing the ADNS 3080 sensor from GLB ($24 shipped). This:
http://www.goodluckbuy.com/images/detai ... 5567_1.jpg
I did test/calculate a FOV of merely 22 deg. This leaves me 10 deg copter inclination max, which is not enough. How can i make the FOV way bigger?
I have tried lenses from other cams, including wide angle fpv lenses, but no change. The sensor is too small.
Video of 2 lines 4cm apart seen trough the 10cm high sensor.
https://www.youtube.com/watch?v=yglonHY ... e=youtu.be
Data is read in by an arduiono 328 over SPI and then sent to the PC over serial 115kbaud. Display is a processing sketch.
Testprog here: https://github.com/Cesco1/ArduFlow
http://www.goodluckbuy.com/images/detai ... 5567_1.jpg
I did test/calculate a FOV of merely 22 deg. This leaves me 10 deg copter inclination max, which is not enough. How can i make the FOV way bigger?
I have tried lenses from other cams, including wide angle fpv lenses, but no change. The sensor is too small.
Video of 2 lines 4cm apart seen trough the 10cm high sensor.
https://www.youtube.com/watch?v=yglonHY ... e=youtu.be
Data is read in by an arduiono 328 over SPI and then sent to the PC over serial 115kbaud. Display is a processing sketch.
Testprog here: https://github.com/Cesco1/ArduFlow
Re: Position Hold with Optical Flow sensor - done
Plüschi wrote:I have been testing the ADNS 3080 sensor from GLB ($24 shipped). This:
http://www.goodluckbuy.com/images/detai ... 5567_1.jpg
I did test/calculate a FOV of merely 22 deg. This leaves me 10 deg copter inclination max, which is not enough. How can i make the FOV way bigger?
I have tried lenses from other cams, including wide angle fpv lenses, but no change. The sensor is too small.
Video of 2 lines 4cm apart seen trough the 10cm high sensor.
https://www.youtube.com/watch?v=yglonHY ... e=youtu.be
Data is read in by an arduiono 328 over SPI and then sent to the PC over serial 115kbaud. Display is a processing sketch.
Testprog here: https://github.com/Cesco1/ArduFlow
Hi Pluschi,
From what I've read the optical flow sensor is just the sensor from an optical mouse. How can this detect height up to 10m?
Also how does MW make sense of the data coming from sensor to determine if image is changing?
Re: Position Hold with Optical Flow sensor - done
brewski wrote:How can this detect height up to 10m?
Who said it can detect height?
brewski wrote:Also how does MW make sense of the data
How does your computer make sense of the data it gets from the mouse? Same-same.
Optical flow is processed IN the sensor. Then its sends out X and Y coords.
Btw the sensor is quite blind, needs lots of light. The pixhawk sensor should be MUCH better, its based on a cam and not on a mouse sensor. Also comes with built in gyro sensor. But $91 ...
http://www.goodluckbuy.com/px4flow-v1-3 ... tible.html
Re: Position Hold with Optical Flow sensor - done
Plüschi wrote:brewski wrote:How can this detect height up to 10m?
Who said it can detect height?brewski wrote:Also how does MW make sense of the data
How does your computer make sense of the data it gets from the mouse? Same-same.
Optical flow is processed IN the sensor. Then its sends out X and Y coords.
Btw the sensor is quite blind, needs lots of light. The pixhawk sensor should be MUCH better, its based on a cam and not on a mouse sensor. Also comes with built in gyro sensor. But $91 ...
http://www.goodluckbuy.com/px4flow-v1-3 ... tible.html
Ok I get it. Optical flow just looks at a section of ground & turns it into a giant mouse mat! I can see issues with non reflective surfaces such as grass & even bitumen. Are you detecting the reflected light from pulsed LED as mouse does or using a high powered pulsed LED/laser?
Last question - what code is required in MW2.3 (I'm using Eos Bandi Nav version) sketch for this to work?
Re: Position Hold with Optical Flow sensor - done
brewski wrote:using a high powered pulsed LED/laser?
Im using a continuous light source with 38500000000000000000000000 W power.
Did you read this thread before asking ?
Re: Position Hold with Optical Flow sensor - done
Yes but still a bit confused as to how a mouse sensor can be used for improved Poshold any better than ultrasonic which I believe can work up to 5m. A mouse sensor detects reflected light from a pulsed LED. Without a light source detector would be just relying on light reflected from ground which in the case of grass or road would be stuff all even at 5m.
Re: Position Hold with Optical Flow sensor - done
2 questions. You may use wikipedia to answer.
- what does ultrasonic measure?
- what does a mouse measure?
Got it?
- what does ultrasonic measure?
- what does a mouse measure?
Got it?
An optical flow sensor essentially takes a picture of an area, then takes another picture and compares how the features have moved.
So called non reflective are better than highly reflective images as it's only highlights which are looked at, that's why flash and mirrors don't work, unless you have an upmarket Microsoft or logitech mouse.
A mouse carries it's own light source as it's the only way the area under the mouse can be illuminated.
These things are used in the big bad outside world for monitoring moving things (flowing liquids being quite common).
So called non reflective are better than highly reflective images as it's only highlights which are looked at, that's why flash and mirrors don't work, unless you have an upmarket Microsoft or logitech mouse.
A mouse carries it's own light source as it's the only way the area under the mouse can be illuminated.
These things are used in the big bad outside world for monitoring moving things (flowing liquids being quite common).
Re:
kilby wrote:An optical flow sensor essentially takes a picture of an area, then takes another picture and compares how the features have moved.
So called non reflective are better than highly reflective images as it's only highlights which are looked at, that's why flash and mirrors don't work, unless you have an upmarket Microsoft or logitech mouse.
A mouse carries it's own light source as it's the only way the area under the mouse can be illuminated.
These things are used in the big bad outside world for monitoring moving things (flowing liquids being quite common).
Thanks for the explanation. If optical flow works on highlights then why not use a cheap laser module to provide this highlight & not be solely reliant on ambient light.
Re: Position Hold with Optical Flow sensor - done
brewski wrote:kilby wrote:An optical flow sensor essentially takes a picture of an area, then takes another picture and compares how the features have moved.
So called non reflective are better than highly reflective images as it's only highlights which are looked at, that's why flash and mirrors don't work, unless you have an upmarket Microsoft or logitech mouse.
A mouse carries it's own light source as it's the only way the area under the mouse can be illuminated.
These things are used in the big bad outside world for monitoring moving things (flowing liquids being quite common).
Thanks for the explanation. If optical flow works on highlights then why not use a cheap laser module to provide this highlight & not be solely reliant on ambient light.
Unless you are flying in incredibly poor lighting conditions you simply don't need to, they're nice for position hold
If you really want a flying laser device (and who doesn't want one) then go for a pulsed light range sensor instead, they look great and they are dropping in price as they're are being fitted to cars (and replacing the small radar is its that are used to measure liquid levels)
Re: Position Hold with Optical Flow sensor - done
Optical flow and ultrasonic DO MEASURE TOTALLY DIFFERENT THINGS. Is that so hard to understand?
Re: Position Hold with Optical Flow sensor - done
Are you Timecop in disguise?
Re: Position Hold with Optical Flow sensor - done
No, but TY for the compliment.