I'm not sure I understand the question. The output rate is governed by the Thread.sleep() call inside your loop() method and the input rate is governed by the way you configure the sensor manager. I don't have an encoder in my app, so I'm not sure I understand your encoder comment.
On Thu, Mar 6, 2014 at 4:15 PM, Jiexin Wang <[email protected]>wrote: > Hey Ytai, > > Now I can fix the sampling rate as 0.005s and 0.02s. The thing is in > 0.005s case, the output will be delayed for a long time, I guess it's > because of the heavy load in such short time interval. How can I set the > control rate different from the sampling rate. Now I directly update ioio > thread with the updating sensor value. Another thing is in 0.02 case, this > situation doesn't happen, but increment of encoder error (encoder drift) > will bias the encoder value. How do I solve this? > Thank you. > > Best, > Jx > > > On Monday, February 24, 2014 9:41:27 PM UTC+9, Ytai wrote: > >> 1. Why is it a problem? >> 2. This is not getting called from the IOIO thread, so is unrelated to >> the delay. When you register a listener on the sensor manager you can >> choose the sample rate. >> On Feb 23, 2014 11:53 PM, "Jiexin Wang" <[email protected]> wrote: >> >>> Another problem is ,now the sampling rate onSensorChanged is around >>> 0.005second. >>> Is that possible to set the sampling rate arount for example 0.01second >>> by doing thread.sleep(10) in the ioio loop()?? >>> >>> On Sunday, February 23, 2014 9:50:19 AM UTC+9, Ytai wrote: >>>> >>>> Yes. When estimating orientation, the gyro is fast, but drifts and the >>>> accelerometer is slow, but doesn't drift. So what I'm doing is setting the >>>> orientation every time I'm getting an acc reading and in between acc >>>> readings I'm integrating gyro samples. >>>> >>>> >>>> On Sat, Feb 22, 2014 at 2:51 AM, Jiexin Wang <[email protected]>wrote: >>>> >>>>> Hey Ytai, >>>>> >>>>> I got it. >>>>> You are using sensor fusion of gyro and acc right? >>>>> >>>>> Best, >>>>> Jx >>>>> >>>>> >>>>> On Saturday, February 22, 2014 5:03:57 PM UTC+9, Jiexin Wang wrote: >>>>>> >>>>>> Hey Ytai, >>>>>> >>>>>> I am trying to implement the lqr algorithm recently. Thank you very >>>>>> much for the sample code. It helps a lot. >>>>>> I have a question about the sensors you use, according to the code, >>>>>> you mainly used gyro sensor for getting error_, errorDeriv_, and >>>>>> errorInt_, >>>>>> which are enough for the three state variable for pid control. >>>>>> But what you use accelerometer for?? why getting another error_ and >>>>>> orientationX_? >>>>>> And actually are the two sensors working at the same time?? how this >>>>>> two sensors working in the same time domain?? >>>>>> Thank you. >>>>>> >>>>>> Best, >>>>>> Jiexin >>>>>> >>>>>> On Tuesday, February 11, 2014 1:38:34 AM UTC+9, Ytai wrote: >>>>>>> >>>>>>> It's a first order IIR filter (lowpass): >>>>>>> y[n] = 0.999*y[n-1] + 0.001*x[n] >>>>>>> >>>>>>> >>>>>>> On Sun, Feb 9, 2014 at 8:56 PM, Al B <[email protected]> wrote: >>>>>>> >>>>>>>> That makes more sense now. >>>>>>>> >>>>>>>> What about that 0.999 factor? Why do you need that? >>>>>>>> >>>>>>>> >>>>>>>> errorInt_ = (float) ((error_ * dt * 1e-9) + 0.999 * errorInt_); >>>>>>>> >>>>>>>> -- >>>>>>>> You received this message because you are subscribed to the Google >>>>>>>> Groups "ioio-users" group. >>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>> send an email to [email protected]. >>>>>>>> To post to this group, send email to [email protected]. >>>>>>>> Visit this group at http://groups.google.com/group/ioio-users. >>>>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>>>> >>>>>>> >>>>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "ioio-users" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To post to this group, send email to [email protected]. >>>>> Visit this group at http://groups.google.com/group/ioio-users. >>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>> >>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "ioio-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at http://groups.google.com/group/ioio-users. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> -- > You received this message because you are subscribed to the Google Groups > "ioio-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/ioio-users. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "ioio-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/ioio-users. For more options, visit https://groups.google.com/d/optout.
