I installed the Lighthouse positioning system according to the instructions. When I moved the copter by hand, Lighthouse positioning track is perfect. But when the copter is flying, the positioning will be chaotic and the flight trajectory is very strange(For example, it will crash everywhere or fly in an extreme direction. . .). Of course, occasionally the flight path will be good, but it is rare. I am confused about this, can anyone provide some experience?
I work with a few example, but the results were mostly very terrible.
1. PID_controller_tuner.py
Code: Select all
PID_controller_tuner.py:
(STANDARD_HEIGHT = 0.8)
Connecting to radio://0/80/2M/E7E7E7E7E7
Connected to radio://0/80/2M/E7E7E7E7E7
Waiting for estimator to find position...
update info
pos: (0.02151080034673214, -0.009399770759046078, 0.16127389669418335)
pos: (0.02156354859471321, -0.009443090297281742, 0.1609809249639511)
pos: (0.02147091180086136, -0.009354745037853718, 0.16114073991775513)
pos: (0.02161705680191517, -0.00943225622177124, 0.1609116643667221)
pos: (0.021552152931690216, -0.009350746870040894, 0.16093295812606812)
pos: (0.021576885133981705, -0.009450281038880348, 0.16106043756008148)
pos: (0.021441571414470673, -0.00933371763676405, 0.16107255220413208)
pos: (0.02149786800146103, -0.009372957982122898, 0.1612711399793625)
pos: (0.021387562155723572, -0.009492979384958744, 0.16086561977863312)
pos: (0.05385962873697281, -0.0692320317029953, 0.28011396527290344)
pos: (0.04449636489152908, -0.030371930450201035, 0.7209135890007019)
pos: (-0.09136592596769333, 0.09741857647895813, 0.8696437478065491)
pos: (-0.017205528914928436, 0.0211090799421072, 0.899692177772522)
pos: (0.01066504418849945, -0.0022861335892230272, 0.8924567103385925)
pos: (-0.0016913965810090303, 0.00845955591648817, 0.8856292366981506)
pos: (0.006614567246288061, -0.0031482211779803038, 0.8736806511878967)
pos: (0.004512520041316748, -0.004332128446549177, 0.8654157519340515)
pos: (-0.0013400246389210224, -0.0009147280943579972, 0.8559897541999817)
pos: (-0.0015537847066298127, -0.002901001600548625, 0.8507428765296936)
pos: (0.0029912476893514395, -0.001080103567801416, 0.8408267498016357)
pos: (0.00072653399547562, 0.0026213328819721937, 0.8336321711540222)
pos: (0.00161321135237813, -0.002416193950921297, 0.8466178178787231)
pos: (0.10273148864507675, -0.3012743890285492, 0.8860851526260376)
pos: (-0.013642516918480396, 0.01084250770509243, 0.580128014087677)
pos: (0.038878876715898514, 1.4567697048187256, -1.2636297941207886)
pos: (-0.15213258564472198, 3.049135684967041, -3.7532737255096436)
pos: (-0.3789260983467102, 4.5621418952941895, -6.228635311126709)
pos: (-0.6429680585861206, 6.0009684562683105, -8.700394630432129)
pos: (-0.9445403218269348, 7.362135887145996, -11.163076400756836)
pos: (-1.2841382026672363, 8.645485877990723, -13.617037773132324)
pos: (-1.6542322635650635, 9.82752513885498, -16.014699935913086)
pos: (-2.0703914165496826, 10.956052780151367, -18.454063415527344)
pos: (-2.526219606399536, 12.00582504272461, -20.88478660583496)
pos: (-3.022432565689087, 12.976350784301758, -23.307233810424805)
pos: (-3.559680461883545, 13.867060661315918, -25.721166610717773)
pos: (-4.137298107147217, 14.675846099853516, -28.121051788330078)
pos: (-4.758283615112305, 15.40552043914795, -30.516826629638672)
pos: (-5.422152042388916, 16.054147720336914, -32.9039306640625)
pos: (-6.1292805671691895, 16.621627807617188, -35.282562255859375)
Traceback (most recent call last):
File "/home/wang/projects/crazyflie-lib-python/examples/tuning/PID_controller_tuner.py", line 344, in <module>
tk.mainloop()
File "/usr/lib/python3.6/tkinter/__init__.py", line 560, in mainloop
_default_root.tk.mainloop(n)
KeyboardInterrupt
Then the plane quickly hit the wall.
the copter dont move as the postions, it flys very strange.
Code: Select all
autonomousSequence.py:
Connecting to radio://0/80/2M
Connected to radio://0/80/2M
Waiting for estimator to find position...
Setting position (0, 0, 0.5, 0)
pos: (0.030154390260577202, -0.04071608930826187, 0.31477421522140503)
pos: (-0.0007748748757876456, -0.006142451427876949, 0.4711490273475647)
pos: (-0.0107026482000947, 0.025943182408809662, 0.5144262313842773)
pos: (0.00021611154079437256, 0.0031076143495738506, 0.53209388256073)
pos: (-0.002681393874809146, 0.0004751934902742505, 0.5370898246765137)
pos: (-0.0013801666209474206, 0.0018157484009861946, 0.5343238115310669)
pos: (-0.0014381464570760727, -0.0018977258587256074, 0.5320922136306763)
pos: (2.1196668967604637e-05, -0.0006699744844809175, 0.5298779606819153)
pos: (-0.00023741312907077372, -0.002970730420202017, 0.015549713745713234)
pos: (0.13737699389457703, -0.08846084028482437, 0.2902442216873169)
Setting position (0.5, 0, 0.5, 0)
pos: (-0.03106614388525486, 0.08126228302717209, 0.5744625329971313)
pos: (0.30443793535232544, 0.0537523552775383, 0.6144019961357117)
pos: (0.5658884048461914, -0.014567425474524498, 0.6227310299873352)
pos: (0.4992747902870178, 0.009026860818266869, 0.603302001953125)
pos: (0.508579671382904, -0.0030377546790987253, 0.5837059020996094)
pos: (0.5209370851516724, -0.0072291200049221516, 0.6171714067459106)
pos: (0.49307477474212646, 0.004012225661426783, 0.8271852731704712)
pos: (0.3982270359992981, -0.003186064073815942, 1.0620712041854858)
pos: (0.23960180580615997, -0.03240860253572464, 1.3043456077575684)
pos: (0.02386433817446232, -0.07567567378282547, 1.5524622201919556)
Setting position (0.5, 0.5, 0.5, 0)
pos: (-0.25042518973350525, -0.11845266073942184, 1.8152929544448853)
pos: (-0.45650550723075867, -0.10432931780815125, 2.0999069213867188)
pos: (-0.4231022894382477, 0.1190827414393425, 2.359199047088623)
pos: (-0.2910715341567993, 0.43813785910606384, 2.6099703311920166)
pos: (0.4132610857486725, 1.0333093404769897, 2.519209861755371)
pos: (1.7409334182739258, 2.020033359527588, 1.8540095090866089)
pos: (2.88242769241333, 2.8240976333618164, 1.166077733039856)
pos: (3.434795618057251, 3.1171939373016357, -0.22234320640563965)
pos: (3.767679214477539, 4.139013290405273, -3.038393974304199)
pos: (3.8838860988616943, 6.210199356079102, -6.432259559631348)
Setting position (0, 0.5, 0.5, 0)
pos: (3.631497859954834, 9.301876068115234, -10.24193286895752)
pos: (-0.020589759573340416, 0.04271910339593887, -0.4165353775024414)
pos: (-0.21874411404132843, 0.3901570439338684, -3.7565155029296875)
pos: (-0.0524086095392704, 0.010095535777509212, -1.2635126113891602)
pos: (8.00841226009652e-05, -0.00014445385022554547, -0.039487358182668686)
pos: (0.006059775594621897, -0.0029605270829051733, -2.031395196914673)
pos: (-0.0012611598940566182, 0.0009671306470409036, -0.3712517023086548)
pos: (0.10050997883081436, -0.1367504745721817, -2.986516237258911)
pos: (-7.737229316262528e-05, 4.253603037795983e-06, -0.030328713357448578)
pos: (-0.09010864794254303, 0.07761498540639877, -1.3127788305282593)
Setting position (0, 0, 0.5, 0)
pos: (-1.1987003087997437, 1.0707621574401855, -3.9952900409698486)
pos: (0.0014176721451804042, -0.0014579802518710494, -0.007437313441187143)
pos: (0.23774608969688416, -0.24290229380130768, -0.6093873977661133)
pos: (1.3221426010131836, -1.407931923866272, -2.7383406162261963)
pos: (5.538136065297294e-06, -1.2720255654130597e-05, -0.008049752563238144)
pos: (-0.0994391068816185, 0.02828286401927471, -0.5576842427253723)
pos: (-1.0641062259674072, 0.6339820623397827, -2.338186264038086)
pos: (-2.689187526702881, 1.86649489402771, -6.673027515411377)
pos: (-1.7364801578878541e-06, 2.4220159957621945e-06, -0.02364034205675125)
pos: (-0.0004657442041207105, 0.0004666387103497982, -1.2602832317352295)
Setting position (0, -0.5, 0.5, 0)
pos: (-0.002549898810684681, -0.004757952410727739, -4.343245029449463)
pos: (5.402640454121865e-05, -9.08933870960027e-05, -0.15477758646011353)
pos: (0.0025304013397544622, -0.0011787477415055037, -1.7655665874481201)
pos: (0.009406345896422863, -0.003538606921210885, -5.1323676109313965)
pos: (-0.00011034830095013604, 0.0001379080640617758, -0.2783437669277191)
pos: (-0.003725956892594695, 0.01094147376716137, -2.2151710987091064)
pos: (-0.012303164228796959, 0.044952671974897385, -5.953046798706055)
pos: (-6.690723239444196e-05, -8.999624697025865e-05, -0.6664299368858337)
pos: (-0.0015465645119547844, 0.002271381439641118, -3.209367513656616)
pos: (6.786091830690566e-07, 2.820702604822145e-07, -0.03882521390914917)
Setting position (0, -0.5, 0, 0)
pos: (-2.162110286008101e-05, -0.00030287730623967946, -1.3723729848861694)
pos: (3.821856080321595e-05, -0.0029776415321975946, -4.5867438316345215)
pos: (-9.09837763174437e-06, 7.044474477879703e-05, -0.27334901690483093)
pos: (0.00022573773458134383, 0.001989845186471939, -2.2413008213043213)
pos: (0.00018643357907421887, 0.005837241653352976, -6.104535102844238)
pos: (-0.00015348738816101104, 0.0006159031763672829, -0.806615948677063)
pos: (-0.00011780473869293928, 0.0023421458899974823, -3.5926342010498047)
pos: (-6.7546952777775005e-06, -2.327300353499595e-05, -0.12579751014709473)
pos: (6.20216887909919e-05, -0.0007342668832279742, -1.7496511936187744)
pos: (0.0010620015673339367, -0.0005018823430873454, -5.351192474365234)
Once, the drone's chaotic flight
Code: Select all
Connecting to radio://0/80/2M
Connected to radio://0/80/2M
Waiting for estimator to find position...
Setting position (0, 0, 0.7)
pos: (-0.14168664813041687, -0.15732799470424652, 0.2798379957675934)
pos: (-0.12018916010856628, 0.16307367384433746, 0.2684902846813202)
pos: (-0.0390496626496315, 0.2986680865287781, -0.2266542613506317)
pos: (-0.20433449745178223, 0.20120200514793396, -0.28798896074295044)
pos: (-0.39177122712135315, 0.04481515288352966, -0.6812000274658203)
pos: (-0.5755356550216675, -0.10842739790678024, -1.061019778251648)
pos: (-0.7693692445755005, -0.2737712860107422, -1.4654326438903809)
pos: (-0.9758564829826355, -0.4518628716468811, -1.8971816301345825)
pos: (-1.1895394325256348, -0.6364529728889465, -2.3443005084991455)
Traceback (most recent call last):
File "/home/wang/projects/crazyflie-lib-python/examples/positioning/initial_position.py", line 172, in <module>
initial_x, initial_y, initial_z, initial_yaw)
File "/home/wang/projects/crazyflie-lib-python/examples/positioning/initial_position.py", line 145, in run_sequence
time.sleep(0.1)
KeyboardInterrupt
Process finished with exit code 1
Code: Select all
Connecting to radio://0/80/2M
Connected to radio://0/80/2M
Waiting for estimator to find position...
Setting position (0, 0, 0.7)
pos: (-0.11075931042432785, -0.11993246525526047, 0.30401915311813354)
pos: (-0.1050366684794426, 0.058083243668079376, 0.6101504564285278)
pos: (-0.014981936663389206, 0.03556116670370102, 0.7747489213943481)
pos: (-0.01492931880056858, -0.009511709213256836, 0.8037581443786621)
pos: (0.005674766842275858, 0.000997885363176465, 0.7979667782783508)
pos: (0.010283300653100014, -0.005211748648434877, 0.786018431186676)
pos: (0.010465807281434536, -0.006768969818949699, 0.7707411050796509)
pos: (0.009757379069924355, -0.004933073651045561, 0.7588413953781128)
pos: (0.008124609477818012, -0.005767980124801397, 0.749455451965332)
pos: (0.022570060566067696, -0.008287589065730572, 0.7493460774421692)
Setting position (-0.7, 0, 0.7)
pos: (-0.0767379179596901, -0.029863521456718445, 0.7248541116714478)
pos: (-0.5260859727859497, 0.00045625504571944475, 0.7322055101394653)
pos: (-0.6966109871864319, 0.007388170808553696, 0.7176498174667358)
pos: (-0.7032651901245117, 0.0005043466226197779, 0.7234547138214111)
pos: (-0.7084795236587524, 0.004109851084649563, 0.720493495464325)
pos: (-0.6969967484474182, 0.007976740598678589, 0.7179866433143616)
pos: (-0.6985143423080444, 0.011143175885081291, 0.715547502040863)
pos: (-0.7068672776222229, 0.006947146262973547, 0.7096388936042786)
pos: (-0.6886261701583862, 2.991433211718686e-05, 0.7049977779388428)
pos: (-0.6723108887672424, 0.0050634886138141155, 0.7071345448493958)
Setting position (0, 0, 0.7)
pos: (-0.5443704128265381, 0.008126562461256981, 0.7008529901504517)
pos: (-0.11303862929344177, -0.02329036220908165, 0.7012369632720947)
pos: (-0.0009557114099152386, -0.024654220789670944, 0.7039843797683716)
pos: (0.016133030876517296, -0.014439907856285572, 0.7141757607460022)
pos: (0.03827916830778122, -0.009921826422214508, 0.7112358808517456)
pos: (0.02819104678928852, -0.004401205573230982, 0.7071875929832458)
pos: (0.020690100267529488, -0.0025961678475141525, 0.7040784955024719)
pos: (0.015688780695199966, -0.003247329266741872, 0.703755259513855)
pos: (0.011507956311106682, -0.0008558977278880775, 0.6977506279945374)
pos: (0.008282961323857307, -9.85568476608023e-06, 0.7033833861351013)
Setting position (0, 0, 0.2)
pos: (-0.001151756732724607, -0.005175657104700804, 0.5196112990379333)
pos: (0.010652776807546616, -0.006880875676870346, 0.22007805109024048)
pos: (0.010514587163925171, 0.011607629247009754, 0.1809195578098297)
pos: (-0.00136845326051116, 0.003705997485667467, 0.1771002858877182)
pos: (-0.016999615356326103, -0.006363851949572563, 0.16647040843963623)
pos: (-0.01857483945786953, 0.005542283412069082, 0.16359539330005646)
pos: (-0.015702620148658752, -0.00029068876756355166, 0.1664767861366272)
pos: (-0.01376656349748373, -0.001262443489395082, 0.16770417988300323)
pos: (-0.004536376800388098, 0.002868087263777852, 0.17198538780212402)
pos: (0.0156106473878026, -0.002121888566762209, 0.17549164593219757)
4.trianglemove only with hand, seems very good.