/Users/fpy/titan-1-5-MBARI/Mers/Executives/DeductiveController/Configs/DC_1_2-Standalone/DCTest.cpp

00001 
00002 //
00003 // Copyright (c) 2004           Model-based Embedded and Robotic Systems Group
00004 // All Rights Reserved          Massachusetts Institute of Technology
00005 //
00006 // This software is provided as is. Model-based Embedded and Robotic Systems
00007 // (MERS) group does not assume any responsibility.
00008 //
00009 // Organization:        Model-based Embedded and Robotic Systems Group
00010 //                                      Massachusetts Institute of Technology
00011 //
00013 
00014 #include <Mers/Utils/Io/Xml/Sax/XMLLoader.h>
00015 
00017 
00018 #ifdef FAILED
00019 #undef FAILED
00020 #endif
00021 
00023 
00024 #include <Mers/Estimation/Discrete/ApproximateBeliefState/BFBSE/BFBSE.h>
00025 #include <Mers/Estimation/Discrete/MEInterface.h>
00026 #include <Mers/Solvers/Entailment/GI/GoalInterpreter.h>
00027 #include <Mers/Models/CCA/CCAModel.h>
00028 #include <Mers/Executives/DeductiveController/DCInterface.h>
00029 #include <Mers/Estimation/Discrete/Trajectories.h>
00030 #include <Mers/Estimation/Discrete/Io/Xml/Sax/TrajCH.h>
00031 #include <Mers/Reconfiguration/Discrete/modeReconfiguration.h>
00032 #include <Mers/Reconfiguration/Discrete/mrInterface.h>
00033 
00035 
00036 using Mers::Models::CCA::CCAModel;
00037 using Mers::Models::Base::BaseModel;
00038 using Mers::Estimation::Discrete::MEInterface;
00039 using Mers::Estimation::Discrete::ApproximateBeliefState::BFBSE::BFBSE;
00040 using Mers::Estimation::Discrete::ME_connection;
00041 using Mers::Solvers::Entailment::GoalInterpreterInterface;
00042 using Mers::Solvers::Entailment::GI::GoalInterpreter;
00043 using Mers::Executives::DeductiveController::DCInterface;
00044 using Mers::Estimation::Discrete::Trajectories;
00045 using Mers::Estimation::Discrete::Io::Xml::Sax::TrajCH;
00046 using Mers::Utils::Io::Xml::Sax::XMLLoader;
00047 using Mers::Reconfiguration::Discrete::MR_connection;
00048 // using Mers::Reconfiguration::Discrete::mrInterface;
00049 // using Mers::Reconfiguration::Discrete::modeReconfiguration;
00050 
00052 
00053 void printUse( const char * progName )
00054 {
00055         printf("Use: %s <CCA file> <ME Init file> [<log4cplus file>]\n", progName);
00056 }
00057 
00059 
00060 bool requiredParameters(int argc, const char * progName) {
00061         if(argc != 2 && argc != 3){
00062                 printUse( (progName == NULL ? "DCTest" : progName) );
00063                 return false;
00064         } else {
00065                 return true;
00066         }
00067 }
00068 
00070 
00071 class Arguments
00072 {
00073 public:
00074         CCAModel * ccaModel;
00075         const char * modelFileName;
00076         const char * trajFileName;
00077         const char * log4cplusFileName;
00078 };
00079 
00081 
00082 CCAModel *      load_MOF(char const * MOF_file_name);
00083 
00085 
00086 Arguments * loadParameters(int argc, const char * argv[]) {
00087         Arguments * args = new Arguments();
00088         args->ccaModel = load_MOF(argv[0]);
00089         args->modelFileName = argv[0];
00090         args->trajFileName = argv[1];
00091         if(argc > 2)
00092                 args->log4cplusFileName = argv[2];
00093         else
00094                 args->log4cplusFileName = NULL;
00095         return args;
00096 }
00097 
00099 
00100 ME_connection * constructME(Arguments * args) {
00101         Trajectories * trajs;
00102         // Load the Trajectories.
00103         if( FAILED(
00104                 XMLLoader::load< Trajectories *, const BaseModel *, TrajCH >
00105                 ( args->trajFileName, trajs, args->ccaModel ) ) )
00106         {
00107                 trajs = NULL;
00108         }
00109 
00110         BFBSE * me = new BFBSE(*(args->ccaModel), trajs);
00111 
00112         return new MEInterface( me );
00113 }
00114 
00116 
00117 GoalInterpreterInterface * constructGI(Arguments * args) {
00118         return new GoalInterpreter(args->ccaModel);
00119 }
00120 
00122 
00123 MR_connection * constructMR(Arguments * args) {
00124         modeReconfiguration * mr =
00125                 new modeReconfiguration( *args->ccaModel, constructGI( args ) );
00126         return new mrInterface( *mr );
00127 }
00128 
00130 
00131 void CreateChildren( Arguments * args, DCInterface * dc ) {
00132         // Don't have any children to create.
00133         (void) args;
00134         (void) dc;
00135 }
00136 
00138 
00139 #include <Mers/Executives/DeductiveController/DeductiveController.cpp>
00140 
00142 

Generated on Mon Dec 4 14:16:44 2006 for Mers by  doxygen 1.5.0