Position Hold with Optical Flow sensor - done

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: Position Hold with Optical Flow sensor - done

Post by alexmos »

sandmen wrote: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 ? :mrgreen:
- Do you plan to merge it with 2.0


-yes, based on 1.9
-sonar will not work with mega, all other will work as in 1.9.
- repo hosted on code.google.com ;) http://code.google.com/p/multiwii-alexmos/
- Yes, I am going to merge soon - when finished all test of my improvements.

LuFa
Posts: 160
Joined: Fri Jan 27, 2012 7:56 pm

Re: Position Hold with Optical Flow sensor - done

Post by LuFa »

today i have finished my test pcb with the adns5050 :)
all works good for the moment ;)

know i waiting for the 2.0 with opticalflow from alexmos :D
when did you plan to release your code with 2.0 ?

thanks sooooo mutch !!!!!

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: Position Hold with Optical Flow sensor - done

Post by alexmos »

Good news, LuFa :) Today I have tested my code for position hold and it works fine! So I have finished working on it and now starting merge with 2.0.

LuFa
Posts: 160
Joined: Fri Jan 27, 2012 7:56 pm

Re: Position Hold with Optical Flow sensor - done

Post by LuFa »

great :D

cant wait to test it :)

at the moment i try to bring the java programm to run ......

Is your Position hold now better than on your first video ?

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: Position Hold with Optical Flow sensor - done

Post by alexmos »

It's more stable, less jerking. And some errors foud and corrected

LuFa
Posts: 160
Joined: Fri Jan 27, 2012 7:56 pm

Re: Position Hold with Optical Flow sensor - done

Post by LuFa »

great :)

for which distance should i adjust/fix the position of the lense ?

at the moment i have this method to find the right lens position :

- look to the delta output from the testcode and move the ADNS
- if the delta output move at the same way like the sensor , the lense have the right position

the proplem is , every setup of the lense position are only work at the right distance to the ground with the testprogramm .
i know that the multiwii code does calculate the movement off the adns in relation of the distance , but for the moment i try to find the best position with the testprogramm .

thanks for your help ;)

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: Position Hold with Optical Flow sensor - done

Post by alexmos »

What test program do you mean? I have used mousecam util (uploaded few posts above) to see image from sensor. Point lense to bright and contrast object at distance 2-3 m and ajust lense to take sharp picture. It should be all in focus for distance 30cm - infinity. The way you choose is not precise.

LuFa
Posts: 160
Joined: Fri Jan 27, 2012 7:56 pm

Re: Position Hold with Optical Flow sensor - done

Post by LuFa »

i know , but its not possible for me to bring mousecam util to run :( have still the proplem from few posts above ....
thatswhy i try it with the x and y move output from the sensor to get the optimal lens position .

did you have a "user manuell" how to bring the mousecam util to run ?

thanks !

Edit :

Now it works :mrgreen: :mrgreen: :mrgreen: :mrgreen:
im so happy !

have use this Manuell how to install rxtx lib :

http://rxtx.qbang.org/wiki/index.php/In ... or_Windows

sandmen
Posts: 24
Joined: Mon Feb 21, 2011 3:26 pm

Re: Position Hold with Optical Flow sensor - done

Post by sandmen »

Here is a script for a adns2610.
I have test it here with a mouse, works fine.
In the next days, I will try to get it working with my lens.
@alexmoos,
this sonar code is working on mega, maybe integrate into your repo :-)

Thanks Peter
Attachments
Adns2610.zip
(1.9 KiB) Downloaded 355 times

Tifani
Posts: 63
Joined: Sun Nov 06, 2011 5:15 pm

Re: Position Hold with Optical Flow sensor - done

Post by Tifani »

Hi !
Idea for lenses+enclosure - some webcams go for $5
Tom

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: Position Hold with Optical Flow sensor - done

Post by alexmos »

sandmen wrote:this sonar code is working on mega, maybe integrate into your repo :-)


Where is sonar code?

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: Position Hold with Optical Flow sensor - done

Post by alexmos »

Tifani wrote:Hi !
Idea for lenses+enclosure - some webcams go for $5
Tom

Anybody know which lense (focal length) used in webcams?

sandmen
Posts: 24
Joined: Mon Feb 21, 2011 3:26 pm

Re: Position Hold with Optical Flow sensor - done

Post by sandmen »

Where is sonar code?


Sorry,
here
viewtopic.php?f=7&t=1033&start=70#p11659

noobee
Posts: 66
Joined: Fri Feb 25, 2011 2:57 pm

Re: Position Hold with Optical Flow sensor - done

Post by noobee »

what is the ideal lens focal length for these mouse image sensors?

was thinking of using the mtv mount lens.

thanks

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: Position Hold with Optical Flow sensor - done

Post by alexmos »

My lense has 8mm from its center to focused plane. I didn't test any other lense, but think 6..10 mm will work, too.

Tifani
Posts: 63
Joined: Sun Nov 06, 2011 5:15 pm

Re: Position Hold with Optical Flow sensor - done

Post by Tifani »

Hi !
I,m going to Microcenter (microcenter.com) to pickup some $5 webcams today. I will post results as soon I be back.
By the way how to attach pictures & videos to post ? I don't have any web storage to post links.
Regards
Tom
P.S. Focal length for webcam by design can be close to what we need ( I assume than webcam sensor is close shape to mouse sensor) anyway we will see in few hours & a few $$$ later. :D

LuFa
Posts: 160
Joined: Fri Jan 27, 2012 7:56 pm

Re: Position Hold with Optical Flow sensor - done

Post by LuFa »

alexmos wrote:Good news, LuFa :) Today I have tested my code for position hold and it works fine! So I have finished working on it and now starting merge with 2.0.


maybe can you upload your finaly 1.9 ?
it will be very cool for my first tests on this weekend :mrgreen:

thanks !

Olaf.J
Posts: 16
Joined: Tue Jul 12, 2011 10:10 pm

Re: Position Hold with Optical Flow sensor - done

Post by Olaf.J »

Hi,

has anybode already successfully tried it with an adns 3080? Could be a nice idea to use it with atmega 2560-arduino (flyduino), because the ISP is normally not used, so you need only 1 extra pin, if I understood it right - whatever "NCS" means...

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: Position Hold with Optical Flow sensor - done

Post by alexmos »

Olaf.J wrote:Hi,

has anybode already successfully tried it with an adns 3080? Could be a nice idea to use it with atmega 2560-arduino (flyduino), because the ISP is normally not used, so you need only 1 extra pin, if I understood it right - whatever "NCS" means...


Hi! You are right - on Mega ISP is free so can be used with arduino ISP library and only NCS pin needed. (it works in ArduPilot this way). You can get sensor communication from there

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: Position Hold with Optical Flow sensor - done

Post by alexmos »

I have uploaded latest version to SVN (r21). Now I am using DigitalWriteFast library for faster SPI communication.
I had some tests today:
- It works without sonar, with baro only
- It works on high altitudes, but weaker
- It well comprensate wind (even strong), but need some time and space to stabilize if wind is choppy.

LuFa
Posts: 160
Joined: Fri Jan 27, 2012 7:56 pm

Re: Position Hold with Optical Flow sensor - done

Post by LuFa »

yeah :) great :mrgreen:

is your r21 based on Mwii 2.0 ?
is it possible to use A0 , A1 , A2 or A3 for connection of the ADNS505 or only digitalpins ?

Tifani
Posts: 63
Joined: Sun Nov 06, 2011 5:15 pm

Re: Position Hold with Optical Flow sensor - done

Post by Tifani »

Hi !
Looks like nobody want to help me with attaching pictures - Ok
I have three webcams to test lens+body, first one look promising.

Something came on my mind:
when copter drift, "picture" in the sensor is moving.
But when copter start compensate, frame tilt in opposite direction and "picture" move in the same direction than previously during drift.
Hard to explain without picture.
Image
http://www.snapixel.com/479413/Photo-of-compensate
Just question
Tom

LuFa
Posts: 160
Joined: Fri Jan 27, 2012 7:56 pm

Re: Position Hold with Optical Flow sensor - done

Post by LuFa »

only need to install the DigitalWriteFast library ? or must also be changed the digitalWriteFast.h file into the library ?

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: Position Hold with Optical Flow sensor - done

Post by alexmos »

Hi, Tifani!

You can upload images to any image or file hosting. It is only way to attach image.
You mind working right - when frame tilt, picture is moving. There is some math in the code to take it into account.

I have added digitalWriteFast.h to code directory so it should compile wuthout extra install

LuFa
Posts: 160
Joined: Fri Jan 27, 2012 7:56 pm

Re: Position Hold with Optical Flow sensor - done

Post by LuFa »

mhmm , without lib i get this error :

Code: Select all



In file included from Multiwii_r21.cpp:2371:
/digitalWriteFast.h:1:23: error: WProgram.h: No such file or directory
/digitalWriteFast.h:2:20: error: wiring.h: No such file or directory


with lib and orginal digitalWriteFast file from the lib i get no error .

if i replace the digitalWriteFast file directly in the lib i get the same error



So will it also work if i install the lib and replace the digitalWriteFast.h from the Mwii folder ? i think yes , because i get no error :)

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: Position Hold with Optical Flow sensor - done

Post by alexmos »

LuFa,

probably you are using Arduino 1.0 IDE? I have added mod for it, now code compiles in 0022 and in 1.0. Changes on SVN.

LuFa
Posts: 160
Joined: Fri Jan 27, 2012 7:56 pm

Re: Position Hold with Optical Flow sensor - done

Post by LuFa »

cool , now it works without proplems :)
tomorrow i will make the first tests :mrgreen:

can you tell me your alt pids for Sonar ? sonar use the same pid like baro , right ?

future question : will your sonar and opticalflow code also work with Mega ?
work your sonar code now also with Hexa or Octocopter ?

LuFa
Posts: 160
Joined: Fri Jan 27, 2012 7:56 pm

Re: Position Hold with Optical Flow sensor - done

Post by LuFa »

hi ,

wich pid values are use the Sonar and Optical flow ? full PID controll or only PD ...... ?

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: Position Hold with Optical Flow sensor - done

Post by alexmos »

Sonat uses the same Alt-PIDS as baro but it can be increased in config: SONAR_BARO_PID_GAIN Default is 1 (means increase by 2)
Try P=5..10, I=0.010, D=20..30

will your sonar and opticalflow code also work with Mega ?

No, I have not tested with mega. Potentialy it can but need some tuning.
And I don't know if it can work with hexa or octo. Try to configure and test it :)

For Alt Hold all 3 PID used, for optical flow - only P and I.

dfidalgo
Posts: 23
Joined: Fri Sep 09, 2011 2:16 pm

Re: Position Hold with Optical Flow sensor - done

Post by dfidalgo »

Hi!
I remembered that I had lost here at home, a Flymentor, and could use the optical sensor with your code. After opening it to find out which sensor was inside the box, I saw that they removed the references ... :shock:
Can someone tell me what sensor is this? I would like to use it with your code.
Regards,

Daniel
Attachments
IMAGE_121.jpg
IMAGE_119.jpg
Flymentor Optical sensor
Flymentor Optical sensor

Tifani
Posts: 63
Joined: Sun Nov 06, 2011 5:15 pm

Re: Position Hold with Optical Flow sensor - done

Post by Tifani »

Hi !
For me look like one of Avago ADNS family - I have ADNS5050, it have very similar hole pattern - do not have "dashes"
Maybe this one: http://zener.ru/catalogue/Sensors,%20Transducers/Optical%20-%20Mouse%20Sensor/ADNS-2610/
or http://www.diylive.net/index.php/2007/07/20/diy-mouse-scanner/

I can not post pictures - maybe You can tell me Your secret - how to attach pictures & videos ???
Thanks
Tom

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Position Hold with Optical Flow sensor - done

Post by copterrichie »

dfidalgo, I have a Flymentor also that is not being used at present. I have connected the optical device to two of the arduino's analog ports and it works. I can get X and Y data out of it but I never did any more with it. I am sure it would be an easy modification to get this optical sensor to work if not by using analog ports, then using something like an ATTiny85 to connect it to the I2C bus.

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: Position Hold with Optical Flow sensor - done

Post by alexmos »

It seems like ADNS for me too. If it is from adns-family - it should have digital output, so could be connected directly to arduino as I did it. Try to look at datasheets in Avago site to find precise sensor name by pictures.

dfidalgo
Posts: 23
Joined: Fri Sep 09, 2011 2:16 pm

Re: Position Hold with Optical Flow sensor - done

Post by dfidalgo »

Yes, comparing pictures seems to be exactly a ADNS2610. I found this on the helifreak site:

I finally got a Flymentor and have begun looking at the way it works.
The names on the chips and camera have been removed, but we worked out that the camera is most likely a ADNS 2610. ( a datasheet is on the web )
It uses two wires for serial data, and the camera should be fairly easy to emulate with a microcontroller.
It might be possible to improve the optics to give higher position hold.



Alexmos, how you did? (sorry, this post starts to get huge...)

alexmos wrote:It seems like ADNS for me too. If it is from adns-family - it should have digital output, so could be connected directly to arduino as I did it. Try to look at datasheets in Avago site to find precise sensor name by pictures.


Thanks guys,

Daniel

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: Position Hold with Optical Flow sensor - done

Post by alexmos »

Yes, Flymentor uses ADNS-2610. It's cleary by picture http://forum.rcdesign.ru/attachment.php ... 1278410342
It has pinout:
Yellow - SCK
White - SDIO
Red - +5V
Black - Ground

It can be conected to Arduino only by 2 wires - there are many examples with code in inet. Needs some modifications in my code (registers and SPI reading-writing) to get it working.

dfidalgo
Posts: 23
Joined: Fri Sep 09, 2011 2:16 pm

Re: Position Hold with Optical Flow sensor - done

Post by dfidalgo »

So I can connect directly to pins A0 and A1 wright? Ok, my programmer and electronic skills are near to "0"... So I'll wait for your code developments, I'm sure that a lot of people have some flymentors to attach on our Multiwiis.

Tifani
Posts: 63
Joined: Sun Nov 06, 2011 5:15 pm

Re: Position Hold with Optical Flow sensor - done

Post by Tifani »

Hallo ! Guys !
I was sure than this (and other) forum is about helping each other.
Why all of You ignoring my question "how to attach pictures to the post".

Daniel - I tried to help You - why You can't help me ? Do not tell me You don't know.

Regards
Tom

nhadrian
Posts: 421
Joined: Tue Oct 25, 2011 9:25 am

Re: Position Hold with Optical Flow sensor - done

Post by nhadrian »

If you go to advanced post editor, there is a tab for uploading attachment. Thats the easiest way.
Or you should upload the pictures into imageshack.com or any other similar page. After uploading, you'll find a code for forum posts. You should copy/paste this into your post here.

BR
Adrian

ps.: looking forward to your pictures....;)
Attachments
Névtelen.jpg

Tifani
Posts: 63
Joined: Sun Nov 06, 2011 5:15 pm

Re: Position Hold with Optical Flow sensor - done

Post by Tifani »

THANKS !!!
But I have to be retarded - no luck ???

Tom
Attachments
smile.jpg
(40.01 KiB) Not downloaded yet

dfidalgo
Posts: 23
Joined: Fri Sep 09, 2011 2:16 pm

Re: Position Hold with Optical Flow sensor - done

Post by dfidalgo »

Hi Tifani, I see that your problem is solved. I just can add some info about the pictures, take care with the size of pics that you want upload, I think that the maximum allowed in this forum is 256kb. Regards.

Tifani
Posts: 63
Joined: Sun Nov 06, 2011 5:15 pm

Re: Position Hold with Optical Flow sensor - done

Post by Tifani »

Hi !
But I can not see my picture - just paperclip symbol and file name.
Sorry to all members for taking your time but I can not sleep.
Regards
Tom

nhadrian
Posts: 421
Joined: Tue Oct 25, 2011 9:25 am

Re: Position Hold with Optical Flow sensor - done

Post by nhadrian »

then register onto imageshack.com, upload your picture and then paste the given link here....

tovrin
Posts: 705
Joined: Tue Sep 20, 2011 4:08 pm

Re: Position Hold with Optical Flow sensor - done

Post by tovrin »

if you want the picture to show up as a visible attachment, you need to have it uploaded to another site and use the "img /img" command, if you want it to show up as a "paperclip" you click the upload attachment button with the editor tool.

Tifani
Posts: 63
Joined: Sun Nov 06, 2011 5:15 pm

Re: Position Hold with Optical Flow sensor - done

Post by Tifani »

This way also do not work.
Image

Lets cut this - I do not want to take any more of Your time.
I quit.
Regards
Tom

LuFa
Posts: 160
Joined: Fri Jan 27, 2012 7:56 pm

Re: Position Hold with Optical Flow sensor - done

Post by LuFa »

Hi Alexmos ,

i have see that you know move your code to 2.0 :)

I have a idea :

What do you think about a Opticalflow and GPS Positionhold fusion ? somethink like :

Code: Select all

PositionHold_Angle = (GPS_Anlge + OpticalFlow_Angle) / 2 


what do you think about this idea ?

Thanks !

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: Position Hold with Optical Flow sensor - done

Post by alexmos »

LuFa wrote:Hi Alexmos ,

i have see that you know move your code to 2.0 :)

I have a idea :

What do you think about a Opticalflow and GPS Positionhold fusion ? somethink like :

Code: Select all

PositionHold_Angle = (GPS_Anlge + OpticalFlow_Angle) / 2 


what do you think about this idea ?

Thanks !


There is no fusion in your example: these angles are summed right now, and you can set weight of 1/2 (or any you want) for each sensor by PIDs.

And some news:
1. I have merged all my code with 2.0 and tested in flight. All seems to be working.
2. I have implemented ADNS-3080. See config.h for details. Latest code in /branches/v20/MultiWii: http://code.google.com/p/multiwii-alexm ... 2FMultiWii

I have not tested it because have not ADNS-3080 sensor, so try debug it yourself :)

LuFa
Posts: 160
Joined: Fri Jan 27, 2012 7:56 pm

Re: Position Hold with Optical Flow sensor - done

Post by LuFa »

Hi Alexmos ,

any news ? works it now with Mwii 2.0 ?

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: Position Hold with Optical Flow sensor - done

Post by alexmos »


Tifani
Posts: 63
Joined: Sun Nov 06, 2011 5:15 pm

Re: Position Hold with Optical Flow sensor - done

Post by Tifani »

Hi Alex!
Can You please share Your connection diagram for 5050.
Looks like I'm doing something wrong.
Thanks
Tom

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: Position Hold with Optical Flow sensor - done

Post by alexmos »

I have connected it as shown in datasheet, only NRESET is not connected to Arduino but to +5V: http://ybex.com/d/nacd3qi2wexloc82ipkn2 ... nv74e.html

SCLK, SDIO, NCS - can be connected to any of free pins and defined in config.h. For my setup, it was unused pins for RX connector (if you select other pins, check that they are not used by MWC for other functions)

Post Reply