Go to Post All the same lessons that can be learned or taught with custom drive trains can also be learned or taught with custom manipulators and scoring mechanisms, and the latter is far more likely to set your team apart in the competition. - Jared Russell [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Spotlight this post!  
Unread 01-02-2009, 15:47
Chief Pride's Avatar
Chief Pride Chief Pride is offline
<3
AKA: James Kiefer
no team
 
Join Date: Sep 2007
Rookie Year: 2007
Location: Kalamazoo, MI
Posts: 653
Chief Pride has a reputation beyond reputeChief Pride has a reputation beyond reputeChief Pride has a reputation beyond reputeChief Pride has a reputation beyond reputeChief Pride has a reputation beyond reputeChief Pride has a reputation beyond reputeChief Pride has a reputation beyond reputeChief Pride has a reputation beyond reputeChief Pride has a reputation beyond reputeChief Pride has a reputation beyond reputeChief Pride has a reputation beyond repute
Re: Threading

I'm having difficulty getting the small code sample to compile, Shinigami. Hopefully, you or someone else could lend a hand?

Here is what I currently have:
Code:
#include "WPILib.h"

/** TODO: Change this message.
 * This is a demo program showing the use of the RobotBase class.
 * The SimpleRobot class is the base of a robot application that will automatically call your
 * Autonomous and OperatorControl methods at the right time as controlled by the switches on
 * the driver station or the field controls.
 */ 
class Robot : public SimpleRobot
{
	RobotDrive myRobot; 	// robot drive system
	Task CameraThread; 
	

public:
	Robot(void):		// these must be initialized in the same order 
		myRobot(1, 2),	// as they are declared above.
		CameraThread("camera_thread", imageProcessThread())
	{
		GetWatchdog().SetExpiration(0.1);
	}

	/** 
	 * Drive left & right motors for 2 seconds then stop
	 */
	void Autonomous(void)
	{
		GetWatchdog().SetEnabled(false);
		myRobot.Drive(0.5, 0.0); 	// drive forwards half speed
		Wait(2.0); 					// for 2 seconds
		myRobot.Drive(0.0, 0.0); 	// stop robot
	}

	void OperatorControl(void)
	{
		GetWatchdog().SetEnabled(true);
		while (IsOperatorControl())
		{
			GetWatchdog().Feed();	//woof.
		}
	}
	
	int imageProcessThread(...)
	{
	   // do stuff...
		return 1;
	}
};

START_ROBOT_CLASS(SimpleRobot);
Thanks.
Reply With Quote
 


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
Threading on the CRIO dpeterson3 Programming 4 04-01-2009 17:56
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 17:52.

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