View unanswered posts | View active topics It is currently Sat Aug 30, 2014 4:47 am






Reply to topic  [ 6 posts ] 
Multitasking efficiency and NXT speed 
Author Message
Professor
User avatar

Joined: Sat May 18, 2013 1:24 pm
Posts: 272
Location: Olympia, WA
Post 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.

_________________
FTC Team 6424, the 'Oly Cow - Chief programmer.
FRC Team 4450, Olympia Robotics Federation (ORF).

and also quadrotors. Quadrotors!


Mon Jun 03, 2013 10:01 pm
Profile
Expert

Joined: Thu Sep 29, 2011 11:09 pm
Posts: 184
Location: Michigan USA
Post 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?

_________________
Matt


Mon Jun 03, 2013 10:09 pm
Profile WWW
Professor
User avatar

Joined: Sat May 18, 2013 1:24 pm
Posts: 272
Location: Olympia, WA
Post 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 :)

_________________
FTC Team 6424, the 'Oly Cow - Chief programmer.
FRC Team 4450, Olympia Robotics Federation (ORF).

and also quadrotors. Quadrotors!


Mon Jun 03, 2013 10:14 pm
Profile
Expert

Joined: Thu Sep 29, 2011 11:09 pm
Posts: 184
Location: Michigan USA
Post 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.

_________________
Matt


Mon Jun 03, 2013 10:19 pm
Profile WWW
Professor
User avatar

Joined: Sat May 18, 2013 1:24 pm
Posts: 272
Location: Olympia, WA
Post 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. :)

_________________
FTC Team 6424, the 'Oly Cow - Chief programmer.
FRC Team 4450, Olympia Robotics Federation (ORF).

and also quadrotors. Quadrotors!


Mon Jun 03, 2013 10:48 pm
Profile
Expert

Joined: Thu Sep 29, 2011 11:09 pm
Posts: 184
Location: Michigan USA
Post 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.

_________________
Matt


Mon Jun 03, 2013 10:59 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.