View Single Post
  #13   Spotlight this post!  
Unread 21-10-2010, 22:30
Greg McKaskle Greg McKaskle is online now
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,754
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: How do I use interrupts?

Perhaps the previous robot architecture is influencing the thinking process.

The teleop code is indeed limited to 20ms start gaps, but that limit need not leak into the rest of the robot code. You can have loops running at the rate appropriate to the sensors or mechanism. Often that just means to build a loop and place a Wait or Wait ms Multiple inside. If you find that a loop is running quite fast, you may choose to switch to the timed loop. It has multiple clocks you can choose from, and you can choose very small delays and different delay and scheduling policies. The timed loop is rich in possibilities, which also means it can be confusing if you dive in and then wonder why your app behaves the way it does. I'd encourage you to look at examples and read up on it a bit and perhaps even experiment with it first. And I'll state again that priorities are a tricky tool, and don't be too careless with them or you will starve out other tasks, perhaps even starving the teleop itself.

If your app's loops need to coordinate, but not be placed into the same loop, look at using the RTFIFO to send notifications/events between them. You can even use the timeout to combine a periodic and event driven response.

If you are interested in going to the next level in LV RT, I'd encourage you to look at examples based on those two concepts, RT FIFOs and Timed loops and think about how your scheduling for sensor loops and state machines is built from those. The cool thing is that rather than having one event mechanism that is interleaved, you can have as many as you like with much finer grained multitasking.

Greg McKaskle
Reply With Quote