task main()
{
	initializeRobot();
	setupPlans();

	waitForStart(); // Wait for the beginning of autonomous phase.

	resetTracker();
	StartTask(trackRobot);

	executePlan(&planA);
}
Example #2
0
bool checkPlan (const std::string& domain_file, const std::string& problem_file, std::stringstream& plan)
{
	try
	{
		current_analysis = &an_analysis;
		//an_analysis.const_tab.symbol_put(""); //for events - undefined symbol
		Silent = false;
		errorCount = 0;
		Verbose = false;
		ContinueAnyway = false;
		ErrorReport = false;
		InvariantWarnings = false;
		makespanDefault = false;
		bool CheckDPs = true;
		bool giveAdvice = true;

		double tolerance = 0.01;
		bool lengthDefault = true;

		string s;

		std::ifstream domainFile (domain_file.c_str());
		if (!domainFile)
		{
			std::cerr << "Bad domain file!\n";
			exit (1);
		};

		yfl = new yyFlexLexer (&domainFile, &cout);

		yydebug = 0;
		yyparse();
		delete yfl;

		if (!an_analysis.the_domain)
		{
			std::cerr << "Problem in domain definition!\n";
			exit (1);
		};

		TypeChecker tc (current_analysis);

		bool typesOK = tc.typecheckDomain();

		if (!typesOK)
		{
			std::cerr << "Type problem in domain description!\n";
			exit (1);
		};

		std::ifstream problemFile (problem_file.c_str());
		if (!problemFile)
		{
			std::cerr << "Bad problem file!\n";
			exit (1);
		};

		yfl = new yyFlexLexer (&problemFile, &cout);
		yyparse();
		delete yfl;

		if (!tc.typecheckProblem())
		{
			std::cerr << "Type problem in problem specification!\n";
			exit (1);
		};

		const DerivationRules * derivRules = new DerivationRules (an_analysis.the_domain->drvs, an_analysis.the_domain->ops);

		if (CheckDPs && !derivRules->checkDerivedPredicates())
		{
			exit (1);
		};

		executePlan (plan, tc, derivRules, tolerance, lengthDefault, giveAdvice);


		delete derivRules;

	}
	catch (exception & e)
	{
		std::cerr << "Error: " << e.what() << "\n";
		an_analysis.error_list.report();
		return 2;
	};

	return errorCount == 0;
};