BridgeConf.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * National Institute of Advanced Industrial Science and Technology (AIST)
8  * General Robotix Inc.
9  */
15 #ifndef OPENHRP_BRIDGE_CONF_H_INCLUDED
16 #define OPENHRP_BRIDGE_CONF_H_INCLUDED
17 
18 #if ( defined ( WIN32 ) || defined ( _WIN32 ) || defined(__WIN32__) || defined(__NT__) )
19 #define SUFFIX_SHARED_EXT ".dll"
20 #elif defined(__APPLE__)
21 #define SUFFIX_SHARED_EXT ".dylib"
22 #else
23 #define SUFFIX_SHARED_EXT ".so"
24 #endif
25 
26 #include <map>
27 #include <list>
28 #include <vector>
29 #include <string>
30 #include <boost/program_options.hpp>
31 #include <rtm/Manager.h>
32 #include <rtm/RTObject.h>
33 
34 enum DataTypeId {
55 };
56 
57 struct PortInfo {
58  std::string portName;
60  std::vector<std::string> dataOwnerName; // link name or sensor name
61  int dataOwnerId; // sensor id
62  double stepTime;
63 };
64 
65 typedef std::map<std::string, PortInfo> PortInfoMap;
66 
67 
69  std::string robotPortName;
71  std::string controllerPortName;
72 };
73 typedef std::vector<PortConnection> PortConnectionList;
74 
75 
76 struct ModuleInfo {
77  std::string fileName;
78  std::string componentName;
79  std::string initFuncName;
80  bool isLoaded;
81  RTC::RtcBase* rtcServant;
82 };
83 typedef std::list<ModuleInfo> ModuleInfoList;
84 
85 typedef std::map<std::string, double> TimeRateMap;
86 
88 {
89  BridgeConf(int argc, char* argv[]);
90 
91 public:
92 
93  static BridgeConf* initialize(int argc, char* argv[]);
94  static BridgeConf* instance();
95 
96  ~BridgeConf();
97 
98  bool isReady() { return isReady_; }
99 
100  const char* getOpenHRPNameServerIdentifier();
101  const char* getControllerName();
102  const char* getVirtualRobotRtcTypeName();
103 
104  void setupModules();
105 
106  typedef std::map<std::string, DataTypeId> LabelToDataTypeIdMap;
108 
111 
113 
115 
117 
118 private:
119 
120  boost::program_options::variables_map vmap;
121  boost::program_options::options_description options;
122  boost::program_options::options_description commandLineOptions;
123 
124  bool isReady_;
126 
128  std::string controllerName;
129  std::string nameServerIdentifier;
130 
131  void initOptionsDescription();
132  void initLabelToDataTypeMap();
133 
134  void parseCommandLineOptions(int argc, char* argv[]);
135  void parseOptions();
136  void setPortInfos(const char* optionLabel, PortInfoMap& portInfos);
137  void addPortConnection(const std::string& value);
138 
139  void setPreLoadModuleInfo();
140  void addModuleInfo(const std::string& value);
141  void addTimeRateInfo(const std::string& value);
142 
143  std::vector<std::string> extractParameters(const std::string& str, const char delimiter=':');
144  std::string expandEnvironmentVariables(std::string str);
145 };
146 
147 
148 #endif
RATE_GYRO_SENSOR2
@ RATE_GYRO_SENSOR2
Definition: BridgeConf.h:52
BridgeConf::BridgeConf
BridgeConf(int argc, char *argv[])
Definition: BridgeConf.cpp:52
BridgeConf::initialize
static BridgeConf * initialize(int argc, char *argv[])
Definition: BridgeConf.cpp:39
BridgeConf::commandLineOptions
boost::program_options::options_description commandLineOptions
Definition: BridgeConf.h:122
ABS_TRANSFORM2
@ ABS_TRANSFORM2
Definition: BridgeConf.h:54
BridgeConf::outPortInfos
PortInfoMap outPortInfos
Definition: BridgeConf.h:109
PortConnectionList
std::vector< PortConnection > PortConnectionList
Definition: BridgeConf.h:73
RANGE_SENSOR
@ RANGE_SENSOR
Definition: BridgeConf.h:50
DEPTH_IMAGE
@ DEPTH_IMAGE
Definition: BridgeConf.h:49
GRAYSCALE_IMAGE
@ GRAYSCALE_IMAGE
Definition: BridgeConf.h:48
BridgeConf::extractParameters
std::vector< std::string > extractParameters(const std::string &str, const char delimiter=':')
Definition: BridgeConf.cpp:383
BridgeConf::virtualRobotRtcTypeName
std::string virtualRobotRtcTypeName
Definition: BridgeConf.h:127
ModuleInfo
Definition: BridgeConf.h:76
BridgeConf::nameServerIdentifier
std::string nameServerIdentifier
Definition: BridgeConf.h:129
PortInfo::portName
std::string portName
Definition: BridgeConf.h:58
BridgeConf::setPreLoadModuleInfo
void setPreLoadModuleInfo()
Definition: BridgeConf.cpp:305
PortInfoMap
std::map< std::string, PortInfo > PortInfoMap
Definition: BridgeConf.h:65
BridgeConf::addModuleInfo
void addModuleInfo(const std::string &value)
Definition: BridgeConf.cpp:320
BridgeConf::expandEnvironmentVariables
std::string expandEnvironmentVariables(std::string str)
Definition: BridgeConf.cpp:405
BridgeConf::isReady
bool isReady()
Definition: BridgeConf.h:98
BridgeConf::timeRateMap
TimeRateMap timeRateMap
Definition: BridgeConf.h:116
ModuleInfo::componentName
std::string componentName
Definition: BridgeConf.h:78
ACCELERATION_SENSOR2
@ ACCELERATION_SENSOR2
Definition: BridgeConf.h:53
BridgeConf::controllerName
std::string controllerName
Definition: BridgeConf.h:128
BridgeConf::initLabelToDataTypeMap
void initLabelToDataTypeMap()
Definition: BridgeConf.cpp:117
PortInfo::dataOwnerName
std::vector< std::string > dataOwnerName
Definition: BridgeConf.h:60
CONSTRAINT_FORCE
@ CONSTRAINT_FORCE
Definition: BridgeConf.h:51
BridgeConf::moduleInfoList
ModuleInfoList moduleInfoList
Definition: BridgeConf.h:112
BridgeConf::~BridgeConf
~BridgeConf()
Definition: BridgeConf.cpp:65
PortInfo::stepTime
double stepTime
Definition: BridgeConf.h:62
BridgeConf::labelToDataTypeIdMap
LabelToDataTypeIdMap labelToDataTypeIdMap
Definition: BridgeConf.h:107
FORCE_SENSOR
@ FORCE_SENSOR
Definition: BridgeConf.h:44
value
png_voidp int value
Definition: png.h:2110
BridgeConf::parseCommandLineOptions
void parseCommandLineOptions(int argc, char *argv[])
Definition: BridgeConf.cpp:143
BridgeConf::vmap
boost::program_options::variables_map vmap
Definition: BridgeConf.h:120
BridgeConf::LabelToDataTypeIdMap
std::map< std::string, DataTypeId > LabelToDataTypeIdMap
Definition: BridgeConf.h:106
BridgeConf::getOpenHRPNameServerIdentifier
const char * getOpenHRPNameServerIdentifier()
Definition: BridgeConf.cpp:366
BridgeConf::setPortInfos
void setPortInfos(const char *optionLabel, PortInfoMap &portInfos)
Definition: BridgeConf.cpp:224
ABS_TRANSFORM
@ ABS_TRANSFORM
Definition: BridgeConf.h:41
ModuleInfo::fileName
std::string fileName
Definition: BridgeConf.h:77
PortConnection::controllerInstanceName
std::string controllerInstanceName
Definition: BridgeConf.h:70
BridgeConf::initOptionsDescription
void initOptionsDescription()
Definition: BridgeConf.cpp:71
COLOR_IMAGE
@ COLOR_IMAGE
Definition: BridgeConf.h:47
JOINT_VALUE
@ JOINT_VALUE
Definition: BridgeConf.h:36
ModuleInfo::rtcServant
RTC::RtcBase * rtcServant
Definition: BridgeConf.h:81
BridgeConf::getVirtualRobotRtcTypeName
const char * getVirtualRobotRtcTypeName()
Definition: BridgeConf.cpp:378
BridgeConf::addPortConnection
void addPortConnection(const std::string &value)
Definition: BridgeConf.cpp:283
PortInfo::dataTypeId
DataTypeId dataTypeId
Definition: BridgeConf.h:59
BridgeConf::parseOptions
void parseOptions()
Definition: BridgeConf.cpp:175
DataTypeId
DataTypeId
Definition: BridgeConf.h:34
ACCELERATION_SENSOR
@ ACCELERATION_SENSOR
Definition: BridgeConf.h:46
JOINT_TORQUE
@ JOINT_TORQUE
Definition: BridgeConf.h:39
BridgeConf::setupModules
void setupModules()
Definition: BridgeConf.cpp:351
TimeRateMap
std::map< std::string, double > TimeRateMap
Definition: BridgeConf.h:85
BridgeConf::instance
static BridgeConf * instance()
Definition: BridgeConf.cpp:46
RATE_GYRO_SENSOR
@ RATE_GYRO_SENSOR
Definition: BridgeConf.h:45
BridgeConf::inPortInfos
PortInfoMap inPortInfos
Definition: BridgeConf.h:110
BridgeConf::portConnections
PortConnectionList portConnections
Definition: BridgeConf.h:114
JOINT_ACCELERATION
@ JOINT_ACCELERATION
Definition: BridgeConf.h:38
ABS_ACCELERATION
@ ABS_ACCELERATION
Definition: BridgeConf.h:43
ModuleInfo::initFuncName
std::string initFuncName
Definition: BridgeConf.h:79
BridgeConf::isReady_
bool isReady_
Definition: BridgeConf.h:124
BridgeConf::getControllerName
const char * getControllerName()
Definition: BridgeConf.cpp:372
BridgeConf::isProcessingConfigFile
bool isProcessingConfigFile
Definition: BridgeConf.h:125
JOINT_VELOCITY
@ JOINT_VELOCITY
Definition: BridgeConf.h:37
BridgeConf::addTimeRateInfo
void addTimeRateInfo(const std::string &value)
Definition: BridgeConf.cpp:341
BridgeConf
Definition: BridgeConf.h:87
ModuleInfo::isLoaded
bool isLoaded
Definition: BridgeConf.h:80
ABS_VELOCITY
@ ABS_VELOCITY
Definition: BridgeConf.h:42
BridgeConf::options
boost::program_options::options_description options
Definition: BridgeConf.h:121
PortConnection::robotPortName
std::string robotPortName
Definition: BridgeConf.h:69
PortInfo::dataOwnerId
int dataOwnerId
Definition: BridgeConf.h:61
INVALID_DATA_TYPE
@ INVALID_DATA_TYPE
Definition: BridgeConf.h:35
ModuleInfoList
std::list< ModuleInfo > ModuleInfoList
Definition: BridgeConf.h:83
PortConnection
Definition: BridgeConf.h:68
PortConnection::controllerPortName
std::string controllerPortName
Definition: BridgeConf.h:71
EXTERNAL_FORCE
@ EXTERNAL_FORCE
Definition: BridgeConf.h:40
PortInfo
Definition: BridgeConf.h:57


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Wed Sep 7 2022 02:51:02