本文整理汇总了C++中TaskManager::check_ordered_task方法的典型用法代码示例。如果您正苦于以下问题:C++ TaskManager::check_ordered_task方法的具体用法?C++ TaskManager::check_ordered_task怎么用?C++ TaskManager::check_ordered_task使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaskManager
的用法示例。
在下文中一共展示了TaskManager::check_ordered_task方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_task_fai
bool test_task_fai(TaskManager& task_manager,
const Waypoints &waypoints)
{
task_manager.set_factory(TaskBehaviour::FACTORY_FAI_GENERAL);
AbstractTaskFactory &fact = task_manager.get_factory();
const Waypoint *wp;
task_report(task_manager, "# adding start\n");
wp = waypoints.lookup_id(1);
if (wp) {
OrderedTaskPoint *tp = fact.createStart(*wp);
if (!fact.append(*tp)) {
return false;
}
delete tp;
}
task_manager.setActiveTaskPoint(0);
task_manager.resume();
task_report(task_manager, "# adding intermdiate\n");
wp = waypoints.lookup_id(2);
if (wp) {
OrderedTaskPoint *tp = fact.createIntermediate(*wp);
if (!fact.append(*tp, false)) {
return false;
}
delete tp;
}
task_report(task_manager, "# adding intermdiate\n");
wp = waypoints.lookup_id(3);
if (wp) {
OrderedTaskPoint *tp = fact.createIntermediate(*wp);
if (!fact.append(*tp,false)) {
return false;
}
delete tp;
}
task_report(task_manager, "# adding finish\n");
wp = waypoints.lookup_id(1);
if (wp) {
OrderedTaskPoint *tp = fact.createFinish(*wp);
if (!fact.append(*tp,false)) {
return false;
}
delete tp;
}
task_report(task_manager, "# checking task\n");
if (!fact.validate()) {
return false;
}
if (!task_manager.check_ordered_task()) {
return false;
}
return true;
}
示例2: test_task_or
bool test_task_or(TaskManager& task_manager,
const Waypoints &waypoints)
{
const Waypoint *wp;
task_manager.set_factory(OrderedTask::FACTORY_TOURING);
AbstractTaskFactory &fact = task_manager.get_factory();
task_report(task_manager, "# adding start\n");
wp = waypoints.lookup_id(1);
if (wp) {
if (!fact.append(fact.createStart(*wp))) {
return false;
}
}
task_manager.setActiveTaskPoint(0);
task_manager.resume();
task_report(task_manager, "# adding intermediate\n");
wp = waypoints.lookup_id(2);
if (wp) {
if (!fact.append(fact.createIntermediate(*wp))) {
return false;
}
}
task_report(task_manager, "# adding finish\n");
wp = waypoints.lookup_id(1);
if (wp) {
if (!fact.append(fact.createFinish(*wp))) {
return false;
}
}
task_report(task_manager, "# checking task..\n");
if (!fact.validate()) {
return false;
}
if (!task_manager.check_ordered_task()) {
return false;
}
return true;
}
示例3: test_task_random
bool test_task_random(TaskManager& task_manager,
const Waypoints &waypoints,
const unsigned num_points)
{
const Waypoint *wp;
OrderedTaskPoint *tp;
task_manager.set_factory(OrderedTask::FACTORY_MIXED);
AbstractTaskFactory &fact = task_manager.get_factory();
task_report(task_manager, "# adding start\n");
wp = random_waypoint(waypoints);
if (wp) {
AbstractTaskFactory::LegalPointType_t s =
fact.getStartTypes()[(rand() % fact.getStartTypes().size())];
tp = fact.createStart(s,*wp);
if (!fact.append(tp,false)) {
return false;
}
}
task_manager.setActiveTaskPoint(0);
task_manager.resume();
for (unsigned i=0; i<num_points; i++) {
task_report(task_manager, "# adding intermediate\n");
wp = random_waypoint(waypoints);
if (wp) {
AbstractTaskFactory::LegalPointType_t s =
fact.getIntermediateTypes()[(rand() % fact.getIntermediateTypes().size())];
tp = fact.createIntermediate(s,*wp);
if (!fact.append(tp,false)) {
return false;
}
}
}
task_report(task_manager, "# adding finish\n");
wp = random_waypoint(waypoints);
if (wp) {
AbstractTaskFactory::LegalPointType_t s =
fact.getFinishTypes()[(rand() % fact.getFinishTypes().size())];
tp = fact.createFinish(s,*wp);
if (!fact.append(tp,false)) {
return false;
}
}
task_report(task_manager, "# validating task..\n");
if (!fact.validate()) {
return false;
}
task_report(task_manager, "# checking task..\n");
if (!task_manager.check_ordered_task()) {
return false;
}
return true;
}
示例4: test_task_aat
bool test_task_aat(TaskManager& task_manager,
const Waypoints &waypoints)
{
const TaskProjection &projection =
task_manager.get_ordered_task().get_task_projection();
task_manager.set_factory(OrderedTask::FACTORY_AAT);
AbstractTaskFactory &fact = task_manager.get_factory();
const Waypoint *wp;
task_report(task_manager, "# adding start\n");
wp = waypoints.lookup_id(1);
if (wp) {
if (!fact.append(fact.createStart(*wp),false)) {
return false;
}
}
task_manager.setActiveTaskPoint(0);
task_manager.resume();
task_report(task_manager, "# adding intermediate\n");
wp = waypoints.lookup_id(2);
if (wp) {
OrderedTaskPoint* tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp);
if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) {
CylinderZone *cz = (CylinderZone *)tp->get_oz();
cz->setRadius(fixed(30000.0));
tp->update_oz(projection);
}
if (!fact.append(tp,false)) {
return false;
}
}
task_report(task_manager, "# adding intermediate\n");
wp = waypoints.lookup_id(3);
if (wp) {
OrderedTaskPoint* tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp);
if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) {
CylinderZone *cz = (CylinderZone *)tp->get_oz();
cz->setRadius(fixed(40000.0));
tp->update_oz(projection);
}
if (!fact.append(tp,false)) {
return false;
}
}
task_report(task_manager, "# adding finish\n");
wp = waypoints.lookup_id(1);
if (wp) {
if (!fact.append(fact.createFinish(*wp),false)) {
return false;
}
}
task_report(task_manager, "# checking task..\n");
if (!fact.validate()) {
return false;
}
if (!task_manager.check_ordered_task()) {
return false;
}
return true;
}
示例5: test_task_manip
//.........这里部分代码省略.........
return false;
}
task_report(task_manager, "# removing tp 0\n");
if (!fact.remove(0)) {
return false;
}
task_report(task_manager, "# removing tp -1 (illegal)\n");
if (fact.remove(0-1)) {
return false;
}
task_report(task_manager, "# removing tp 50 (illegal)\n");
if (fact.remove(50)) {
return false;
}
OrderedTaskPoint *tp;
const Waypoint *wp;
task_report(task_manager, "# inserting at 3\n");
wp = waypoints.lookup_id(3);
if (wp) {
tp = fact.createIntermediate(AbstractTaskFactory::AST_CYLINDER,*wp);
if (!fact.insert(tp,3)) return false;
}
task_report(task_manager, "# auto-replacing at 2 (no morph)\n");
wp = waypoints.lookup_id(9);
if (wp) {
tp = fact.createIntermediate(AbstractTaskFactory::AST_CYLINDER,*wp);
if (!fact.replace(tp,2)) return false;
}
task_report(task_manager, "# auto-replacing at 2 (morph)\n");
wp = waypoints.lookup_id(9);
if (wp) {
tp = fact.createStart(*wp);
if (!fact.replace(tp,2)) return false;
}
task_report(task_manager, "# auto-replacing at 0 (morph this)\n");
wp = waypoints.lookup_id(12);
if (wp) {
tp = fact.createIntermediate(AbstractTaskFactory::AST_CYLINDER,*wp);
if (!fact.replace(tp,0)) return false;
}
task_report(task_manager, "# auto-replacing at end (morph this)\n");
wp = waypoints.lookup_id(14);
if (wp) {
tp = fact.createIntermediate(AbstractTaskFactory::AST_CYLINDER,*wp);
if (!fact.replace(tp,task_manager.task_size()-1)) return false;
}
task_report(task_manager, "# removing finish point\n");
if (!fact.remove(task_manager.task_size()-1)) {
return false;
}
task_report(task_manager, "# inserting at 50 (equivalent to append)\n");
wp = waypoints.lookup_id(8);
if (wp) {
tp = fact.createFinish(*wp);
if (!fact.insert(tp,50)) return false;
}
task_report(task_manager, "# inserting at 0 (morph this)\n");
wp = waypoints.lookup_id(3);
if (wp) {
tp = fact.createFinish(*wp);
if (!fact.insert(tp,0)) return false;
}
task_report(task_manager, "# inserting at 2 (morph this)\n");
wp = waypoints.lookup_id(4);
if (wp) {
tp = fact.createStart(*wp);
if (!fact.insert(tp,2)) return false;
}
task_report(task_manager, "# inserting at 2 (direct)\n");
wp = waypoints.lookup_id(6);
if (wp) {
tp = fact.createIntermediate(*wp);
if (!fact.insert(tp,2,false)) return false;
}
task_report(task_manager, "# checking task\n");
if (task_manager.check_ordered_task()) {
task_manager.reset();
task_manager.setActiveTaskPoint(0);
task_manager.resume();
} else {
return false;
}
return true;
}
示例6: test_task_mixed
bool test_task_mixed(TaskManager& task_manager,
const Waypoints &waypoints)
{
const TaskProjection &projection =
task_manager.get_ordered_task().get_task_projection();
OrderedTaskPoint *tp;
const Waypoint *wp;
task_manager.set_factory(TaskBehaviour::FACTORY_MIXED);
AbstractTaskFactory &fact = task_manager.get_factory();
task_report(task_manager, "# adding start\n");
wp = waypoints.lookup_id(1);
if (wp) {
tp = fact.createStart(AbstractTaskFactory::START_LINE,*wp);
if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) {
CylinderZone *cz = (CylinderZone *)tp->get_oz();
cz->setRadius(fixed(5000.0));
tp->update_oz(projection);
}
if (!fact.append(*tp,false)) return false;
delete tp;
} else {
return false;
}
task_manager.setActiveTaskPoint(0);
task_manager.resume();
task_report(task_manager, "# adding intermdiate\n");
wp = waypoints.lookup_id(2);
if (wp) {
tp = fact.createIntermediate(AbstractTaskFactory::AST_CYLINDER,*wp);
if (!fact.append(*tp,false)) return false;
delete tp;
} else {
return false;
}
task_report(task_manager, "# adding intermdiate\n");
wp = waypoints.lookup_id(3);
if (wp) {
tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp);
if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) {
CylinderZone *cz = (CylinderZone *)tp->get_oz();
cz->setRadius(fixed(30000.0));
tp->update_oz(projection);
}
if (!fact.append(*tp,false)) return false;
delete tp;
} else {
return false;
}
task_report(task_manager, "# adding intermediate\n");
wp = waypoints.lookup_id(4);
if (wp) {
tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp);
if (!fact.append(*tp,false)) return false;
delete tp;
} else {
return false;
}
task_report(task_manager, "# adding intermediate\n");
wp = waypoints.lookup_id(5);
if (wp) {
tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp);
if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) {
CylinderZone *cz = (CylinderZone *)tp->get_oz();
cz->setRadius(fixed(30000.0));
tp->update_oz(projection);
}
if (!fact.append(*tp,false)) return false;
delete tp;
} else {
return false;
}
task_report(task_manager, "# adding finish\n");
wp = waypoints.lookup_id(1);
if (wp) {
tp = fact.createFinish(AbstractTaskFactory::FINISH_LINE,*wp);
if (!fact.append(*tp,false)) return false;
delete tp;
} else {
return false;
}
task_report(task_manager, "# checking task\n");
if (!fact.validate()) {
return false;
}
if (!task_manager.check_ordered_task()) {
return false;
}
return true;
}
示例7: test_task_type_manip
bool test_task_type_manip(TaskManager& task_manager,
const Waypoints &waypoints, unsigned n_points)
{
if (!test_task_random_RT_AAT_FAI(task_manager, waypoints, n_points))
return false;
AbstractTaskFactory &fact = task_manager.get_factory();
switch (rand() %3) {
case 0:
task_manager.set_factory(TaskBehaviour::FACTORY_AAT);
test_note("# switched FACTORY TYPE to AAT\n");
break;
case 1:
task_manager.set_factory(TaskBehaviour::FACTORY_RT);
test_note("# switched FACTORY TYPE to RT\n");
break;
case 2:
task_manager.set_factory(TaskBehaviour::FACTORY_FAI_GENERAL);
test_note("# switched FACTORY TYPE to FAI GENERAL\n");
break;
default:
test_note("# unknown task type\n");
}
fact.mutate_tps_to_task_type();
test_note("# checking mutated start..\n");
if (!fact.validStartType(
fact.getType(*task_manager.get_ordered_task().getTaskPoint(0))))
return false;
char tmp[255];
sprintf(tmp, "# checking mutated intermediates. task_size():%d..\n",
task_manager.task_size());
test_note(tmp);
for (unsigned i = 1; i < (task_manager.task_size() - 1); i++) {
sprintf(tmp, "# checking mutated intermediate point %d..\n", i);
test_note(tmp);
if (!fact.validIntermediateType(
fact.getType(*task_manager.get_ordered_task().getTaskPoint(i))))
return false;
}
test_note("# checking mutated finish..\n");
if (!fact.validFinishType(
fact.getType(*task_manager.get_ordered_task().getTaskPoint(
task_manager.task_size() - 1))))
return false;
test_note("# validating task..\n");
if (!fact.validate()) {
return false;
}
test_note("# checking task..\n");
if (!task_manager.check_ordered_task()) {
return false;
}
if (task_manager.get_ordered_task().get_factory_type() ==
TaskBehaviour::FACTORY_FAI_GENERAL) {
test_note("# checking OZs for FAI task..\n");
if (!fact.validateFAIOZs())
return false;
}
return true;
}