ROBOTC.net forums
http://www.robotc.net/forums/

Multitasking efficiency and NXT speed
http://www.robotc.net/forums/viewtopic.php?f=1&t=5925
Page 1 of 1

Author:  Ernest3.14 [ Mon Jun 03, 2013 10:01 pm ]
Post subject:  Multitasking efficiency and NXT speed

I am writing a program which needs to check two loops: one is the primary loop which checks sensors and responds; the other one is constantly monitoring (multiple, I think 4) quadrature encoders (and feeding PID).

The encoders should be turning at a maximum of 720 counts per second. I would need to manually increment the encoder count in the code, so I'm thinking about having a task take care of that. I have some trig in the code, and it will only increase. I guess my question is whether the NXT is fast enough to not miss any encoder counts.

If it becomes necessary, will putting a `endTimeSlice();` every-so-often fix the issue? Or is there no way the NXT is quick enough? If so, would 2-bit Gray code provide enough leeway that I could get by? (I only have 2 digital pins available :( )

I am good at, writing choppy sentences, I just noticed.

Author:  mattallen37 [ Mon Jun 03, 2013 10:09 pm ]
Post subject:  Re: Multitasking efficiency and NXT speed

How are you planning to capture the encoder signals? Using the motor ports? Using an external uC? Using the sensor port IOs?

Author:  Ernest3.14 [ Mon Jun 03, 2013 10:14 pm ]
Post subject:  Re: Multitasking efficiency and NXT speed

I have a "SuperPro" prototype board; the encoders would be connected to the digital pins.

EDIT: I would like to buy a prototype board in the very near future :)

Author:  mattallen37 [ Mon Jun 03, 2013 10:19 pm ]
Post subject:  Re: Multitasking efficiency and NXT speed

For reading encoders, you're best off using a uC with interrupts. I usually use PCINT with an AtMega328 or AtTiny85.

Author:  Ernest3.14 [ Mon Jun 03, 2013 10:48 pm ]
Post subject:  Re: Multitasking efficiency and NXT speed

Ok. This is for an FTC game, so there's a bunch of (unnecessary?) limitations on what I can do. <rant> If I had it my way, I'd attach an Arduino and make it an I2C sensor and plug that into the NXT. Heck, I'd just use an Arduino instead of an NXT. </rant> How do you recommend I fetch data from the uC? I only have 8 digital I/O pins and 8 digital I pins available. :)

Author:  mattallen37 [ Mon Jun 03, 2013 10:59 pm ]
Post subject:  Re: Multitasking efficiency and NXT speed

If you have to poll the IOs over I2C, and then do the encoder signal processing, you'd be lucky to be able to read 100 signal changes per second.

If you have to stick with certain equipment, I suggest you use the encoder inputs of the NXT motor ports.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/