Code:
class 4174robot : public IterativeRobot
{
public:
...(Interative Robot Overrides)...
Task *task1;
4174robot();
~4174robot();
...
};
static void TestTaskFunction(void)
{
std::cout<<"task has been started"<<endl;
}
4174robot::4174robot()
{
task1 = new Task("testtask", (VOIDFUNCPTR) TestTaskFunction);
}
4174robot::~4174robot()
{
delete task1;
}
...
4174robot::Teleopinit()
{
task1->Start();
}
...
Disabledinit()
{
task1->Stop();
}
Note that once you enabled TeleOp, it will print the line "task has been started" and the task will end.