From 24604c0f79b945a577eda57cc4b99c11f1b5a511 Mon Sep 17 00:00:00 2001 From: "woody.chow" Date: Thu, 24 Jan 2019 09:56:23 +0900 Subject: [PATCH 01/38] Replace semicollons in FCL_LDFLAGS with spaces. This fixes https://github.com/rdiankov/openrave/issues/633 --- plugins/fclrave/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/fclrave/CMakeLists.txt b/plugins/fclrave/CMakeLists.txt index 49a01909b5..06b26ba1c7 100644 --- a/plugins/fclrave/CMakeLists.txt +++ b/plugins/fclrave/CMakeLists.txt @@ -74,7 +74,8 @@ if( FCL_FOUND ) if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR COMPILER_IS_CLANG) add_definitions("-std=c++11") endif() - set_target_properties(fclrave PROPERTIES COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} ${FCL_CFLAGS_OTHER} -std=c++11" LINK_FLAGS "${PLUGIN_LINK_FLAGS}" ${FCL_LDFLAGS}) + string(REPLACE ";" " " FCL_LDFLAGS_STR "${FCL_LDFLAGS}") + set_target_properties(fclrave PROPERTIES COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} ${FCL_CFLAGS_OTHER} -std=c++11" LINK_FLAGS "${PLUGIN_LINK_FLAGS} ${FCL_LDFLAGS_STR}") install(TARGETS fclrave DESTINATION ${OPENRAVE_PLUGINS_INSTALL_DIR} COMPONENT ${COMPONENT_PREFIX}plugin-fclrave) else() message(STATUS "Could not find FCL. Please install FCL (https://github.com/flexible-collision-library/fcl)") From b6e9921664d768661c528deaabb693080ab7708e Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Tue, 12 May 2020 13:00:46 +0900 Subject: [PATCH 02/38] fixed fclrave CMAKE_REQUIRED_FLAGS --- plugins/fclrave/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/fclrave/CMakeLists.txt b/plugins/fclrave/CMakeLists.txt index 06b26ba1c7..d72995802e 100644 --- a/plugins/fclrave/CMakeLists.txt +++ b/plugins/fclrave/CMakeLists.txt @@ -33,8 +33,9 @@ if( FCL_FOUND ) STRING( REGEX REPLACE "[0-9]+.([0-9]+).[0-9]+" "\\1" FCL_MINOR_VERSION ${FCL_VERSION}) if(FCL_MINOR_VERSION GREATER "4") + string(REPLACE ";" " " FCL_LDFLAGS_STR "${FCL_LDFLAGS}") set(CMAKE_REQUIRED_INCLUDES ${FCL_INCLUDE_DIRS} ${FCL_INCLUDEDIR}) - set(CMAKE_REQUIRED_FLAGS "${PLUGIN_COMPILE_FLAGS} ${FCL_CFLAGS_OTHER} -std=c++11 ${PLUGIN_LINK_FLAGS} ${FCL_LDFLAGS}") + set(CMAKE_REQUIRED_FLAGS "${PLUGIN_COMPILE_FLAGS} ${FCL_CFLAGS_OTHER} -std=c++11 ${PLUGIN_LINK_FLAGS} ${FCL_LDFLAGS_STR}") set(CMAKE_REQUIRED_LIBRARIES fcl) check_cxx_source_compiles(" #include @@ -74,7 +75,6 @@ if( FCL_FOUND ) if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR COMPILER_IS_CLANG) add_definitions("-std=c++11") endif() - string(REPLACE ";" " " FCL_LDFLAGS_STR "${FCL_LDFLAGS}") set_target_properties(fclrave PROPERTIES COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} ${FCL_CFLAGS_OTHER} -std=c++11" LINK_FLAGS "${PLUGIN_LINK_FLAGS} ${FCL_LDFLAGS_STR}") install(TARGETS fclrave DESTINATION ${OPENRAVE_PLUGINS_INSTALL_DIR} COMPONENT ${COMPONENT_PREFIX}plugin-fclrave) else() From dc52e2da07b3210c7d7bd5b942bd8077d58babf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20=C5=81ukawski?= Date: Fri, 11 Aug 2023 21:03:38 +0200 Subject: [PATCH 03/38] Unbreak export for CMake 3.16 and Python-less consumers --- openrave-config.cmake.in | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/openrave-config.cmake.in b/openrave-config.cmake.in index 609e2e1377..b7389e8fe4 100644 --- a/openrave-config.cmake.in +++ b/openrave-config.cmake.in @@ -46,7 +46,6 @@ set_and_check(OpenRAVE_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUD set_and_check(OpenRAVE_RAPIDJSON_INCLUDE_DIR "@RAPIDJSON_INCLUDES@") set( OpenRAVE_INCLUDE_DIRS ${OpenRAVE_INCLUDE_DIR} ${OpenRAVE_RAPIDJSON_INCLUDE_DIR} ) -set( OpenRAVE_LIBRARIES libopenrave ) set( OpenRAVE_Boost_VERSION "@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@" ) set( OpenRAVE_BLA_VENDOR "@BLA_VENDOR@" ) set( OpenRAVE_CXX_FLAGS "-DOPENRAVE_DLL -DOPENRAVE_CORE_DLL" ) @@ -90,16 +89,13 @@ if (OpenRAVE_USE_PYBIND11_PYTHON_BINDINGS OR OpenRAVE_USE_PYBIND11_PYTHON3_BINDI else() find_package(Boost ${OpenRAVE_Boost_VERSION} REQUIRED COMPONENTS python) endif() -set_and_check(OpenRAVE_PYTHON_DIR "${OpenRAVE_PYTHON_DIR}") # Backward compatibility only. get_target_property(libopenrave_LOCATION OpenRAVE::libopenrave LOCATION) get_target_property(libopenrave-core_LOCATION OpenRAVE::libopenrave-core LOCATION) +set(OpenRAVE_LIBRARIES "${libopenrave_LOCATION}") set(OpenRAVE_CORE_LIBRARIES "${libopenrave_LOCATION};${libopenrave-core_LOCATION}") -add_library(libopenrave ALIAS OpenRAVE::libopenrave) -add_library(libopenrave-core ALIAS OpenRAVE::libopenrave-core) - find_package(Eigen3 3.3.7 REQUIRED) message(STATUS "Found OpenRAVE ${OpenRAVE_VERSION}, compiled with Boost ${OpenRAVE_Boost_VERSION}.") @@ -107,4 +103,4 @@ message(STATUS "Found OpenRAVE ${OpenRAVE_VERSION}, compiled with Boost ${OpenRA mark_as_advanced( libopenrave_LOCATION libopenrave-core_LOCATION -) \ No newline at end of file +) From bac0cbdc980e840dda923e36ec88123105653bb9 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Fri, 18 Aug 2023 01:10:19 +0900 Subject: [PATCH 04/38] link OpenRAVE::libopenrave instead --- openrave-config.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openrave-config.cmake.in b/openrave-config.cmake.in index b7389e8fe4..1a6fe83a86 100644 --- a/openrave-config.cmake.in +++ b/openrave-config.cmake.in @@ -93,7 +93,7 @@ endif() # Backward compatibility only. get_target_property(libopenrave_LOCATION OpenRAVE::libopenrave LOCATION) get_target_property(libopenrave-core_LOCATION OpenRAVE::libopenrave-core LOCATION) -set(OpenRAVE_LIBRARIES "${libopenrave_LOCATION}") +set(OpenRAVE_LIBRARIES OpenRAVE::libopenrave) set(OpenRAVE_CORE_LIBRARIES "${libopenrave_LOCATION};${libopenrave-core_LOCATION}") find_package(Eigen3 3.3.7 REQUIRED) From 25acbe59f5d1157069adcb5175c5b75f641f9c78 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Fri, 18 Aug 2023 01:15:44 +0900 Subject: [PATCH 05/38] modify OPENRAVE_CORE_LIBRARIES as well --- openrave-config.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openrave-config.cmake.in b/openrave-config.cmake.in index 1a6fe83a86..4a2293db5c 100644 --- a/openrave-config.cmake.in +++ b/openrave-config.cmake.in @@ -94,7 +94,7 @@ endif() get_target_property(libopenrave_LOCATION OpenRAVE::libopenrave LOCATION) get_target_property(libopenrave-core_LOCATION OpenRAVE::libopenrave-core LOCATION) set(OpenRAVE_LIBRARIES OpenRAVE::libopenrave) -set(OpenRAVE_CORE_LIBRARIES "${libopenrave_LOCATION};${libopenrave-core_LOCATION}") +set(OpenRAVE_CORE_LIBRARIES OpenRAVE::libopenrave;OpenRAVE::libopenrave-core) find_package(Eigen3 3.3.7 REQUIRED) From c71b2829fa7df4e94ab2700cf5d5f37c48539d65 Mon Sep 17 00:00:00 2001 From: nothingstopsme Date: Sun, 27 Aug 2023 17:00:23 +0800 Subject: [PATCH 06/38] Correct the typo: tan(self.tvar) -> tan(self.var) in the "subsinv" list Not sure if that affected pair in the "subsinv" list is ever used for symbol substitution when solving equations, but I think it might be a good idea to have it corrected before that typo leads to any future issues. --- python/ikfast.py | 2 +- python/ikfast_sympy0_6.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/ikfast.py b/python/ikfast.py index 65f585007e..8de4066672 100644 --- a/python/ikfast.py +++ b/python/ikfast.py @@ -1343,7 +1343,7 @@ def __init__(self, var): self.htvar = Symbol("ht%s"%var.name) self.vars = [self.var,self.svar,self.cvar,self.tvar,self.htvar] self.subs = [(cos(self.var),self.cvar),(sin(self.var),self.svar),(tan(self.var),self.tvar),(tan(self.var/2),self.htvar)] - self.subsinv = [(self.cvar,cos(self.var)),(self.svar, sin(self.var)),(self.tvar,tan(self.tvar))] + self.subsinv = [(self.cvar,cos(self.var)),(self.svar, sin(self.var)),(self.tvar,tan(self.var))] def getsubs(self,value): return [(self.var,value)]+[(s,v.subs(self.var,value).evalf()) for v,s in self.subs] diff --git a/python/ikfast_sympy0_6.py b/python/ikfast_sympy0_6.py index fd38fb0a7a..ae85223ac4 100644 --- a/python/ikfast_sympy0_6.py +++ b/python/ikfast_sympy0_6.py @@ -1036,7 +1036,7 @@ def __init__(self, var): self.htvar = Symbol("ht%s"%var.name) self.vars = [self.var,self.svar,self.cvar,self.tvar,self.htvar] self.subs = [(cos(self.var),self.cvar),(sin(self.var),self.svar),(tan(self.var),self.tvar),(tan(self.var/2),self.htvar)] - self.subsinv = [(self.cvar,cos(self.var)),(self.svar, sin(self.var)),(self.tvar,tan(self.tvar))] + self.subsinv = [(self.cvar,cos(self.var)),(self.svar, sin(self.var)),(self.tvar,tan(self.var))] def getsubs(self,value): return [(self.var,value)]+[(s,v.subs(self.var,value).evalf()) for v,s in self.subs] From d120c1aecd7983850027786ab630eade110c7514 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Mon, 16 Oct 2023 15:43:01 +0900 Subject: [PATCH 07/38] Revert "revert constexpr change until it can be tested more" This reverts commit 3bc6152ed7a26925c0bfc34d5bf40ac751617925. --- include/openrave/units.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/openrave/units.h b/include/openrave/units.h index c2dd9d49bc..02c47b6d43 100644 --- a/include/openrave/units.h +++ b/include/openrave/units.h @@ -156,7 +156,7 @@ inline T GetLengthUnitStandardValue(const std::string& s) { // \brief how many units in a meter template -inline T GetLengthUnitStandardValue(const LengthUnit unit) +constexpr inline T GetLengthUnitStandardValue(const LengthUnit unit) { if( unit == OpenRAVE::LU_Meter ) { return T(1.0); @@ -187,6 +187,7 @@ inline T GetLengthUnitStandardValue(const LengthUnit unit) } throw OPENRAVE_EXCEPTION_FORMAT("Unsupported length unit '%s'", GetLengthUnitString(unit), ORE_LengthUnitInvalid); + return T{}; } template @@ -239,7 +240,7 @@ inline T GetMassUnitStandardValue(const std::string& s) { // \brief how many units in a gram template -inline T GetMassUnitStandardValue(const MassUnit unit) +constexpr inline T GetMassUnitStandardValue(const MassUnit unit) { if( unit == OpenRAVE::MU_Gram ) { return T(1.0); @@ -255,6 +256,7 @@ inline T GetMassUnitStandardValue(const MassUnit unit) } throw OPENRAVE_EXCEPTION_FORMAT("Unsupported mass unit '%s'", GetMassUnitString(unit), ORE_LengthUnitInvalid); + return T{}; } template @@ -310,7 +312,7 @@ inline T GetTimeUnitStandardValue(const std::string& s) { // \brief how many units in a second template -inline T GetTimeUnitStandardValue(const TimeUnit unit) +constexpr inline T GetTimeUnitStandardValue(const TimeUnit unit) { if( unit == OpenRAVE::TU_Second ) { return T(1.0); @@ -329,6 +331,7 @@ inline T GetTimeUnitStandardValue(const TimeUnit unit) } throw OPENRAVE_EXCEPTION_FORMAT("Unsupported time unit '%s'", GetTimeUnitString(unit), ORE_LengthUnitInvalid); + return T{}; } template @@ -376,7 +379,7 @@ inline T GetAngleUnitStandardValue(const std::string& s) { // \brief how many units in a radian template -inline T GetAngleUnitStandardValue(const AngleUnit unit) +constexpr inline T GetAngleUnitStandardValue(const AngleUnit unit) { if( unit == OpenRAVE::AU_Radian ) { return T(1.0); @@ -386,6 +389,7 @@ inline T GetAngleUnitStandardValue(const AngleUnit unit) } throw OPENRAVE_EXCEPTION_FORMAT("Unsupported angle unit '%s'", GetAngleUnitString(unit), ORE_LengthUnitInvalid); + return T{}; } template From 51cfe72ceaec9cb125cadc26366efdf6640724c9 Mon Sep 17 00:00:00 2001 From: Eisoku Kuroiwa Date: Tue, 7 Nov 2023 20:05:17 +0900 Subject: [PATCH 08/38] add AABBFromOrientedBox --- CMakeLists.txt | 4 ++-- docs/source/changelog.rst | 5 +++++ include/openrave/geometry.h | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index afa8b74539..a60f6c0f17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,8 @@ set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE ) # Define here the needed parameters set (OPENRAVE_VERSION_MAJOR 0) -set (OPENRAVE_VERSION_MINOR 133) -set (OPENRAVE_VERSION_PATCH 3) +set (OPENRAVE_VERSION_MINOR 134) +set (OPENRAVE_VERSION_PATCH 0) set (OPENRAVE_VERSION ${OPENRAVE_VERSION_MAJOR}.${OPENRAVE_VERSION_MINOR}.${OPENRAVE_VERSION_PATCH}) set (OPENRAVE_SOVERSION ${OPENRAVE_VERSION_MAJOR}.${OPENRAVE_VERSION_MINOR}) message(STATUS "Compiling OpenRAVE Version ${OPENRAVE_VERSION}, soversion=${OPENRAVE_SOVERSION}") diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 3b704d9131..8feda28583 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -6,6 +6,11 @@ ChangeLog Unreleased ========== +Version 0.134.0 +=============== + +* Add AABBFromOrientedBox + Version 0.133.3 =============== diff --git a/include/openrave/geometry.h b/include/openrave/geometry.h index fd3ab10e22..c93b59d197 100644 --- a/include/openrave/geometry.h +++ b/include/openrave/geometry.h @@ -1932,6 +1932,24 @@ inline RaveOrientedBox OrientedBoxFromAABB(const RaveAxisAlignedBox& ab, c return OrientedBoxFromAABB(ab,RaveTransform(t)); } +/// \brief Transform an axis aligned bounding box to an oriented bounding box expressed in transform. +/// +/// \ingroup geometric_primitives +/// \param[in] t transformation used to set the coordinate system of ab. +template +inline RaveAxisAlignedBox AABBFromOrientedBox(RaveOrientedBox obb) +{ + const RaveTransformMatrix rotationMatrix = matrixFromQuat(obb.transform.rot); + RaveVector newExtents(0, 0, 0); + for (size_t iRow = 0; iRow < 3; ++iRow) { + for (size_t iCol = 0; iCol < 3; ++iCol) { + newExtents[iRow] += RaveFabs(rotationMatrix.m[4 * iRow + iCol]) * obb.extents[iCol]; + } + } + const RaveAxisAlignedBox ab(obb.transform.trans, newExtents); + return ab; +} + /// \brief Transforms an oriented bounding box. /// /// \ingroup geometric_primitives From cc8c7f9d7f73886f483c1bd5bfe29afe4b4f61c1 Mon Sep 17 00:00:00 2001 From: Eisoku Kuroiwa Date: Thu, 9 Nov 2023 15:17:24 +0900 Subject: [PATCH 09/38] fix docstring and use const reference --- include/openrave/geometry.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/openrave/geometry.h b/include/openrave/geometry.h index c93b59d197..efe41f385b 100644 --- a/include/openrave/geometry.h +++ b/include/openrave/geometry.h @@ -1932,12 +1932,11 @@ inline RaveOrientedBox OrientedBoxFromAABB(const RaveAxisAlignedBox& ab, c return OrientedBoxFromAABB(ab,RaveTransform(t)); } -/// \brief Transform an axis aligned bounding box to an oriented bounding box expressed in transform. +/// \brief projects an obb along the world axes /// /// \ingroup geometric_primitives -/// \param[in] t transformation used to set the coordinate system of ab. template -inline RaveAxisAlignedBox AABBFromOrientedBox(RaveOrientedBox obb) +inline RaveAxisAlignedBox AABBFromOrientedBox(const RaveOrientedBox& obb) { const RaveTransformMatrix rotationMatrix = matrixFromQuat(obb.transform.rot); RaveVector newExtents(0, 0, 0); From c11d17683d35495e4c1c3712019bfd68906b818d Mon Sep 17 00:00:00 2001 From: "justin.schaare" Date: Fri, 10 Nov 2023 13:21:50 +0900 Subject: [PATCH 10/38] add SetUserText to display custom text within viewer --- include/openrave/viewer.h | 2 ++ plugins/qtcoinrave/qtcoinviewer.cpp | 9 +++++++++ plugins/qtcoinrave/qtcoinviewer.h | 2 ++ plugins/qtosgrave/osgviewerwidget.cpp | 2 +- plugins/qtosgrave/qtosgviewer.cpp | 5 +++++ plugins/qtosgrave/qtosgviewer.h | 3 +++ python/bindings/openravepy_viewer.cpp | 4 ++++ 7 files changed, 26 insertions(+), 1 deletion(-) diff --git a/include/openrave/viewer.h b/include/openrave/viewer.h index c88bc5bfc0..cce8deec40 100644 --- a/include/openrave/viewer.h +++ b/include/openrave/viewer.h @@ -174,6 +174,8 @@ class OPENRAVE_API ViewerBase : public InterfaceBase SetName(ptitle); } + virtual void SetUserText(const std::string& userText) OPENRAVE_DUMMY_IMPLEMENTATION; + /// \brief controls showing the viewer. /// /// \param showtype If zero, will hide all viewers. If != 0, should show viewers (dependent on plugin could have different meanings) diff --git a/plugins/qtcoinrave/qtcoinviewer.cpp b/plugins/qtcoinrave/qtcoinviewer.cpp index f96925233e..5a65fda724 100644 --- a/plugins/qtcoinrave/qtcoinviewer.cpp +++ b/plugins/qtcoinrave/qtcoinviewer.cpp @@ -635,6 +635,11 @@ void QtCoinViewer::_SetName(const string& ptitle) setWindowTitle(ptitle.c_str()); } +void QtCoinViewer::SetUserText(const string& ) +{ + _userText = userText; +} + bool QtCoinViewer::LoadModel(const string& pfilename) { SoInput mySceneInput; @@ -2791,6 +2796,10 @@ void QtCoinViewer::AdvanceFrame(bool bForward) _pdragger->GetMessage(ss); } + if (_userText.size() > 0 ) { + ss << _userText << endl; + } + // adjust the shadow text SbViewportRegion v = _pviewer->getViewportRegion(); float fwratio = 964.0f/v.getWindowSize()[0], fhratio = 688.0f/v.getWindowSize()[1]; diff --git a/plugins/qtcoinrave/qtcoinviewer.h b/plugins/qtcoinrave/qtcoinviewer.h index 37fc02c248..1f8c04166d 100644 --- a/plugins/qtcoinrave/qtcoinviewer.h +++ b/plugins/qtcoinrave/qtcoinviewer.h @@ -131,6 +131,7 @@ class QtCoinViewer : public QMainWindow, public ViewerBase virtual const std::string& GetName() const { return _name; } + virtual void SetUserText(const string& userText); virtual bool LoadModel(const string& filename); @@ -419,6 +420,7 @@ public slots: int _VideoFrameRate; std::string _name; + std::string _userText; std::map _mapbodies; ///< all the bodies created ItemPtr _pSelectedItem; ///< the currently selected item diff --git a/plugins/qtosgrave/osgviewerwidget.cpp b/plugins/qtosgrave/osgviewerwidget.cpp index fc88dd27df..837fc14420 100644 --- a/plugins/qtosgrave/osgviewerwidget.cpp +++ b/plugins/qtosgrave/osgviewerwidget.cpp @@ -1063,7 +1063,7 @@ void QOSGViewerWidget::_UpdateHUDText() if( s.size() > 0 ) { s += "\n"; } - s += _strRayInfoText; + s += _strUserText; } if( _strSelectedItemText.size() > 0 ) { if( s.size() > 0 ) { diff --git a/plugins/qtosgrave/qtosgviewer.cpp b/plugins/qtosgrave/qtosgviewer.cpp index 56b13fbe1e..f76897456d 100644 --- a/plugins/qtosgrave/qtosgviewer.cpp +++ b/plugins/qtosgrave/qtosgviewer.cpp @@ -2035,6 +2035,11 @@ void QtOSGViewer::_SetName(const string& name) setWindowTitle(name.c_str()); } +void QtOSGViewer::SetUserText(const string& userText) +{ + _posgWidget->SetUserHUDText(userText); +} + bool QtOSGViewer::LoadModel(const string& filename) { if( filename == "") { diff --git a/plugins/qtosgrave/qtosgviewer.h b/plugins/qtosgrave/qtosgviewer.h index 5c3369399c..c02aebc140 100644 --- a/plugins/qtosgrave/qtosgviewer.h +++ b/plugins/qtosgrave/qtosgviewer.h @@ -110,6 +110,9 @@ class QtOSGViewer : public QMainWindow, public ViewerBase /// \brief Set title of the viewer window virtual void SetName(const string& name); + /// \brief Set User-defined text to be displayed in the viewer window + virtual void SetUserText(const string& userText); + /// \brief notified when a body has been removed from the environment virtual void RemoveKinBody(KinBodyPtr pbody) { if( !!pbody ) { diff --git a/python/bindings/openravepy_viewer.cpp b/python/bindings/openravepy_viewer.cpp index 6fcf1db0da..2dbbc41934 100644 --- a/python/bindings/openravepy_viewer.cpp +++ b/python/bindings/openravepy_viewer.cpp @@ -255,6 +255,9 @@ class PyViewerBase : public PyInterfaceBase void SetName(const std::string &title) { _pviewer->SetName(title); } + void SetUserText(const std::string &userText) { + _pviewer->SetUserText(userText); + } std::string GetName() { return _pviewer->GetName(); } @@ -382,6 +385,7 @@ void init_openravepy_viewer() .def("Move",&PyViewerBase::Move, PY_ARGS("x", "y") DOXY_FN(ViewerBase,Move)) .def("Show",&PyViewerBase::Show, PY_ARGS("showtype") DOXY_FN(ViewerBase,Show)) .def("SetTitle",&PyViewerBase::SetName, PY_ARGS("title") DOXY_FN(ViewerBase,SetName)) + .def("SetUserText",&PyViewerBase::SetUserText, PY_ARGS("userText") DOXY_FN(ViewerBase,SetUserText)) .def("SetName",&PyViewerBase::SetName, PY_ARGS("title") DOXY_FN(ViewerBase,SetName)) .def("GetName",&PyViewerBase::GetName, DOXY_FN(ViewerBase,GetName)) .def("RegisterCallback",&PyViewerBase::RegisterCallback, PY_ARGS("properties", "callback") DOXY_FN(ViewerBase,RegisterItemSelectionCallback)) From d2888c321eecec77a49d3f31d5d4c91967d969fe Mon Sep 17 00:00:00 2001 From: "rosen.diankov@gmail.com" Date: Fri, 10 Nov 2023 13:41:01 -0500 Subject: [PATCH 11/38] add SetUserText --- docs/source/changelog.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 8feda28583..1aaab1580f 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -11,6 +11,8 @@ Version 0.134.0 * Add AABBFromOrientedBox +* Add ViewerBase::SetUserText + Version 0.133.3 =============== From 50b9ae1a2bd1d529270db33545ff5162c49417c0 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Mon, 13 Nov 2023 09:33:44 +0900 Subject: [PATCH 12/38] Fix QtCoin SetUserText --- plugins/qtcoinrave/qtcoinviewer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/qtcoinrave/qtcoinviewer.cpp b/plugins/qtcoinrave/qtcoinviewer.cpp index 5a65fda724..ccd78c6a76 100644 --- a/plugins/qtcoinrave/qtcoinviewer.cpp +++ b/plugins/qtcoinrave/qtcoinviewer.cpp @@ -635,7 +635,7 @@ void QtCoinViewer::_SetName(const string& ptitle) setWindowTitle(ptitle.c_str()); } -void QtCoinViewer::SetUserText(const string& ) +void QtCoinViewer::SetUserText(const string& userText) { _userText = userText; } From 0c6d9f00e2c4dbd6ff5c39e56bdaa61aa1ae8145 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Mon, 13 Nov 2023 09:36:53 +0900 Subject: [PATCH 13/38] bump version --- CMakeLists.txt | 2 +- docs/source/changelog.rst | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a60f6c0f17..9106f2109b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE ) # Define here the needed parameters set (OPENRAVE_VERSION_MAJOR 0) set (OPENRAVE_VERSION_MINOR 134) -set (OPENRAVE_VERSION_PATCH 0) +set (OPENRAVE_VERSION_PATCH 1) set (OPENRAVE_VERSION ${OPENRAVE_VERSION_MAJOR}.${OPENRAVE_VERSION_MINOR}.${OPENRAVE_VERSION_PATCH}) set (OPENRAVE_SOVERSION ${OPENRAVE_VERSION_MAJOR}.${OPENRAVE_VERSION_MINOR}) message(STATUS "Compiling OpenRAVE Version ${OPENRAVE_VERSION}, soversion=${OPENRAVE_SOVERSION}") diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 1aaab1580f..0b3ec215b5 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -6,6 +6,11 @@ ChangeLog Unreleased ========== +Version 0.134.1 +=============== + +* Fixed QtCoinViewer SetUserText, fixing compilation + Version 0.134.0 =============== From b30e378392900e421d7b15eb7f89b59a850209cd Mon Sep 17 00:00:00 2001 From: Eisoku Kuroiwa Date: Mon, 13 Nov 2023 15:27:40 +0900 Subject: [PATCH 14/38] add OBB collision check --- include/openrave/geometry.h | 171 ++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) diff --git a/include/openrave/geometry.h b/include/openrave/geometry.h index efe41f385b..5d2154b0fb 100644 --- a/include/openrave/geometry.h +++ b/include/openrave/geometry.h @@ -896,6 +896,11 @@ class RaveOrientedBox RaveTransform transform; RaveVector extents; + RaveOrientedBox() { + } + RaveOrientedBox(const RaveTransform& vtransform, const RaveVector& vextents) : transform(vtransform), extents(vextents) { + } + template inline bool operator==(const RaveOrientedBox& other) const { return transform == other.transform && extents == other.extents; @@ -2002,6 +2007,172 @@ inline bool AABBCollision(const RaveAxisAlignedBox& ab1, const RaveAxisAligne return MATH_FABS(v.x) <= ab1.extents.x+ab2.extents.x && MATH_FABS(v.y) <= ab1.extents.y+ab2.extents.y && MATH_FABS(v.z) <= ab1.extents.z+ab2.extents.z; } +/// \brief Test collision between two oriented bounding boxes. +template +inline bool OBBCollision(const RaveOrientedBox& obb1, const RaveOrientedBox& obb2) +{ + const RaveTransform relativeTransform = obb1.transform.inverse() * obb2.transform; + return BoxAtOriginOBBCollision(obb1.extents, RaveOrientedBox(relativeTransform, obb2.extents)); +} + +/// \brief Test collision between an axis-aligned bounding box and an oriented bounding box. +template +inline bool AABBOBBCollision(const RaveAxisAlignedBox& ab, const RaveOrientedBox& obb) +{ + const RaveTransform relativeTransform(obb.transform.rot, obb.transform.trans - ab.pos); + return BoxAtOriginOBBCollision(ab.extents, RaveOrientedBox(relativeTransform, obb.extents)); +} + +/// \brief Test collision between an axis-aligned bounding box located at world origin and an oriented bounding box. +/// using Separating Axis Theorem. +/// S. Gottschalk, M.C. Lin, D. Manocha. OBBTree: A Hierarchical Structure for Rapid Interference Detection. In Proceedings of SIGGRAPH '96. +template +inline bool BoxAtOriginOBBCollision(const RaveVector& extents, const RaveOrientedBox& obb) +{ + const RaveVector& relativeCenter = obb.transform.trans; + const RaveTransformMatrix relativeRotationMatrix = matrixFromQuat(obb.transform.rot); + // rotation matrix + // 0 1 2 + // 4 5 6 + // 8 9 10 + const std::array, 3> relativeCoordinateAxes = { + RaveVector(relativeRotationMatrix.m[0], relativeRotationMatrix.m[4], relativeRotationMatrix.m[8]), + RaveVector(relativeRotationMatrix.m[1], relativeRotationMatrix.m[5], relativeRotationMatrix.m[9]), + RaveVector(relativeRotationMatrix.m[2], relativeRotationMatrix.m[6], relativeRotationMatrix.m[10]) + }; + const std::array, 3> absRelativeCoordinateAxes = { + RaveVector(MATH_FABS(relativeCoordinateAxes[0].x), MATH_FABS(relativeCoordinateAxes[0].y), MATH_FABS(relativeCoordinateAxes[0].z)), + RaveVector(MATH_FABS(relativeCoordinateAxes[1].x), MATH_FABS(relativeCoordinateAxes[1].y), MATH_FABS(relativeCoordinateAxes[1].z)), + RaveVector(MATH_FABS(relativeCoordinateAxes[2].x), MATH_FABS(relativeCoordinateAxes[2].y), MATH_FABS(relativeCoordinateAxes[2].z)) + }; + + // centerDistanceInSeparatingAxis = |dot(separatingAxis, relativeCenter)| + // box1ExtentsInSeparatingAxis = dot(|separatingAxis|, extents) + // box2ExtentsInSeparatingAxis = dot(|separatingAxis in box2 frame|, obb.extents) = dot(|relativeRotationMatrix^T separatingAxis|, obb.extents) + + // 3 separating axes from box1 represented by extents: [1, 0, 0]^T, [0, 1, 0]^T, [0, 0, 1]^T + for (size_t iAxis = 0; iAxis < 3; ++iAxis) { + const T centerDistanceInSeparatingAxis = MATH_FABS(relativeCenter[iAxis]); + const T box1ExtentsInSeparatingAxis = extents[iAxis]; // always positive + T box2ExtentsInSeparatingAxis = 0; + for (size_t iXYZ = 0; iXYZ < 3; ++iXYZ) { + box2ExtentsInSeparatingAxis += absRelativeCoordinateAxes[iXYZ][iAxis] * obb.extents[iXYZ]; + } + if (centerDistanceInSeparatingAxis > box1ExtentsInSeparatingAxis + box2ExtentsInSeparatingAxis) { + return false; + } + } + // 3 separating axes from box2 represented by obb + for (size_t iAxis = 0; iAxis < 3; ++iAxis) { + const T centerDistanceInSeparatingAxis = MATH_FABS(relativeCoordinateAxes[iAxis].dot3(relativeCenter)); + T box1ExtentsInSeparatingAxis = 0; + for (size_t iXYZ = 0; iXYZ < 3; ++iXYZ) { + box1ExtentsInSeparatingAxis += absRelativeCoordinateAxes[iAxis][iXYZ] * extents[iXYZ]; + } + const T box2ExtentsInSeparatingAxis = obb.extents[iAxis]; + if (centerDistanceInSeparatingAxis > box1ExtentsInSeparatingAxis + box2ExtentsInSeparatingAxis) { + return false; + } + } + + // 9 separating axes + // relativeRotationMatrix^T separatingAxis can be simplified even for these 9 separating axes + for (size_t iAxisForBox1 = 0; iAxisForBox1 < 3; ++iAxisForBox1) { + for (size_t iAxisForBox2 = 0; iAxisForBox2 < 3; ++iAxisForBox2) { + const RaveVector& checkDirectionForBox2 = relativeCoordinateAxes[iAxisForBox2]; + const RaveVector& absCheckDirectionForBox2 = absRelativeCoordinateAxes[iAxisForBox2]; + T centerDistanceInSeparatingAxis = 0; + T box1ExtentsInSeparatingAxis = 0; + T box2ExtentsInSeparatingAxis = 0; + for (size_t iXYZ = 0; iXYZ < 3; ++iXYZ) { + bool needComputation = true; + bool needComputationForBox2 = true; + T coeffForCenter = 0; + T coeffForBox1 = 0; + T coeffForBox2 = 0; + if (iXYZ == 0) { + if (iAxisForBox1 == 0) { + needComputation = false; + } + else if (iAxisForBox1 == 1) { + coeffForCenter = checkDirectionForBox2[2]; + coeffForBox1 = absCheckDirectionForBox2[2]; + } + else { + coeffForCenter = -checkDirectionForBox2[1]; + coeffForBox1 = absCheckDirectionForBox2[1]; + } + if (iAxisForBox2 == 0) { + needComputationForBox2 = false; + } + else if (iAxisForBox2 == 1) { + coeffForBox2 = absRelativeCoordinateAxes[2][iAxisForBox1]; + } + else { + coeffForBox2 = absRelativeCoordinateAxes[1][iAxisForBox1]; + } + } + else if (iXYZ == 1) { + if (iAxisForBox1 == 0) { + coeffForCenter = -checkDirectionForBox2[2]; + coeffForBox1 = absCheckDirectionForBox2[2]; + } + else if (iAxisForBox1 == 1) { + needComputation = false; + } + else { + coeffForCenter = checkDirectionForBox2[0]; + coeffForBox1 = absCheckDirectionForBox2[0]; + } + if (iAxisForBox2 == 0) { + coeffForBox2 = absRelativeCoordinateAxes[2][iAxisForBox1]; + } + else if (iAxisForBox2 == 1) { + needComputationForBox2 = false; + } + else { + coeffForBox2 = absRelativeCoordinateAxes[0][iAxisForBox1]; + } + } + else if (iXYZ == 2) { + if (iAxisForBox1 == 0) { + coeffForCenter = checkDirectionForBox2[1]; + coeffForBox1 = absCheckDirectionForBox2[1]; + } + else if (iAxisForBox1 == 1) { + coeffForCenter = -checkDirectionForBox2[0]; + coeffForBox1 = absCheckDirectionForBox2[0]; + } + else { + needComputation = false; + } + if (iAxisForBox2 == 0) { + coeffForBox2 = absRelativeCoordinateAxes[1][iAxisForBox1]; + } + else if (iAxisForBox2 == 1) { + coeffForBox2 = absRelativeCoordinateAxes[0][iAxisForBox1]; + } + else { + needComputationForBox2 = false; + } + } + if (needComputation) { // when needComputation is false, coeffForCenter / coeffForBox1 is 0 + centerDistanceInSeparatingAxis += coeffForCenter * relativeCenter[iXYZ]; + box1ExtentsInSeparatingAxis += coeffForBox1 * extents[iXYZ]; + } + if (needComputationForBox2) { + box2ExtentsInSeparatingAxis += coeffForBox2 * obb.extents[iXYZ]; + } + } + centerDistanceInSeparatingAxis = MATH_FABS(centerDistanceInSeparatingAxis); + if (centerDistanceInSeparatingAxis > box1ExtentsInSeparatingAxis + box2ExtentsInSeparatingAxis) { + return false; + } + } + } + return true; +} + //bool AABBOBBTest(const AABB& a, const OBB& o) //{ // DXVEC3 vd = o.vPos - a.vPos; From 9952b7ba36a8b0a10bd44a13f0768f94a8419200 Mon Sep 17 00:00:00 2001 From: Eisoku Kuroiwa Date: Mon, 13 Nov 2023 15:27:56 +0900 Subject: [PATCH 15/38] add python bindings for obb intersection check --- python/bindings/openravepy_global.cpp | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/python/bindings/openravepy_global.cpp b/python/bindings/openravepy_global.cpp index cf473af8fd..f0882a0995 100644 --- a/python/bindings/openravepy_global.cpp +++ b/python/bindings/openravepy_global.cpp @@ -1331,6 +1331,36 @@ object TransformLookat(object olookat, object ocamerapos, object ocameraup) return toPyArray(transformLookat(ExtractVector3(olookat),ExtractVector3(ocamerapos),ExtractVector3(ocameraup))); } +object OrientedBoxFromAABB(object oab, object otransform) +{ + return toPyOrientedBox(OrientedBoxFromAABB(ExtractAABB(oab), ExtractTransform(otransform))); +} + +object AABBFromOrientedBox(object oobb) +{ + return toPyAABB(AABBFromOrientedBox(ExtractOrientedBox(oobb))); +} + +bool AABBCollision(object oab1, object oab2) +{ + return AABBCollision(ExtractAABB(oab1), ExtractAABB(oab2)); +} + +bool OBBCollision(object obb1, object oobb2) +{ + return OBBCollision(ExtractOrientedBox(obb1), ExtractOrientedBox(oobb2)); +} + +bool AABBOBBCollision(object oab, object oobb) +{ + return AABBOBBCollision(ExtractAABB(oab), ExtractOrientedBox(oobb)); +} + +bool BoxAtOriginOBBCollision(object oextents, object oobb) +{ + return BoxAtOriginOBBCollision(ExtractVector3(oextents), ExtractOrientedBox(oobb)); +} + dReal ComputePoseDistSqr(object opose0, object opose1, dReal quatweight=1.0) { Transform t0 = ExtractTransformType(opose0); @@ -2542,6 +2572,12 @@ void init_openravepy_global() #else def("transformLookat",openravepy::TransformLookat,PY_ARGS("lookat","camerapos","cameraup") "Returns a camera matrix that looks along a ray with a desired up vector.\n\n:param lookat: unit axis, 3 values\n\n:param camerapos: 3 values\n\n:param cameraup: unit axis, 3 values\n"); #endif + m.def("OrientedBoxFromAABB",openravepy::OrientedBoxFromAABB,PY_ARGS("aabb","transform") "Transforms an axis aligned bounding box to an oriented bounding box expressed in transform."); + m.def("AABBFromOrientedBox",openravepy::AABBFromOrientedBox,PY_ARGS("obb") "Projects an obb along the world axes."); + m.def("AABBCollision",openravepy::AABBCollision,PY_ARGS("aabb1","aabb2") "Tests collision between two axis-aligned bounding boxes."); + m.def("OBBCollision",openravepy::OBBCollision,PY_ARGS("obb1","obb2") "Tests collision between two oriented bounding boxes."); + m.def("AABBOBBCollision",openravepy::AABBOBBCollision,PY_ARGS("aabb","obb") "Tests collision between an axis-aligned bounding box and an oriented bounding box."); + m.def("BoxAtOriginOBBCollision",openravepy::BoxAtOriginOBBCollision,PY_ARGS("extents","obb") "Tests collision between an axis-aligned bounding box located at world origin and an oriented bounding box."); #ifdef USE_PYBIND11_PYTHON_BINDINGS m.def("matrixSerialization",openravepy::matrixSerialization,PY_ARGS("transform") "Serializes a transformation into a string representing a 3x4 matrix.\n\n:param transform: 3x4 or 4x4 array\n"); #else From 897d77a076ec4df5256fcc9ce3b61f38186888f2 Mon Sep 17 00:00:00 2001 From: Eisoku Kuroiwa Date: Mon, 13 Nov 2023 17:09:33 +0900 Subject: [PATCH 16/38] bump version --- CMakeLists.txt | 4 ++-- docs/source/changelog.rst | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9106f2109b..e6624f4db6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,8 @@ set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE ) # Define here the needed parameters set (OPENRAVE_VERSION_MAJOR 0) -set (OPENRAVE_VERSION_MINOR 134) -set (OPENRAVE_VERSION_PATCH 1) +set (OPENRAVE_VERSION_MINOR 135) +set (OPENRAVE_VERSION_PATCH 0) set (OPENRAVE_VERSION ${OPENRAVE_VERSION_MAJOR}.${OPENRAVE_VERSION_MINOR}.${OPENRAVE_VERSION_PATCH}) set (OPENRAVE_SOVERSION ${OPENRAVE_VERSION_MAJOR}.${OPENRAVE_VERSION_MINOR}) message(STATUS "Compiling OpenRAVE Version ${OPENRAVE_VERSION}, soversion=${OPENRAVE_SOVERSION}") diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 0b3ec215b5..6413e87eb8 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -6,6 +6,11 @@ ChangeLog Unreleased ========== +Version 0.135.0 +=============== + +* Add an OBB intersection check function + Version 0.134.1 =============== From 2f07633c0c5c3510f64bece38af90b6489065adf Mon Sep 17 00:00:00 2001 From: Eisoku Kuroiwa Date: Mon, 13 Nov 2023 19:27:02 +0900 Subject: [PATCH 17/38] improve readability --- include/openrave/geometry.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/include/openrave/geometry.h b/include/openrave/geometry.h index 5d2154b0fb..f9c08faff9 100644 --- a/include/openrave/geometry.h +++ b/include/openrave/geometry.h @@ -2076,31 +2076,31 @@ inline bool BoxAtOriginOBBCollision(const RaveVector& extents, const RaveOrie } // 9 separating axes - // relativeRotationMatrix^T separatingAxis can be simplified even for these 9 separating axes + // relativeRotationMatrix^T separatingAxis can be simplified even for these 9 separating axes using that the rotation matrix of box1 is an identity matrix. It requires to read the original paper to understand this optimization. for (size_t iAxisForBox1 = 0; iAxisForBox1 < 3; ++iAxisForBox1) { for (size_t iAxisForBox2 = 0; iAxisForBox2 < 3; ++iAxisForBox2) { - const RaveVector& checkDirectionForBox2 = relativeCoordinateAxes[iAxisForBox2]; - const RaveVector& absCheckDirectionForBox2 = absRelativeCoordinateAxes[iAxisForBox2]; + const RaveVector& checkAxisForBox2 = relativeCoordinateAxes[iAxisForBox2]; + const RaveVector& absCheckAxisForBox2 = absRelativeCoordinateAxes[iAxisForBox2]; T centerDistanceInSeparatingAxis = 0; T box1ExtentsInSeparatingAxis = 0; T box2ExtentsInSeparatingAxis = 0; for (size_t iXYZ = 0; iXYZ < 3; ++iXYZ) { bool needComputation = true; bool needComputationForBox2 = true; - T coeffForCenter = 0; - T coeffForBox1 = 0; - T coeffForBox2 = 0; + T coeffForCenter = 0; // == separatingAxis[iXYZ] + T coeffForBox1 = 0; // == |separatingAxis|[iXYZ] + T coeffForBox2 = 0; // == |relativeRotationMatrix^T separatingAxis|[iXYZ] if (iXYZ == 0) { if (iAxisForBox1 == 0) { needComputation = false; } else if (iAxisForBox1 == 1) { - coeffForCenter = checkDirectionForBox2[2]; - coeffForBox1 = absCheckDirectionForBox2[2]; + coeffForCenter = checkAxisForBox2[2]; + coeffForBox1 = absCheckAxisForBox2[2]; } else { - coeffForCenter = -checkDirectionForBox2[1]; - coeffForBox1 = absCheckDirectionForBox2[1]; + coeffForCenter = -checkAxisForBox2[1]; + coeffForBox1 = absCheckAxisForBox2[1]; } if (iAxisForBox2 == 0) { needComputationForBox2 = false; @@ -2114,15 +2114,15 @@ inline bool BoxAtOriginOBBCollision(const RaveVector& extents, const RaveOrie } else if (iXYZ == 1) { if (iAxisForBox1 == 0) { - coeffForCenter = -checkDirectionForBox2[2]; - coeffForBox1 = absCheckDirectionForBox2[2]; + coeffForCenter = -checkAxisForBox2[2]; + coeffForBox1 = absCheckAxisForBox2[2]; } else if (iAxisForBox1 == 1) { needComputation = false; } else { - coeffForCenter = checkDirectionForBox2[0]; - coeffForBox1 = absCheckDirectionForBox2[0]; + coeffForCenter = checkAxisForBox2[0]; + coeffForBox1 = absCheckAxisForBox2[0]; } if (iAxisForBox2 == 0) { coeffForBox2 = absRelativeCoordinateAxes[2][iAxisForBox1]; @@ -2136,12 +2136,12 @@ inline bool BoxAtOriginOBBCollision(const RaveVector& extents, const RaveOrie } else if (iXYZ == 2) { if (iAxisForBox1 == 0) { - coeffForCenter = checkDirectionForBox2[1]; - coeffForBox1 = absCheckDirectionForBox2[1]; + coeffForCenter = checkAxisForBox2[1]; + coeffForBox1 = absCheckAxisForBox2[1]; } else if (iAxisForBox1 == 1) { - coeffForCenter = -checkDirectionForBox2[0]; - coeffForBox1 = absCheckDirectionForBox2[0]; + coeffForCenter = -checkAxisForBox2[0]; + coeffForBox1 = absCheckAxisForBox2[0]; } else { needComputation = false; From 0865caaa4cadc82d85e9d2314bc7d2b0dce74b24 Mon Sep 17 00:00:00 2001 From: Eisoku Kuroiwa Date: Mon, 13 Nov 2023 20:44:34 +0900 Subject: [PATCH 18/38] improve readability more --- include/openrave/geometry.h | 104 ++++++++---------------------------- 1 file changed, 22 insertions(+), 82 deletions(-) diff --git a/include/openrave/geometry.h b/include/openrave/geometry.h index f9c08faff9..74dc688241 100644 --- a/include/openrave/geometry.h +++ b/include/openrave/geometry.h @@ -2079,92 +2079,32 @@ inline bool BoxAtOriginOBBCollision(const RaveVector& extents, const RaveOrie // relativeRotationMatrix^T separatingAxis can be simplified even for these 9 separating axes using that the rotation matrix of box1 is an identity matrix. It requires to read the original paper to understand this optimization. for (size_t iAxisForBox1 = 0; iAxisForBox1 < 3; ++iAxisForBox1) { for (size_t iAxisForBox2 = 0; iAxisForBox2 < 3; ++iAxisForBox2) { - const RaveVector& checkAxisForBox2 = relativeCoordinateAxes[iAxisForBox2]; - const RaveVector& absCheckAxisForBox2 = absRelativeCoordinateAxes[iAxisForBox2]; T centerDistanceInSeparatingAxis = 0; T box1ExtentsInSeparatingAxis = 0; - T box2ExtentsInSeparatingAxis = 0; - for (size_t iXYZ = 0; iXYZ < 3; ++iXYZ) { - bool needComputation = true; - bool needComputationForBox2 = true; - T coeffForCenter = 0; // == separatingAxis[iXYZ] - T coeffForBox1 = 0; // == |separatingAxis|[iXYZ] - T coeffForBox2 = 0; // == |relativeRotationMatrix^T separatingAxis|[iXYZ] - if (iXYZ == 0) { - if (iAxisForBox1 == 0) { - needComputation = false; - } - else if (iAxisForBox1 == 1) { - coeffForCenter = checkAxisForBox2[2]; - coeffForBox1 = absCheckAxisForBox2[2]; - } - else { - coeffForCenter = -checkAxisForBox2[1]; - coeffForBox1 = absCheckAxisForBox2[1]; - } - if (iAxisForBox2 == 0) { - needComputationForBox2 = false; - } - else if (iAxisForBox2 == 1) { - coeffForBox2 = absRelativeCoordinateAxes[2][iAxisForBox1]; - } - else { - coeffForBox2 = absRelativeCoordinateAxes[1][iAxisForBox1]; - } - } - else if (iXYZ == 1) { - if (iAxisForBox1 == 0) { - coeffForCenter = -checkAxisForBox2[2]; - coeffForBox1 = absCheckAxisForBox2[2]; - } - else if (iAxisForBox1 == 1) { - needComputation = false; - } - else { - coeffForCenter = checkAxisForBox2[0]; - coeffForBox1 = absCheckAxisForBox2[0]; - } - if (iAxisForBox2 == 0) { - coeffForBox2 = absRelativeCoordinateAxes[2][iAxisForBox1]; - } - else if (iAxisForBox2 == 1) { - needComputationForBox2 = false; - } - else { - coeffForBox2 = absRelativeCoordinateAxes[0][iAxisForBox1]; - } - } - else if (iXYZ == 2) { - if (iAxisForBox1 == 0) { - coeffForCenter = checkAxisForBox2[1]; - coeffForBox1 = absCheckAxisForBox2[1]; - } - else if (iAxisForBox1 == 1) { - coeffForCenter = -checkAxisForBox2[0]; - coeffForBox1 = absCheckAxisForBox2[0]; - } - else { - needComputation = false; - } - if (iAxisForBox2 == 0) { - coeffForBox2 = absRelativeCoordinateAxes[1][iAxisForBox1]; - } - else if (iAxisForBox2 == 1) { - coeffForBox2 = absRelativeCoordinateAxes[0][iAxisForBox1]; - } - else { - needComputationForBox2 = false; - } - } - if (needComputation) { // when needComputation is false, coeffForCenter / coeffForBox1 is 0 - centerDistanceInSeparatingAxis += coeffForCenter * relativeCenter[iXYZ]; - box1ExtentsInSeparatingAxis += coeffForBox1 * extents[iXYZ]; - } - if (needComputationForBox2) { - box2ExtentsInSeparatingAxis += coeffForBox2 * obb.extents[iXYZ]; - } + if (iAxisForBox1 == 0) { // 1st element of separatingAxis is 0 when iAxisForBox1 is 0 + centerDistanceInSeparatingAxis = -relativeCoordinateAxes[iAxisForBox2].z * relativeCenter.y + relativeCoordinateAxes[iAxisForBox2].y * relativeCenter.z; + box1ExtentsInSeparatingAxis = absRelativeCoordinateAxes[iAxisForBox2].z * extents.y + absRelativeCoordinateAxes[iAxisForBox2].y * extents.z; + } + else if (iAxisForBox1 == 1) { // 2nd element of separatingAxis is 0 when iAxisForBox1 is 1 + centerDistanceInSeparatingAxis = -relativeCoordinateAxes[iAxisForBox2].x * relativeCenter.z + relativeCoordinateAxes[iAxisForBox2].z * relativeCenter.x; + box1ExtentsInSeparatingAxis = absRelativeCoordinateAxes[iAxisForBox2].x * extents.z + absRelativeCoordinateAxes[iAxisForBox2].z * extents.x; + } + else if (iAxisForBox1 == 2) { // 3rd element of separatingAxis is 0 when iAxisForBox1 is 2 + centerDistanceInSeparatingAxis = -relativeCoordinateAxes[iAxisForBox2].y * relativeCenter.x + relativeCoordinateAxes[iAxisForBox2].x * relativeCenter.y; + box1ExtentsInSeparatingAxis = absRelativeCoordinateAxes[iAxisForBox2].y * extents.x + absRelativeCoordinateAxes[iAxisForBox2].x * extents.y; } centerDistanceInSeparatingAxis = MATH_FABS(centerDistanceInSeparatingAxis); + + T box2ExtentsInSeparatingAxis = 0; + if (iAxisForBox2 == 0) { // 1st element of relativeRotationMatrix^T separatingAxis is 0 when iAxisForBox2 is 0 + box2ExtentsInSeparatingAxis = absRelativeCoordinateAxes[2][iAxisForBox1] * obb.extents.y + absRelativeCoordinateAxes[1][iAxisForBox1] * obb.extents.z; + } + else if (iAxisForBox2 == 1) { // 2nd element of relativeRotationMatrix^T separatingAxis is 0 when iAxisForBox2 is 1 + box2ExtentsInSeparatingAxis = absRelativeCoordinateAxes[0][iAxisForBox1] * obb.extents.z + absRelativeCoordinateAxes[2][iAxisForBox1] * obb.extents.x; + } + else if (iAxisForBox2 == 2) { // 3rd element of relativeRotationMatrix^T separatingAxis is 0 when iAxisForBox2 is 2 + box2ExtentsInSeparatingAxis = absRelativeCoordinateAxes[1][iAxisForBox1] * obb.extents.x + absRelativeCoordinateAxes[0][iAxisForBox1] * obb.extents.y; + } if (centerDistanceInSeparatingAxis > box1ExtentsInSeparatingAxis + box2ExtentsInSeparatingAxis) { return false; } From bc2bbaf0d1c220a3c32b83ab466ca8e65e709963 Mon Sep 17 00:00:00 2001 From: Eisoku Kuroiwa Date: Fri, 24 Nov 2023 09:23:41 +0900 Subject: [PATCH 19/38] remove commented functions which use DirectX API --- include/openrave/geometry.h | 131 ------------------------------------ 1 file changed, 131 deletions(-) diff --git a/include/openrave/geometry.h b/include/openrave/geometry.h index 74dc688241..f233a89bc1 100644 --- a/include/openrave/geometry.h +++ b/include/openrave/geometry.h @@ -1986,17 +1986,6 @@ inline obb TransformOBB(const RaveTransformMatrix& t, const obb& o) return newobb; } -/// projects an obb along the world axes -//void AABBFromOBB(const OBB& obb, DXVEC3& vMin, DXVEC3& vMax) -//{ -// vMax.x = fabsf(obb.vRight.x) * obb.vExtents.x + fabsf(obb.vUp.x) * obb.vExtents.y + fabsf(obb.vDir.x) * obb.vExtents.z; -// vMax.y = fabsf(obb.vRight.y) * obb.vExtents.x + fabsf(obb.vUp.y) * obb.vExtents.y + fabsf(obb.vDir.y) * obb.vExtents.z; -// vMax.z = fabsf(obb.vRight.z) * obb.vExtents.x + fabsf(obb.vUp.z) * obb.vExtents.y + fabsf(obb.vDir.z) * obb.vExtents.z; -// -// vMin = obb.vPos - vMax; -// vMax += obb.vPos; -//} - /// \brief Test collision between two axis-aligned bounding boxes. /// /// \ingroup geometric_primitives @@ -2113,126 +2102,6 @@ inline bool BoxAtOriginOBBCollision(const RaveVector& extents, const RaveOrie return true; } -//bool AABBOBBTest(const AABB& a, const OBB& o) -//{ -// DXVEC3 vd = o.vPos - a.vPos; -// float r01, r; -// -// // test the 3 axes of the AABB -// -// // A0 -// if(a.vExtents.x + o.vExtents.x * fabsf(o.vRight.x) + o.vExtents.y * fabsf(o.vUp.x) + -// o.vExtents.z * fabsf(o.vDir.x) < fabsf(vd.x)) return false; -// // A1 -// if(a.vExtents.y + o.vExtents.x * fabsf(o.vRight.y) + o.vExtents.y * fabsf(o.vUp.y) + -// o.vExtents.z * fabsf(o.vDir.y) < fabsf(vd.y)) return false; -// // A2 -// if(a.vExtents.z + o.vExtents.x * fabsf(o.vRight.z) + o.vExtents.y * fabsf(o.vUp.z) + -// o.vExtents.z * fabsf(o.vDir.z) < fabsf(vd.z)) return false; -// -// // test the 3 axes of the OBB -// -// // B0 -// if(a.vExtents.x * fabsf(o.vRight.x) + a.vExtents.y * fabsf(o.vRight.y) + -// a.vExtents.z * fabsf(o.vRight.z) + o.vExtents.x < -// fabsf(D3DXVec3Dot(&o.vRight, &vd)) ) return false; -// // B1 -// if(a.vExtents.x * fabsf(o.vUp.x) + a.vExtents.y * fabsf(o.vUp.y) + -// a.vExtents.z * fabsf(o.vUp.z) + o.vExtents.y < -// fabsf(D3DXVec3Dot(&o.vUp, &vd)) ) return false; -// // B2 -// if(a.vExtents.x * fabsf(o.vDir.x) + a.vExtents.y * fabsf(o.vDir.y) + -// a.vExtents.z * fabsf(o.vDir.z) + o.vExtents.z < -// fabsf(D3DXVec3Dot(&o.vDir, &vd)) ) return false; -// -// // test the 9 different cross products (from different combinations of the axes) -// // A0 x B0 (0, -b0.z, b0.y) -// r01 = a.vExtents.y * fabsf(o.vRight.z) + a.vExtents.z * fabsf(o.vRight.y) + -// o.vExtents.y * fabsf(o.vDir.x) + o.vExtents.z * fabsf(o.vUp.x); -// r = fabsf( o.vRight.y * vd.z - o.vRight.z * vd.y); -// if(r01 < r) return false; -// -// // A0 x B1 (0, -b1.z, b1.y) -// r01 = a.vExtents.y * fabsf(o.vUp.z) + a.vExtents.z * fabsf(o.vUp.y) + -// o.vExtents.x * fabsf(o.vDir.x) + o.vExtents.z * fabsf(o.vRight.x); -// r = fabsf( o.vUp.y * vd.z - o.vUp.z * vd.y); -// if(r01 < r) return false; -// -// // A0 x B2 (0, -b2.z, b2.y) -// r01 = a.vExtents.y * fabsf(o.vDir.z) + a.vExtents.z * fabsf(o.vDir.y) + -// o.vExtents.x * fabsf(o.vUp.x) + o.vExtents.y * fabsf(o.vRight.x); -// r = fabsf( o.vDir.y * vd.z - o.vDir.z * vd.y); -// if(r01 < r) return false; -// -// // A1 x B0 (b0.z, 0, -b0.x) -// r01 = a.vExtents.x * fabsf(o.vRight.z) + a.vExtents.z * fabsf(o.vRight.x) + -// o.vExtents.y * fabsf(o.vDir.y) + o.vExtents.z * fabsf(o.vUp.y); -// r = fabsf( o.vRight.z * vd.x - o.vRight.x * vd.z); -// if(r01 < r) return false; -// -// // A1 x B1 (b1.z, 0, -b1.x) -// r01 = a.vExtents.x * fabsf(o.vUp.z) + a.vExtents.z * fabsf(o.vUp.x) + -// o.vExtents.x * fabsf(o.vDir.y) + o.vExtents.z * fabsf(o.vRight.y); -// r = fabsf( o.vUp.z * vd.x - o.vUp.x * vd.z); -// if(r01 < r) return false; -// -// // A1 x B2 (b2.z, 0, -b2.x) -// r01 = a.vExtents.x * fabsf(o.vDir.z) + a.vExtents.z * fabsf(o.vDir.x) + -// o.vExtents.x * fabsf(o.vUp.y) + o.vExtents.y * fabsf(o.vRight.y); -// r = fabsf( o.vDir.z * vd.x - o.vDir.x * vd.z); -// if(r01 < r) return false; -// -// // A2 x B0 (-b0.y, b0.x, 0) -// r01 = a.vExtents.x * fabsf(o.vRight.y) + a.vExtents.y * fabsf(o.vRight.x) + -// o.vExtents.y * fabsf(o.vDir.z) + o.vExtents.z * fabsf(o.vUp.z); -// r = fabsf( o.vRight.x * vd.y - o.vRight.y * vd.x); -// if(r01 < r) return false; -// -// // A2 x B1 (-b1.y, b1.x, 0) -// r01 = a.vExtents.x * fabsf(o.vUp.y) + a.vExtents.y * fabsf(o.vUp.x) + -// o.vExtents.x * fabsf(o.vDir.z) + o.vExtents.z * fabsf(o.vRight.z); -// r = fabsf( o.vUp.x * vd.y - o.vUp.y * vd.x); -// if(r01 < r) return false; -// -// // A2 x B2 (-b2.y, b2.x, 0) -// r01 = a.vExtents.x * fabsf(o.vDir.y) + a.vExtents.y * fabsf(o.vDir.x) + -// o.vExtents.x * fabsf(o.vUp.z) + o.vExtents.y * fabsf(o.vRight.z); -// r = fabsf( o.vDir.x * vd.y - o.vDir.y * vd.x); -// if(r01 < r) return false; -// -// return true; -//} -// -//bool OBBOBBTest(const OBB& o1, const OBB& o2) -//{ -// // convert to AABB and OBB -// AABB ab(DXVEC3(0.0f, 0.0f, 0.0f), o1.vExtents); -// OBB obb; -// -// // position -// ab.vPos = o2.vPos - o1.vPos; -// obb.vPos.x = D3DXVec3Dot(&o1.vRight, &ab.vPos); -// obb.vPos.y = D3DXVec3Dot(&o1.vUp, &ab.vPos); -// obb.vPos.z = D3DXVec3Dot(&o1.vDir, &ab.vPos); -// ab.vPos.x = ab.vPos.y = ab.vPos.z = 0.0f; -// -// obb.vRight.x = D3DXVec3Dot(&o1.vRight, &o2.vRight); -// obb.vRight.y = D3DXVec3Dot(&o1.vUp, &o2.vRight); -// obb.vRight.z = D3DXVec3Dot(&o1.vDir, &o2.vRight); -// -// obb.vUp.x = D3DXVec3Dot(&o1.vRight, &o2.vUp); -// obb.vUp.y = D3DXVec3Dot(&o1.vUp, &o2.vUp); -// obb.vUp.z = D3DXVec3Dot(&o1.vDir, &o2.vUp); -// -// obb.vDir.x = D3DXVec3Dot(&o1.vRight, &o2.vDir); -// obb.vDir.y = D3DXVec3Dot(&o1.vUp, &o2.vDir); -// obb.vDir.z = D3DXVec3Dot(&o1.vDir, &o2.vDir); -// -// obb.vExtents = o2.vExtents; -// -// return AABBOBBTest(ab, obb); -//} - //AABB AABBUnion(const AABB& ab1, AABB& ab2) //{ // return AABB( 0.5f * (ab1.vPos + ab2.vPos), 0.5f * (ab1.vExtents + ab2.vExtents + From bdae94daf362f145d8960f9554cc4a99a92632b1 Mon Sep 17 00:00:00 2001 From: Eisoku Kuroiwa Date: Fri, 24 Nov 2023 18:41:15 +0900 Subject: [PATCH 20/38] use better names --- include/openrave/geometry.h | 10 +++++----- python/bindings/openravepy_global.cpp | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/openrave/geometry.h b/include/openrave/geometry.h index f233a89bc1..d18460daf5 100644 --- a/include/openrave/geometry.h +++ b/include/openrave/geometry.h @@ -1998,25 +1998,25 @@ inline bool AABBCollision(const RaveAxisAlignedBox& ab1, const RaveAxisAligne /// \brief Test collision between two oriented bounding boxes. template -inline bool OBBCollision(const RaveOrientedBox& obb1, const RaveOrientedBox& obb2) +inline bool CheckOBBCollision(const RaveOrientedBox& obb1, const RaveOrientedBox& obb2) { const RaveTransform relativeTransform = obb1.transform.inverse() * obb2.transform; - return BoxAtOriginOBBCollision(obb1.extents, RaveOrientedBox(relativeTransform, obb2.extents)); + return CheckBoxAtOriginAndOBBCollision(obb1.extents, RaveOrientedBox(relativeTransform, obb2.extents)); } /// \brief Test collision between an axis-aligned bounding box and an oriented bounding box. template -inline bool AABBOBBCollision(const RaveAxisAlignedBox& ab, const RaveOrientedBox& obb) +inline bool CheckAABBAndOBBCollision(const RaveAxisAlignedBox& ab, const RaveOrientedBox& obb) { const RaveTransform relativeTransform(obb.transform.rot, obb.transform.trans - ab.pos); - return BoxAtOriginOBBCollision(ab.extents, RaveOrientedBox(relativeTransform, obb.extents)); + return CheckBoxAtOriginAndOBBCollision(ab.extents, RaveOrientedBox(relativeTransform, obb.extents)); } /// \brief Test collision between an axis-aligned bounding box located at world origin and an oriented bounding box. /// using Separating Axis Theorem. /// S. Gottschalk, M.C. Lin, D. Manocha. OBBTree: A Hierarchical Structure for Rapid Interference Detection. In Proceedings of SIGGRAPH '96. template -inline bool BoxAtOriginOBBCollision(const RaveVector& extents, const RaveOrientedBox& obb) +inline bool CheckBoxAtOriginAndOBBCollision(const RaveVector& extents, const RaveOrientedBox& obb) { const RaveVector& relativeCenter = obb.transform.trans; const RaveTransformMatrix relativeRotationMatrix = matrixFromQuat(obb.transform.rot); diff --git a/python/bindings/openravepy_global.cpp b/python/bindings/openravepy_global.cpp index f0882a0995..dbf4c04b5d 100644 --- a/python/bindings/openravepy_global.cpp +++ b/python/bindings/openravepy_global.cpp @@ -1346,19 +1346,19 @@ bool AABBCollision(object oab1, object oab2) return AABBCollision(ExtractAABB(oab1), ExtractAABB(oab2)); } -bool OBBCollision(object obb1, object oobb2) +bool CheckOBBCollision(object obb1, object oobb2) { - return OBBCollision(ExtractOrientedBox(obb1), ExtractOrientedBox(oobb2)); + return CheckOBBCollision(ExtractOrientedBox(obb1), ExtractOrientedBox(oobb2)); } -bool AABBOBBCollision(object oab, object oobb) +bool CheckAABBAndOBBCollision(object oab, object oobb) { - return AABBOBBCollision(ExtractAABB(oab), ExtractOrientedBox(oobb)); + return CheckAABBAndOBBCollision(ExtractAABB(oab), ExtractOrientedBox(oobb)); } -bool BoxAtOriginOBBCollision(object oextents, object oobb) +bool CheckBoxAtOriginAndOBBCollision(object oextents, object oobb) { - return BoxAtOriginOBBCollision(ExtractVector3(oextents), ExtractOrientedBox(oobb)); + return CheckBoxAtOriginAndOBBCollision(ExtractVector3(oextents), ExtractOrientedBox(oobb)); } dReal ComputePoseDistSqr(object opose0, object opose1, dReal quatweight=1.0) @@ -2575,9 +2575,9 @@ void init_openravepy_global() m.def("OrientedBoxFromAABB",openravepy::OrientedBoxFromAABB,PY_ARGS("aabb","transform") "Transforms an axis aligned bounding box to an oriented bounding box expressed in transform."); m.def("AABBFromOrientedBox",openravepy::AABBFromOrientedBox,PY_ARGS("obb") "Projects an obb along the world axes."); m.def("AABBCollision",openravepy::AABBCollision,PY_ARGS("aabb1","aabb2") "Tests collision between two axis-aligned bounding boxes."); - m.def("OBBCollision",openravepy::OBBCollision,PY_ARGS("obb1","obb2") "Tests collision between two oriented bounding boxes."); - m.def("AABBOBBCollision",openravepy::AABBOBBCollision,PY_ARGS("aabb","obb") "Tests collision between an axis-aligned bounding box and an oriented bounding box."); - m.def("BoxAtOriginOBBCollision",openravepy::BoxAtOriginOBBCollision,PY_ARGS("extents","obb") "Tests collision between an axis-aligned bounding box located at world origin and an oriented bounding box."); + m.def("CheckOBBCollision",openravepy::CheckOBBCollision,PY_ARGS("obb1","obb2") "Tests collision between two oriented bounding boxes."); + m.def("CheckAABBAndOBBCollision",openravepy::CheckAABBAndOBBCollision,PY_ARGS("aabb","obb") "Tests collision between an axis-aligned bounding box and an oriented bounding box."); + m.def("CheckBoxAtOriginAndOBBCollision",openravepy::CheckBoxAtOriginAndOBBCollision,PY_ARGS("extents","obb") "Tests collision between an axis-aligned bounding box located at world origin and an oriented bounding box."); #ifdef USE_PYBIND11_PYTHON_BINDINGS m.def("matrixSerialization",openravepy::matrixSerialization,PY_ARGS("transform") "Serializes a transformation into a string representing a 3x4 matrix.\n\n:param transform: 3x4 or 4x4 array\n"); #else From d0ca2e8973c5d8914e7f45523bbbbb4221502511 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Sat, 25 Nov 2023 01:41:34 +0900 Subject: [PATCH 21/38] link crlibm only if found, via openrave_static_libraries --- src/CMakeLists.txt | 2 +- src/libopenrave/CMakeLists.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4961a651de..84d0f3a0a5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,7 +16,7 @@ else() endif() if( TARGET crlibm-native ) - set(openrave_libraries ${openrave_libraries} ${CRLIBM_LIBRARY}) + set(openrave_static_libraries ${openrave_static_libraries} crlibm) if( CRLIBM_INCLUDE_DIR ) include_directories(${CRLIBM_INCLUDE_DIR}) endif() diff --git a/src/libopenrave/CMakeLists.txt b/src/libopenrave/CMakeLists.txt index e36f6d13b2..783077220a 100644 --- a/src/libopenrave/CMakeLists.txt +++ b/src/libopenrave/CMakeLists.txt @@ -66,7 +66,7 @@ set_target_properties(libopenrave PROPERTIES OUTPUT_NAME openrave${OPENRAVE_LIBR LINK_FLAGS "${LIBOPENRAVE_LINK_FLAGS} ${FPARSER_LINK_FLAGS}") target_compile_definitions(libopenrave PRIVATE "OPENRAVE_STATIC_PLUGINS=${OPENRAVE_STATIC_PLUGINS}") target_link_libraries(libopenrave - PRIVATE boost_assertion_failed static_plugins openrave-md5 crlibm ${openrave_static_libraries} openrave-msgpack + PRIVATE boost_assertion_failed static_plugins openrave-md5 ${openrave_static_libraries} openrave-msgpack PUBLIC LibXml2::LibXml2 Boost::filesystem Boost::thread ${CMAKE_DL_LIBS} ${openrave_libraries} ) install(TARGETS libopenrave @@ -112,7 +112,7 @@ if( OPT_STATIC ) add_dependencies(libopenrave_static check_libm_accuracy-native) # forces check to be run before libopenrave is compilde endif() target_link_libraries(libopenrave_static - PRIVATE boost_assertion_failed static_plugins openrave-md5 crlibm ${openrave_static_libraries} openrave-msgpack + PRIVATE boost_assertion_failed static_plugins openrave-md5 ${openrave_static_libraries} openrave-msgpack PUBLIC LibXml2::LibXml2 Boost::filesystem Boost::thread ${openrave_libraries} ) install(TARGETS libopenrave_static From 52b1e72af6e1d91251b23e1f9bb3f59fe1eb3cb9 Mon Sep 17 00:00:00 2001 From: Eisoku Kuroiwa Date: Mon, 27 Nov 2023 14:43:44 +0900 Subject: [PATCH 22/38] use better name --- include/openrave/geometry.h | 10 +++++++++- python/bindings/openravepy_global.cpp | 11 +++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/include/openrave/geometry.h b/include/openrave/geometry.h index d18460daf5..75cd7beba3 100644 --- a/include/openrave/geometry.h +++ b/include/openrave/geometry.h @@ -1986,11 +1986,19 @@ inline obb TransformOBB(const RaveTransformMatrix& t, const obb& o) return newobb; } +/// \brief Test collision between two axis-aligned bounding boxes. +/// +/// \ingroup geometric_primitives +template RAVE_DEPRECATED +inline bool AABBCollision(const RaveAxisAlignedBox& ab1, const RaveAxisAlignedBox& ab2) { + return CheckAABBCollision(ab1, ab2); +} + /// \brief Test collision between two axis-aligned bounding boxes. /// /// \ingroup geometric_primitives template -inline bool AABBCollision(const RaveAxisAlignedBox& ab1, const RaveAxisAlignedBox& ab2) +inline bool CheckAABBCollision(const RaveAxisAlignedBox& ab1, const RaveAxisAlignedBox& ab2) { RaveVector v = ab1.pos-ab2.pos; return MATH_FABS(v.x) <= ab1.extents.x+ab2.extents.x && MATH_FABS(v.y) <= ab1.extents.y+ab2.extents.y && MATH_FABS(v.z) <= ab1.extents.z+ab2.extents.z; diff --git a/python/bindings/openravepy_global.cpp b/python/bindings/openravepy_global.cpp index dbf4c04b5d..a9c47055d4 100644 --- a/python/bindings/openravepy_global.cpp +++ b/python/bindings/openravepy_global.cpp @@ -1341,9 +1341,15 @@ object AABBFromOrientedBox(object oobb) return toPyAABB(AABBFromOrientedBox(ExtractOrientedBox(oobb))); } +bool CheckAABBCollision(object oab1, object oab2) +{ + return CheckAABBCollision(ExtractAABB(oab1), ExtractAABB(oab2)); +} + +// DEPRECATED. Please use CheckAABBCollision instead. bool AABBCollision(object oab1, object oab2) { - return AABBCollision(ExtractAABB(oab1), ExtractAABB(oab2)); + return CheckAABBCollision(oab1, oab2); } bool CheckOBBCollision(object obb1, object oobb2) @@ -2574,7 +2580,8 @@ void init_openravepy_global() #endif m.def("OrientedBoxFromAABB",openravepy::OrientedBoxFromAABB,PY_ARGS("aabb","transform") "Transforms an axis aligned bounding box to an oriented bounding box expressed in transform."); m.def("AABBFromOrientedBox",openravepy::AABBFromOrientedBox,PY_ARGS("obb") "Projects an obb along the world axes."); - m.def("AABBCollision",openravepy::AABBCollision,PY_ARGS("aabb1","aabb2") "Tests collision between two axis-aligned bounding boxes."); + m.def("AABBCollision",openravepy::AABBCollision,PY_ARGS("aabb1","aabb2") "deprecated. Please use CheckAABBCollision instead."); + m.def("CheckAABBCollision",openravepy::CheckAABBCollision,PY_ARGS("aabb1","aabb2") "Tests collision between two axis-aligned bounding boxes."); m.def("CheckOBBCollision",openravepy::CheckOBBCollision,PY_ARGS("obb1","obb2") "Tests collision between two oriented bounding boxes."); m.def("CheckAABBAndOBBCollision",openravepy::CheckAABBAndOBBCollision,PY_ARGS("aabb","obb") "Tests collision between an axis-aligned bounding box and an oriented bounding box."); m.def("CheckBoxAtOriginAndOBBCollision",openravepy::CheckBoxAtOriginAndOBBCollision,PY_ARGS("extents","obb") "Tests collision between an axis-aligned bounding box located at world origin and an oriented bounding box."); From 6fb5caca445ea7da52d2699f78b525c25957cd05 Mon Sep 17 00:00:00 2001 From: Eisoku Kuroiwa Date: Mon, 27 Nov 2023 18:41:16 +0900 Subject: [PATCH 23/38] remove unused function --- python/bindings/openravepy_global.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/python/bindings/openravepy_global.cpp b/python/bindings/openravepy_global.cpp index a9c47055d4..f51f865ac7 100644 --- a/python/bindings/openravepy_global.cpp +++ b/python/bindings/openravepy_global.cpp @@ -1346,12 +1346,6 @@ bool CheckAABBCollision(object oab1, object oab2) return CheckAABBCollision(ExtractAABB(oab1), ExtractAABB(oab2)); } -// DEPRECATED. Please use CheckAABBCollision instead. -bool AABBCollision(object oab1, object oab2) -{ - return CheckAABBCollision(oab1, oab2); -} - bool CheckOBBCollision(object obb1, object oobb2) { return CheckOBBCollision(ExtractOrientedBox(obb1), ExtractOrientedBox(oobb2)); From f10db27cf0bef98316fc9f8bf617c94c85af222e Mon Sep 17 00:00:00 2001 From: Ziyan Date: Mon, 27 Nov 2023 11:00:23 -0500 Subject: [PATCH 24/38] Fix ExtractAll not returning removed bodies, and also grabbed update not using grabbedName. --- CMakeLists.txt | 2 +- docs/source/changelog.rst | 5 +++++ src/libopenrave-core/jsonparser/jsonreader.cpp | 9 ++++++--- src/libopenrave/kinbody.cpp | 14 +++++++++----- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9106f2109b..4c254de9d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE ) # Define here the needed parameters set (OPENRAVE_VERSION_MAJOR 0) set (OPENRAVE_VERSION_MINOR 134) -set (OPENRAVE_VERSION_PATCH 1) +set (OPENRAVE_VERSION_PATCH 2) set (OPENRAVE_VERSION ${OPENRAVE_VERSION_MAJOR}.${OPENRAVE_VERSION_MINOR}.${OPENRAVE_VERSION_PATCH}) set (OPENRAVE_SOVERSION ${OPENRAVE_VERSION_MAJOR}.${OPENRAVE_VERSION_MINOR}) message(STATUS "Compiling OpenRAVE Version ${OPENRAVE_VERSION}, soversion=${OPENRAVE_SOVERSION}") diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 0b3ec215b5..9416883a6c 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -6,6 +6,11 @@ ChangeLog Unreleased ========== +Version 0.134.2 +=============== + +* Fixed ExtractAll not returning removed bodies correctly + Version 0.134.1 =============== diff --git a/src/libopenrave-core/jsonparser/jsonreader.cpp b/src/libopenrave-core/jsonparser/jsonreader.cpp index 1cd20e658c..b2571ad0b0 100644 --- a/src/libopenrave-core/jsonparser/jsonreader.cpp +++ b/src/libopenrave-core/jsonparser/jsonreader.cpp @@ -224,9 +224,10 @@ class JSONReader throw OPENRAVE_EXCEPTION_FORMAT("The environment data needs to be a valid dictionary. Currently it is '%s'", orjson::DumpJson(rEnvInfo), ORE_InvalidArguments); } + std::vector vRemovedBodiesExtra; // cannot use vRemovedBodies because UpdateFromInfo later clears it EnvironmentBase::EnvironmentBaseInfo envInfo; if( updateMode == UFIM_OnlySpecifiedBodiesExact ) { - _ExtractSpecifiedBodies(envInfo, rEnvInfo); + _ExtractSpecifiedBodies(envInfo, rEnvInfo, vRemovedBodiesExtra); } else { // extract everything @@ -300,7 +301,7 @@ class JSONReader RAVELOG_VERBOSE_FORMAT("resolved fullFilename=%s", fullFilename); if( updateMode == UFIM_OnlySpecifiedBodiesExact ) { - _ExtractSpecifiedBodies(envInfo, *prReferenceEnvInfo); + _ExtractSpecifiedBodies(envInfo, *prReferenceEnvInfo, vRemovedBodiesExtra); } if( prReferenceEnvInfo->IsObject() ) { @@ -385,6 +386,7 @@ class JSONReader } _penv->UpdateFromInfo(envInfo, vCreatedBodies, vModifiedBodies, vRemovedBodies, updateMode); + vRemovedBodies.insert(vRemovedBodies.end(), vRemovedBodiesExtra.begin(), vRemovedBodiesExtra.end()); RAVELOG_DEBUG_FORMAT("env=%d, loaded %d bodies in %u[us]", _penv->GetId()%envInfo._vBodyInfos.size()%(utils::GetMonotonicTime()-starttimeus)); return true; } @@ -1015,7 +1017,7 @@ class JSONReader /// \brief extracts the specified bodies of rEnvInfo into envInfo. /// /// If envInfo already holds bodies, tries to extract ones that do not conflict - void _ExtractSpecifiedBodies(EnvironmentBase::EnvironmentBaseInfo& envInfo, const rapidjson::Value& rEnvInfo) + void _ExtractSpecifiedBodies(EnvironmentBase::EnvironmentBaseInfo& envInfo, const rapidjson::Value& rEnvInfo, std::vector& vRemovedBodies) { int numOriginalBodyInfos = (int)envInfo._vBodyInfos.size(); @@ -1085,6 +1087,7 @@ class JSONReader if( isDeleted ) { RAVELOG_DEBUG_FORMAT("env=%d, removing body '%s' since got __deleted__", _penv->GetId()%pbody->GetName()); _penv->Remove(pbody); + vRemovedBodies.push_back(pbody); } else { // no need to add an entry if partial is false since all the data will be in rBodyInfo diff --git a/src/libopenrave/kinbody.cpp b/src/libopenrave/kinbody.cpp index 6e43ac4eba..ead9c412cb 100644 --- a/src/libopenrave/kinbody.cpp +++ b/src/libopenrave/kinbody.cpp @@ -321,17 +321,21 @@ void KinBody::KinBodyInfo::DeserializeJSON(const rapidjson::Value& value, dReal continue; } - if (isDeleted) { - // ignore - continue; - } - if( itMatchingName != _vGrabbedInfos.end() ) { + if (isDeleted) { + _vGrabbedInfos.erase(itMatchingId); + continue; + } (*itMatchingName)->DeserializeJSON(rGrabbed, fUnitScale, options); (*itMatchingName)->_id = id; continue; } + if (isDeleted) { + // ignore + continue; + } + GrabbedInfoPtr pNewInfo(new GrabbedInfo()); pNewInfo->DeserializeJSON(rGrabbed, fUnitScale, options); pNewInfo->_id = id; From b22b25db85c9aeba4384d5bf75e14d0854f91faf Mon Sep 17 00:00:00 2001 From: Ziyan Date: Mon, 27 Nov 2023 12:49:57 -0500 Subject: [PATCH 25/38] Fix update grab not reporting the modification to caller. --- src/libopenrave-core/environment-core.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libopenrave-core/environment-core.h b/src/libopenrave-core/environment-core.h index f7a8bf9e58..9b0c2d4102 100644 --- a/src/libopenrave-core/environment-core.h +++ b/src/libopenrave-core/environment-core.h @@ -3192,6 +3192,13 @@ class Environment : public EnvironmentBase if (itExistingBody != vBodies.end()) { // grabbed infos + if (pKinBodyInfo->_vGrabbedInfos.size() != (*itExistingBody)->GetNumGrabbed()) { + RAVELOG_DEBUG_FORMAT("env=%s, body name='%s' updating grab from %d -> %d", GetNameId()%bodyName%(*itExistingBody)->GetNumGrabbed()%pKinBodyInfo->_vGrabbedInfos.size()); + // when grab info changes, have to report to caller + if (std::find(vModifiedBodies.begin(), vModifiedBodies.end(), *itExistingBody) == vModifiedBodies.end() && std::find(vCreatedBodies.begin(), vCreatedBodies.end(), *itExistingBody) == vCreatedBodies.end()) { + vModifiedBodies.push_back(*itExistingBody); + } + } vGrabbedInfos.clear(); vGrabbedInfos.reserve(pKinBodyInfo->_vGrabbedInfos.size()); FOREACHC(itGrabbedInfo, pKinBodyInfo->_vGrabbedInfos) { From 26b814307613087fd70382cd5f3147be9c1aa757 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Tue, 28 Nov 2023 11:31:26 +0900 Subject: [PATCH 26/38] add github action --- .github/workflows/ci.yaml | 117 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000000..5ac4e7023c --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,117 @@ +name: CI + +on: + push: + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + python-version: ['3.9'] + os: [ubuntu-20.04] + architecture: ["x64"] + + steps: + - name: Set up Python ${{ matrix.python-version }} + if: ${{ matrix.python-version != 'pyston' }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.architecture }} + - name: Set up APT + run: | + apt-get update -y + apt-get -y install dirmngr gnupg apt-transport-https liblog4cxx-dev libopenscenegraph-dev python3-dev python3-setuptools python3-pip python3-nose libcoin-dev libsoqt520-dev + apt-get -y install g++ gfortran git pkg-config debhelper gettext zlib1g-dev libminizip-dev libxml2-dev liburiparser-dev libpcre3-dev libgmp-dev libmpfr-dev qtbase5-dev libqt5opengl5-dev libavcodec-dev libavformat-dev libswscale-dev libsimage-dev libode-dev libqhull-dev libann-dev libhdf5-serial-dev liblapack-dev libboost-iostreams-dev libboost-regex-dev libboost-filesystem-dev libboost-system-dev libboost-thread-dev libboost-date-time-dev libboost-test-dev libmpfi-dev ffmpeg libtinyxml-dev libflann-dev sqlite3 libccd-dev libeigen3-dev libgpgme-dev libgpgmepp-dev + apt-get update -y + apt-get -y install cmake-data cmake cmake-curses-gui python3-coverage python3-opengl python3-six ninja-build + - name: Set up Python modules + run: | + python3 -m pip install numpy==1.24.3 IPython==8.14.0 + python3 -m pip install https://github.com/cielavenir/sympy/releases/download/0.7.1-py3/sympy-0.7.1-py3.tar.gz + python3 -m pip install scipy==1.10.1 + - name: Set up RapidJSON + run: | + set -e + git clone https://github.com/Tencent/rapidjson.git && mkdir rapidjson/build + cd rapidjson/build + # there are no stable version available + cmake .. -GNinja -DRAPIDJSON_HAS_STDSTRING=ON -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF + ninja -j4 && ninja install + cd ../.. + - name: Install RapidJSON + run: | + set -e + git clone https://github.com/Tencent/rapidjson.git && mkdir rapidjson/build + cd rapidjson/build + # there are no stable version available + cmake .. -GNinja -DRAPIDJSON_HAS_STDSTRING=ON -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF + ninja -j4 && ninja install + cd ../.. + - name: Install ASSIMP + run: | + set -e + git clone https://github.com/assimp/assimp.git && mkdir assimp/build + cd assimp/build + git checkout v5.2.5 + cmake .. -GNinja + ninja -j4 && ninja install + cd ../.. + - name: Install Fcl + run: | + set -e + git clone https://github.com/rdiankov/fcl.git && mkdir fcl/build + cd fcl/build + git checkout origin/trimeshContactPoints20200813 + cmake .. -GNinja -DFCL_BUILD_TESTS=OFF + ninja -j4 && ninja install + cd ../.. + - name: Install Pybind11 + # Need patched version of pybind11: + # File "/usr/local/lib/python3.11/site-packages/openravepy/_openravepy_/__main__.py", line 180, in main + # for type in InterfaceType.values.values(): + # ^^^^^^^^^^^^^^^^^^^^ + # AttributeError: type object 'openravepy._openravepy_.openravepy_int.InterfaceTy' has no attribute 'values'. Did you mean: 'value'? + run: | + set -e + git clone https://github.com/pybind/pybind11.git && mkdir pybind11/build + cd pybind11/build + # git remote add woody https://github.com/woodychow/pybind11.git + # git fetch woody + git remote add ciel https://github.com/cielavenir/pybind11.git + git fetch ciel + git checkout ciel/v2.9_ty + + cmake .. -GNinja -DPYBIND11_TEST=OFF -DPythonLibsNew_FIND_VERSION=3 + ninja -j4 && ninja install + cd ../.. + - name: Install msgpack-c + run: | + set -e + git clone https://github.com/msgpack/msgpack-c && mkdir msgpack-c/build + cd msgpack-c/build + git checkout cpp-6.0.0 + + cmake .. -GNinja -DMSGPACK_BUILD_EXAMPLES=OFF -DMSGPACK_BUILD_TESTS=OFF + ninja -j4 && ninja install + cd ../.. + - name: Install + run: | + mkdir -p build + cd build + cmake .. -GNinja -DUSE_PYBIND11_PYTHON_BINDINGS=ON -DOPT_PYTHON=OFF + ninja -j4 && ninja install + cd ../.. + + # https://bugs.launchpad.net/ubuntu/+source/python3-stdlib-extensions/+bug/1832215 + for ver in 3.8 3.9 3.10 3.11 3.12 3.13; do + if [ -d /usr/local/lib/python${ver} ] && [ ! -d /usr/local/lib/python${ver}/dist-packages/openravepy ]; then + ln -s /usr/local/lib/python3/dist-packages/openravepy /usr/local/lib/python${ver}/dist-packages/openravepy + ln -s /usr/local/lib/python3/dist-packages/sympy /usr/local/lib/python${ver}/dist-packages/sympy + fi + done + - name: Basic Test + # todo: check other tests + run: | + python3 -m nose test/test_controller.py From aac87827312e6d5dd55918ee1056863a50599194 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Tue, 28 Nov 2023 11:33:56 +0900 Subject: [PATCH 27/38] sudo --- .github/workflows/ci.yaml | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5ac4e7023c..4ba11ccbf2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,16 +21,16 @@ jobs: architecture: ${{ matrix.architecture }} - name: Set up APT run: | - apt-get update -y - apt-get -y install dirmngr gnupg apt-transport-https liblog4cxx-dev libopenscenegraph-dev python3-dev python3-setuptools python3-pip python3-nose libcoin-dev libsoqt520-dev - apt-get -y install g++ gfortran git pkg-config debhelper gettext zlib1g-dev libminizip-dev libxml2-dev liburiparser-dev libpcre3-dev libgmp-dev libmpfr-dev qtbase5-dev libqt5opengl5-dev libavcodec-dev libavformat-dev libswscale-dev libsimage-dev libode-dev libqhull-dev libann-dev libhdf5-serial-dev liblapack-dev libboost-iostreams-dev libboost-regex-dev libboost-filesystem-dev libboost-system-dev libboost-thread-dev libboost-date-time-dev libboost-test-dev libmpfi-dev ffmpeg libtinyxml-dev libflann-dev sqlite3 libccd-dev libeigen3-dev libgpgme-dev libgpgmepp-dev - apt-get update -y - apt-get -y install cmake-data cmake cmake-curses-gui python3-coverage python3-opengl python3-six ninja-build + sudo apt-get update -y + sudo apt-get -y install dirmngr gnupg apt-transport-https liblog4cxx-dev libopenscenegraph-dev python3-dev python3-setuptools python3-pip python3-nose libcoin-dev libsoqt520-dev + sudo apt-get -y install g++ gfortran git pkg-config debhelper gettext zlib1g-dev libminizip-dev libxml2-dev liburiparser-dev libpcre3-dev libgmp-dev libmpfr-dev qtbase5-dev libqt5opengl5-dev libavcodec-dev libavformat-dev libswscale-dev libsimage-dev libode-dev libqhull-dev libann-dev libhdf5-serial-dev liblapack-dev libboost-iostreams-dev libboost-regex-dev libboost-filesystem-dev libboost-system-dev libboost-thread-dev libboost-date-time-dev libboost-test-dev libmpfi-dev ffmpeg libtinyxml-dev libflann-dev sqlite3 libccd-dev libeigen3-dev libgpgme-dev libgpgmepp-dev + sudo apt-get update -y + sudo apt-get -y install cmake-data cmake cmake-curses-gui python3-coverage python3-opengl python3-six ninja-build - name: Set up Python modules run: | - python3 -m pip install numpy==1.24.3 IPython==8.14.0 - python3 -m pip install https://github.com/cielavenir/sympy/releases/download/0.7.1-py3/sympy-0.7.1-py3.tar.gz - python3 -m pip install scipy==1.10.1 + sudo python3 -m pip install numpy==1.24.3 IPython==8.14.0 + sudo python3 -m pip install https://github.com/cielavenir/sympy/releases/download/0.7.1-py3/sympy-0.7.1-py3.tar.gz + sudo python3 -m pip install scipy==1.10.1 - name: Set up RapidJSON run: | set -e @@ -38,7 +38,7 @@ jobs: cd rapidjson/build # there are no stable version available cmake .. -GNinja -DRAPIDJSON_HAS_STDSTRING=ON -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF - ninja -j4 && ninja install + ninja -j4 && sudo ninja install cd ../.. - name: Install RapidJSON run: | @@ -47,7 +47,7 @@ jobs: cd rapidjson/build # there are no stable version available cmake .. -GNinja -DRAPIDJSON_HAS_STDSTRING=ON -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF - ninja -j4 && ninja install + ninja -j4 && sudo ninja install cd ../.. - name: Install ASSIMP run: | @@ -56,7 +56,7 @@ jobs: cd assimp/build git checkout v5.2.5 cmake .. -GNinja - ninja -j4 && ninja install + ninja -j4 && sudo ninja install cd ../.. - name: Install Fcl run: | @@ -65,7 +65,7 @@ jobs: cd fcl/build git checkout origin/trimeshContactPoints20200813 cmake .. -GNinja -DFCL_BUILD_TESTS=OFF - ninja -j4 && ninja install + ninja -j4 && sudo ninja install cd ../.. - name: Install Pybind11 # Need patched version of pybind11: @@ -84,7 +84,7 @@ jobs: git checkout ciel/v2.9_ty cmake .. -GNinja -DPYBIND11_TEST=OFF -DPythonLibsNew_FIND_VERSION=3 - ninja -j4 && ninja install + ninja -j4 && sudo ninja install cd ../.. - name: Install msgpack-c run: | @@ -94,24 +94,24 @@ jobs: git checkout cpp-6.0.0 cmake .. -GNinja -DMSGPACK_BUILD_EXAMPLES=OFF -DMSGPACK_BUILD_TESTS=OFF - ninja -j4 && ninja install + ninja -j4 && sudo ninja install cd ../.. - name: Install run: | mkdir -p build cd build cmake .. -GNinja -DUSE_PYBIND11_PYTHON_BINDINGS=ON -DOPT_PYTHON=OFF - ninja -j4 && ninja install - cd ../.. + ninja -j4 && sudo ninja install + cd .. # https://bugs.launchpad.net/ubuntu/+source/python3-stdlib-extensions/+bug/1832215 for ver in 3.8 3.9 3.10 3.11 3.12 3.13; do if [ -d /usr/local/lib/python${ver} ] && [ ! -d /usr/local/lib/python${ver}/dist-packages/openravepy ]; then - ln -s /usr/local/lib/python3/dist-packages/openravepy /usr/local/lib/python${ver}/dist-packages/openravepy - ln -s /usr/local/lib/python3/dist-packages/sympy /usr/local/lib/python${ver}/dist-packages/sympy + sudo ln -s /usr/local/lib/python3/dist-packages/openravepy /usr/local/lib/python${ver}/dist-packages/openravepy + sudo ln -s /usr/local/lib/python3/dist-packages/sympy /usr/local/lib/python${ver}/dist-packages/sympy fi done - name: Basic Test # todo: check other tests run: | - python3 -m nose test/test_controller.py + OPENRAVE_DATA=$PWD/src python3 -m nose test/test_controller.py From fb72135146176778633b52979b3abd3dbdb07ba4 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Tue, 28 Nov 2023 11:37:32 +0900 Subject: [PATCH 28/38] python3 apt should not be used --- .github/workflows/ci.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4ba11ccbf2..3191115e65 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,12 +22,13 @@ jobs: - name: Set up APT run: | sudo apt-get update -y - sudo apt-get -y install dirmngr gnupg apt-transport-https liblog4cxx-dev libopenscenegraph-dev python3-dev python3-setuptools python3-pip python3-nose libcoin-dev libsoqt520-dev + sudo apt-get -y install dirmngr gnupg apt-transport-https liblog4cxx-dev libopenscenegraph-dev libcoin-dev libsoqt520-dev sudo apt-get -y install g++ gfortran git pkg-config debhelper gettext zlib1g-dev libminizip-dev libxml2-dev liburiparser-dev libpcre3-dev libgmp-dev libmpfr-dev qtbase5-dev libqt5opengl5-dev libavcodec-dev libavformat-dev libswscale-dev libsimage-dev libode-dev libqhull-dev libann-dev libhdf5-serial-dev liblapack-dev libboost-iostreams-dev libboost-regex-dev libboost-filesystem-dev libboost-system-dev libboost-thread-dev libboost-date-time-dev libboost-test-dev libmpfi-dev ffmpeg libtinyxml-dev libflann-dev sqlite3 libccd-dev libeigen3-dev libgpgme-dev libgpgmepp-dev sudo apt-get update -y - sudo apt-get -y install cmake-data cmake cmake-curses-gui python3-coverage python3-opengl python3-six ninja-build + sudo apt-get -y install cmake-data cmake cmake-curses-gui ninja-build - name: Set up Python modules run: | + sudo python3 -m pip install nose==1.3.7 six==1.16.0 sudo python3 -m pip install numpy==1.24.3 IPython==8.14.0 sudo python3 -m pip install https://github.com/cielavenir/sympy/releases/download/0.7.1-py3/sympy-0.7.1-py3.tar.gz sudo python3 -m pip install scipy==1.10.1 From 25b514ce544eef366a9be070fac29b7dfae7a972 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Tue, 28 Nov 2023 11:42:11 +0900 Subject: [PATCH 29/38] PATH= --- .github/workflows/ci.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3191115e65..99c034573a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,10 +28,10 @@ jobs: sudo apt-get -y install cmake-data cmake cmake-curses-gui ninja-build - name: Set up Python modules run: | - sudo python3 -m pip install nose==1.3.7 six==1.16.0 - sudo python3 -m pip install numpy==1.24.3 IPython==8.14.0 - sudo python3 -m pip install https://github.com/cielavenir/sympy/releases/download/0.7.1-py3/sympy-0.7.1-py3.tar.gz - sudo python3 -m pip install scipy==1.10.1 + sudo PATH=$PATH python3 -m pip install nose==1.3.7 six==1.16.0 + sudo PATH=$PATH python3 -m pip install numpy==1.24.3 IPython==8.14.0 + sudo PATH=$PATH python3 -m pip install https://github.com/cielavenir/sympy/releases/download/0.7.1-py3/sympy-0.7.1-py3.tar.gz + sudo PATH=$PATH python3 -m pip install scipy==1.10.1 - name: Set up RapidJSON run: | set -e From 7a71fdef06d90018b38d7a551e51a47c1614ee24 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Tue, 28 Nov 2023 11:53:58 +0900 Subject: [PATCH 30/38] cannot use sudo on python3 --- .github/workflows/ci.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 99c034573a..d96e6c73d3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,10 +28,10 @@ jobs: sudo apt-get -y install cmake-data cmake cmake-curses-gui ninja-build - name: Set up Python modules run: | - sudo PATH=$PATH python3 -m pip install nose==1.3.7 six==1.16.0 - sudo PATH=$PATH python3 -m pip install numpy==1.24.3 IPython==8.14.0 - sudo PATH=$PATH python3 -m pip install https://github.com/cielavenir/sympy/releases/download/0.7.1-py3/sympy-0.7.1-py3.tar.gz - sudo PATH=$PATH python3 -m pip install scipy==1.10.1 + python3 -m pip install nose==1.3.7 six==1.16.0 + python3 -m pip install numpy==1.24.3 IPython==8.14.0 + python3 -m pip install https://github.com/cielavenir/sympy/releases/download/0.7.1-py3/sympy-0.7.1-py3.tar.gz + python3 -m pip install scipy==1.10.1 - name: Set up RapidJSON run: | set -e From 6ba1ec452668f77e37d16c48d171a7d0bc053dd5 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Tue, 28 Nov 2023 11:57:54 +0900 Subject: [PATCH 31/38] remove duplicated entry --- .github/workflows/ci.yaml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d96e6c73d3..62acb953d0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -32,15 +32,6 @@ jobs: python3 -m pip install numpy==1.24.3 IPython==8.14.0 python3 -m pip install https://github.com/cielavenir/sympy/releases/download/0.7.1-py3/sympy-0.7.1-py3.tar.gz python3 -m pip install scipy==1.10.1 - - name: Set up RapidJSON - run: | - set -e - git clone https://github.com/Tencent/rapidjson.git && mkdir rapidjson/build - cd rapidjson/build - # there are no stable version available - cmake .. -GNinja -DRAPIDJSON_HAS_STDSTRING=ON -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF - ninja -j4 && sudo ninja install - cd ../.. - name: Install RapidJSON run: | set -e From 851fce6497b8d3a6d21892ed81fc76313e67c9f4 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Tue, 28 Nov 2023 12:03:28 +0900 Subject: [PATCH 32/38] forgot to checkout current hash --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 62acb953d0..9f14d0fbdb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,6 +13,7 @@ jobs: architecture: ["x64"] steps: + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} if: ${{ matrix.python-version != 'pyston' }} uses: actions/setup-python@v4 From 7679d81b7d827814c1d4b198441213d65147c8a7 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Tue, 28 Nov 2023 12:16:12 +0900 Subject: [PATCH 33/38] Allow gpgme 1.13 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9106f2109b..7172d79bd6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -417,7 +417,7 @@ find_package(LibXml2 REQUIRED) add_library(openrave_gpgme IMPORTED INTERFACE) if (OPT_ENCRYPTION) - find_package(Gpgmepp 1.14 REQUIRED) + find_package(Gpgmepp 1.13 REQUIRED) target_link_libraries(openrave_gpgme INTERFACE Gpgmepp) target_compile_definitions(openrave_gpgme INTERFACE "OPENRAVE_ENCRYPTION=1") endif() From 3d14337971361753bc26ca4e5b467e89dbfbe9d5 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Tue, 28 Nov 2023 13:25:54 +0900 Subject: [PATCH 34/38] no symlink --- .github/workflows/ci.yaml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9f14d0fbdb..719e234a9a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -97,13 +97,7 @@ jobs: ninja -j4 && sudo ninja install cd .. - # https://bugs.launchpad.net/ubuntu/+source/python3-stdlib-extensions/+bug/1832215 - for ver in 3.8 3.9 3.10 3.11 3.12 3.13; do - if [ -d /usr/local/lib/python${ver} ] && [ ! -d /usr/local/lib/python${ver}/dist-packages/openravepy ]; then - sudo ln -s /usr/local/lib/python3/dist-packages/openravepy /usr/local/lib/python${ver}/dist-packages/openravepy - sudo ln -s /usr/local/lib/python3/dist-packages/sympy /usr/local/lib/python${ver}/dist-packages/sympy - fi - done + # no need to symlink /usr/local/lib/python3/dist-packages/openravepy as we use python from actions/setup-python - name: Basic Test # todo: check other tests run: | From 61f7371b12022ddf84f0c1009c58641109af9754 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Tue, 28 Nov 2023 13:56:16 +0900 Subject: [PATCH 35/38] try --- .github/workflows/ci.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 719e234a9a..20c111f28f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -96,9 +96,8 @@ jobs: cmake .. -GNinja -DUSE_PYBIND11_PYTHON_BINDINGS=ON -DOPT_PYTHON=OFF ninja -j4 && sudo ninja install cd .. - - # no need to symlink /usr/local/lib/python3/dist-packages/openravepy as we use python from actions/setup-python - name: Basic Test + # setup-python does not look at /usr/local/lib # todo: check other tests run: | - OPENRAVE_DATA=$PWD/src python3 -m nose test/test_controller.py + PYTHONPATH=/usr/local/lib/python3.9/site-packages OPENRAVE_DATA=$PWD/src python3 -m nose test/test_controller.py From 1ef80a5031b154c2e8b20d0619fd0eed1f15e026 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Tue, 28 Nov 2023 13:57:15 +0900 Subject: [PATCH 36/38] set-e --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 20c111f28f..522ab68e50 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -91,6 +91,7 @@ jobs: cd ../.. - name: Install run: | + set -e mkdir -p build cd build cmake .. -GNinja -DUSE_PYBIND11_PYTHON_BINDINGS=ON -DOPT_PYTHON=OFF From 872c120e27155b9b4c265c4d11e2117d4bf1d7e1 Mon Sep 17 00:00:00 2001 From: "woody.chow" Date: Thu, 24 Jan 2019 09:56:23 +0900 Subject: [PATCH 37/38] Replace semicollons in FCL_LDFLAGS with spaces. This fixes https://github.com/rdiankov/openrave/issues/633 fixed fclrave CMAKE_REQUIRED_FLAGS --- plugins/fclrave/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/fclrave/CMakeLists.txt b/plugins/fclrave/CMakeLists.txt index e67b259b77..29c77c9583 100644 --- a/plugins/fclrave/CMakeLists.txt +++ b/plugins/fclrave/CMakeLists.txt @@ -33,8 +33,9 @@ if( FCL_FOUND ) STRING( REGEX REPLACE "[0-9]+.([0-9]+).[0-9]+" "\\1" FCL_MINOR_VERSION ${FCL_VERSION}) if(FCL_MINOR_VERSION GREATER "4") + string(REPLACE ";" " " FCL_LDFLAGS_STR "${FCL_LDFLAGS}") set(CMAKE_REQUIRED_INCLUDES ${FCL_INCLUDE_DIRS} ${FCL_INCLUDEDIR}) - set(CMAKE_REQUIRED_FLAGS "${PLUGIN_COMPILE_FLAGS} ${FCL_CFLAGS_OTHER} -std=c++11 ${PLUGIN_LINK_FLAGS} ${FCL_LDFLAGS}") + set(CMAKE_REQUIRED_FLAGS "${PLUGIN_COMPILE_FLAGS} ${FCL_CFLAGS_OTHER} -std=c++11 ${PLUGIN_LINK_FLAGS} ${FCL_LDFLAGS_STR}") set(CMAKE_REQUIRED_LIBRARIES fcl) check_cxx_source_compiles(" #include @@ -82,7 +83,7 @@ if( FCL_FOUND ) ) target_link_libraries(fclrave PRIVATE boost_assertion_failed PUBLIC libopenrave ${FCL_LIBRARIES}) # ${FCL_CFLAGS_OTHER} is useless as CMAKE_CXX_STANDARD now requires 14 - set_target_properties(fclrave PROPERTIES COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS}" LINK_FLAGS "${PLUGIN_LINK_FLAGS} ${FCL_LDFLAGS}") + set_target_properties(fclrave PROPERTIES COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS}" LINK_FLAGS "${PLUGIN_LINK_FLAGS} ${FCL_LDFLAGS_STR}") install(TARGETS fclrave DESTINATION ${OPENRAVE_PLUGINS_INSTALL_DIR} COMPONENT ${COMPONENT_PREFIX}plugin-fclrave) else() message(STATUS "Could not find FCL. Please install FCL (https://github.com/flexible-collision-library/fcl)") From 589074a9e1852aff0edb7a5f469bba68a5ea552a Mon Sep 17 00:00:00 2001 From: "rosen.diankov@gmail.com" Date: Tue, 28 Nov 2023 09:47:25 -0500 Subject: [PATCH 38/38] fix compilation --- python/bindings/openravepy_global.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/python/bindings/openravepy_global.cpp b/python/bindings/openravepy_global.cpp index f51f865ac7..2041938415 100644 --- a/python/bindings/openravepy_global.cpp +++ b/python/bindings/openravepy_global.cpp @@ -2574,7 +2574,6 @@ void init_openravepy_global() #endif m.def("OrientedBoxFromAABB",openravepy::OrientedBoxFromAABB,PY_ARGS("aabb","transform") "Transforms an axis aligned bounding box to an oriented bounding box expressed in transform."); m.def("AABBFromOrientedBox",openravepy::AABBFromOrientedBox,PY_ARGS("obb") "Projects an obb along the world axes."); - m.def("AABBCollision",openravepy::AABBCollision,PY_ARGS("aabb1","aabb2") "deprecated. Please use CheckAABBCollision instead."); m.def("CheckAABBCollision",openravepy::CheckAABBCollision,PY_ARGS("aabb1","aabb2") "Tests collision between two axis-aligned bounding boxes."); m.def("CheckOBBCollision",openravepy::CheckOBBCollision,PY_ARGS("obb1","obb2") "Tests collision between two oriented bounding boxes."); m.def("CheckAABBAndOBBCollision",openravepy::CheckAABBAndOBBCollision,PY_ARGS("aabb","obb") "Tests collision between an axis-aligned bounding box and an oriented bounding box.");