00001 00009 /* 00010 * This file is part of ocra-icub. 00011 * Copyright (C) 2016 Institut des Systèmes Intelligents et de Robotique (ISIR) 00012 * 00013 * This program is free software: you can redistribute it and/or modify 00014 * it under the terms of the GNU General Public License as published by 00015 * the Free Software Foundation, either version 3 of the License, or 00016 * (at your option) any later version. 00017 * 00018 * This program is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 * GNU General Public License for more details. 00022 * 00023 * You should have received a copy of the GNU General Public License 00024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00025 */ 00026 00027 #ifndef OCRA_CONTROLLER_SERVER_MODULE_H 00028 #define OCRA_CONTROLLER_SERVER_MODULE_H 00029 00030 #include <iostream> 00031 #include <memory> 00032 #include <algorithm> 00033 #include <locale> 00034 00035 #include <yarp/os/RFModule.h> 00036 00037 #include <yarpWholeBodyInterface/yarpWholeBodyInterface.h> 00038 #include "ocra-icub-server/Thread.h" 00039 #include "ocra-icub/Utilities.h" 00040 00041 00047 class Module: public yarp::os::RFModule 00048 { 00049 // CLASS_POINTER_TYPEDEFS(Module) 00050 00051 public: 00054 Module(); 00055 00058 ~Module(); 00059 00065 bool configure(yarp::os::ResourceFinder &rf); // configure all the module parameters and return true if successful 00066 00069 bool interruptModule(); // interrupt, e.g., the ports 00070 00073 bool close(); 00074 00078 bool updateModule(); 00079 00082 void printHelp(); 00083 00084 private: 00085 std::shared_ptr<Thread> ctrlThread; 00086 // Thread* ctrlThread; /*!< The controller thread. This is where the magic happens. */ 00087 // Thread ctrlThread; /*!< The controller thread. This is where the magic happens. */ 00088 std::shared_ptr<wbi::wholeBodyInterface> robotInterface; 00090 yarp::os::Log yLog; 00091 OcraControllerOptions controller_options; 00092 double avgTime; 00093 double stdDev; 00094 double avgTimeUsed; 00095 double stdDevUsed; 00096 double dangerPeriodLoopTime; 00097 static const int DEFAULT_THREAD_PERIOD = 10; 00098 }; 00099 00100 00101 #endif //OCRA_CONTROLLER_SERVER_MODULE_H