int main (int argc, char** argv) { // Initialize ROS ros::init (argc, argv, "dhri_multipleObjectTracking"); ros::NodeHandle n; // read parameters if(!readParameters()) return 0; tf_listener = new tf::TransformListener(ros::Duration(5000)); // publishers pub_filtered = n.advertise<pcl::PCLPointCloud2>(param_pub_points_filtered.data(), 1000); pub_segmented = n.advertise<pcl::PCLPointCloud2>(param_pub_points_segmented.data(), 1000); pub_track = n.advertise<pcl::PCLPointCloud2>(param_pub_points_trackID.data(), 1000); pub_objectmodel = n.advertise<pcl::PCLPointCloud2>(param_pub_points_objectmodel.data(), 1000); pub_trackID = n.advertise<visualization_msgs::MarkerArray>(param_pub_markers_trackID.data(), 1000); pub_gaussians = n.advertise<visualization_msgs::MarkerArray>(param_pub_markers_gaussians.data(), 1000); pub_workspace = n.advertise<nav_msgs::GridCells> (param_workspace_topic, 1000); pub_lastmodel = n.advertise<sensor_msgs::PointCloud2>("models", 1000); pub_particles = n.advertise<sensor_msgs::PointCloud2>("particles", 1000); pctracking = new PCTracking(isdebug, param_frame_id, &pub_scene, &pub_model, 3, cont_sampling, cont_simplify, param_segmentTolerance); tf_listener->waitForTransform(param_frame_id.data(), "/camera_rgb_frame", ros::Time::now(), ros::Duration(5.0)); ros::Subscriber sub_id = n.subscribe(param_sub_topic.data(), param_buffernum, cb_rgb); ros::spin(); delete pctracking; return 0; }
//#define EXTREME_LOGGING //#define EXTREME_LOGGING_PLUS //---------------------------------------------------------------------------------- Simulation::Simulation(const OptionsFile& optionsFile, const SimulationFile& simulationFile) : mpFunctions(FunctionsSingleton::instance()), mOptionsFileParameters(optionsFile.getOptionsFileParameters()) { simulationFile.coutAll(); readParameters(simulationFile.getParameters()); const unsigned int popSize = mPop.size(); switch (simulationFile.getReproductionMode()) { case enumReproductionModeFraction: for (unsigned int i=0; i<popSize; ++i) { mPop[i] = new SoilMiteFraction("INIT"); assert(mPop[i]!=NULL); } break; case enumReproductionModeAmount: for (unsigned int i=0; i<popSize; ++i) { mPop[i] = new SoilMiteAmount("INIT"); assert(mPop[i]!=NULL); } break; default: assert(!"Unknown value of: simulationFile.getReproductionMode()"); } }
int main(int argc, char *argv[]) { #if QT_VERSION < 0x050000 QTextCodec::setCodecForTr(TApplication::codec()); QTextCodec::setCodecForCStrings(TApplication::codec()); #endif QTextCodec::setCodecForLocale(TApplication::codec()); int lResult = 0; // по умолчанию программа возвращает 0 bool lStart = true; // по умолчанию программа запускается if (argc > 1) // были заданы какие-то аргументы lStart = readParameters(argc, argv); // прочитаем их if (lStart) { TApplication application(argc, argv); QStringList paths = application.libraryPaths(); application.setLibraryPaths(paths); application.debug(application.debugMode(), "\n"); application.debug(application.debugMode(), "Program startup."); if (application.open()) { // Если приложение удалось создать application.show(); // Откроем приложение lResult = application.exec(); } application.debug(application.debugMode(), "Program shutdown.\n"); application.close(); // Закроем приложение application.quit(); } return lResult; }
bool PreprocessorVisitor::expandMacro(std::string& input, PreprocessorSymbol* const symbol) const { if (symbol == 0) return false; const std::string& name = symbol->getID(); bool expanded = false; for (size_t pos = input.find(name, 0), lastPos = 0; pos != std::string::npos; pos = input.find(name, lastPos)) { std::string body = symbol->getBody()->toString(terminals_); expanded = true; lastPos = pos + name.size(); if (symbol->isFunction()) { const std::vector<std::string>& formals = symbol->getFormals(); std::vector<std::string> parameters = readParameters(input, lastPos); if (symbol->getNumFormals() == parameters.size()) { for (size_t i = 0; i < parameters.size(); ++i) body = replace(body, formals[i], parameters[i]); } std::string macroInvocation = input.substr(pos, lastPos - pos); input = replace(input, macroInvocation, body); } else { std::string macroInvocation = input.substr(pos, lastPos - pos); input = replace(input, macroInvocation, body); break; } } return expanded; }
executeIfPythonFunctionObject::executeIfPythonFunctionObject ( const word& name, const Time& t, const dictionary& dict ) : conditionalFunctionObjectListProxy( name, t, dict ), pythonInterpreterWrapper( t.db(), dict ) { if(!parallelNoRun()) { initEnvironment(t); setRunTime(t); } readParameters(dict); }
static IntegralArea* prepareParameters(const SeparationFlags* sf, AstronomyParameters* ap, BackgroundParameters* bgp, Streams* streams) { IntegralArea* ias; ias = setupSeparation(ap, bgp, streams, sf); /* Try the new file first. If that doesn't work, try the old one. */ if (!ias) { mw_printf("Error reading astronomy parameters from file '%s'\n" " Trying old parameters file\n", sf->ap_file); ias = readParameters(sf->ap_file, ap, bgp, streams); } if (!ias) { mw_printf("Failed to read parameters file\n"); return NULL; } if (sf->numArgs && setParameters(ap, bgp, streams, sf->numArgs, sf->nForwardedArgs)) { mwFreeA(ias); freeStreams(streams); return NULL; } return ias; }
StorePuckServer::StorePuckServer(ros::NodeHandle nh) : Server(nh, "Store Puck"), server_(nh, "store_puck", boost::bind(&StorePuckServer::executeCallback, this, _1), false), align_client_("align", true) { readParameters(); digital_readings_sub_ = nh_.subscribe("digital_readings", 1, &StorePuckServer::digitalReadingsCallback, this); distance_sensors_sub_ = nh_.subscribe("distance_sensors", 1, &StorePuckServer::distanceSensorsCallback, this); laser_scan_sub_ = nh_.subscribe("scan", 10, &StorePuckServer::laserScanCallback, this); find_areas_cli_ = nh_.serviceClient<robotino_vision::FindInsulatingTapeAreas>("find_areas"); state_ = store_puck_states::UNINITIALIZED; percentage_ = 0; loaded_ = false; flag_aux_ = false; left_index_ = 0; right_index_ = 0; lateral_ = false; laser_front_ = 0.0; laser_right_ = 0.0; laser_left_ = 0.0; phi_fut_ = 0.0; }
/** \brief Main entry point */ int main(int argc, char **argv) { // Override SIGINT handler ros::init(argc, argv, "stereo_odometry"); ros::start(); // Objects odom::Tracker tracker; // Read parameters odom::Tracker::Params tracker_params; readParameters(tracker_params); // Set the parameters for every object tracker.setParams(tracker_params); // Launch threads boost::thread trackingThread(&odom::Tracker::run, &tracker); // ROS spin ros::Rate r(10); while (ros::ok()) { r.sleep(); } ros::shutdown(); return 0; }
MyFracWindow::MyFracWindow() : KDockMainWindow(NULL, "mainwnd", WType_TopLevel), _posValid(false), _juliaMode(false), _maxIter(0.5), _threshold(0.5), _gradientData(NULL), _scrollTimer(NULL), _scrollDir(0), _generator(this, false), _progressDialog(NULL) { KImageIO::registerFormats(); generatorThread.start(QThread::LowPriority); createWidgets(); createActions(); createGUI(); _presets.loadPresets(kapp->config()); readParameters(); onDefaultView(); updateMode(); _scrollTimer = new QTimer(this); connect(_scrollTimer, SIGNAL(timeout()), SLOT(scrollTimer())); resize(700, 520); setAutoSaveSettings(); readDockConfig(); }
void init(const QString& desktopFileName) { delete mDesktopFile; mDesktopFile=new KDesktopFile(desktopFileName); mUrl.setPath(desktopFileName); QStringList parameterNameList = readParameterNameList(desktopFileName); readParameters(parameterNameList); }
void setupParametersFromFile(std::string path) { FILE * pFile = fopen( path.c_str(), "r"); if (pFile == NULL) perror ("Error opening file"); else readParameters(pFile); fclose(pFile); }
ImageToGridmapDemo::ImageToGridmapDemo(ros::NodeHandle& nodeHandle) : nodeHandle_(nodeHandle), map_(grid_map::GridMap({"elevation"})), mapInitialized_(false) { readParameters(); map_.setBasicLayers({"elevation"}); imageSubscriber_ = nodeHandle_.subscribe(imageTopic_, 1, &ImageToGridmapDemo::imageCallback, this); gridMapPublisher_ = nodeHandle_.advertise<grid_map_msgs::GridMap>("grid_map", 1, true); }
setDeltaTWithPythonFunctionObject::setDeltaTWithPythonFunctionObject ( const word &name, const Time& t, const dictionary& dict ) : timeManipulationWithPythonFunctionObject(name,t,dict) { readParameters(dict); }
// =================================================== // Methods // =================================================== void BCInterfaceData::readBC( const std::string& fileName, const std::string& dataSection, const std::string& name ) { GetPot dataFile( fileName ); // Read base readBase( dataFile, dataSection + name + "/", M_base, M_baseString ); // Read parameters readParameters( dataFile, ( dataSection + name + "/parameters" ).c_str() ); }
/* * Read parameter block, including begin and end. */ void McSimulation::readParam(std::istream& in) { if (isRestarting_) { if (isInitialized_) { return; } } readBegin(in, className().c_str()); readParameters(in); readEnd(in); }
int main(int argc, char *argv[]){ double *collideField = NULL; double *streamField = NULL; int *flagField = NULL; int xlength = 0; double tau = 0.0; double velocityWall[3] = {0}; int timesteps = 0; int timestepsPerPlotting = 0; int t = 0; int readParamError = 0; const char *szProblem = "data_CFD_Assignment_02"; readParamError = readParameters(&xlength, &tau, velocityWall, ×teps, ×tepsPerPlotting, argc, argv); if(readParamError != 0) { printf("Please provide only one argument to the program; the path to the input file."); return -1; } /* Initialize pointers according to the D3Q19 discretization scheme */ collideField = malloc(19*(xlength+2)*(xlength+2)*(xlength+2)*sizeof(*collideField)); streamField = malloc(19*(xlength+2)*(xlength+2)*(xlength+2)*sizeof(*streamField)); flagField = malloc((xlength+2)*(xlength+2)*(xlength+2)*sizeof(*flagField)); initialiseFields(collideField, streamField, flagField, xlength); for(t = 0; t < timesteps; t++) { double *swap = NULL; doStreaming(collideField, streamField, flagField, xlength); swap = collideField; collideField = streamField; streamField = swap; doCollision(collideField, flagField, &tau, xlength); treatBoundary(collideField, flagField, velocityWall, xlength); if (t % timestepsPerPlotting == 0) { writeVtkOutput(collideField, flagField, szProblem, t, xlength); } } /* Free heap memory */ free(collideField); free(streamField); free(flagField); return 0; }
/*bool PolicyImprovementLoop::initializeAndRunTaskByName(ros::NodeHandle& node_handle, std::string& task_name) { // load the task boost::shared_ptr<Task> task; ROS_INFO("abans de getTaskByName"); ROS_VERIFY(task_manager_.getTaskByName(task_name, task)); // initialize the PI loop ROS_INFO("abans inicialitzar PI loop"); ROS_VERIFY(initialize(node_handle, task)); int first_trial, last_trial; // first_trial defaults to 1: node_handle.param("first_trial", first_trial, 1); //ROS_VERIFY(usc_utilities::read(node_handle, std::string("first_trial"), first_trial)); ROS_INFO("abans llegir last trial"); ROS_VERIFY(usc_utilities::read(node_handle, std::string("last_trial"), last_trial)); ROS_INFO("abans de començar cicles de runSingleIterations"); for (int i=first_trial; i<=last_trial; ++i) { ROS_VERIFY(runSingleIteration(i)); ros::spinOnce(); } return true; }*/ bool PolicyImprovementLoop::first_init(ros::NodeHandle& node_handle)//, DMPWaypointTask::DMPWaypointTask& task) { node_handle_ = node_handle; ROS_INFO("abans de llegir parametres"); ROS_VERIFY(readParameters()); //task_.dmp_controller_ //task_.dmp_controller_ = dmp_controller; //task_ = task; //assert(Utilities<DMPWaypointTask::DMPWaypointTask>::assign(task_, task)); return task_.first_init(node_handle_); }
GridMapVisualization::GridMapVisualization(ros::NodeHandle& nodeHandle) : nodeHandle_(nodeHandle), mapRegionVisualization_(nodeHandle), pointCloudVisualization_(nodeHandle), vectorVisualization_(nodeHandle), occupancyGridVisualization_(nodeHandle) { ROS_INFO("Grid map visualization node started."); readParameters(); mapSubscriber_ = nodeHandle_.subscribe(mapTopic_, 1, &GridMapVisualization::callback, this); initialize(); }
bool pcl::io::LZFImageReader::readParameters (const std::string &filename) { std::filebuf fb; std::filebuf *f = fb.open (filename.c_str (), std::ios::in); if (f == NULL) return (false); std::istream is (&fb); bool res = readParameters (is); fb.close (); return (res); }
ReadPuckServer::ReadPuckServer(ros::NodeHandle nh) : Server(nh, "Read Puck"), server_(nh, "read_puck", boost::bind(&ReadPuckServer::executeCallback, this, _1), false), align_client_("align", true) { readParameters(); find_objects_cli_ = nh_.serviceClient<robotino_vision::FindObjects>("find_objects"); state_ = read_puck_states::UNINITIALIZED; percentage_ = 0; verify_markers_ = false; }
GridMapVisualization::GridMapVisualization(ros::NodeHandle& nodeHandle, const std::string& parameterName) : nodeHandle_(nodeHandle), visualizationsParameter_(parameterName), factory_(nodeHandle_), isSubscribed_(false) { ROS_INFO("Grid map visualization node started."); readParameters(); activityCheckTimer_ = nodeHandle_.createTimer(activityCheckDuration_, &GridMapVisualization::updateSubscriptionCallback, this); initialize(); }
GrabPuckServer::GrabPuckServer(ros::NodeHandle nh) : Server(nh, "Grab Puck"), server_(nh, "grab_puck", boost::bind(&GrabPuckServer::executeCallback, this, _1), false) { readParameters(); digital_readings_sub_ = nh_.subscribe("digital_readings", 1, &GrabPuckServer::digitalReadingsCallback, this); find_objects_cli_ = nh_.serviceClient<robotino_vision::FindObjects>("find_objects"); state_ = grab_puck_states::UNINITIALIZED; percentage_ = 0; loaded_ = false; loaded_ramp_ = false; loaded_delay_ = ros::Time::now(); }
int main(){ cout <<"****************************** READING INPUTS *****************************"<<endl; readParameters(); readRouteChoiceModel(); cout <<readStops()<<"\t Stops"<<endl; cout <<readTransfers()<<"\t Transfers"<<endl; cout <<readRoutes()<<"\t Routes"<<endl; cout <<readTrips()<<"\t Trips"<<endl; cout <<readStopTimes()<<"\t Stop Times"<<endl; cout <<defineTransferStops()<<"\t Transfer Stops"<<endl; cout <<readTAZs()<<"\t TAZs"<<endl; cout <<readAccessLinks()<<"\t Access Links"<<endl; cout <<readPassengers()<<"\t Passengers"<<endl; passengerAssignment(); return 0; }
ElevationChangeDetection::ElevationChangeDetection(ros::NodeHandle& nodeHandle) : nodeHandle_(nodeHandle), layer_("elevation") { ROS_INFO("Elevation change detection node started."); readParameters(); submapClient_ = nodeHandle_.serviceClient<grid_map_msgs::GetGridMap>(submapServiceName_); elevationChangePublisher_ = nodeHandle_.advertise<grid_map_msgs::GridMap>("elevation_change_map", 1, true); groundTruthPublisher_ = nodeHandle_.advertise<grid_map_msgs::GridMap>("ground_truth_map", 1, true); updateTimer_ = nodeHandle_.createTimer(updateDuration_, &ElevationChangeDetection::updateTimerCallback, this); requestedMapTypes_.push_back(layer_); }
//When loading, increase degree if number of parameters exceed qlen bool Algebraic::readImplicit(std::ifstream &file,bool verbose) { std::vector<double> params; readParameters(file,params); if(params.size() != qlen()) { //params doesn't match qlen, change degree int newdegree = 0; while (Algebraic::coefficients(newdegree) < (int)params.size()) newdegree++; degree(newdegree); } setq(params); return true; }
bool CHOMP::initialize(ros::NodeHandle& node_handle, boost::shared_ptr<Task> task) { node_handle_ = node_handle; ROS_VERIFY(readParameters()); task_ = task; task_->getPolicy(policy_); policy_->getNumTimeSteps(num_time_steps_); control_cost_weight_ = task_->getControlCostWeight(); policy_->getNumDimensions(num_dimensions_); policy_->getControlCosts(control_costs_); policy_->getInvControlCosts(inv_control_costs_); policy_->getParameters(parameters_); update_.resize(num_dimensions_, Eigen::VectorXd(num_time_steps_)); noiseless_rollout_.noise_.resize(num_time_steps_, Eigen::VectorXd::Zero(num_time_steps_)); noiseless_rollout_.control_costs_.resize(num_time_steps_, Eigen::VectorXd::Zero(num_time_steps_)); return true; }
int main(int argc, char *argv[]) { unsigned int size, p1, p2; // obtain user inputs readParameters(size, p1, p2); // create board of selected size HexGame game(size); // register players registerPlayers(game, p1, p2); // seed random generator and start play srand(time(0)); game.Play(HEXBLUE); }
writeAndEndPythonFunctionObject::writeAndEndPythonFunctionObject ( const word &name, const Time& t, const dictionary& dict ) : writeAndEndFunctionObject(name,t,dict), pythonInterpreterWrapper( t.db(), dict ) { if(!parallelNoRun()) { initEnvironment(t); setRunTime(t); } readParameters(dict); }
Profile::Profile() { startInst = 0; stopInst = 0; currTaskID = 0; currTime = 0; maxCurrTime = 0; lastRecInst = 0; started = false; //push the first thread into spawns SpawnInfo sInfo; sInfo.taskID = 0; sInfo.instPos= 0; sInfo.vTime = 0; spawns.push_front(sInfo); readParameters(osSim->getProfSectionName()); subscribe(); }
int main(int argc, char **argv) { tagBITMAPFILEHEADER BITMAPFILEHEADER; tagBITMAPINFOHEADER BITMAPINFOHEADER; matrix image; char source_file_name[100]; parameters inputParameters; bool dontStopMeNow = true;//flag for help calling or incorrect parameters initParameters(inputParameters); readParameters(argc, argv, inputParameters, source_file_name[0], dontStopMeNow); //function: sort parameters by queue --> user can combine it as he want if (dontStopMeNow) { readBMP(BITMAPFILEHEADER, BITMAPINFOHEADER, image, source_file_name[0]); runFilters(inputParameters, BITMAPFILEHEADER, BITMAPINFOHEADER, image); writeBMP(BITMAPFILEHEADER, BITMAPINFOHEADER, image); } }