Position Hold with Optical Flow sensor - done
Position Hold with Optical Flow sensor - done
Just for fun, i have implemented position hold. It uses ADNS-5050 as low-cost 5v sensor with simple connection. Lense is from chinese laser pointer (about 9mm focal length).
This mode is always on, but start working only when sticks are in their neutral position - so full manual control is retained.
Sensor:
Test video: http://www.youtube.com/watch?feature=pl ... dZnxTz1Y_g
Sorry but there are no instructions how to insert this mod into current multiwii code, because there are many dependencies with my other mods. The code is quite simple to do this by your own hands.
UPDATE:
My code based on latest MWC 2.0: http://code.google.com/p/multiwii-alexm ... akechanges
Position Hold is activated in GPS Hold mode (even if you have not GPS, use this checkbox to switch mode). Works only in LEVEL (STABLE) mode.
ADNS-5050 wiring:
SCLK,SDIO,NCS may be connected to any unused arduino pins (don't forget about +5V, Ground).
This mode is always on, but start working only when sticks are in their neutral position - so full manual control is retained.
Sensor:
Test video: http://www.youtube.com/watch?feature=pl ... dZnxTz1Y_g
Sorry but there are no instructions how to insert this mod into current multiwii code, because there are many dependencies with my other mods. The code is quite simple to do this by your own hands.
UPDATE:
My code based on latest MWC 2.0: http://code.google.com/p/multiwii-alexm ... akechanges
Position Hold is activated in GPS Hold mode (even if you have not GPS, use this checkbox to switch mode). Works only in LEVEL (STABLE) mode.
ADNS-5050 wiring:
SCLK,SDIO,NCS may be connected to any unused arduino pins (don't forget about +5V, Ground).
Last edited by alexmos on Thu Apr 26, 2012 6:40 pm, edited 2 times in total.
Re: Position Hold with Optical Flow sensor - done
great idea, and fantastic doing
maybe a Small snippet for MW2.0
Peter
The code is quite simple to do this by your own hands.
maybe a Small snippet for MW2.0
Peter
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: Position Hold with Optical Flow sensor - done
This is awesome and I strongly believe this is the system used in the Flymentor. By Chance, have you tested the range or altitude ?
Thank you.
Thank you.
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: Position Hold with Optical Flow sensor - done
I am receiving an error message when clicking on the code link.
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: Position Hold with Optical Flow sensor - done
Awesome, Thank you PatrikE
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: Position Hold with Optical Flow sensor - done
I located a source for those chips if anyone is interested.
http://search.digikey.com/us/en/cat/sen ... =adns-5050
http://search.digikey.com/us/en/cat/sen ... =adns-5050
Re: Position Hold with Optical Flow sensor - done
copterrichie wrote:This is awesome and I strongly believe this is the system used in the Flymentor. By Chance, have you tested the range or altitude ?
Thank you.
In my code, starting from 2 meters, if altitude increases - stabilization effect decreases proportionaly (because no trust for sensor data). But I have noticable effect on altitudes about 6 meters, and I think with good light conditions it should be up to 10 meters.
-
- Posts: 1630
- Joined: Wed Jan 19, 2011 9:07 pm
Re: Position Hold with Optical Flow sensor - done
Very interesting !
Could we find ready to use sensor for this ? (with the right lens for several meters)
Could we find ready to use sensor for this ? (with the right lens for several meters)
Re: Position Hold with Optical Flow sensor - done
Yes, there is full assembled sensor for sale, for example http://store.diydrones.com/ProductDetai ... BR-0016-01. ADNS-3080 is better than I have used, and lense is better - so it should works fine.
But it requires a little code modification to handle it (reading data part in OpticalFlow.pde).. If anyone will buy it - I will help to implement.
There is support for this sensor in ArduCopter, so you can steal reading code and useful utils for testing from this project
But it requires a little code modification to handle it (reading data part in OpticalFlow.pde).. If anyone will buy it - I will help to implement.
There is support for this sensor in ArduCopter, so you can steal reading code and useful utils for testing from this project
Re: Position Hold with Optical Flow sensor - done
Also notice, that ADNS-3080 requires additional PIN (total 4 pins) compared to ADNS-5050 (total 3 pins) for SPI-communication, so firstly check have you free pins to connect sensor? (I am using Serial Sum PPM so has 3 extra pins in my ATMEGA 328P)
Re: Position Hold with Optical Flow sensor - done
Dear Alexmos,
This is quite interresting project indeed! could be really useful on field!
But I have some questions. First, did you make any tests in windy conditions? What do you think, could this code hold the position in wind too?
How copter reacts to different angles?
If ADNS-3080 would work with mwi that would be great!!!
BTW, thanks for the good job!!!!!
This is quite interresting project indeed! could be really useful on field!
But I have some questions. First, did you make any tests in windy conditions? What do you think, could this code hold the position in wind too?
How copter reacts to different angles?
If ADNS-3080 would work with mwi that would be great!!!
BTW, thanks for the good job!!!!!
Re: Position Hold with Optical Flow sensor - done
I have made only one outdoor test, there was no wind. But I think it should compensate even strong wind, due to I-term of PID regulator.
In rotation, sensor will not give any data or will give wrong data - so rotation is hard to compensate for it. But I have not tested it.
In windy condition, after rotation I-term should be re-found, so position will be lost. Theoretically it is possible to rotate I-vector to the same angle - but we can't distinguish what information is stored in it. It can hold information about wrong leveling (and compensate level drift), too. This part should not be rotated.
I have no test data now. After some field tests, I will decide is it neccesary to rotate I. Ma be compensation of strong wind is more useful than compensation of small level drift.
In rotation, sensor will not give any data or will give wrong data - so rotation is hard to compensate for it. But I have not tested it.
In windy condition, after rotation I-term should be re-found, so position will be lost. Theoretically it is possible to rotate I-vector to the same angle - but we can't distinguish what information is stored in it. It can hold information about wrong leveling (and compensate level drift), too. This part should not be rotated.
I have no test data now. After some field tests, I will decide is it neccesary to rotate I. Ma be compensation of strong wind is more useful than compensation of small level drift.
Re: Position Hold with Optical Flow sensor - done
And also I want to try a potentialy useful idea: when I-term will hold informatin about wind (i.e. the angles of inclination to compensate wind), we can use it in flight, not only in position hold mode.
Re: Position Hold with Optical Flow sensor - done
Very impressive !
Thats a feature that would be very welcome in 2.1.
I also noticed how it holds altitude so well ? That is not due to the flow sensor, or is it ?
Thats a feature that would be very welcome in 2.1.
I also noticed how it holds altitude so well ? That is not due to the flow sensor, or is it ?
Re: Position Hold with Optical Flow sensor - done
Altitude holding by sonar sensor. It has 0.3 cm precision by spec, so with strong PID it gives very good results on low altitudes.
I have implemented ideas I sayed above, all code on SVN. But have not tested and I am afraid can't test it on this week
I have implemented ideas I sayed above, all code on SVN. But have not tested and I am afraid can't test it on this week
Re: Position Hold with Optical Flow sensor - done
this optical flow hold looks impressive and interresting.
Can't wait for final solution (I mean find the most optimal sensor for us)....
Keep on good work guys!!!!
Can't wait for final solution (I mean find the most optimal sensor for us)....
Keep on good work guys!!!!
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: Position Hold with Optical Flow sensor - done
because of the way a multi-rotor copters has to tilt the airframe, placing the optical lens on a gimbal may increase the altitude.
Re: Position Hold with Optical Flow sensor - done
There is sonar and optical sensor on the ar-drone 1 and works great even on a windy day, so this behaviour should work without gimballs, only used the calculations.
BTW, when optical flow sensor is used for compensating the relative sideway movements, it could be work great, because some dergees of frame tilt would cause only some dm mooves.
BTW, when optical flow sensor is used for compensating the relative sideway movements, it could be work great, because some dergees of frame tilt would cause only some dm mooves.
Re: Position Hold with Optical Flow sensor - done
nice work !
is it possible to juse your code with Hexa with PPM Receiver by activate A0/A1 to get the SPI Pins free ?
have order some ADNS5050
is it possible to juse your code with Hexa with PPM Receiver by activate A0/A1 to get the SPI Pins free ?
have order some ADNS5050
Re: Position Hold with Optical Flow sensor - done
Dear Alexmos,
the same question as from LuFa.
What do you think, is it possible to use the ADNS3080 (with optical lens from DIYDRONES Store) with a 328P in a hexa, if PPM receiver is used?
The other question is that I'm using an XBee module for telemetry, so RT/TX is used. Does it cause a problem for this sensor?
My last question is that approx. how many bytes is the optical flow code in the sketch?
Thanks for your reply in advance!
BR
Adrian
the same question as from LuFa.
What do you think, is it possible to use the ADNS3080 (with optical lens from DIYDRONES Store) with a 328P in a hexa, if PPM receiver is used?
The other question is that I'm using an XBee module for telemetry, so RT/TX is used. Does it cause a problem for this sensor?
My last question is that approx. how many bytes is the optical flow code in the sketch?
Thanks for your reply in advance!
BR
Adrian
Re: Position Hold with Optical Flow sensor - done
Alexmos which sonar do you use? Is there any good cheap supplier for ADNS-5050?
Re: Position Hold with Optical Flow sensor - done
I'm going to test the Ping)) Copy from.
http://www.goodluckbuy.com/ultrasonic-wave-detector-ranging-module-distance-sensor.html
http://www.goodluckbuy.com/ultrasonic-wave-detector-ranging-module-distance-sensor.html
Re: Position Hold with Optical Flow sensor - done
copterrichie wrote:because of the way a multi-rotor copters has to tilt the airframe, placing the optical lens on a gimbal may increase the altitude.
That's right, it will help a little to improve altitue range. But it requires option in config to disable tilt compensation in calculations and very precise gimbal needed (because we well know angle of frame, but don't know angle of gimbal if it is not precisely holds horizon)
Re: Position Hold with Optical Flow sensor - done
LuFa wrote:nice work !
is it possible to juse your code with Hexa with PPM Receiver by activate A0/A1 to get the SPI Pins free ?
have order some ADNS5050
You can connect sensor to any 3 DIGITAL pins, because I am using software SPI without interrupts, etc. As I know, A0-A5 may be used as DIGITAL pins. So answer is yes.
Re: Position Hold with Optical Flow sensor - done
nhadrian wrote:Dear Alexmos,
the same question as from LuFa.
What do you think, is it possible to use the ADNS3080 (with optical lens from DIYDRONES Store) with a 328P in a hexa, if PPM receiver is used?
The other question is that I'm using an XBee module for telemetry, so RT/TX is used. Does it cause a problem for this sensor?
My last question is that approx. how many bytes is the optical flow code in the sketch?
Thanks for your reply in advance!
BR
Adrian
You can look at you device and count free pins. For ADNS3080, it's required 4 pins. It can be any pin with digital mode. My code does not use any interrupts, timers and so on.
Compiled optflow code takes 2462 bytes.
Re: Position Hold with Optical Flow sensor - done
msev wrote:Alexmos which sonar do you use? Is there any good cheap supplier for ADNS-5050?
I have bought it on ebay under label "HC-SR04". But it is slightly differs from specifications I have found in net. I suppose any analog sonar with Echo and Trig pins will work with my code (I have added many configurable parameters in config.h)
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: Position Hold with Optical Flow sensor - done
alexmos wrote:copterrichie wrote:because of the way a multi-rotor copters has to tilt the airframe, placing the optical lens on a gimbal may increase the altitude.
That's right, it will help a little to improve altitue range. But it requires option in config to disable tilt compensation in calculations and very precise gimbal needed (because we well know angle of frame, but don't know angle of gimbal if it is not precisely holds horizon)
A mathematical solution would be best as long as the tilt is within the FOV of the optical lens.
This is a great Project and I think it has great potential.
Re: Position Hold with Optical Flow sensor - done
Hi ,
Some ADNS5050 are on the way to me
But i have some questions :
- which Lens is the best one ?
- How to adjust the Lens ? is there any kind of video quality output in the code ?
- Can you upload the 2.0 with your optical flow ? because i use the MPU6050
- which PID Values are good for the first start ?
- works the calculation of the movement in relation of the altitute only with sonar or also with baro ?
Thanks so mutch !
Some ADNS5050 are on the way to me
But i have some questions :
- which Lens is the best one ?
- How to adjust the Lens ? is there any kind of video quality output in the code ?
- Can you upload the 2.0 with your optical flow ? because i use the MPU6050
- which PID Values are good for the first start ?
- works the calculation of the movement in relation of the altitute only with sonar or also with baro ?
Thanks so mutch !
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: Position Hold with Optical Flow sensor - done
I have a question, are there some mouses/mice that also have this chip? If true, will the lens work for this project?
-
- Posts: 31
- Joined: Sat Dec 31, 2011 12:10 am
Re: Position Hold with Optical Flow sensor - done
Important is to know the FOV of lense. This is the distance from lense to Sensor.
Re: Position Hold with Optical Flow sensor - done
LuFa wrote:Hi ,
Some ADNS5050 are on the way to me
But i have some questions :
- which Lens is the best one ?
- How to adjust the Lens ? is there any kind of video quality output in the code ?
- Can you upload the 2.0 with your optical flow ? because i use the MPU6050
- which PID Values are good for the first start ?
- works the calculation of the movement in relation of the altitute only with sonar or also with baro ?
Thanks so mutch !
- I have plastic lense about 6mm focal distance from laser pointer. If you find lense from camera with 5-8mm, it will work better.
- To view row data from sensor, download sketch and java GUI from this post attachement. It will help to fine tune focus.-
- I am going to merge with 2.0 in few weeks..
- Try to start from very low PIDS: P=3, I = 0.010, D=5. (remember tis is VEL section in GUI). I have a very little test data to say the best PIDS
- I think altitude from baro will works, too. In my test on 6 meters only baro was used.
- Attachments
-
- ADNS_5050_test.zip
- (21.12 KiB) Downloaded 963 times
Re: Position Hold with Optical Flow sensor - done
copterrichie wrote:I have a question, are there some mouses/mice that also have this chip? If true, will the lens work for this project?
No, I don't know where this sensor was used. I bought it in electronic shop. Mouse lense will not work, it has less focal distance than needed.
Re: Position Hold with Optical Flow sensor - done
thanks
can you tell me how to run the Java Gui ?
can you tell me how to run the Java Gui ?
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: Position Hold with Optical Flow sensor - done
alexmos wrote:copterrichie wrote:I have a question, are there some mouses/mice that also have this chip? If true, will the lens work for this project?
No, I don't know where this sensor was used. I bought it in electronic shop. Mouse lense will not work, it has less focal distance than needed.
Thank you, it was a wild thought.
Re: Position Hold with Optical Flow sensor - done
My ADNS3080 with lens from DIY Drones is on the way...
Re: Position Hold with Optical Flow sensor - done
LuFa wrote:thanks
can you tell me how to run the Java Gui ?
It is quite simply - download and install Java (JRE from Sun.com). And run "mousecam/bin/run.bat" (java.exe must be in the path environment).
Re: Position Hold with Optical Flow sensor - done
ok , i have chanche the .bat to this :
and if i start it i see this :
is that right ? how can i see the camera picture ?
Thanks
Code: Select all
set path=.;C:\Program Files (x86)\Java\jre6\bin
java mousecam/MouseCam
and if i start it i see this :
is that right ? how can i see the camera picture ?
Thanks
Re: Position Hold with Optical Flow sensor - done
I have downloaded mousecam from http://www.bidouille.org/hack/mousecam They says: "You can download the Arduino script and the PC program below. The program is in java and requires the RXTX library to be installed. You need to get the "RXTX 2.1 for use withOUT Sun's CommAPI (namespace gnu.io)" version. No, as of 2008 java still does not natively support the serial port. It should work with Linux, Mac OS X and Windows, but I only tested it under Windows."
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: Position Hold with Optical Flow sensor - done
alexmos wrote:I have downloaded mousecam from http://www.bidouille.org/hack/mousecam They says: "You can download the Arduino script and the PC program below. The program is in java and requires the RXTX library to be installed. You need to get the "RXTX 2.1 for use withOUT Sun's CommAPI (namespace gnu.io)" version. No, as of 2008 java still does not natively support the serial port. It should work with Linux, Mac OS X and Windows, but I only tested it under Windows."
Would you believe I JUST disassembled one of these yesterday? It appears to be the same as the Wireless Microsoft Mouse. It has a A2030 Chip but I was unable to locate the Datasheet for it.
Re: Position Hold with Optical Flow sensor - done
i cant find the right download link to the txrx lib
is that the only way to setup the lens ?
i´m to stupid to bring the java programm to run
is that the only way to setup the lens ?
i´m to stupid to bring the java programm to run
Re: Position Hold with Optical Flow sensor - done
https://www.google.ru/search?hl=ru&q=adns+2030+pdf - the first link is what you need But it is much more complicated to connect this sensor to arduino (3.3V, many electronics required)
Re: Position Hold with Optical Flow sensor - done
the hardware is allready ready (use BSS123 for levelconverter)
are you shure that is it the right link ? its a google search link
are you shure that is it the right link ? its a google search link
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: Position Hold with Optical Flow sensor - done
alexmos wrote:https://www.google.ru/search?hl=ru&q=adns+2030+pdf - the first link is what you need But it is much more complicated to connect this sensor to arduino (3.3V, many electronics required)
Awe! Thank you, I have a few more mouses around here, maybe we will hit the jackpot.
Re: Position Hold with Optical Flow sensor - done
have receive now my adns 5050 sensors
can you tell me where is the front of the sensor ? in wich direction should i mount the sensor ?
how did you connect the NRESET Pin from the adns 5050 ? High , Low or NC ?
thanks
can you tell me where is the front of the sensor ? in wich direction should i mount the sensor ?
how did you connect the NRESET Pin from the adns 5050 ? High , Low or NC ?
thanks
Re: Position Hold with Optical Flow sensor - done
Y = PITCH - Forward direction of other sensors, X = ROLL
NRESET should be HIGH. I have connected it to +5V (don't know is it safe, but works)
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: Position Hold with Optical Flow sensor - done
I apologize for being a pain.
I just opened a MAC original mouse and found an ADNS-2051, any opinions?
http://www.alldatasheet.com/datasheet-p ... S2051.html
Hmmm: http://www.martijnthe.nl/2009/07/interf ... r-arduino/
I just opened a MAC original mouse and found an ADNS-2051, any opinions?
http://www.alldatasheet.com/datasheet-p ... S2051.html
Hmmm: http://www.martijnthe.nl/2009/07/interf ... r-arduino/
Re: Position Hold with Optical Flow sensor - done
You can connect almoust ANY mice sensor to arduino All you need - to add some code into OpticalFlow.pde to read delta_x and delta_y according to the datasheet, and properly convert them to mm. All other mathematics and PID control things are the same for every sensor I have selected ADNS-5050 only because it has the most simply connection for me.
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: Position Hold with Optical Flow sensor - done
Awesome, I will bench test this and report back.
Re: Position Hold with Optical Flow sensor - done
@alexmoos
today I assembled my diy-flow-control
I have a lense from a old laser pointer. I can adjust it via a screw.
The Adns-2610 has some different regs on I2C. I will use your script from here,
viewtopic.php?f=7&t=1413&start=30#p11421
and modify the address. Do you think I have to connect the LED_CNTL?
Hope this will work
My question is, about your repository.
- You have integrated into your repo, sonar and flwo control , based 1.9. Is that correct?
- Is your repo working with mega (flyduino) ? or What board/mcu do you use?
- Where is your repo ?
- Do you plan to merge it with 2.0
today I assembled my diy-flow-control
I have a lense from a old laser pointer. I can adjust it via a screw.
The Adns-2610 has some different regs on I2C. I will use your script from here,
viewtopic.php?f=7&t=1413&start=30#p11421
and modify the address. Do you think I have to connect the LED_CNTL?
Hope this will work
My question is, about your repository.
- You have integrated into your repo, sonar and flwo control , based 1.9. Is that correct?
- Is your repo working with mega (flyduino) ? or What board/mcu do you use?
- Where is your repo ?
- Do you plan to merge it with 2.0