Exemplo n.º 1
0
	void run(void)
	{
		try
		{
			if(!getExcept()) taskMain();
		}
		catch(const std::exception &e)
		{
			QMutexLocker lock(&s_mutex);
			if(!s_bExcept)
			{
				s_bExcept = true;
				strncpy_s(s_errMsg, BUFF_SIZE, e.what(), _TRUNCATE);
			}
			lock.unlock();
			qWarning("OptionalInitTask exception error:\n%s\n\n", e.what());
		}
		catch(...)
		{
			QMutexLocker lock(&s_mutex);
			if(!s_bExcept)
			{
				s_bExcept = true;
				strncpy_s(s_errMsg, BUFF_SIZE, "Unknown exception error!", _TRUNCATE);
			}
			lock.unlock();
			qWarning("OptionalInitTask encountered an unknown exception!");
		}
	}
Exemplo n.º 2
0
// Main function of the task
int SimpleTask::Main(int a2, int a3, int a4, int a5,
			int a6, int a7, int a8, int a9, int a10)
{
	if(taskMain == NULL) {
		return(0);
	}
	
	// Let the world know we're in
	DPRINTF(LOG_DEBUG,"SimpleTask started: %s\n", taskName.c_str());
	
	// Wait for Robot go-ahead (e.g. entering Autonomous or Tele-operated mode)
	WaitForGoAhead();
	
	// Register our logger
	lHandle = Robot::getInstance();
		
  // Call the "main" function
	while(!taskMain(proxy,lHandle)) {
		WaitForNextLoop();
	}
	return (0);
};