コード例 #1
0
ファイル: ResourceFinderTest.cpp プロジェクト: apaikan/yarp
    void testGetHomeDirsForWriting()
    {
        ConstString slash = Network::getDirectorySeparator();
        report(0,"test get 'home' dirs for writing");
        setUpTestArea(false);

        {
            ResourceFinder rf;
            const char *fname1 = "_yarp_regression_test_rf1.txt";
            rf.setDefaultContext("my_app");
            rf.setDefaultConfigFile(fname1); // should be in pwd
            rf.configure(0,NULL);

            char buf[1000];
            char *result = getcwd(buf,sizeof(buf));
            checkEqual(rf.getHomeContextPath(),result,"cwd found as context directory for writing");
            checkEqual(rf.getHomeRobotPath(),result,"cwd found as robot directory for writing");
        }

        {
            ResourceFinder rf;
            rf.setDefaultContext("my_app");
            rf.setDefaultConfigFile("my_app.ini");
            rf.configure(0,NULL);

            bool found;
            ConstString robot = NetworkBase::getEnvironment("YARP_ROBOT_NAME",
                                                            &found);
            if (!found) robot = "default";
            checkEqual(rf.getHomeContextPath(),ResourceFinder::getDataHome() + slash + "contexts" + slash + "my_app","$YARP_DATA_HOME/contexts/my_app found as directory for writing");
            checkEqual(rf.getHomeRobotPath(),ResourceFinder::getDataHome() + slash + "robots" + slash + robot,"$YARP_DATA_HOME/robots/dummyRobot found as directory for writing");

        }
        breakDownTestArea();
    }
コード例 #2
0
ファイル: ResourceFinderTest.cpp プロジェクト: apaikan/yarp
    void testContextVer2() {
        report(0,"test context version 2");
        setUpTestArea(false);

        {
            ResourceFinder rf;
            rf.setDefaultContext("my_app");
            Property p;
            bool ok = rf.readConfig(p,"my_app.ini",
                                    ResourceFinderOptions::findFirstMatch());
            checkTrue(ok,"read a my_app.ini");
            checkEqual(p.find("magic_number").asInt(),1000,"right version found");
        }

        {
            ResourceFinder rf;
            rf.setDefaultContext("my_app");
            rf.setDefaultConfigFile("my_app.ini");
            rf.configure(0,NULL);
            checkEqual(rf.find("magic_number").asInt(),1000,"my_app.ini found as default config file");
        }

        {
            ResourceFinder rf;
            rf.setDefaultContext("shadowtest");
            rf.setDefaultConfigFile("shadow.ini");
            rf.configure(0,NULL);
            checkEqual(rf.find("magic_number").asInt(),5001,"shadow.ini found as correct location");
        }

        {
            ResourceFinder rf;
            rf.setDefaultContext("shadowtest");
            rf.setDefaultConfigFile("noshadow.ini");
            rf.configure(0,NULL);
            checkEqual(rf.find("magic_number").asInt(),5002,"noshadow.ini found as correct location");
        }

        {
            ResourceFinder rf;
            rf.setDefaultContext("shadowtest");
            rf.setDefaultConfigFile("noshadow.ini");
            rf.configure(0,NULL);
            checkEqual(rf.find("magic_number").asInt(),5002,"noshadow.ini found as correct location");
            Property p;
            ResourceFinderOptions opts;
            checkTrue(rf.readConfig(p,"shadow.ini",opts),"found shadow.ini");
            checkEqual(p.find("magic_number").asInt(),5001,"shadow.ini found as correct location");
        }

        breakDownTestArea();
    }
コード例 #3
0
int main(int argc, char *argv[]) {
    using yarp::os::Network;
    using yarp::os::ResourceFinder;
    using iCub::interactionForces::FingerForceModule;

    // Initialise device driver list
    YARP_REGISTER_DEVICES(icubmod);

    // Open network
    Network yarp;
    if (!yarp.checkNetwork()) {
         fprintf(stdout, "Error: yarp server is not available.\n");
         return -1;
    }     

    // Using modules
    FingerForceModule mod;

    // Create resource finder
    ResourceFinder rf;
    rf.setVerbose();
    rf.setDefaultConfigFile("confFingertipsRight.ini");
    rf.setDefaultContext("fingerForce");
    rf.configure("ICUB_ROOT", argc, argv);

    // Configure and run module
    mod.configure(rf);
    mod.runModule();

    return 0;
}
コード例 #4
0
int main(int argc, char *argv[])
{
    /* 
     * create a specific Network object, rather than using Network::init().
     * this way, automatic cleanup by the means of Network::fini() will be smoother
     */

    Network network;

    AttentionNetworkTest attentionNetworkTestModule;	// instantiate module
 
    /* prepare and configure the resource finder */

    ResourceFinder rf;
    rf.setVerbose(true);
    rf.setDefaultConfigFile("attentionNetworkTest.ini");       //overridden by --from parameter
    rf.setDefaultContext("attentionNetworkTest/conf");         //overridden by --context parameter
    rf.configure("ICUB_ROOT", argc, argv);

    /* run the module: runModule() calls configure first and, if successful, it then runs */

    attentionNetworkTestModule.runModule(rf);

    return 0;
}
コード例 #5
0
//********************************************
int main(int argc, char * argv[])
{
    Network yarp;

    ResourceFinder rf;
    rf.setVerbose(false);
    rf.setDefaultContext("periPersonalSpace");
    rf.setDefaultConfigFile("ppsAggregEventsForiCubGui.ini");
    rf.configure(argc,argv);
   
    if (rf.check("help"))
    {    
        yInfo(" ");
        yInfo("Options:");
        yInfo("   --context     path:  where to find the called resource (default periPersonalSpace).");
        yInfo("   --from        from:  the name of the .ini file (default ppsAggregEventsForiCubGui.ini).");
        yInfo("   --name        name:  the name of the module (default ppsAggregEventsForiCubGui).");
        yInfo("   --verbosity   verbosity:  verbosity level.");
        yInfo("   --autoConnect flag:  if to auto connect the ports or not. Default no.");
        yInfo("   --tactile    flag:  if enabled, the tactile aggreg events will be prepared for iCubGui visualization.");
        yInfo("   --pps       flag:  if enabled, the peripersonal space aggreg events will be prepared for iCubGui visualization.");
        yInfo("   --gain     gain:  the multiplication vector for the visualization of normalized event magnitude.");
        yInfo(" ");
        return 0;
    }

    if (!yarp.checkNetwork())
    {
        yError("No Network!!!");
        return -1;
    }
      
    ppsAggregEventsForiCubGui module;
    return module.runModule(rf);   
}
コード例 #6
0
ファイル: main.cpp プロジェクト: xufango/contrib_bk
int main(int argc, char *argv[])
{
    printf("-- START --\n");

	// we need to initialize the drivers list 
	YARP_REGISTER_DEVICES(icubmod)

	yarp::os::Network yarp;
	if (!yarp.checkNetwork())
	{
		cout << "NO CONNECTION TO YARP..." << endl;
		return 1;
	}

	/* prepare and configure the resource finder */
	ResourceFinder rf;
	rf.setVerbose(true);
	rf.setDefaultConfigFile("SimoxGraspExecutionModule.ini");		//overridden by --from parameter
	rf.setDefaultContext("SimoxGraspExecution/conf");						//overridden by --context parameter
	rf.configure("ICUB_ROOT", argc, argv);

	SimoxGraspExecutionModulePtr rvm(new SimoxGraspExecutionModule());

	rvm->configure(rf);

	return rvm->runModule();
}
コード例 #7
0
ファイル: main.cpp プロジェクト: apaikan/icub-main
int main(int argc, char *argv[])
{
    ResourceFinder rf;
    rf.setVerbose(true);
    rf.setDefaultContext("simCartesianControl");
    rf.setDefault("robot","icubSim");
    rf.setDefault("local","simCartesianControl");
    rf.setDefault("right_arm_file","cartesianRightArm.ini");
    rf.setDefault("left_arm_file","cartesianLeftArm.ini");
    rf.setDefault("right_leg_file","cartesianRightLeg.ini");
    rf.setDefault("left_leg_file","cartesianLeftLeg.ini");
    rf.configure(argc,argv);

    Network yarp;
    if (!yarp.checkNetwork())
    {
        cout<<"YARP server not available!"<<endl;
        return -1;
    }

    YARP_REGISTER_DEVICES(icubmod)

    SimCartCtrlModule mod;
    return mod.runModule(rf);
}
コード例 #8
0
int main(int argc, char *argv[])
{
    Network yarp;

    ResourceFinder rf;
    rf.setVerbose(false);
    rf.setDefaultContext("poeticon");    // overridden by --context
    rf.setDefaultConfigFile("wsm.ini");  // overridden by --from
    rf.configure(argc, argv);

    if(rf.check("help"))
    {
        yInfo("Available options:");
        yInfo("--name prefix (default wsm)");
        yInfo("--playback filename (read dummy world state data from a file, for example dbdummy.ini)");
        return 0; // EXIT_SUCCESS
    }

    if(! yarp::os::Network::checkNetwork() )
    {
        yError("YARP server not available!");
        return 1; // EXIT_FAILURE
    }

    DummyWorldStateMgrModule mod;
    return mod.runModule(rf);
}
コード例 #9
0
ファイル: main.cpp プロジェクト: xufango/contrib_bk
int main(int argc, char *argv[])
{
    printf("-- START --\n");
    YARP_REGISTER_DEVICES(icubmod)
	yarp::os::Network yarp;
	if (!yarp.checkNetwork())
	{
		cout << "NO CONNECTION TO YARP..." << endl;
		return 1;
	}

	// We must always have an application
	QApplication a( argc, argv );

	/* prepare and configure the resource finder */
	ResourceFinder rf;
	rf.setVerbose(true);
	rf.setDefaultConfigFile("SimoxHandEyeCalibrationGui_iCub.ini");		//overridden by --from parameter
	rf.setDefaultContext("SimoxHandEyeCalibrationGui/conf");				//overridden by --context parameter
	rf.configure("ICUB_ROOT", argc, argv);

        bool isleft = false;
        SimoxHandEyeCalibrationGuiPtr rvm(new SimoxHandEyeCalibrationGui(isleft));

	rvm->configure(rf);

	return rvm->runModule();
}
コード例 #10
0
ファイル: main.cpp プロジェクト: apaikan/icub-main
int main(int argc, char * argv[])
{
    ResourceFinder rf;
    rf.setVerbose(true);
    rf.configure(argc,argv);
    //rf.setDefaultContext("empty");
    //rf.setDefaultConfigFile("empty");

    if (rf.check("help"))
    {
        //help here
    }

    //initialize yarp network
    Network yarp;

    if (!yarp.checkNetwork())
    {
        fprintf(stderr, "Sorry YARP network does not seem to be available, is the yarp server available?\n");
        return -1;
    }

    YARP_REGISTER_DEVICES(icubmod)

    CtrlModule mod;

    return mod.runModule(rf);
}
コード例 #11
0
ファイル: ResourceFinderTest.cpp プロジェクト: apaikan/yarp
 void testDefaults() {
     report(0,"test default values of generic type");
     int defInt=42;
     double defDouble=42.42;
     ConstString defString="fortytwo";
     Bottle defList("(answers (42 24))");
     const char *argv[] = { NULL };
     int argc = 1;
     ResourceFinder rf;
     rf.setDefault("int", defInt);
     rf.setDefault("double", defDouble);
     rf.setDefault("string", defString);
     rf.setDefault("constchar", defString.c_str());
     rf.setDefault("list", defList.toString());
     rf.configure(argc,(char **)argv);
     checkEqual(rf.find("int").asInt(), defInt, "default integer set correctly");
     checkEqualish(rf.find("double").asDouble(), defDouble, "default double set correctly");
     checkEqual(rf.find("string").asString(), defString, "default string set correctly");
     checkEqual(rf.find("constchar").asString(), defString, "default string (passed as const char*) set correctly");
     Bottle *foundList=rf.find("list").asList();
     if(foundList!=NULL)
         checkEqual(rf.find("list").asList()->get(0).asString(), "answers", "default list set correctly");
     else
         report(1, "RF could not find default list");
 }
コード例 #12
0
ファイル: consumer.cpp プロジェクト: iron76/Teaching
int main(int argc, char *argv[]) {
    Network yarp;
    BufferedPort<Bottle> inPort;

    ResourceFinder parameters;
    parameters.configure(argc, argv);

    int delay=0;
    string portname="/consumer";

    if (parameters.check("name"))
        portname=parameters.find("name").asString().c_str();

    if (parameters.check("delay"))
    {
        delay=parameters.find("delay").asInt();
        printf("Setting delay to %d[ms]\n", delay);
    }

    inPort.open(portname.c_str());

    while (true) {
        Bottle *message=inPort.read();
        if (message==0)
            continue;

        int counter=message->get(0).asInt();
        string msg=message->get(1).asString().c_str();

        printf("Received: %d %s\n", counter, msg.c_str());

        Time::delay(delay/1000.0);
    }
    return 0;
}
コード例 #13
0
ファイル: onlineLearnerMain.cpp プロジェクト: bdamas/IMLE
int main(int argc, char * argv[])
{
    /* initialize yarp network */

    Network yarp;
    if ( !yarp.checkNetwork() )
        return -1;


    /* prepare and configure the resource finder */

    ResourceFinder rf;
    rf.setVerbose(true);
    rf.setDefaultConfigFile("onlineLearnerModule.ini"); //overridden by --from parameter
//    rf.setDefaultContext("onlineLearnerModule/conf");   //overridden by --context parameter
    rf.configure("ICUB_ROOT", argc, argv);

    /* create your module */

    OnlineLearnerModule onlineLearnerModule;

    /* run the module: runModule() calls configure first and, if successful, it then runs */

    onlineLearnerModule.runModule(rf);

    return 0;
}
コード例 #14
0
ファイル: main.cpp プロジェクト: robotology/navigation
int main(int argc, char *argv[])
{
    ResourceFinder rf;
    rf.setVerbose(true);
    rf.setDefaultContext("navigation");
    rf.setDefaultConfigFile("baseCtrl.ini");
    rf.configure(argc,argv);

    if (rf.check("help"))
    {
        yInfo("Possible options: ");
        yInfo("'rate <r>' sets the threads rate (default 20ms).");
        yInfo("'no_filter' disables command filtering.");
        yInfo("'no_motors' motor interface will not be opened.");
        yInfo("'no_start' do not automatically enables pwm.");
        yInfo("'joystick_connect' tries to automatically connect to the joystickCtrl output.");
        yInfo("'skip_robot_interface_check' does not connect to robotInterface/rpc (useful for simulator)");
        return 0;
    }

    //Initialize Yarp network
    Network yarp;

    if (!yarp.checkNetwork())
    {
        yError("Sorry YARP network does not seem to be available, is the yarp server available?\n");
        return -1;
    }

    //Starts the control module
    CtrlModule mod;
    return mod.runModule(rf);
}
コード例 #15
0
int main(int argc, char *argv[]) 
{
    Network yarp;

    ResourceFinder rf;
    rf.setVerbose();
    rf.setDefaultConfigFile("or.ini");
    rf.setDefaultContext("orBottle");
    rf.configure(argc, argv);
        
    std::string robotName=rf.find("robot").asString();
    std::string model=rf.findFile("model");
    
    cout<<"Running with:"<<endl;
    cout<<"robot: "<<robotName.c_str()<<endl;
    
    if (model=="")
    {
        cout<<"Sorry no model was found, check config parameters"<<endl;
        return -1;
    }

    cout << "Using object model: " << model.c_str() << endl;

    int times=4;
    while(times--)
    {
        cout << ".";
        Time::delay(0.5);
    }

    cout << "done!" <<endl;

    return 0;
}
コード例 #16
0
ファイル: main.cpp プロジェクト: xufango/contrib_bk
int main(int argc, char * argv[])
{
    //initialize yarp network
    Network yarp;
	
    //create your module
    TorqueObserver tauObs;

    // prepare and configure the resource finder
    ResourceFinder rf;
    rf.setVerbose(true);
    rf.configure("ICUB_ROOT", argc, argv);

	if( tauObs.configure(rf) )
		cout<<"TorqueObserver configured correctly!"<<endl;
	else
	{
		cout<<"TorqueObserver is not properly configured: exiting.."<<endl;
		return 0;
	}

	cout<<"Start module TorqueObserver..."<<endl;
	
	//running module: if configure() succeeds, module runs
	tauObs.runModule();
	
    cout<<"TorqueObserver has been closed!"<<endl;
    return 1;
}
コード例 #17
0
int main(int argc, char *argv[])
{

    ResourceFinder rf;
    rf.setVerbose(true);
    rf.setDefaultContext("crawling");
    //SI: was before -> but now context has changed
    //rf.setDefaultContext("crawlingApplication/conf");

    rf.setDefaultConfigFile("crawling_managerConfig.ini");
    //SI: was before located -> ICUB_ROOT\contrib\src\crawlingTest\app\conf\managerConfig.ini

    rf.configure(argc, argv);

    if (rf.check("help"))
    {
        cout << "Options:" << endl << endl;
        cout << "\t--robot      robot: the robot name. default: iCub" << endl;

        return 0;
    }

    Network yarp;

    if (!yarp.checkNetwork())
    {
        yError("Sorry YARP network does not seem to be available, is the yarp server available?\n");
        return 1;
    }

    //create and run the Crawl generator module
    CrawlManagerModule mod;
    return mod.runModule(rf);

}
コード例 #18
0
/**
* Main function.
*/
int main(int argc, char * argv[])
{
    Network yarp;

    ResourceFinder rf;
    rf.setVerbose(true);
    rf.setDefaultContext("periPersonalSpace");
    rf.setDefaultConfigFile("skinEventsAggregation.ini");
    rf.configure(argc,argv);

    if (rf.check("help"))
    {   
        yInfo(" "); 
        yInfo("Options:");
        yInfo(" ");
        yInfo("  --context    path:  where to find the called resource");
        yInfo("  --from       from:  the name of the .ini file.");
        yInfo("  --general::name      name:  the name of the module (default virtualContactGeneration).");
        yInfo("  --general::robot     robot: the name of the robot. Default icubSim.");
        yInfo("  --general::rate      rate:  the period used by the thread. Default 100ms.");
        yInfo("  --general::verbosity int:   verbosity level (default 0).");
        yInfo(" ");
        return 0;
    }
    
    if (!yarp.checkNetwork())
    {
        printf("No Network!!!\n");
        return -1;
    }

    skinEventsAggregator sEA;
    return sEA.runModule(rf);
}
コード例 #19
0
ファイル: main.cpp プロジェクト: robotology/cer
int main(int argc, char *argv[])
{
    ResourceFinder rf;
    rf.setVerbose(true);
    rf.setDefaultContext("cer");
    rf.setDefaultConfigFile("robotJoystickCtrl.ini");
    rf.configure(argc,argv);

    if (rf.check("help"))
    {
        yInfo("Possible options: ");
        yInfo("'robot <name>' the robot name for remote connection.");
        yInfo("'local <name>' the local port name.");
        yInfo("'rate <r>' sets the threads rate (default 20ms).");
        yInfo("'no_motors' motor interface will not be opened.");
        yInfo("'joystick_connect' tries to automatically connect to the joystickCtrl output.");
        yInfo("'skip_robot_interface_check' does not connect to robotInterface/rpc (useful for simulator)");

        yInfo("''");
        yInfo("example: robotJoystickCtrl --robot SIM_CER_ROBOT --joystick_connect --skip_robot_interface_check ");
        return 0;
    }

    Network yarp;

    if (!yarp.checkNetwork())
    {
        yError("Sorry YARP network does not seem to be available, is the yarp server available?\n");
        return -1;
    }

    CtrlModule mod;

    return mod.runModule(rf);
}
コード例 #20
0
int main(int argc, char * argv[])
{
    /* initialize yarp network */ 

    Network yarp;
    if ( !yarp.checkNetwork() )
    {
        fprintf(stderr,"Connection problem. No yarp server?\n\n");
        return -1;
    }


    /* prepare and configure the resource finder */

    ResourceFinder rf;
    rf.setVerbose(true);
    rf.setDefaultConfigFile("../conf/handTactileControl.ini"); //overridden by --from parameter
    //rf.setDefaultContext("/home/lorejam/SW/iCub_myApps/handTactileControl/conf");   //overridden by --context parameter
    rf.configure("ICUB_ROOT", argc, argv);
 
    /* create your module */

    HandTactileControlModule handControlModule; 

    /* run the module: runModule() calls configure first and, if successful, it then runs */

    handControlModule.runModule(rf);

    return 0;
}
コード例 #21
0
ファイル: main.cpp プロジェクト: kt10aan/icub-main
int main(int argc, char *argv[])
{
    ResourceFinder rf;
    rf.setVerbose(true);
    rf.setDefaultContext("ctpService/conf");
    rf.configure("ICUB_ROOT",argc,argv);

    if (rf.check("help"))
    {
        yInfo() << "Options:";
        yInfo() << "\t--joints       <n>:          number of joints, default 6";
        yInfo() << "\t--name         <moduleName>: set new module name";
        yInfo() << "\t--robot        <robotname>:  robot name";
        yInfo() << "\t--part         <robotname>:  part name";
        yInfo() << "\t--filename     <filename>:   the positions file";
        yInfo() << "\t--execute      activate the iPid->setReference() control";
        yInfo() << "\t--period       <period>: the period in ms of the internal thread (default 5)";
        yInfo() << "\t--verbose      to display additional infos";
        return 0;
    }

    Network yarp;

    if (!yarp.checkNetwork())
    {
        yError() << "yarp.checkNetwork() failed.";
        return -1;
    }

    scriptModule mod;
 
    return mod.runModule(rf);
}
コード例 #22
0
ファイル: main.cpp プロジェクト: robotology/navigation
int main(int argc, char *argv[])
{
    ResourceFinder rf;
    rf.setVerbose(true);
    rf.setDefaultContext("navigation");
    rf.setDefaultConfigFile("fakeMobileBaseTest.ini");
    rf.configure(argc,argv);

    if (rf.check("help"))
    {
        yInfo("Possible options: ");
        yInfo("'period <r>' sets the threads period (default 20ms).");
        yInfo("'joystick_connect' tries to automatically connect to the joystickCtrl output.");
        yInfo("'holonomic' if set, the robot will be holonomic");
        return 0;
    }

    Network yarp;

    if (!yarp.checkNetwork())
    {
        yError("Sorry YARP network does not seem to be available, is the yarp server available?\n");
        return -1;
    }

    CtrlModule mod;

    return mod.runModule(rf);
}
コード例 #23
0
ファイル: main.cpp プロジェクト: robotology/icub-main
int main(int argc, char *argv[])
{
    ResourceFinder rf;
    rf.setVerbose(true);
    rf.setDefaultContext("ctpService");
    rf.configure(argc,argv);

    if (rf.check("help"))
    {
        cout << "Options:" << endl << endl;
        cout << "\t--name moduleName: set new module name"      << endl;
        cout << "\t--robot robotname: robot name"      << endl;
        cout << "\t--part partname: robot part name" << endl;
        cout << "\t--from   fileName: input configuration file" << endl;
        cout << "\t--context dirName: resource finder context"  << endl;

        return 0;
    }

    Network yarp;
    if (!yarp.checkNetwork())
        return 1;

    scriptModule mod;
    return mod.runModule(rf);
}
コード例 #24
0
ファイル: main.cpp プロジェクト: liuwei000000/codyco-modules
int main(int argc, char **argv)
{
    ResourceFinder *rf = new ResourceFinder;
    
    rf->setVerbose(true);
    rf->setDefaultConfigFile("default.ini");         //default config file name.
    rf->setDefaultContext("adaptiveControl/conf"); //when no parameters are given to the module this is the default context
    rf->configure("ICUB_ROOT",argc,argv);
    
    if (rf->check("help"))
    {
        std::cout<< "Possible parameters" << std::endl << std::endl;
        std::cout<< "\t--context          :Where to find a user defined .ini file within $ICUB_ROOT/app e.g. /adaptiveControl/conf" << std::endl;
//        std::cout<< "\t--from             :Name of the file.ini to be used for calibration." << std::endl;
        std::cout<< "\t--rate             :Period used by the module. Default set to 10ms." << std::endl;
        std::cout<< "\t--robot            :Robot name (icubSim or icub). Set to icub by default." << std::endl;
        std::cout<< "\t--local            :Prefix of the ports opened by the module. Set to the module name by default, i.e. adaptiveControl." << std::endl;
        return 0;
    }
    
    Network yarp;
    
    if (!yarp.checkNetwork())
    {
        std::cerr << "Sorry YARP network is not available\n";
        return -1;
    }
    
    //Creating the module
    adaptiveControl::AdaptiveControlModule module;
    return module.runModule(*rf);
}
コード例 #25
0
int main (int argc, char * argv[])
{
    YARP_REGISTER_DEVICES(icubmod)
    
    Network yarp;
    if (!yarp.checkNetwork())
    {
        cout<<"YARP network not available. Aborting."<<endl;
        return -1;
    }
    
    ResourceFinder rf;
    rf.setVerbose(true);
    rf.setDefaultConfigFile("defaultSim.ini");         
    rf.setDefaultContext("reachComBalance/conf"); 
    rf.configure("ICUB_ROOT",argc,argv);
    
    if (rf.check("help"))
    {
        cout<< "Possible parameters"                                                                                                                                          << endl << endl;
        cout<< "\t--context          :Where to find an user defined .ini file "                                   <<endl;
        cout<< "\t--from             :Name of the file.ini to be used for calibration."                                                                                       <<endl;
        
        cout<<"The list of parameters is huge: please fill the configuration file.ini"<<endl;
        
        return 0;
    }
    
    //Creating the module
    ISIR_Balancer balancerModule;
    balancerModule.runModule(rf);
    
    return 0;
}
コード例 #26
0
ファイル: main.cpp プロジェクト: asilx/rossi-demo
int
main (int argc, char *argv[])
{
  Network yarp;

  if (!yarp.checkNetwork ())
    return -1;

  YARP_REGISTER_DEVICES(icubmod)

  ResourceFinder rf;
  rf.setVerbose (true);
  rf.setDefaultContext ("actionPrimitivesExample/conf");
  rf.setDefaultConfigFile ("config.ini");
  rf.setDefault ("part", "left_arm");
  rf.setDefault ("grasp_model_type", "tactile");
  rf.setDefault ("grasp_model_file", "grasp_model.ini");
  rf.setDefault ("hand_sequences_file", "hand_sequences.ini");
  rf.setDefault ("name", "actionPrimitivesMod");
  rf.setDefault ("sim", "off");
  rf.configure ("ICUB_ROOT", argc, argv);

  BehaviorModule mod;

  return mod.runModule (rf);
}
コード例 #27
0
ファイル: show3D.cpp プロジェクト: tanismar/objects3DModeler
int main(int argc, char * argv[])
{
    
    Network yarp;
    if (!yarp.checkNetwork())
    {
        printf("YARP server not available!\n");
        return -1;
    }

    ShowModule module;
    ResourceFinder rf;
    rf.setDefaultContext("toolIncorporation");
    rf.setDefaultConfigFile("cloudsPath.ini");
    rf.setVerbose(true);
    rf.configure(argc, argv);


    cout<<"Configure module..."<<endl;
    module.configure(rf);
    cout<<"Start module..."<<endl;
    module.runModule();

    cout<<"Main returning..."<<endl;
    return 0;
}
コード例 #28
0
//********************************************
int main(int argc, char * argv[])
{
    Network yarp;

    ResourceFinder moduleRF;
    moduleRF.setVerbose(false);
    moduleRF.setDefaultContext("periPersonalSpace");
    moduleRF.setDefaultConfigFile("demoAvoidance.ini");
    moduleRF.configure(argc,argv);

    if (moduleRF.check("help"))
    {
        yInfo(" ");
        yInfo("Options:");
        yInfo("   --context     path:  where to find the called resource (default periPersonalSpace).");
        yInfo("   --from        from:  the name of the .ini file (default demoAvoidance.ini).");
        yInfo("   --name        name:  the name of the module (default avoidance).");
        yInfo("   --autoConnect flag:  if to auto connect the ports or not. Default no.");
        yInfo("   --catching    flag:  if enabled, the robot will catch the target instead of avoiding it.");
        yInfo("   --stiff       flag:  if enabled, the robot will perform movements in stiff mode instead of compliant.");
        yInfo("   --noLeftArm   flag:  if enabled, the robot will perform movements without the left arm.");
        yInfo("   --noRightArm  flag:  if enabled, the robot will perform movements without the rihgt arm.");
        yInfo(" ");
        return 0;
    }

    if (!yarp.checkNetwork())
    {
        yError("No Network!!!");
        return -1;
    }

    Avoidance module;
    return module.runModule(moduleRF);
}
コード例 #29
0
ファイル: demoINNOROBO.cpp プロジェクト: alecive/demoINNOROBO
/**
* Main function.
*/
int main(int argc, char * argv[])
{
    YARP_REGISTER_DEVICES(icubmod)

    ResourceFinder rf;
    rf.setVerbose(true);
    rf.setDefaultContext("demoINNOROBO");
    rf.setDefaultConfigFile("demoINNOROBO.ini");
    rf.configure(argc,argv);

    if (rf.check("help"))
    {    
        cout << endl << "Options:" << endl;
        cout << "   --context    path:  where to find the called resource" << endl;
        cout << "   --from       from:  the name of the .ini file." << endl;
        cout << "   --name       name:  the name of the module (default demoINNOROBO)." << endl;
        cout << "   --robot      robot: the name of the robot. Default icub." << endl;
        cout << "   --rate       rate:  the period used by the thread. Default 100ms." << endl;
        cout << "   --verbosity  int:   verbosity level (default 1)." << endl;
        cout << endl;
        return 0;
    }

    Network yarp;
    if (!yarp.checkNetwork())
    {
        printf("No Network!!!\n");
        return -1;
    }

    demoINNOROBO chEyeTest;
    return chEyeTest.runModule(rf);
}
コード例 #30
0
int main(int argc, char *argv[])
{
    Network yarp;

    ResourceFinder rf;
    rf.setVerbose(true);
    rf.setDefaultContext("poeticon");    // overridden by --context
    rf.setDefaultConfigFile("geometricGrounding.ini");  // overridden by --from
    rf.configure(argc, argv);

    if(rf.check("help"))
    {
        yInfo("Options available:");
        yInfo(" --prerules <filename> (pre-rules file, default: pre_rules.dat)");
        return 0; // EXIT_SUCCESS
    }

    if(! yarp.checkNetwork() )
    {
        yError("yarp server does not seem available");
        return 1; // EXIT_FAILURE
    }

    geoGround module;
    return module.runModule(rf);
}