Skip to content

Commit

Permalink
changes for ubuntu22.04+OpenRTM2.0 environment
Browse files Browse the repository at this point in the history
  • Loading branch information
fkanehiro committed Jun 19, 2024
1 parent 2e96aa8 commit f5308de
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 43 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ if(UNIX)
set(OPENRTM_IDL_DIR "${OPENRTM_DIR}/include/openrtm-1.1/rtm/idl")
elseif(OPENRTM_VERSION STREQUAL OPENRTM_VERSION120 OR OPENRTM_VERSION STREQUAL OPENRTM_VERSION121 OR OPENRTM_VERSION STREQUAL OPENRTM_VERSION122)
set(OPENRTM_IDL_DIR "${OPENRTM_DIR}/include/openrtm-1.2/rtm/idl")
elseif(OPENRTM_VERSION STREQUAL OPENRTM_VERSION202)
set(OPENRTM_IDL_DIR "${OPENRTM_DIR}/include/openrtm-2.0/rtm/idl")
else()
set(OPENRTM_IDL_DIR "${OPENRTM_DIR}/include/rtm/idl")
endif()
Expand Down
11 changes: 8 additions & 3 deletions cmake_modules/FindOpenRTM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,21 @@ set(OPENRTM_VERSION112 "1.1.2")
set(OPENRTM_VERSION120 "1.2.0")
set(OPENRTM_VERSION121 "1.2.1")
set(OPENRTM_VERSION122 "1.2.2")
set(OPENRTM_VERSION202 "2.0.2")
set(OPENRTM_PKG_CONFIG_FOUND FALSE)
#Additional threshold OpenRTM versions switching processing
set(OPENRTM_DEFAULT_VERSION ${OPENRTM_VERSION100})

if(UNIX)
if(OPENRTM_DIR)
string(REGEX REPLACE "/$" "" OPENRTM_DIR ${OPENRTM_DIR})
set(OPENRTM_CONFIG_EXECUTABLE ${OPENRTM_DIR}/bin/rtm-config)
set(OPENRTM_CONFIG_EXECUTABLE ${OPENRTM_DIR}/bin/rtm2-config)
if(NOT EXISTS ${OPENRTM_CONFIG_EXECUTABLE})
set(OPENRTM_CONFIG_EXECUTABLE)
message(FATAL_ERROR "rtm-config was not found in ${OPENRTM_DIR}/bin. Please set OPENRTM_DIR correctly.")
message(FATAL_ERROR "rtm2-config was not found in ${OPENRTM_DIR}/bin. Please set OPENRTM_DIR correctly.")
endif()
else()
find_program(OPENRTM_CONFIG_EXECUTABLE rtm-config DOC "The location of the rtm-config script")
find_program(OPENRTM_CONFIG_EXECUTABLE rtm2-config DOC "The location of the rtm2-config script")
mark_as_advanced(OPENRTM_CONFIG_EXECUTABLE)
endif()

Expand Down Expand Up @@ -58,6 +59,10 @@ if(UNIX)
list(APPEND OPENRTM_INCLUDE_DIRS "${OPENRTM_DIR}/include/openrtm-1.2/rtm/idl")
list(APPEND OPENRTM_INCLUDE_DIRS "${OPENRTM_DIR}/include/openrtm-1.2")
list(APPEND OPENRTM_INCLUDE_DIRS "${OPENRTM_DIR}/include/coil-1.2")
elseif(OPENRTM_VERSION STREQUAL OPENRTM_VERSION202)
list(APPEND OPENRTM_INCLUDE_DIRS "${OPENRTM_DIR}/include/openrtm-2.0/rtm/idl")
list(APPEND OPENRTM_INCLUDE_DIRS "${OPENRTM_DIR}/include/openrtm-2.0")
list(APPEND OPENRTM_INCLUDE_DIRS "${OPENRTM_DIR}/include/coil-2.0")
else()
list(APPEND OPENRTM_INCLUDE_DIRS "${OPENRTM_DIR}/include/rtm/idl")
list(APPEND OPENRTM_INCLUDE_DIRS "${OPENRTM_DIR}/include")
Expand Down
2 changes: 1 addition & 1 deletion hrplib/hrpCorba/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ set(given_headers ORBwrap.h)

install(FILES ${given_headers} ${idl_h_files} DESTINATION ${RELATIVE_HEADERS_INSTALL_PATH}/hrpCorba)
execute_process(
COMMAND python -c "import sys; print('%s.%s'%(sys.version_info[0:2]))"
COMMAND python3 -c "import sys; print('%s.%s'%(sys.version_info[0:2]))"
OUTPUT_VARIABLE python_version
OUTPUT_STRIP_TRAILING_WHITESPACE)

Expand Down
20 changes: 10 additions & 10 deletions hrplib/hrpModel/BodyCustomizerInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace {
NameToInterfaceMap customizerRepository;
bool pluginLoadingFunctionsCalled = false;

inline string toNativePathString(const filesystem::path& path) {
inline string toNativePathString(const boost::filesystem::path& path) {
#if (BOOST_VERSION <= 103301)
return path.native_file_string();
#elif (BOOST_VERSION < 104600)
Expand Down Expand Up @@ -175,21 +175,21 @@ int hrp::loadBodyCustomizers(const std::string pathString, BodyInterface* bodyIn
}
}
#elif (BOOST_VERSION >= 105000)
filesystem::path pluginPath(pathString, (void *)filesystem::native);
boost::filesystem::path pluginPath(pathString, (void *)boost::filesystem::native);

if(filesystem::exists(pluginPath)){
if(boost::filesystem::exists(pluginPath)){

if(!filesystem::is_directory(pluginPath)){
if(!boost::filesystem::is_directory(pluginPath)){
if(loadCustomizerDll(bodyInterface, toNativePathString(pluginPath))){
numLoaded++;
}
} else {
regex pluginNamePattern(string(".+Customizer") + DLLSFX);
filesystem::directory_iterator end;
boost::filesystem::directory_iterator end;

for(filesystem::directory_iterator it(pluginPath); it != end; ++it){
const filesystem::path& filepath = *it;
if(!filesystem::is_directory(filepath)){
for(boost::filesystem::directory_iterator it(pluginPath); it != end; ++it){
const boost::filesystem::path& filepath = *it;
if(!boost::filesystem::is_directory(filepath)){
if(regex_match(filepath.filename().string(), pluginNamePattern)){
if(loadCustomizerDll(bodyInterface, toNativePathString(filepath))){
numLoaded++;
Expand Down Expand Up @@ -262,8 +262,8 @@ int hrp::loadBodyCustomizers(BodyInterface* bodyInterface)
#ifndef _WIN32
Dl_info info;
if(dladdr((void*)&hrp::findBodyCustomizer, &info)){
filesystem::path customizerPath =
filesystem::path(info.dli_fname).branch_path().branch_path() / OPENHRP_RELATIVE_SHARE_DIR / "customizer";
boost::filesystem::path customizerPath =
boost::filesystem::path(info.dli_fname).branch_path().branch_path() / OPENHRP_RELATIVE_SHARE_DIR / "customizer";
numLoaded += loadBodyCustomizers(customizerPath.string(), bodyInterface);
}
#else
Expand Down
4 changes: 2 additions & 2 deletions hrplib/hrpRTM/SimulationExecutionContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace RTC
{
ReturnCode_t SimulationExecutionContext::start() throw (CORBA::SystemException)
ReturnCode_t SimulationExecutionContext::start()
{

ReturnCode_t ret = OpenHRPExecutionContext::start();
Expand All @@ -19,7 +19,7 @@ namespace RTC
}


ReturnCode_t SimulationExecutionContext::stop() throw (CORBA::SystemException)
ReturnCode_t SimulationExecutionContext::stop()
{
#if (defined(OPENRTM_VERSION042) || defined(OPENRTM_VERSION110)) && !defined(OPENRTM_VERSION_TRUNK)
if (!m_running) return RTC::PRECONDITION_NOT_MET;
Expand Down
4 changes: 2 additions & 2 deletions hrplib/hrpRTM/SimulationExecutionContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace RTC
class SimulationExecutionContext : public virtual OpenHRPExecutionContext
{
public:
virtual ReturnCode_t start() throw (CORBA::SystemException);
virtual ReturnCode_t stop() throw (CORBA::SystemException);
virtual ReturnCode_t start();
virtual ReturnCode_t stop();
static OpenHRP::ClockGenerator_var m_cg;
};
};
Expand Down
8 changes: 4 additions & 4 deletions hrplib/hrpUtil/UrlUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ void hrp::getPathFromUrl(string& refUrl, const string& rootDir, string srcUrl)
}
}
#elif (BOOST_VERSION >= 105000)
filesystem::path filepath( deleteURLScheme(srcUrl), (void *)filesystem::native);
boost::filesystem::path filepath( deleteURLScheme(srcUrl), (void *)boost::filesystem::native);
if(exists(filepath)){ // 元が絶対パス //
refUrl = filesystem::system_complete(filepath).string();
refUrl = boost::filesystem::system_complete(filepath).string();
}else{ // 元が相対パス //
filesystem::path filepath(rootDir + deleteURLScheme(srcUrl), (void *)filesystem::native);
if(filesystem::exists(filepath)){
boost::filesystem::path filepath(rootDir + deleteURLScheme(srcUrl), (void *)boost::filesystem::native);
if(boost::filesystem::exists(filepath)){
refUrl = system_complete(filepath).string();
}
}
Expand Down
8 changes: 4 additions & 4 deletions hrplib/hrpUtil/VrmlParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ void VrmlParser::load(const string& filename)

void VrmlParserImpl::load(const string& filename)
{
filesystem::path localPath(filename);
boost::filesystem::path localPath(filename);
localPath.normalize();

#if (BOOST_VERSION < 104600)
Expand Down Expand Up @@ -764,17 +764,17 @@ VrmlNodePtr VrmlParserImpl::readInlineNode(VrmlNodeCategory nodeCategory)

VrmlNodePtr VrmlParserImpl::newInlineSource(string& io_filename)
{
filesystem::path localPath;
boost::filesystem::path localPath;
string chkFile("");
if( isFileProtocol( io_filename ) )
{
localPath = filesystem::path( deleteURLScheme(io_filename) );
localPath = boost::filesystem::path( deleteURLScheme(io_filename) );

localPath.normalize();
// Relative path check & translate to absolute path
if ( ! exists(localPath) ){

filesystem::path parentPath( scanner->filename );
boost::filesystem::path parentPath( scanner->filename );
#if BOOST_VERSION < 103600
localPath = parentPath.branch_path() / localPath;
#else
Expand Down
4 changes: 2 additions & 2 deletions server/ControllerBridge/BridgeConf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void BridgeConf::parseOptions()
vector<string> values = vmap["module"].as<vector<string> >();
for(size_t i=0; i < values.size(); ++i){
string modulePath( values[i] );
if( filesystem::extension(filesystem::path( modulePath )).empty() )
if( boost::filesystem::extension(boost::filesystem::path( modulePath )).empty() )
{
modulePath += string( SUFFIX_SHARED_EXT );
}
Expand Down Expand Up @@ -326,7 +326,7 @@ void BridgeConf::addModuleInfo(const std::string& value)
} else {
ModuleInfo info;
info.fileName = parameters[0];
info.componentName = filesystem::basename(filesystem::path(info.fileName));
info.componentName = boost::filesystem::basename(boost::filesystem::path(info.fileName));
if(parameters.size() == 1){
info.initFuncName = info.componentName + "Init";
} else {
Expand Down
5 changes: 0 additions & 5 deletions server/ModelLoader/ModelLoader_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ static void changetoBoundingBox(POA_OpenHRP::BodyInfo* bodyInfo, unsigned int* d
}

BodyInfo_ptr ModelLoader_impl::loadBodyInfo(const char* url)
throw (CORBA::SystemException, OpenHRP::ModelLoader::ModelLoaderException)
{
OpenHRP::ModelLoader::ModelLoadOption option;
option.readImage = false;
Expand All @@ -168,7 +167,6 @@ BodyInfo_ptr ModelLoader_impl::loadBodyInfo(const char* url)
}

BodyInfo_ptr ModelLoader_impl::loadBodyInfoEx(const char* url, const OpenHRP::ModelLoader::ModelLoadOption& option)
throw (CORBA::SystemException, OpenHRP::ModelLoader::ModelLoaderException)
{
POA_OpenHRP::BodyInfo* bodyInfo = loadBodyInfoFromModelFile(replaceProjectDir(std::string(url)), option);
if(option.AABBdata.length()){
Expand All @@ -184,7 +182,6 @@ BodyInfo_ptr ModelLoader_impl::loadBodyInfoEx(const char* url, const OpenHRP::Mo
}

BodyInfo_ptr ModelLoader_impl::getBodyInfoEx(const char* url0, const OpenHRP::ModelLoader::ModelLoadOption& option)
throw (CORBA::SystemException, OpenHRP::ModelLoader::ModelLoaderException)
{
string url(url0);

Expand Down Expand Up @@ -217,7 +214,6 @@ BodyInfo_ptr ModelLoader_impl::getBodyInfoEx(const char* url0, const OpenHRP::Mo
}

BodyInfo_ptr ModelLoader_impl::getBodyInfo(const char* url)
throw (CORBA::SystemException, OpenHRP::ModelLoader::ModelLoaderException)
{
OpenHRP::ModelLoader::ModelLoadOption option;
option.readImage = false;
Expand Down Expand Up @@ -282,7 +278,6 @@ POA_OpenHRP::BodyInfo* ModelLoader_impl::loadBodyInfoFromModelFile(const string


SceneInfo_ptr ModelLoader_impl::loadSceneInfo(const char* url)
throw (CORBA::SystemException, OpenHRP::ModelLoader::ModelLoaderException)
{
cout << "loading " << url << endl;

Expand Down
15 changes: 5 additions & 10 deletions server/ModelLoader/ModelLoader_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,15 @@ class ModelLoader_impl : public POA_OpenHRP::ModelLoader

virtual PortableServer::POA_ptr _default_POA();

virtual BodyInfo_ptr getBodyInfo(const char* url)
throw (CORBA::SystemException, OpenHRP::ModelLoader::ModelLoaderException);
virtual BodyInfo_ptr getBodyInfo(const char* url);

virtual BodyInfo_ptr getBodyInfoEx(const char* url, const OpenHRP::ModelLoader::ModelLoadOption& option )
throw (CORBA::SystemException, OpenHRP::ModelLoader::ModelLoaderException);
virtual BodyInfo_ptr getBodyInfoEx(const char* url, const OpenHRP::ModelLoader::ModelLoadOption& option );

virtual BodyInfo_ptr loadBodyInfo(const char* url)
throw (CORBA::SystemException, OpenHRP::ModelLoader::ModelLoaderException);
virtual BodyInfo_ptr loadBodyInfo(const char* url);

virtual BodyInfo_ptr loadBodyInfoEx(const char* url, const OpenHRP::ModelLoader::ModelLoadOption& option)
throw (CORBA::SystemException, OpenHRP::ModelLoader::ModelLoaderException);
virtual BodyInfo_ptr loadBodyInfoEx(const char* url, const OpenHRP::ModelLoader::ModelLoadOption& option);

virtual SceneInfo_ptr loadSceneInfo(const char* url)
throw (CORBA::SystemException, OpenHRP::ModelLoader::ModelLoaderException);
virtual SceneInfo_ptr loadSceneInfo(const char* url);

virtual void clearData();

Expand Down

0 comments on commit f5308de

Please sign in to comment.