View Single Post
  #1   Spotlight this post!  
Unread 07-02-2012, 19:33
agartner01 agartner01 is offline
Captain + Control Sys & Design
FRC #4174
Team Role: Engineer
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Hector MN
Posts: 109
agartner01 is an unknown quantity at this point
How to use tasks

I read the task section in the WPILib manual and the class help file, but when I'm having difficulty getting anything working. The example I'm giving has everything extra cut out. (spelling and code punctuation might not be right)

Code:
class 4174robot : public InterativeRobot
{
public:
4174robot();
...(Interative Robot Overrides)...
void TestTaskFunction();
...
private:
Task *task1;
...
};
4174robot:4174robot()
{
task1 = new Task("testtask", (VOIDFUNCPTR) TestTaskFunction();
}
...
4174robot:Teleopinit
{
task1->start;
}
...
4174robot:Disabledinit
{
task1->stop;
}
...
4174robot:TestTaskFunction()
{
std::cout<<"task has been started"<<endl;
}
It complies fine (sometimes), but as I watch it on the WTX console, it just says something along the lines of "task failed." whey I start teleop.

Last edited by agartner01 : 07-02-2012 at 20:13.
Reply With Quote