MyModuleMain.cpp

From Wiki for iCub and Friends
Jump to navigation Jump to search
The correct title of this article is myModuleMain.cpp. The initial letter is shown capitalized due to technical restrictions.

The following goes in myModuleMain.cpp

/* 
 * Copyright (C) 2009 RobotCub Consortium, European Commission FP6 Project IST-004370
 * Authors: David Vernon
 * email:   david@vernon.eu
 * website: www.robotcub.org 
 * Permission is granted to copy, distribute, and/or modify this program
 * under the terms of the GNU General Public License, version 2 or any
 * later version published by the Free Software Foundation.
 *
 * A copy of the license can be found at
 * http://www.robotcub.org/icub/license/gpl.txt
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
 * Public License for more details
 */
  

/*
 * Audit Trail
 * -----------
 * 26/07/07  First version validated   DV
 */ 

#include "iCub/myModule.h" 

int main(int argc, char * argv[])
{
   /* initialize yarp network */ 

   Network yarp;

   /* create your module */

   MyModule myModule; 

   /* prepare and configure the resource finder */

   ResourceFinder rf;
   rf.setVerbose(true);
   rf.setDefaultConfigFile("myModule.ini"); //overridden by --from parameter
   rf.setDefaultContext("myModule/conf");   //overridden by --context parameter
   rf.configure("ICUB_ROOT", argc, argv);
 
   /* run the module: runModule() calls configure first and, if successful, it then runs */

   myModule.runModule(rf);

   return 0;
}