Hi, I am trying to determine the sample rate for a new hobby project (digital control of a quad-rotor flying robot). The few references I've found seem to suggest there are no rigorous calculations available to decide the sample rate. They suggested the following "rules of thumb": * Use ten times the rate suggested by Shannon’s sampling theorem. * Make sure that there are four to ten samples per rise time of the closed loop system. * Make sure that there are 15 to 45 samples per period of the oscillating closed loop system. * Sampling frequency should be 10 to 30 times the bandwidth. * Choose ωcTs to be 0.15 to 0.5, where ωc is the crossover frequency and Ts is the sampling time. * Choose the sampling time in such a manner that the decrease in phase margin of the discretized system is not more than 5 to 15 degrees of the margin in the continuous time system. I don't have an actual vehicle, nor do I have a model (yet). I've seen data on the web that indicates the (open loop) step response of rotor thrust has a rise time of 0.1 sec, which implies a bandwidth of 3.5 Hz or so (I'm presuming the inertia of the frame will only increase the rise time). So it seems that I could get away with 35-100 Hz sampling rate (per the 4th rule) Does anyone have any better rules or calculation procedure? What if the un-augmented system is unstable? Are there rules of thumb or calculations to select the closed loop bandwidth? Thanks in advance, Roy
Sample rate selection for digital control project
Started by ●June 9, 2009
Reply by ●June 9, 20092009-06-09
Roy wrote:> Hi, > > I am trying to determine the sample rate for a new hobby project > (digital control of a quad-rotor flying robot). The few references > I've found seem to suggest there are no rigorous calculations > available to decide the sample rate. They suggested the following > "rules of thumb": > > * Use ten times the rate suggested by Shannon’s sampling theorem. > * Make sure that there are four to ten samples per rise time of the > closed loop system. > * Make sure that there are 15 to 45 samples per period of the > oscillating closed loop system. > * Sampling frequency should be 10 to 30 times the bandwidth. > * Choose ωcTs to be 0.15 to 0.5, where ωc is the crossover frequency > and Ts is the sampling time.What do you mean by crossover frequency?> * Choose the sampling time in such a manner that the decrease in phase > margin of the discretized system is not more than 5 to 15 degrees of > the margin in the continuous time system.Remember that a one-sample delay is a 180-degree lag at the sampling frequency, and 18 degrees at a tenth of the sampling frequency. Remember too that processing usually involves many samples of delay.> I don't have an actual vehicle, nor do I have a model (yet). I've seen > data on the web that indicates the (open loop) step response of rotor > thrust has a rise time of 0.1 sec, which implies a bandwidth of 3.5 Hz > or so (I'm presuming the inertia of the frame will only increase the > rise time). So it seems that I could get away with 35-100 Hz sampling > rate (per the 4th rule) > > Does anyone have any better rules or calculation procedure? What if > the un-augmented system is unstable? Are there rules of thumb or > calculations to select the closed loop bandwidth?How fast can you sample and process at reasonable cost? Why go slower than that? "Prompt" filters -- those with low delay -- will be more useful than linear phase. Jerry -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Reply by ●June 9, 20092009-06-09
On Mon, 08 Jun 2009 20:30:21 -0700, Roy wrote:> Hi, > > I am trying to determine the sample rate for a new hobby project > (digital control of a quad-rotor flying robot). The few references I've > found seem to suggest there are no rigorous calculations available to > decide the sample rate. They suggested the following "rules of thumb": > > * Use ten times the rate suggested by Shannon’s sampling theorem.Argh. No. Forget Shannon's sampling theorem. Shannon's sampling theorem is for communications. You're designing a control loop.> * Make > sure that there are four to ten samples per rise time of the closed loop > system.Better.> * Make sure that there are 15 to 45 samples per period of the > oscillating closed loop system.You _want_ your closed loop system to oscillate?> * Sampling frequency should be 10 to 30 times the bandwidth.5 to 30, or more. Never less than 5 unless your back is against the wall and the bastards are holding your first born hostage.> * Choose > ωcTs to be 0.15 to 0.5, where ωc is the crossover frequency and Ts is > the sampling time.You'll probably find that this is just the above rule, restated.> * Choose the sampling time in such a manner that the decrease in phase > margin of the discretized system is not more than 5 to 15 degrees of the > margin in the continuous time system.Ditto.> I don't have an actual vehicle, nor do I have a model (yet). I've seen > data on the web that indicates the (open loop) step response of rotor > thrust has a rise time of 0.1 sec, which implies a bandwidth of 3.5 Hz > or so (I'm presuming the inertia of the frame will only increase the > rise time). So it seems that I could get away with 35-100 Hz sampling > rate (per the 4th rule) > > Does anyone have any better rules or calculation procedure? What if the > un-augmented system is unstable? Are there rules of thumb or > calculations to select the closed loop bandwidth? > > Thanks in advance, > RoyYou should find that your closed loop bandwidth is higher than the bandwidth of the plant (consider an integrating plant -- it's "3dB" bandwidth is essentially zero, yet the closed-loop bandwidth of the plant isn't set by that first pole at all). You should also find that if you wrap inner loops around your motors the rotor thrust rise time will shorten considerably, at least for small increments of motor speed. (I'm assuming that you're changing rotor thrust by changing motor speed, rather than by changing pitch). If the system is unstable you'll find that there's a minimum bandwidth that you cannot go below without losing phase margin. You'll also find that there's a distinct bandwidth vs. disturbance tradeoff. Decide how far you're willing to let the thing fall if the wind flips it on it's side, and select your bandwidth accordingly (translating bandwidth and the acceleration due to gravity into distance is left as an exercise to the reader). 100Hz feels right, but I'd probably want to crank that up to 500Hz just for comfort's sake. -- www.wescottdesign.com
Reply by ●June 9, 20092009-06-09
On Jun 8, 8:30 pm, Roy <brewer....@gmail.com> wrote:> Hi, > > I am trying to determine the sample rate for a new hobby project > (digital control of a quad-rotor flying robot). The few references > I've found seem to suggest there are no rigorous calculations > available to decide the sample rate. They suggested the following > "rules of thumb": > > * Use ten times the rate suggested by Shannon’s sampling theorem. > * Make sure that there are four to ten samples per rise time of the > closed loop system. > * Make sure that there are 15 to 45 samples per period of the > oscillating closed loop system. > * Sampling frequency should be 10 to 30 times the bandwidth. > * Choose ωcTs to be 0.15 to 0.5, where ωc is the crossover frequency > and Ts is the sampling time. > * Choose the sampling time in such a manner that the decrease in phase > margin of the discretized system is not more than 5 to 15 degrees of > the margin in the continuous time system. > > I don't have an actual vehicle, nor do I have a model (yet). I've seen > data on the web that indicates the (open loop) step response of rotor > thrust has a rise time of 0.1 sec, which implies a bandwidth of 3.5 Hz > or so (I'm presuming the inertia of the frame will only increase the > rise time). So it seems that I could get away with 35-100 Hz sampling > rate (per the 4th rule) > > Does anyone have any better rules or calculation procedure? What if > the un-augmented system is unstable? Are there rules of thumb or > calculations to select the closed loop bandwidth? > > Thanks in advance, > RoyJust sample as fast as possible. The nearer to analogue you get the better. Hardy
Reply by ●June 9, 20092009-06-09
On Tue, 09 Jun 2009 12:33:01 -0700, HardySpicer wrote:> On Jun 8, 8:30 pm, Roy <brewer....@gmail.com> wrote: >> Hi, >> >> I am trying to determine the sample rate for a new hobby project >> (digital control of a quad-rotor flying robot). The few references I've >> found seem to suggest there are no rigorous calculations available to >> decide the sample rate. They suggested the following "rules of thumb": >> >> * Use ten times the rate suggested by Shannon’s sampling theorem. * >> Make sure that there are four to ten samples per rise time of the >> closed loop system. >> * Make sure that there are 15 to 45 samples per period of the >> oscillating closed loop system. >> * Sampling frequency should be 10 to 30 times the bandwidth. * Choose >> ωcTs to be 0.15 to 0.5, where ωc is the crossover frequency and Ts is >> the sampling time. >> * Choose the sampling time in such a manner that the decrease in phase >> margin of the discretized system is not more than 5 to 15 degrees of >> the margin in the continuous time system. >> >> I don't have an actual vehicle, nor do I have a model (yet). I've seen >> data on the web that indicates the (open loop) step response of rotor >> thrust has a rise time of 0.1 sec, which implies a bandwidth of 3.5 Hz >> or so (I'm presuming the inertia of the frame will only increase the >> rise time). So it seems that I could get away with 35-100 Hz sampling >> rate (per the 4th rule) >> >> Does anyone have any better rules or calculation procedure? What if the >> un-augmented system is unstable? Are there rules of thumb or >> calculations to select the closed loop bandwidth? >> >> Thanks in advance, >> Roy > > Just sample as fast as possible. The nearer to analogue you get the > better.... keeping in mind that as you sample faster any filters -- particularly integrators -- will need greater precision keep track of their states. (See Bruce Varley's comment in sci.engr.control, in your anti-alias thread). -- www.wescottdesign.com
Reply by ●June 9, 20092009-06-09
Thanks! On Jun 9, 4:27 pm, Tim Wescott <t...@seemywebsite.com> wrote:> On Tue, 09 Jun 2009 12:33:01 -0700, HardySpicer wrote: > > On Jun 8, 8:30 pm, Roy <brewer....@gmail.com> wrote: > >> Hi, > > >> I am trying to determine the sample rate for a new hobby project > >> (digital control of a quad-rotor flying robot). The few references I've > >> found seem to suggest there are no rigorous calculations available to > >> decide the sample rate. They suggested the following "rules of thumb": > > >> * Use ten times the rate suggested by Shannon’s sampling theorem. * > >> Make sure that there are four to ten samples per rise time of the > >> closed loop system. > >> * Make sure that there are 15 to 45 samples per period of the > >> oscillating closed loop system. > >> * Sampling frequency should be 10 to 30 times the bandwidth. * Choose > >> ωcTs to be 0.15 to 0.5, where ωc is the crossover frequency and Ts is > >> the sampling time. > >> * Choose the sampling time in such a manner that the decrease in phase > >> margin of the discretized system is not more than 5 to 15 degrees of > >> the margin in the continuous time system. > > >> I don't have an actual vehicle, nor do I have a model (yet). I've seen > >> data on the web that indicates the (open loop) step response of rotor > >> thrust has a rise time of 0.1 sec, which implies a bandwidth of 3.5 Hz > >> or so (I'm presuming the inertia of the frame will only increase the > >> rise time). So it seems that I could get away with 35-100 Hz sampling > >> rate (per the 4th rule) > > >> Does anyone have any better rules or calculation procedure? What if the > >> un-augmented system is unstable? Are there rules of thumb or > >> calculations to select the closed loop bandwidth? > > >> Thanks in advance, > >> Roy > > > Just sample as fast as possible. The nearer to analogue you get the > > better. > > ... keeping in mind that as you sample faster any filters -- particularly > integrators -- will need greater precision keep track of their states. > (See Bruce Varley's comment in sci.engr.control, in your anti-alias > thread). > > --www.wescottdesign.com
Reply by ●June 12, 20092009-06-12
Tim (et al) A followup question:> You should also find that if you wrap inner loops around your motors the > rotor thrust rise time will shorten considerably, at least for small > increments of motor speed. �(I'm assuming that you're changing rotor > thrust by changing motor speed, rather than by changing pitch). >> > --www.wescottdesign.comYes, I am planning to fly the vehicle by altering the thrust via control of the 4 motor speeds. I had not intended to wrap inner loops around the motors themselves. I am concerned with having too much computational load (initial controller will be an 8 bit micro). I had just planned to close the loop on angular position/rate, and perhaps an outer loop on position (all via complementary filtered or even Kalman filtered IMU). I was considering using some lead shaping on the feedforward control to boost the motor response. Do you think this is sufficient or would the inner motor loop control be preferable? Thanks again Roy
Reply by ●June 12, 20092009-06-12
On Fri, 12 Jun 2009 15:40:13 -0700, Roy wrote:> Tim (et al) > > A followup question: > >> You should also find that if you wrap inner loops around your motors >> the rotor thrust rise time will shorten considerably, at least for >> small increments of motor speed. (I'm assuming that you're changing >> rotor thrust by changing motor speed, rather than by changing pitch). >> >> > >> --www.wescottdesign.com > > Yes, I am planning to fly the vehicle by altering the thrust via control > of the 4 motor speeds. I had not intended to wrap inner loops around the > motors themselves. I am concerned with having too much computational > load (initial controller will be an 8 bit micro). I had just planned to > close the loop on angular position/rate, and perhaps an outer loop on > position (all via complementary filtered or even Kalman filtered IMU). I > was considering using some lead shaping on the feedforward control to > boost the motor response. Do you think this is sufficient or would the > inner motor loop control be preferable?I don't have a feel for whether it'll be sufficient or not, but in a perfect world (i.e. where both processors and engineers take infinitesimal amounts of time to complete their work), inner loops are preferable. Good 16-bit processors just aren't that much more expensive than 8-bit ones in hobbyist quantities; even the 32-bit ARM chips from Luminary/TI aren't _that_ much more. No matter what you do you'll spend ten times more on the non-processor part of your BOM -- why cut corners on the processing? -- www.wescottdesign.com
Reply by ●June 13, 20092009-06-13
On Jun 12, 3:40�pm, Roy <brewer....@gmail.com> wrote:> Tim (et al) > > A followup question: > > > You should also find that if you wrap inner loops around your motors the > > rotor thrust rise time will shorten considerably, at least for small > > increments of motor speed. �(I'm assuming that you're changing rotor > > thrust by changing motor speed, rather than by changing pitch). > > > --www.wescottdesign.com > > Yes, I am planning to fly the vehicle by altering the thrust via > control of the 4 motor speeds. I had not intended to wrap inner loops > around the motors themselves. I am concerned with having too much > computational load (initial controller will be an 8 bit micro). I had > just planned to close the loop on angular position/rate, and perhaps > an outer loop on position (all via complementary filtered or even > Kalman filtered IMU). I was considering using some lead shaping on the > feedforward control to boost the motor response. Do you think this is > sufficient or would the inner motor loop control be preferable? > > Thanks again > RoyI would use a 32 bit CPU woth good debugging tools. The development/ debugging tools will cost more than the 8 bit or 32 bit micro controller Peter Nachtwey .
Reply by ●June 13, 20092009-06-13






