Thread: Threading
View Single Post
  #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