News:



  • June 05, 2024, 10:02:50 PM

Login with username, password and session length

Author Topic: Gyroscope Timer Project  (Read 5059 times)

Offline Jason Greer

  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 486
Gyroscope Timer Project
« on: December 24, 2012, 03:01:52 PM »
I've been experimenting with a 3 axis gyroscope and an Arduino microcontroller in hopes of learning more about what is involved in regulating the rotation rate of a control line stunter.  I am using only the Z axis from the gyro.  I've attached a few graphs of two test flights from yesterday afternoon.  Both flights were flown within 30 minutes of one another, so the flight conditions were similar.

The first spreadsheet was from a test flight with the ESC in set rpm mode.  The rotation rate fluctuations due to wind speed are clearly visible.  The rotation rate in degrees per second varies between about 55 and 85.  The spikes in the middle of the graph were during a loop.

The second spreadsheet is from a test flight where the speed of the motor is controlled using a PID loop with the PID input coming from the gyro.  The output of the PID is fed to the ESC to control the speed of the motor.  The graph displays the rotation rate (blue), the throttle output from the PID (red), and the target rotation rate (green).  The rotation rate is held fairly close to a constant rate with the PID controller.  This flight had two loops and a wingover as can be seen in the graph.  I still have some tuning to do on the PID, but I'm fairly happy with the results from this test flight.   I am using a new verson of the Castle Creations firmware that supports 400 hz output rate changes.  The software mode is called Multi Rotor and was developed for use in multi rotor copters.  Without this firmware the Castle ESC's will not work as the thottle output rate does not update fast enough to react to the needs of the PID output.

As I progress foward I will continue to update this thread.  I still have a lot of work ahead of me, but I was excited after yesterday's testing.

Jason 
El Dorado, AR
AMA 518858

Online Tim Wescott

  • 2016 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 12829
Re: Gyroscope Timer Project
« Reply #1 on: December 24, 2012, 03:22:09 PM »
Looks like you've mostly got just proportional active at the moment -- if you've got any integral action there its too slow to track the variations you're seeing.

I take it you like the improvement in feel?

I'm not sure what your background is, but these may be helpful:

http://www.embedded.com/design/prototyping-and-development/4211211/PID-without-a-PhD
http://www.wescottdesign.com/articles.html
http://www.wescottdesign.com/actfes/actfes.html
AMA 64232

The problem with electric is that once you get the smoke generator and sound system installed, the plane is too heavy.

Online Tim Wescott

  • 2016 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 12829
Re: Gyroscope Timer Project
« Reply #2 on: December 24, 2012, 03:24:22 PM »
An alternative thing to measure is the acceleration in the port/starboard direction.  This gives you a pretty good indication of line tension, but it would tend to make the plane speed up in the overheads (which, maybe, isn't a bad thing).  I think this is what Igor Burger uses in his fancy inertial-feedback timer.
AMA 64232

The problem with electric is that once you get the smoke generator and sound system installed, the plane is too heavy.

Offline Jason Greer

  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 486
Re: Gyroscope Timer Project
« Reply #3 on: December 24, 2012, 03:37:28 PM »
Thanks Tim.  My background is in the software/database field.  The hardware side is all new to me.  I've been reading and learning as much as possible over the last month.  I really appreciate your input.

After reading about the affects of gravity on an accelerometer, I thought I would try a gyro.  It didn't hurt that the local Radio Shack had an inexpensive 3 axis 250 dps gyro in stock.  I may be going down the wrong path, but it's been a fun project either way!

I have tried increasing the D value slowly, but I tend to get more oscillations.  So far the graph I attached earlier shows the best control response I've been able to achieve.  I'm anxious to do more testing, but the weather has not been very cooperative lately. 
El Dorado, AR
AMA 518858

Online Tim Wescott

  • 2016 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 12829
Re: Gyroscope Timer Project
« Reply #4 on: December 24, 2012, 04:42:09 PM »
Differential action can be difficult to tame.  It aids stability in a lot of systems, yet it can make it worse on quite a few, too.  And when it does make things worse, it generally does so at high frequencies (often one half the sampling rate) where the direct problem may not be noticeable, but instead causes secondary problems.  (The most dramatic of these that I've experienced was on a system that used a so-called "torquer" motor, which is a motor that's designed to exert a controlled torque while moving slowly.  When you use a torque you drive an axis that's as free-moving as possible, so when the motor is off the axis is limp.  In this case, we were getting a strong oscillation at 1/2 the sampling rate that wasn't making any noise.  So the first symptom that you noticed was the axis going limp.  Much later, you noticed the motors burning up.)

In addition to it being a toss-up whether your differential action will help or hurt stability, it also can make your control system much more sensitive to noise.  In fact, without having your plane in front of me I would be hard pressed to fully believe that what you're interpreting as oscillation isn't just noise that's getting into the gyro and is turning into wild command swings, without having "real" oscillation (I'm not going to disbelieve it, either -- it's just that differential action can be tricky, and you sound like a beginner).

If you get a copy of my book there's a chapter in there on building the data-collection half of a control systems analyzer into your code.  If you take the trouble to do that and if you have enough memory on board (you'll have to do it in flight), then you can collect detailed information on how your aircraft responds to input, post a Bode plot, and then all the engineers here who do closed-loop control can give you conflicting advice on how to tune your PID.  If you have or get my book, and you want to go that route, let me know and I'll send you some supplementary material that may be helpful.
AMA 64232

The problem with electric is that once you get the smoke generator and sound system installed, the plane is too heavy.

Offline Jason Greer

  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 486
Re: Gyroscope Timer Project
« Reply #5 on: December 24, 2012, 06:03:42 PM »
Thanks for the input Tim.  I am most definately a beginner at this.  A month ago I hadn't even heard of PID.  At least now I know what the letters stand for!!  This has been and continues to be a very steep learning curve.  I will review your articles. 

The oscillations could definately be from noise from the gyro.  In an attempt to reduce the noise and get a more useable signal from the gyro I have applied some smoothing to the gyro output.  Each time through the loop I grab a new reading from the gyro.  The new reading is added to the previous 20 readings and then those 21 readings are sorted.  The top and bottom 3 samples are excluded and the average of the remaining samples are returned as the PID input.  This really helped clean up the response of the motor output.

Again, I appreciate your input.
El Dorado, AR
AMA 518858

Offline Howard Rush

  • 22 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 7818
Re: Gyroscope Timer Project
« Reply #6 on: December 24, 2012, 06:10:35 PM »
From a post awhile back where somebody recorded gyro data, I concluded that using yaw rate as a surrogate for inertial speed would be difficult, because it would always get some pitch rate in it from maneuvers.  On the other hand, you could use a 3-DOF gyro as a trimming tool.  

As far as control stuff goes, you do have an analog filter on the gyro before you sample it for a digital input, don't you?  Also, it may be prudent to leave out the integral path for stunt. 
The Jive Combat Team
Making combat and stunt great again

Online Tim Wescott

  • 2016 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 12829
Re: Gyroscope Timer Project
« Reply #7 on: December 24, 2012, 06:48:33 PM »
In an attempt to reduce the noise and get a more useable signal from the gyro I have applied some smoothing to the gyro output.  Each time through the loop I grab a new reading from the gyro.  The new reading is added to the previous 20 readings and then those 21 readings are sorted.  The top and bottom 3 samples are excluded and the average of the remaining samples are returned as the PID input.  This really helped clean up the response of the motor output.

Eww, ick.  A nonlinear moving average filter.

That may be the right thing to use, but it is almost certainly not.  It's much better to use a simple 1st-order lowpass (AKA exponentially weighted, but don't say that around control types).

The problem with using a nonlinear filter (which comes from the part where you toss out the top and bottom samples from your data set) is that nonlinear systems tend to defy structured analysis, and they exhibit what's called "local behavior" which means that you'll think you're cooking along just fine, then you suddenly discover a maneuver (or a particular flavor of wind gust) that'll make the system go unstable and stay that way.  You may, indeed, be solving the problem in the best possible way with a nonlinear compensator, but you generally don't want to fling one into your system unless you have a driving need.

The problem with using a moving average filter (which is where you're taking the average of the latest 21 samples) is that delay kills stability, and a moving average filter adds a lot more delay for the amount of high-frequency attenuation you get than so-called "minimum phase" filters, of which a simple 1st-order lowpass filter is an example, and one that has better amplitude vs. frequency characteristics than a moving average.
AMA 64232

The problem with electric is that once you get the smoke generator and sound system installed, the plane is too heavy.

Online Tim Wescott

  • 2016 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 12829
Re: Gyroscope Timer Project
« Reply #8 on: December 24, 2012, 07:01:06 PM »
From a post awhile back where somebody recorded gyro data, I concluded that using yaw rate as a surrogate for inertial speed would be difficult, because it would always get some pitch rate in it from maneuvers.  On the other hand, you could use a 3-DOF gyro as a trimming tool.  

And possibly a varying amount of pitch rate, if your yaw vs. elevator is affected by where you are with respect to the wind.

Quote
As far as control stuff goes, you do have an analog filter on the gyro before you sample it for a digital input, don't you?  Also, it may be prudent to leave out the integral path for stunt. 

Eh?  Whazzat?  Anti-aliasing filters on sensor data in a close-loop system isn't always a good idea, and is often bad.  The best gyros are designed to be sampled at a specific rate, and cough up a reading that's the integral of the rate since the last output (or, more properly, it's the measured angular offset since the last output).  Analog anti-aliasing may possibly make sense if you had reason to believe that vibration noise was getting into your gyro reading -- but doing the "integrate to angle" thing is better (sampling the gyro as fast as it'll go and properly integrating the rotations is even better, as it keeps you from having problems with coning ((Jason -- don't worry about coning; I'm talking in the larger sense of possible problems one may have with gyros in general, not with something that may happen to you specifically))).

Besides, a lot of silicon MEMS gyros these days are digital output.

That having been said, many of those digital-output silicon MEMS gyros have a selectable analog lowpass filter available.

At the risk of overloading the group with way-overly technical stuff: http://www.wescottdesign.com/articles/Sampling/sampling.pdf.  While I did write the paper, it doesn't just reflect my opinion: you'll find agreement by a large number of engineers that work in discrete-time control on the issues revolving around sampling and anti-aliasing filters.
AMA 64232

The problem with electric is that once you get the smoke generator and sound system installed, the plane is too heavy.

Offline Jason Greer

  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 486
Re: Gyroscope Timer Project
« Reply #9 on: December 24, 2012, 07:22:31 PM »
Thanks for your input Howard!  I'll have to dig up that thread with the gyroscope logs.  I searched a good bit before I started this, but I don't recall seeing any logs showing flight data recorded from a gyrscope.  The gyroscope that I'm using incorporates both low and high pass filters and communicates on the I2C bus.  As a reference, this is the gyroscope that I'm using: http://www.parallax.com/Store/Sensors/AccelerationTilt/tabid/172/ProductID/778/List/0/Default.aspx?SortField=ProductName,ProductName

I am worried that yaw changes during maneuvers will affect the output and I don't know if there is a solution that will solve that problem.  I started this project knowing that I would make mistakes, but thats OK.  I may never get to the point of having a viable working solution, but I'm still having fun experimenting.

Tim, I'll rethink my smoothing algorithm and investigate the 1st order filter you mention.  To be honest, I came up with the filtering that I am using by researching control algorithms that are being used in two wheel balancing robots.  If I follow what you are saying then with my system the PID could be reacting to data that could be several loop iterations old and therefore my PID output will lag behind what is really happening.  I will work on sorting this out.

Have a Merry Christmas,
Jason

El Dorado, AR
AMA 518858

Offline Crist Rigotti

  • 23 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 3862
  • Electric - The future of Old Time Stunt
Re: Gyroscope Timer Project
« Reply #10 on: December 24, 2012, 08:02:14 PM »
Jason,
Interesting stuff!  Merry Christmas!
Crist
AMA 482497
Waxahachie, TX
Electric - The Future of Old Time Stunt

Offline Jason Greer

  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 486
Re: Gyroscope Timer Project
« Reply #11 on: December 24, 2012, 09:10:23 PM »
Thanks Crist!  Merry Christmas to you!
El Dorado, AR
AMA 518858

Offline Howard Rush

  • 22 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 7818
Re: Gyroscope Timer Project
« Reply #12 on: December 24, 2012, 10:42:01 PM »
I am worried that yaw changes during maneuvers will affect the output and I don't know if there is a solution that will solve that problem.  I started this project knowing that I would make mistakes, but thats OK.  I may never get to the point of having a viable working solution, but I'm still having fun experimenting.

I haven't done the ciphering, but I'd guess that the yaw oscillations you get in maneuvering are fast enough that they can be filtered out without messing up the control loop.  Recordings of them, too, could be useful in trimming.
The Jive Combat Team
Making combat and stunt great again

Offline paul winter

  • Trade Count: (0)
  • Lieutenant
  • ***
  • Posts: 85
Re: Gyroscope Timer Project
« Reply #13 on: December 25, 2012, 02:46:33 AM »
hi Jason
wow very interesting
merry xmas to all of you
paul and john

Offline Igor Burger

  • Trade Count: (0)
  • Admiral
  • ******
  • Posts: 2166
Re: Gyroscope Timer Project
« Reply #14 on: December 25, 2012, 02:47:30 AM »
An alternative thing to measure is the acceleration in the port/starboard direction.  This gives you a pretty good indication of line tension, but it would tend to make the plane speed up in the overheads (which, maybe, isn't a bad thing).  I think this is what Igor Burger uses in his fancy inertial-feedback timer.

Actualy my lates solution is not inetrial and not feedback :- )))) ... but yes, works better.

here is my latest solotion with gyroscope:



it is on edge of hunting so sometimes it makes that "uuuiiiiuuiiiiuiiiiiuuuuiiii" :-)))) ... later (after 2 years of messing) I decided it is not way and used G sensor  

Offline Igor Burger

  • Trade Count: (0)
  • Admiral
  • ******
  • Posts: 2166
Re: Gyroscope Timer Project
« Reply #15 on: December 25, 2012, 02:59:10 AM »
the yaw oscillations you get in maneuvering are fast enough that they can be filtered

and I affraid they are too close :- ))) ... or even worse, they can be even slower :- ))))

Offline Igor Burger

  • Trade Count: (0)
  • Admiral
  • ******
  • Posts: 2166

Offline Jason Greer

  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 486
Re: Gyroscope Timer Project
« Reply #17 on: December 25, 2012, 09:53:38 AM »
Igor, I really appreciate your input.  With the short time I have invested in my project, I have a much greater appreciation for what you have accomplished!!  It's discouraging to hear that you were not able to get satifactory results from a gyroscope.  I may have to completely rethink my approach. 

Tim, after the holidays I will read your articles closely and try to apply what I learn from them.  I'm sure I'll have more questions!

Thanks,
Jason
El Dorado, AR
AMA 518858

Offline Igor Burger

  • Trade Count: (0)
  • Admiral
  • ******
  • Posts: 2166
Re: Gyroscope Timer Project
« Reply #18 on: December 25, 2012, 10:12:40 AM »
NOOO :-)) .. I did not want to discourage yo, do not expect to get solution without finding what is good and what is not, may be you will find better way than I did ...  :- ))))

I stopped, because I simply did not see way how to improve it anymore, and that solution which I had, was simply not enough for me. I saw it on World championship in Gyula 2010. Some guys from forum were there, it worked, but simply it was suboptimal in bad conditions. Then I simply changed mind, worked another 2 years and now I have solution which works also in hard wind and turbulence. You cannot have solution in few weeks, so do not stop if first try is not the best, I worked over 5 years, now we have much better components, we know what to expect from such device, so it will be much easier.

BTW I remember that Spain guys wanted to do it also ... Alberto are you reading? I did not hear about it long time.

Online Tim Wescott

  • 2016 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 12829
Re: Gyroscope Timer Project
« Reply #19 on: December 25, 2012, 11:22:03 AM »
Igor, I know I should know this, but -- what do you do now?
AMA 64232

The problem with electric is that once you get the smoke generator and sound system installed, the plane is too heavy.

Offline Igor Burger

  • Trade Count: (0)
  • Admiral
  • ******
  • Posts: 2166
Re: Gyroscope Timer Project
« Reply #20 on: December 25, 2012, 01:07:16 PM »
You mean right now? Reading forum, eating cakes and building "tummy muscles" :- )))))))))

Offline Jason Greer

  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 486
Re: Gyroscope Timer Project
« Reply #21 on: December 25, 2012, 01:45:02 PM »
Thanks Igor,  I'll keep experimenting. :)

Paul, Merry Christmas to you and John!  Good to hear from you guys.
El Dorado, AR
AMA 518858

Offline Howard Rush

  • 22 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 7818
Re: Gyroscope Timer Project
« Reply #22 on: December 25, 2012, 05:07:23 PM »
You mean right now? Reading forum, eating cakes and building "tummy muscles" :- )))))))))

I'm copying Igor.  Merry Christmas.
The Jive Combat Team
Making combat and stunt great again

Offline Alberto Solera

  • Trade Count: (0)
  • Lieutenant
  • ***
  • Posts: 51
Re: Gyroscope Timer Project
« Reply #23 on: December 26, 2012, 05:17:26 AM »
Hi everybody.
I am a silent reader Igor  :)

I keep working in my gyro based controller. It was working very well for me the last weeks before world championship, sadly I could not show it working. Jose Luis is currently flying with my controller with pretty good results but it takes time to get a really good set of PID constants (PI actually).
I worked in other areas (like bluetooth programming with my smartphone  ;D) but there are no major changes in control since this article:
http://adarvueltas.blogspot.com.es/2011/10/otro-temporizador-para-f2b-electricos.html

I have to rebuild my model. And then I plan to keep working with hardware from Pablo Saez (JPaeromodels) that includes a 6 axis IMU, so we will be able to try any approach from our busy minds  ;)

Regards and merry christmas.  H^^

Offline Jason Greer

  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 486
Re: Gyroscope Timer Project
« Reply #24 on: December 27, 2012, 07:44:20 AM »
Alberto, 

Thanks for joining in the discussion.  It was your project that turned me on to the Arduino and gyroscope.  It's good to hear that you are still having success! 

Thanks,
Jason 
El Dorado, AR
AMA 518858

Online Tim Wescott

  • 2016 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 12829
Re: Gyroscope Timer Project
« Reply #25 on: December 27, 2012, 11:12:46 AM »
If someone wanted to do a whole lot of work at a pretty advanced level (graduate level in engineering or math) you should be able to take that 6-axis IMU output and turn it into a pretty good moment-to-moment estimate of the airplane's attitude and speed (both vertical and horizontal).

I'm vastly interested, but I'm pretty sure that it'd be a man-month for me just to get a simulation working in Scilab (that's an open-source Matlab equivalent, for the systems engineering geeks in the crowd).  Transferring that to an embedded processor would be more work yet, and would very likely be beyond the number-crunching capabilities of the little 8-bit processors that you find in Arduinos. 

There may be decent approximations that take a lot less work, though.
AMA 64232

The problem with electric is that once you get the smoke generator and sound system installed, the plane is too heavy.

Online Tim Wescott

  • 2016 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 12829
Re: Gyroscope Timer Project
« Reply #26 on: December 29, 2012, 07:15:31 PM »
Actualy my lates solution is not inetrial and not feedback :- )))) ... but yes, works better.

here is my latest solotion with gyroscope:



it is on edge of hunting so sometimes it makes that "uuuiiiiuuiiiiuiiiiiuuuuiiii" :-)))) ... later (after 2 years of messing) I decided it is not way and used G sensor  

Heh.  I just noticed.

A gyroscope is inertial.  And since the motor affects the speed, the speed affects the gyro, and the gyro affects the motor setting -- that's a feedback loop.
AMA 64232

The problem with electric is that once you get the smoke generator and sound system installed, the plane is too heavy.

Offline Howard Rush

  • 22 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 7818
Re: Gyroscope Timer Project
« Reply #27 on: December 29, 2012, 07:26:20 PM »
Igor is being tricky.
The Jive Combat Team
Making combat and stunt great again

Online Tim Wescott

  • 2016 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 12829
Re: Gyroscope Timer Project
« Reply #28 on: December 29, 2012, 08:06:38 PM »
I missed his wording: "my latest is not...", then "here is my latest with gyroscope".

Oh, if only I could learn how to read...
AMA 64232

The problem with electric is that once you get the smoke generator and sound system installed, the plane is too heavy.

Offline Igor Burger

  • Trade Count: (0)
  • Admiral
  • ******
  • Posts: 2166
Re: Gyroscope Timer Project
« Reply #29 on: December 30, 2012, 02:00:05 AM »
Sorry Tim, I alwas save words :-P

That wideo shows gyroscope solution which is usual close loop feedback regulation. However it is 4 years old solution which I last time used 2 years ago on Wch in hungary and then I decided to go to something else.

And that else is solution with accelerometer and it is not close loop regulation, it is some kind of feed-forward system. So I am speaking about 2 different things :- ))

so sorry for that "latest" and "latest with gyro" ... both are latest, but one is latest with accelerometer (my actual) and another is latest with gyro (2 year ago stopped) :- )))))))))))))))))))))

Offline Jason Greer

  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 486
Re: Gyroscope Timer Project
« Reply #30 on: January 06, 2013, 04:07:41 PM »
Sorry for the long delay between updates.  The holidays and weather have prevented any testing since my last update. 

Today proved to be a fairly decent day.  The winds were a little gusty at times, but I was able to make some progress.  Under Tim's advice I sought a new filtering method.  The new method seems to produce more acceptable output from the gyro.  After multiple tests I was able to achieve a smooth power increase and decrease where desired with minimal noise in level flight due to wind gusts.  I am using two sets of PID values, one set of conservative values for when the error is minimal and a more aggressive set for large errors. 

The attached graph shows the best results of todays testing.  I still have a little more tuning, but I feel pretty good with todays progress.

Thanks to everyone that has provided advice!  I greatly appreciate it. 

Jason
El Dorado, AR
AMA 518858

Offline Igor Burger

  • Trade Count: (0)
  • Admiral
  • ******
  • Posts: 2166
Re: Gyroscope Timer Project
« Reply #31 on: January 06, 2013, 05:13:21 PM »
Definitelly smoother, but what we see now? I guess I see differencial value on lower line ... right? And what is upper? Seems to be filtered P regulation? (I guees because it loosk like inverted, amplified and limited lover line). If yes can you put also I and D regulation? .. because that is much more important what is happening with Iand D then just P.

BTW it will be better if we see real result on video, because it is much more important what is real result, then simply lines without relation to model movement. You will always have some overregulation, important is where it happens, because when I did tests with gyro, I spend over year solving problems with overregulation just on places when I wanted braking :-)) ... and that was reason of bad pull ups in descending legs of corners and thus incosistent bottoms.

Offline Jason Greer

  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 486
Re: Gyroscope Timer Project
« Reply #32 on: January 06, 2013, 06:36:11 PM »
Thanks Igor.  I forgot to label my graph.  Sorry about that!  The green line is my PID set point, the blue line represents the gyro rotation rate in degrees per second, and the red line is the output from my PID feedback loop.  The red line is the esc signal divided by 10.  For example, 144 on the chart represents a 1440 millisecond signal. 

In my previous post I should have said that it reponds mostly correctly.  I still need to work on the timing of the response.  It's far from perfect!  :)

Hopefully on my next outing I will be able to get some in flight video.  Up to this point I would be embarrassed to post a video!!

Thanks again,
Jason
El Dorado, AR
AMA 518858

Offline Igor Burger

  • Trade Count: (0)
  • Admiral
  • ******
  • Posts: 2166
Re: Gyroscope Timer Project
« Reply #33 on: January 07, 2013, 02:41:53 AM »
I expected it will be power signal, but I do not see effects of I and D ... ok ok we will see what it does in the air.

Offline Howard Rush

  • 22 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 7818
Re: Gyroscope Timer Project
« Reply #34 on: January 07, 2013, 06:57:15 AM »
The output seems to be hitting limits at 131 and 149.  Why's that?
The Jive Combat Team
Making combat and stunt great again

Offline Jason Greer

  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 486
Re: Gyroscope Timer Project
« Reply #35 on: January 07, 2013, 09:26:35 AM »
Howard, I am limiting the output so that it does not exceed a range of 1310 and 1490 ms (In the spreadsheet the output is divided by 10).  This corresponds to an RPM range of roughly 7500 to 9500 on the power system I am testing with.

Thanks,
Jason
El Dorado, AR
AMA 518858

Online Tim Wescott

  • 2016 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 12829
Re: Gyroscope Timer Project
« Reply #36 on: January 07, 2013, 10:15:54 AM »
The problem that I see with any inertial speed measurement is that at the very best you will achieve a constant speed with respect to the pilot.  This should be grand under normal flight conditions, but is it going to be best in the wind?
AMA 64232

The problem with electric is that once you get the smoke generator and sound system installed, the plane is too heavy.

Offline Igor Burger

  • Trade Count: (0)
  • Admiral
  • ******
  • Posts: 2166
Re: Gyroscope Timer Project
« Reply #37 on: January 07, 2013, 10:46:07 AM »
The problem that I see with any inertial speed measurement is that at the very best you will achieve a constant speed with respect to the pilot.  This should be grand under normal flight conditions, but is it going to be best in the wind?

At the best, but reality is (as we can see on those chards) far from that. I think it is impossible with power train and system of measuring which we have available. So reality is, that is slows down and then it is overspeeded just in moment when we do not want it. That wind problem is good example, wind tends to accelerate in loop, so the power will go down little ... and now imagine that you have to go against wing, model will need some time to get the power back, so it will go slowly against the wind. That is not big problem in level, we can wait until it comes to upwind side, but imagine you have to go to upper loop of vertical eight, it is also against wind, that subtracted power in lower loop will be counteproductive, model will come to big troubles.

It is the question of proper tuning of software to what pilot expects, not simply technical numbers etc. And that was reason why I had to give up with gyro, I was simply not able to make well ballanced reactions. That is why I am curiouse where Jason can push it. I had worse components 4 years ago, so may be he can do it better with better hardware. I see he is quicker with first steps then I was. We will see :- ))))

Online Tim Wescott

  • 2016 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 12829
Re: Gyroscope Timer Project
« Reply #38 on: January 07, 2013, 10:52:59 AM »
I think it is impossible with power train and system of measuring which we have available.

Having done some work with compact six-axis IMU's and Kalman filtering I'm not so sure.  I do think that anything you do that depends on just one or two axes is doomed to failure, as you'll either have to low-pass filter the heck out of everything or put up with the airplane constantly zinging faster and slower as it rocks and rolls around the correct speed.  (Not to mention that if you don't do the low-pass thing, and lower overall loop gain, that you may find some rather interesting oscillatory modes).

Didn't you try servoing on airspeed at one point?  Did it work?
AMA 64232

The problem with electric is that once you get the smoke generator and sound system installed, the plane is too heavy.

Offline Jason Greer

  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 486
Re: Gyroscope Timer Project
« Reply #39 on: January 07, 2013, 11:33:15 AM »
Tim, funny you mention Kalman filtering.  I have been reading about that method of sensor fusion.  I will need to brush up on my linear algebra before I fully understand the concept.  I've also been reading about the Complementary filter method.  This one seems a little easier to understand, but I'm not sure it would produce the same results as Kalman.  I am using an aggressive LPF to clean up the signal.  This has to be causing excess lag in the output response.  I will have to get an accelerometer so that I can experiment with the sensor fusion concept.
El Dorado, AR
AMA 518858

Online Tim Wescott

  • 2016 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 12829
Re: Gyroscope Timer Project
« Reply #40 on: January 07, 2013, 12:29:43 PM »
I don't think the complementary filter is going to cut it, in this case.  Where I see the term used (and it's a new one to me -- it seems to have been invented by the smart-phone software community) it's assuming that the phone is being accelerated mildly and rotated wildly.  The airplane case is almost, but not quite, opposite.

You'll need to know a lot more than just linear algebra to get your head wrapped around Kalman filtering, and then, to confuse things further, this problem actually demands an extended Kalman filter.  Trust me, the math will get wacky, and demanding, and a lot of other things only some of which can be stated in a family-friendly forum.

The way that a Kalman filter works is that it sorts out redundant data.  This means that in order for a Kalman filter to do you any good, you have to have redundant data to feed it.  If you just have a free body moving in space (like an RC plane), then a six-axis IMU (accelerometer and gyro) does not give you redundant information: the plane can move in six axes, you have six axes, too bad.  You can use a six-axis IMU plus some absolute position reference (like GPS) to get your redundancy, but in our case you'd need to add a GPS to your plane. 

What saves us here is that you do have redundant information, but it is indirect and screwy: the pilot constrains the airplane to operate in a hemispherical shell with a radius that's more or less limited to the line length, and the acceleration of gravity is a constant vector of known magnitude.  With that information I think that there's enough to get the airplane's position, velocity and attitude with respect to the pilot and to ground, but with a North reference that's "unpinned" and will spin around the circle at some rate that's (hopefully!) much less than the speed of flight.

This "pilot pins the center of the circle" is what you're already using to deduce speed from rotation rate, by the way.  What a Kalman filter will do for you is to take into account all of the rotations and accelerations of the airplane such that (for instance) any rocking of the airplane in yaw, or any coupling between the gyro's yaw axis and the airframe's pitch axis, will be washed out of the final velocity estimate.  In addition, I think (everything I say about this subject at this point should be prefaced with "I think" or "if I'm right") that as a bonus you'll know when the airplane is pointed up and when it's pointed down, and be able to add that to the motor speed as a feed-forward, to get a quicker reaction than you could from the loop.
AMA 64232

The problem with electric is that once you get the smoke generator and sound system installed, the plane is too heavy.

Offline Igor Burger

  • Trade Count: (0)
  • Admiral
  • ******
  • Posts: 2166
Re: Gyroscope Timer Project
« Reply #41 on: January 07, 2013, 02:16:31 PM »
Having done some work with compact six-axis IMU's and Kalman filtering I'm not so sure.  I do think that anything you do that depends on just one or two axes is doomed to failure, as you'll either have to low-pass filter the heck out of everything or put up with the airplane constantly zinging faster and slower as it rocks and rolls around the correct speed.  (Not to mention that if you don't do the low-pass thing, and lower overall loop gain, that you may find some rather interesting oscillatory modes).

Didn't you try servoing on airspeed at one point?  Did it work?

I did, but it worked well (or somehow usefull) only in gym with calm air :- ))) ... and why I think the constant speed is impossible? because because gyro sensor has lot of unwanted in its output ... filtering all of that means either (or also) unwanted time shift or limiting of its function ... sencond problem is limited power and its ability to accelerate and stop inertia of the prop and also mass of the model. I do not say I tried all possible, but during 5 winters in gym, having new software version every week I tried and tuned (remember, the constant speed or technical realization itself is not the only targed, target is good feeling during flight and it needs lot of tuning and flying, comparing etc, it is usually not visible on first flight, sometimes not visible at all, simply you see it only on given points on contest) so I tried so many ways, that I even do not remember all I tried :- )))  ... and believe me, now I use that best I found, so I am tired and now I concentrate to something else :- ))) ... at least for a while ... I think actual solution works well enough ... first 3 places of WCh had my regulator in, and I do not think they failed in some conditions, either in calm, in strong wind and also in crazy mixed air when one does not know till last picosecond what line tension will come in next corner :- ))) .... but if Jason will find better solution it will be at least good impulse for me to find something even better  VD~

Offline Jason Greer

  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 486
Re: Gyroscope Timer Project
« Reply #42 on: January 21, 2013, 07:04:13 PM »
Sorry for the break in updates on this project.  Between wind, rain, ice, and me having the flu I just haven't felt like working on this project.  The last two days were beautiful so I went out and tested a few more ideas, but the timer just isn't working like I'd hoped for.  I now have a digital 9 DOF IMU to experiment with, but it is going to take a lot of time and research before I attempt a solution using that sensor.

The one major drawback I noticed the last two days with the PID implementation (at least my implementation) is that it is very difficult to anticipate when the system is going to add or remove power.  This makes it difficult to fly with any precision or repeatablity.  In practice it is not consistent even under farily calm conditions. 

Thanks again to everyone for your input on this project.

Jason
El Dorado, AR
AMA 518858

Online Brett Buck

  • Trade Count: (0)
  • Admiral
  • ******
  • Posts: 13771
Re: Gyroscope Timer Project
« Reply #43 on: January 21, 2013, 09:32:03 PM »
And possibly a varying amount of pitch rate, if your yaw vs. elevator is affected by where you are with respect to the wind.

Eh?  Whazzat?  Anti-aliasing filters on sensor data in a close-loop system isn't always a good idea, and is often bad.  The best gyros are designed to be sampled at a specific rate, and cough up a reading that's the integral of the rate since the last output (or, more properly, it's the measured angular offset since the last output). 

   The reason they are "designed to be sampled as a specific rate" is primarily based on the anti-aliasing properties. There are very few applications where you actually want an aliased signal. It can certainly be dealt with downstream if necessary but you almost always want to do something about it somewhere. An analog pre-filter is a good way to do it.

    Of course, there's not NEARLY enough information here about the system in question to make any real analysis of how it works or how it might be improved.

    Brett

Online Tim Wescott

  • 2016 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 12829
Re: Gyroscope Timer Project
« Reply #44 on: January 21, 2013, 09:52:14 PM »
   The reason they are "designed to be sampled as a specific rate" is primarily based on the anti-aliasing properties. There are very few applications where you actually want an aliased signal. It can certainly be dealt with downstream if necessary but you almost always want to do something about it somewhere. An analog pre-filter is a good way to do it.

The ones that I've worked with are sampled at some fixed relationship to the wheel rotation rate (if it's a spinning gyro), vibratory rate (if it's a tuning-fork gyro), or dither frequency (if it's a laser gyro).  Anti-aliasing, per se, is not the motivation for the chosen sampling rate out of the gyro.

Many control systems (including the vast majority of the ones that I've worked with) have little spectral content in the sensor signals at those frequencies that may be aliased down to where they might cause problems.  However, they have, largely, been limited in the ultimate sampling rate that could be achieved, either because of processor limitations or because the nature of the sensor itself limited the sampling rate.

In such cases the only thing that an analog pre-filter is good for is for taking up space on a board, using power, and, if it has any significant anti-aliasing properties, limiting the ultimate bandwidth that could be achieved.  Such filters in such systems do all of that while filtering out no significant amount of energy at all; the only impact they have on performance is to contribute phase lag to a loop that already came equipped with plenty, without any need for human intervention.

Granted, I've dealt with systems that did have spectral content that needed to be filtered, and in those cases I have specified anti-alias filters in loops that I've designed -- but they've been few and far between, and in general the knee-jerk inclusion of anti-alias filters in a control loop is both naive and wrong.

Here's a screed, written after an unusually dense cluster of posts on various USENET newsgroups that included statements that started with "Nyquist says" followed by some glaringly wrong "fact"; it explains the reasoning more fully: http://www.wescottdesign.com/articles/Sampling/sampling.pdf
AMA 64232

The problem with electric is that once you get the smoke generator and sound system installed, the plane is too heavy.

Offline Douglas Ames

  • 2014 Supporters
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 1299
Re: Gyroscope Timer Project
« Reply #45 on: January 22, 2013, 07:57:33 AM »
Is the purpose of this experiment to build a "Point & Shoot" Stunter?
Perfect corners (exits) every time, or are trying to smooth out the flight?
AMA 656546

If you do a little bit every day it will get done, or you can do it tomorrow.

Online Tim Wescott

  • 2016 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 12829
Re: Gyroscope Timer Project
« Reply #46 on: January 22, 2013, 08:00:57 AM »
Is the purpose of this experiment to build a "Point & Shoot" Stunter?
Perfect corners (exits) every time, or are trying to smooth out the flight?

Jason's aiming for speed regulation only, not pitch.  Have faith: perfect speed regulation + crappy piloting = crappy pattern.
AMA 64232

The problem with electric is that once you get the smoke generator and sound system installed, the plane is too heavy.

Offline Douglas Ames

  • 2014 Supporters
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 1299
Re: Gyroscope Timer Project
« Reply #47 on: January 23, 2013, 09:18:09 AM »
Jason's aiming for speed regulation only, not pitch.  Have faith: perfect speed regulation + crappy piloting = crappy pattern.
[/b]

...that would be me.  :P
AMA 656546

If you do a little bit every day it will get done, or you can do it tomorrow.

Offline Dean Pappas

  • Moderator
  • Trade Count: (0)
  • Admiral
  • *****
  • Posts: 1195
  • Welcome to the Stunt Hanger.
Re: Gyroscope Timer Project
« Reply #48 on: January 23, 2013, 09:02:56 PM »
Besides ... anything that controlled pitch would rightfully be illegal.

take care, Friends
           Dean P.
Dean Pappas

Offline john e. holliday

  • 24 supporter
  • Trade Count: (0)
  • Admiral
  • *
  • Posts: 22791
Re: Gyroscope Timer Project
« Reply #49 on: January 24, 2013, 12:21:58 PM »
I guess I will wait for the system that will take into effect the conditions of the flying site as you  move from one contest to the next or even just sport flying as the weather changes during the day.   Also don't forget the wind  that sometimes disappears.   Try Tuscon in the afternoon during VSC after official flying is done for the day.
John E. "DOC" Holliday
10421 West 56th Terrace
Shawnee, KANSAS  66203
AMA 23530  Have fun as I have and I am still breaking a record.


Advertise Here
Tags:
 


Advertise Here