int main(int argc, char** argv) { /* Check number of parameters. */ if (argc != 4) usage(argv[0]); /* Read the grid from the input file. */ readInputFile(argv[1]); /* Read the solution file generated by the Prolog run. */ readPrologFile(argv[2]); /* Write the query file. */ writeOutputFile(argv[3]); return 0; }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void WriteStatsGenOdfAngleFile::execute() { int err = 0; setErrorCondition(err); dataCheck(); if(getErrorCondition() < 0) { return; } // Figure out how many unique phase values we have by looping over all the phase values int64_t totalPoints = m_CellPhasesPtr.lock()->getNumberOfTuples(); std::set<int32_t> uniquePhases; for (int64_t i = 0; i < totalPoints; i++) { uniquePhases.insert(m_CellPhases[i]); } uniquePhases.erase(0); // remove Phase 0 as this is a Special Phase for DREAM3D std::vector<QFile*> oFiles; QFileInfo fi(getOutputFile()); QString absPath = fi.absolutePath(); QString fname = fi.completeBaseName(); QString suffix = fi.suffix(); for (std::set<int32_t>::iterator iter = uniquePhases.begin(); iter != uniquePhases.end(); iter++) { /* Let the GUI know we are done with this filter */ QString ss = QObject::tr("Writing file for phase '%1'").arg(*iter); notifyStatusMessage(getHumanLabel(), ss); QString absFilePath = absPath + "/" + fname + "_Phase_" + QString::number(*iter) + "." + suffix; QFile file(absFilePath); if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { setErrorCondition(-99000); QString ss = QObject::tr("Error creating output file '%1'").arg(absFilePath); notifyErrorMessage(getHumanLabel(), ss, getErrorCondition()); return; } QTextStream out(&file); // Dry run to figure out how many lines we are going to have int32_t lineCount = determineOutputLineCount(totalPoints, *iter); int err = writeOutputFile(out, lineCount, totalPoints, *iter); if (err < 0) { setErrorCondition(-99001); QString ss = QObject::tr("Error writing output file '%1'").arg(absFilePath); notifyErrorMessage(getHumanLabel(), ss, getErrorCondition()); return; } out.flush(); file.close(); // Close the file } /* Let the GUI know we are done with this filter */ notifyStatusMessage(getHumanLabel(), "Complete"); }
void TaskManager::actionlib_callback(const apc_bt_comms::ManagerGoalConstPtr &goal) { ROS_INFO("BT Task Manager got a request!"); sleep(0.1); if (goal->success) { if (task_ == "pick") { ROS_INFO("Will mark bin as solved!"); if (markAsSolved(current_bin_)) { nh_.setParam("/apc/task_manager/running", false); } } else { ROS_INFO("Will mark object as solved!"); if (markAsSolved(current_object_)) { nh_.setParam("/apc/task_manager/running", false); } } } else { if (goal->pop) { if (task_ == "pick") { if (!current_bin_.empty()) { ROS_INFO("Current bin is not empty! Will mark as impossible"); markAsImpossible(current_bin_); current_bin_.clear(); current_object_.clear(); } ROS_INFO("Will pop next mission bin!"); current_bin_ = getNextInMission(); current_object_ = getOrderForBin(current_bin_); current_arm_ = selectArm(current_object_, current_bin_); } else { if (!current_object_.empty()) { ROS_INFO("Current object is not empty! Will mark as impossible"); markAsImpossible(current_object_); current_bin_.clear(); current_object_.clear(); } ROS_INFO("Will pop next mission object!"); current_object_ = getNextInMission(); current_arm_ = selectArm(current_object_, current_bin_); current_bin_ = getBinWithFewerItems(current_arm_); } } else { if (task_ == "stow") // Failed to place an object { setParam("/apc/task_manager/place_failure", true); current_bin_ = getOtherBin(); } } } setSystemTarget(); writeOutputFile(); result_.result = true; action_server_.setSucceeded(result_); }