Go to Post "The hardest part about building the robot is figuring out what to build..." - Jeff Waegelin [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 04-01-2009, 11:35
dpeterson3 dpeterson3 is offline
Registered User
FRC #1178 (DURT)
Team Role: Alumni
 
Join Date: Aug 2008
Rookie Year: 2008
Location: St. Louis
Posts: 158
dpeterson3 is a jewel in the roughdpeterson3 is a jewel in the roughdpeterson3 is a jewel in the roughdpeterson3 is a jewel in the rough
Threading on the CRIO

Is it possible to do threading on the CRIO. It is a powerPC processor, so I know the processor can handle it. I want to be able to run a targeting system along side the drive system so the bot can be ligning up shots while we are driving around. If there is no way to tell the camera to pan in a seperate thread, is there a way to simulate this behavior?
  #2   Spotlight this post!  
Unread 04-01-2009, 11:47
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,708
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: Threading on the CRIO

Labview by design will thread programs. Loops/code that are programmatically separate will automatically be launched in separate threads. That is, if there's no data flow restrictions forcing one loop or bit of code to operate after another, they'll be in separate threads.

The Windriver environment also supports threading via the Task class released in the latest update from WPI.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
  #3   Spotlight this post!  
Unread 04-01-2009, 11:51
nathanww nathanww is offline
Hacker
FRC #1678 (Citrus Circuits)
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2007
Location: Davis, CA
Posts: 224
nathanww is just really nicenathanww is just really nicenathanww is just really nicenathanww is just really nice
Re: Threading on the CRIO

Are you using labview or C++? As I understand, the "dataflow execution" model in labview means that to do multithreading you just make two dataflow things and don't connect them. In c++, it's a bit more complicated, but I think the "programming user's guide" has some stuff on how to do it.


For what you're talking about, however, you don't even really need to use all the fancy multithreading features. Instead, you can just set up a loop in your program like:


1.Get data from DS
2.Make whatever calculations you need for traction control, etc
3.Set your speed controllers
4.Get and analyze data from the camera
5.Set your panning servos
6.Repeat
__________________
Get yer robot source code here!
  #4   Spotlight this post!  
Unread 04-01-2009, 11:58
dpeterson3 dpeterson3 is offline
Registered User
FRC #1178 (DURT)
Team Role: Alumni
 
Join Date: Aug 2008
Rookie Year: 2008
Location: St. Louis
Posts: 158
dpeterson3 is a jewel in the roughdpeterson3 is a jewel in the roughdpeterson3 is a jewel in the roughdpeterson3 is a jewel in the rough
Re: Threading on the CRIO

Cool. I know we couldn't do this in years past. I just want to be sure we don't drag down the processor with image processing while trying to drive. I want responsive driver controls while the bot helps us get lined up for shots. I think it could really improve accuracy.
  #5   Spotlight this post!  
Unread 04-01-2009, 17:56
wireties's Avatar
wireties wireties is offline
Principal Engineer
AKA: Keith Buchanan
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Rockwall, TX
Posts: 1,170
wireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond repute
Send a message via AIM to wireties
Re: Threading on the CRIO

The operating system running on the cRIO (Wind Rivers VxWorks) is multi-threaded and does pre-emptive priority-based scheduling. You can do exactly what you want. You can start as many threads as you want (till you run out of memory).

VxWorks supports something like processes in Linux (called RTPs in VxWorks) and something like threads in Linux (called tasks in VxWorks). There is a kernel context and any number of RTPs running at one time. Each RTP or the kernel can have any number of tasks running. The operation system schedules tasks, not RTPs (also like Linux).

But looking at the default code I see no evidence that RTPs are being used. It looks like everything is being run in multiple tasks in the kernel context. It is possible the kernels that WPI and NI have built for us do not have support for RTPs included (but they could have been).


HTH
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shipping the CRio Tottanka FRC Control System 7 10-02-2009 12:20
how to transfer the program to the crio? beefy1 Programming 5 04-01-2009 10:04
24v Power Conector to from the PDB to the cRIO mcf747 Electrical 14 01-12-2008 19:19
Threading tool not working.... strange? q_prof Inventor 3 20-02-2006 00:14
Muti-threading Ryan M. Programming 19 26-04-2004 09:10


All times are GMT -5. The time now is 03:11.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi