diff --git a/CMakeLists.txt b/CMakeLists.txt index ad3bbc191db4d965de0ce42bd85bb7dec73b3ea1..aa900db479a0c561c385e42cf4df2b7609b2c986 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,6 @@ cmake_minimum_required(VERSION 3.10) MESSAGE (STATUS "cmake version: ${CMAKE_VERSION}") + # If OS is Ubuntu 20 we nned to change some things execute_process(COMMAND lsb_release -cs OUTPUT_VARIABLE RELEASE_CODENAME @@ -97,6 +98,10 @@ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0) add_compile_options(-Wno-error=sign-compare) endif() +if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0) + add_compile_options(-Wno-error=deprecated-copy) +endif() + ####################################################################################### #options OPTION (Simox_USE_RBDL_LIB "Use RBDL" ON) diff --git a/CMakeModules/FindBullet.cmake b/CMakeModules/FindBullet.cmake deleted file mode 100644 index fcf3d519795c11d3aa4bdb8cbb7de0639e5a5bc7..0000000000000000000000000000000000000000 --- a/CMakeModules/FindBullet.cmake +++ /dev/null @@ -1,181 +0,0 @@ -# Locate Bullet. Original version from osgbullet, http://code.google.com/p/osgbullet/ -# -# This script defines: -# BULLET_FOUND, set to 1 if found -# BULLET_LIBRARIES -# BULLET_INCLUDE_DIRS -# BULLET_*_LIBRARY, one for each library (for example, "BULLET_BulletCollision_LIBRARY"). -# BULLET_*_LIBRARY_debug, one for each library. -# BULLET_DEMOS_INCLUDE_DIR - Directory containing the Demos headers -# BULLET_OPENGL_INCLUDE_DIR - Include path for OpenGL/DemoApplication/Glut headers -# -# This script will look in standard locations for installed Bullet. However, if you -# install Bullet into a non-standard location, you can use the BULLET_ROOT -# variable (in environment or CMake) to specify the location. -# -# You can also use Bullet out of a source tree by specifying BULLET_SOURCE_DIR -# and BULLET_BUILD_DIR (in environment or CMake). - -SET( BULLET_ROOT "" CACHE PATH "Bullet install dir, parent of both header files and binaries." ) -SET( BULLET_BUILD_DIR "" CACHE PATH "Parent directory of Bullet binary file directories such as src/BulletCollision." ) -SET( BULLET_SOURCE_DIR "" CACHE PATH "Parent directory of Bullet header file directories such as src or include." ) - -set(BULLET_SEARCH_PATHS) -macro(add_bullet_search_path p) - if(NOT "${p}" STREQUAL "") - set(BULLET_SEARCH_PATHS ${BULLET_SEARCH_PATHS} ${p}) - endif() -endmacro() - -add_bullet_search_path("C:/Program Files/BULLET_PHYSICS") - -add_bullet_search_path("$ENV{Bullet_DIR}") -add_bullet_search_path("${Bullet_DIR}") - -add_bullet_search_path("$ENV{BULLET_DIR}") -add_bullet_search_path("${BULLET_DIR}") - -add_bullet_search_path("$ENV{BULLET_ROOT}") -add_bullet_search_path("${BULLET_ROOT}") - -add_bullet_search_path("$ENV{BULLET_SOURCE_DIR}") -add_bullet_search_path("${BULLET_SOURCE_DIR}") - -message(STATUS "Searching bullet using these base paths: ${BULLET_SEARCH_PATHS}") - -#UNSET( BULLET_INCLUDE_DIRS CACHE ) -MARK_AS_ADVANCED( BULLET_INCLUDE_DIRS ) -FIND_PATH( BULLET_INCLUDE_DIRS btBulletCollisionCommon.h - PATHS - ${BULLET_SEARCH_PATHS} - PATH_SUFFIXES - /BulletCollision - /src - ../src - /include - /include/bullet - /src/BulletCollision - /include/BulletCollision - /include/bullet/BulletCollision - NO_DEFAULT_PATH -) - -if(NOT BULLET_INCLUDE_DIRS) - FIND_PATH( BULLET_INCLUDE_DIRS btBulletCollisionCommon.h - PATH_SUFFIXES - bullet - ) -endif() - -MESSAGE (STATUS " **** BULLET_INCLUDE_DIRS: ${BULLET_INCLUDE_DIRS}") -IF( BULLET_INCLUDE_DIRS ) - #SET( BULLET_DEMOS_INCLUDE_DIR ${BULLET_INCLUDE_DIRS}/../Demos/OpenGL ) - FIND_PATH( BULLET_OPENGL_INCLUDE_DIR DemoApplication.h - PATHS - ${BULLET_INCLUDE_DIRS} - ${BULLET_INCLUDE_DIRS}/.. - ${BULLET_INCLUDE_DIRS}/../OpenGL - ${BULLET_INCLUDE_DIRS}/OpenGL - ${BULLET_INCLUDE_DIRS}/../Demos/OpenGL - ) - FIND_PATH( BULLET_DEMOS_INCLUDE_DIR GlutDemoApplication.h - PATHS - ${BULLET_INCLUDE_DIRS} - ${BULLET_INCLUDE_DIRS}/.. - ${BULLET_INCLUDE_DIRS}/../OpenGL - ${BULLET_INCLUDE_DIRS}/OpenGL - ${BULLET_INCLUDE_DIRS}/../Demos/OpenGL - ) - MESSAGE (STATUS " **** BULLET_OPENGL_INCLUDE_DIR: ${BULLET_OPENGL_INCLUDE_DIR}") - MESSAGE (STATUS " **** BULLET_DEMOS_INCLUDE_DIR: ${BULLET_DEMOS_INCLUDE_DIR}") -ENDIF( BULLET_INCLUDE_DIRS ) - -MACRO( FIND_BULLET_LIBRARY_DIRNAME LIBNAME DIRNAME ) - #UNSET( BULLET_${LIBNAME}_LIBRARY CACHE ) - #UNSET( BULLET_${LIBNAME}_LIBRARY_debug CACHE ) - MARK_AS_ADVANCED( BULLET_${LIBNAME}_LIBRARY ) - MARK_AS_ADVANCED( BULLET_${LIBNAME}_LIBRARY_debug ) - FIND_LIBRARY( BULLET_${LIBNAME}_LIBRARY - NAMES - ${LIBNAME} - PATHS - ${BULLET_SEARCH_PATHS} - PATH_SUFFIXES - ./src/${DIRNAME} - ./Extras/${DIRNAME} - ./Demos/${DIRNAME} - ./src/${DIRNAME}/Release - ./Extras/${DIRNAME}/Release - ./Demos/${DIRNAME}/Release - ./libs/${DIRNAME} - ./libs - ./lib - ./lib/Release # v2.76, new location for build tree libs on Windows - NO_DEFAULT_PATH - ) - # check for defualt path if BULLET_ROOT path failed - FIND_LIBRARY( BULLET_${LIBNAME}_LIBRARY NAMES ${LIBNAME}) - - FIND_LIBRARY( BULLET_${LIBNAME}_LIBRARY_debug - NAMES - ${LIBNAME}_d - ${LIBNAME}_Debug - ${LIBNAME} - PATHS - ${BULLET_SEARCH_PATHS} - PATH_SUFFIXES - ./src/${DIRNAME} - ./Extras/${DIRNAME} - ./Demos/${DIRNAME} - ./src/${DIRNAME}/Debug - ./Extras/${DIRNAME}/Debug - ./Demos/${DIRNAME}/Debug - ./libs/${DIRNAME} - ./libs - ./lib - ./lib/Debug # v2.76, new location for build tree libs on Windows - NO_DEFAULT_PATH - ) - # check for defualt path if BULLET_ROOT path failed - FIND_LIBRARY( BULLET_${LIBNAME}_LIBRARY_debug NAMES ${LIBNAME}_d ${LIBNAME}_Debug ${LIBNAME} ) - - #message( STATUS "${BULLET_${LIBNAME}_LIBRARY} and ${BULLET_${LIBNAME}_LIBRARY_debug}" ) - #message( SEND_ERROR ${LIBNAME} ) - IF( BULLET_${LIBNAME}_LIBRARY ) - SET( BULLET_LIBRARIES ${BULLET_LIBRARIES} - "optimized" ${BULLET_${LIBNAME}_LIBRARY} - ) - ENDIF( BULLET_${LIBNAME}_LIBRARY ) - IF( BULLET_${LIBNAME}_LIBRARY_debug ) - SET( BULLET_LIBRARIES ${BULLET_LIBRARIES} - "debug" ${BULLET_${LIBNAME}_LIBRARY_debug} - ) - ENDIF( BULLET_${LIBNAME}_LIBRARY_debug ) -ENDMACRO( FIND_BULLET_LIBRARY_DIRNAME LIBNAME ) - -MACRO( FIND_BULLET_LIBRARY LIBNAME ) - FIND_BULLET_LIBRARY_DIRNAME( ${LIBNAME} ${LIBNAME} ) -ENDMACRO( FIND_BULLET_LIBRARY LIBNAME ) - - -FIND_BULLET_LIBRARY( BulletDynamics ) -FIND_BULLET_LIBRARY( BulletSoftBody ) -FIND_BULLET_LIBRARY( BulletCollision ) -FIND_BULLET_LIBRARY( BulletMultiThreaded ) -FIND_BULLET_LIBRARY( LinearMath ) -FIND_BULLET_LIBRARY_DIRNAME( OpenGLSupport OpenGL ) - -# Hide BULLET_LIBRARY in the GUI, since most users can just ignore it -MARK_AS_ADVANCED( BULLET_LIBRARIES ) -MARK_AS_ADVANCED( BULLET_LIBRARIES_debug ) - -SET( BULLET_FOUND 0 ) -IF( BULLET_INCLUDE_DIRS AND BULLET_LIBRARIES ) - SET( BULLET_FOUND 1 ) -ENDIF( BULLET_INCLUDE_DIRS AND BULLET_LIBRARIES ) - - -# Possible future support for collision-only (no dynamics) -IF( BULLET_BulletDynamics_LIBRARY OR BULLET_BulletDynamics_LIBRARY_debug ) - SET( BULLET_DYNAMICS_FOUND 1 ) -ENDIF( BULLET_BulletDynamics_LIBRARY OR BULLET_BulletDynamics_LIBRARY_debug ) diff --git a/CMakeModules/FindCoin3D.cmake b/CMakeModules/FindCoin3D.cmake deleted file mode 100644 index ad226bb3a3b588c7cfc2907308612cbdddd75859..0000000000000000000000000000000000000000 --- a/CMakeModules/FindCoin3D.cmake +++ /dev/null @@ -1,94 +0,0 @@ -# - Find Coin3D (Open Inventor) -# Coin3D is an implementation of the Open Inventor API. -# It provides data structures and algorithms for 3D visualization -# http://www.coin3d.org/ -# -# This module defines the following variables -# COIN3D_FOUND - system has Coin3D - Open Inventor -# COIN3D_INCLUDE_DIRS - where the Inventor include directory can be found -# COIN3D_LIBRARIES - Link to this to use Coin3D -# -# The Coin directory can be defined by the environment variable <Coin3D_DIR> - -#============================================================================= -# Copyright 2008-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -IF (WIN32) - IF (CYGWIN) - - FIND_PATH(COIN3D_INCLUDE_DIRS Inventor/So.h) - FIND_LIBRARY(COIN3D_LIBRARIES Coin) - - ELSE (CYGWIN) - - FIND_PATH(COIN3D_INCLUDE_DIRS Inventor/So.h - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\SIM\\Coin3D\\2;Installation Path]/include" - $ENV{Coin3D_DIR}/include - $ENV{COINDIR}/include - ) - - FIND_LIBRARY(COIN3D_LIBRARY_DEBUG coin3d - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\SIM\\Coin3D\\2;Installation Path]/lib" - $ENV{Coin3D_DIR}/lib - $ENV{COINDIR}/lib - ) - - FIND_LIBRARY(COIN3D_LIBRARY_RELEASE coin3 - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\SIM\\Coin3D\\2;Installation Path]/lib" - $ENV{Coin3D_DIR}/lib - $ENV{COINDIR}/lib - ) - - IF (COIN3D_LIBRARY_DEBUG AND COIN3D_LIBRARY_RELEASE) - SET(COIN3D_LIBRARIES optimized ${COIN3D_LIBRARY_RELEASE} - debug ${COIN3D_LIBRARY_DEBUG}) - ELSE (COIN3D_LIBRARY_DEBUG AND COIN3D_LIBRARY_RELEASE) - IF (COIN3D_LIBRARY_DEBUG) - SET (COIN3D_LIBRARIES ${COIN3D_LIBRARY_DEBUG}) - ENDIF (COIN3D_LIBRARY_DEBUG) - IF (COIN3D_LIBRARY_RELEASE) - SET (COIN3D_LIBRARIES ${COIN3D_LIBRARY_RELEASE}) - ENDIF (COIN3D_LIBRARY_RELEASE) - ENDIF (COIN3D_LIBRARY_DEBUG AND COIN3D_LIBRARY_RELEASE) - - ENDIF (CYGWIN) - -ELSE (WIN32) - IF(APPLE) - FIND_PATH(COIN3D_INCLUDE_DIRS Inventor/So.h - /Library/Frameworks/Inventor.framework/Headers - ) - FIND_LIBRARY(COIN3D_LIBRARIES Coin - /Library/Frameworks/Inventor.framework/Libraries - ) - SET(COIN3D_LIBRARIES "-framework Coin3d" CACHE STRING "Coin3D library for OSX") - ELSE(APPLE) - - find_path( COIN3D_INCLUDE_DIRS NAMES Inventor/So.h PATHS $ENV{Coin3D_DIR}/include /usr/include /usr/include/Coin4 /usr/local/include NO_DEFAULT_PATH ) - find_library( COIN3D_LIBRARIES NAMES Coin PATHS $ENV{Coin3D_DIR}/lib ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES} /usr/local/lib NO_DEFAULT_PATH ) -#FIND_PATH(COIN3D_INCLUDE_DIRS Inventor/So.h $ENV{COIN3D_DIR}/include) -#FIND_LIBRARY(COIN3D_LIBRARIES Coin $ENV{COIN3D_DIR}/lib) - - ENDIF(APPLE) - -ENDIF (WIN32) - -# handle the QUIETLY and REQUIRED arguments and set COIN3D_FOUND to TRUE if -# all listed variables are TRUE -#INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") -INCLUDE( FindPackageHandleStandardArgs ) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Coin3D DEFAULT_MSG COIN3D_LIBRARIES COIN3D_INCLUDE_DIRS) - -MARK_AS_ADVANCED(COIN3D_INCLUDE_DIRS COIN3D_LIBRARIES ) - - diff --git a/CMakeModules/FindSoQt.cmake b/CMakeModules/FindSoQt.cmake deleted file mode 100644 index 0a3ff2c74e92d132052bed55b607d57c74211d4d..0000000000000000000000000000000000000000 --- a/CMakeModules/FindSoQt.cmake +++ /dev/null @@ -1,63 +0,0 @@ -# - Find SoQt (Open Inventor Qt Integration) -# SoQt is an implementation of the Open Inventor API. -# It provides data structures and algorithms for 3D visualization -# http://www.coin3d.org/ -# -# This module defines the following variables -# SoQt_FOUND - system has SoQt - Open Inventor Qt Integration -# SoQt_INCLUDE_DIRS - where the SoQt include directory can be found -# SoQt_LIBRARIES - Link to this to use SoQt -# - - -IF (WIN32) - IF (CYGWIN) - - FIND_PATH(SoQt_INCLUDE_DIRS Inventor/Qt/SoQt.h) - FIND_LIBRARY(SoQt_LIBRARIES SoQt) - - ELSE (CYGWIN) - FIND_PATH(SoQt_INCLUDE_DIRS Inventor/Qt/SoQt.h "$ENV{COINDIR}/include" "$ENV{Coin3D_DIR}/include") - FIND_LIBRARY(SoQt_LIBRARY_RELEASE soqt1 "$ENV{COINDIR}/lib" "$ENV{Coin3D_DIR}/lib") - FIND_LIBRARY(SoQt_LIBRARY_DEBUG soqt1d "$ENV{COINDIR}/lib" "$ENV{Coin3D_DIR}/lib") - - IF (SoQt_LIBRARY_DEBUG AND SoQt_LIBRARY_RELEASE) - SET(SoQt_LIBRARIES optimized ${SoQt_LIBRARY_RELEASE} - debug ${SoQt_LIBRARY_DEBUG}) - ELSE (SoQt_LIBRARY_DEBUG AND SoQt_LIBRARY_RELEASE) - IF (SoQt_LIBRARY_DEBUG) - SET (SoQt_LIBRARIES ${SoQt_LIBRARY_DEBUG}) - ENDIF (SoQt_LIBRARY_DEBUG) - IF (SoQt_LIBRARY_RELEASE) - SET (SoQt_LIBRARIES ${SoQt_LIBRARY_RELEASE}) - ENDIF (SoQt_LIBRARY_RELEASE) - ENDIF (SoQt_LIBRARY_DEBUG AND SoQt_LIBRARY_RELEASE) - - ENDIF (CYGWIN) - -ELSE (WIN32) - IF(APPLE) - FIND_PATH(SoQt_INCLUDE_DIRS Inventor/Qt/SoQt.h - /Library/Frameworks/Inventor.framework/Headers - ) - FIND_LIBRARY(SoQt_LIBRARIES SoQt - /Library/Frameworks/Inventor.framework/Libraries - ) - SET(SoQt_LIBRARIES "-framework SoQt" CACHE STRING "SoQt library for OSX") - ELSE(APPLE) - - FIND_PATH(SoQt_INCLUDE_DIRS NAMES Inventor/Qt/SoQt.h PATHS "$ENV{SoQt_DIR}/include" "$ENV{COIN3D_DIR}/include" "$ENV{Coin3D_DIR}/include" /usr/include /usr/local/include NO_DEFAULT_PATH) - FIND_LIBRARY(SoQt_LIBRARIES NAMES SoQt PATHS "$ENV{SoQt_DIR}/lib" "$ENV{COIN3D_DIR}/lib" "$ENV{Coin3D_DIR}/lib" ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES} /usr/local/lib NO_DEFAULT_PATH) - - ENDIF(APPLE) - -ENDIF (WIN32) - -# handle the QUIETLY and REQUIRED arguments and set SoQt_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SoQt DEFAULT_MSG SoQt_LIBRARIES SoQt_INCLUDE_DIRS) - -MARK_AS_ADVANCED(SoQt_INCLUDE_DIRS SoQt_LIBRARIES ) - - diff --git a/CMakeModules/SimoxConfig.cmake.in b/CMakeModules/SimoxConfig.cmake.in index a93ffb8471298ee2a0394f7806270288531e60a9..bb5d268367baef382f158c599d45fbfda2dc1978 100644 --- a/CMakeModules/SimoxConfig.cmake.in +++ b/CMakeModules/SimoxConfig.cmake.in @@ -70,7 +70,7 @@ FIND_PACKAGE(Boost ${Simox_BOOST_VERSION} EXACT COMPONENTS regex QUIET) - +FIND_PACKAGE(SoQt QUIET) if (NOT (Simox_FIND_QUIETLY OR VirtualRobot_FIND_QUIETLY)) MESSAGE(STATUS " * Including ${Simox_MACROS_INCLUDE_DIR}/SimoxMacros.cmake") diff --git a/CMakeModules/SimoxMacros.cmake b/CMakeModules/SimoxMacros.cmake index a4abbee7ac20ff5c11fde389471b2e5069134001..c5a1d42aab55f189f375e9839f435a3696b004a2 100644 --- a/CMakeModules/SimoxMacros.cmake +++ b/CMakeModules/SimoxMacros.cmake @@ -16,7 +16,8 @@ function(VirtualRobotQtApplication name srcs incs mocFiles uiFiles) ################################## EXECUTABLE ############################## ADD_EXECUTABLE(${name} ${srcs} ${incs} ${generatedUiFiles} ${generatedMocFiles}) target_include_directories(${name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) - TARGET_LINK_LIBRARIES(${name} PUBLIC VirtualRobot) + FIND_PACKAGE(SoQt REQUIRED) + TARGET_LINK_LIBRARIES(${name} PUBLIC VirtualRobot SoQt::SoQt) endfunction() diff --git a/SimDynamics/CMakeLists.txt b/SimDynamics/CMakeLists.txt index a2a7674307953b1139db666abf7c77fb6a55ff6c..35bd6158bceef11cf13f25d32e8b55361ca3a7a3 100644 --- a/SimDynamics/CMakeLists.txt +++ b/SimDynamics/CMakeLists.txt @@ -179,7 +179,8 @@ if (SimDynamics_DYNAMICSENGINE) MESSAGE (STATUS " ** Bullet's OpenGLSupport library not found: Skipping BulletOpenGLViewer") endif() - if (Simox_USE_COIN_VISUALIZATION AND SOQT_FOUND) + find_package(SoQt QUIET) + if (Simox_USE_COIN_VISUALIZATION AND SoQt_FOUND) SET(SOURCES ${SOURCES} DynamicsEngine/BulletEngine/BulletCoinQtViewer.cpp @@ -190,7 +191,7 @@ if (SimDynamics_DYNAMICSENGINE) DynamicsEngine/BulletEngine/BulletCoinQtViewer.h ) else() - MESSAGE (STATUS "SOQT_FOUND : ${SOQT_FOUND}") + MESSAGE (STATUS "SoQt_FOUND : ${SoQt_FOUND}") MESSAGE (STATUS "Simox_USE_COIN_VISUALIZATION: ${Simox_USE_COIN_VISUALIZATION}") MESSAGE (STATUS " ** Qt/Coin3D disabled: Skipping BulletCoinQtViewer") endif() diff --git a/SimoxUtility/color/json.cpp b/SimoxUtility/color/json.cpp index 12bbf17e77fc6e084a061bfd1339a93182bfd14c..b7dedca39cdcb655b2b41b3222c747e109d27101 100644 --- a/SimoxUtility/color/json.cpp +++ b/SimoxUtility/color/json.cpp @@ -14,10 +14,10 @@ namespace simox void color::from_json(const nlohmann::json& j, Color& color) { - color.r = j.at("r"); - color.g = j.at("g"); - color.b = j.at("b"); - color.a = j.at("a"); + j.at("r").get_to(color.r); + j.at("g").get_to(color.g); + j.at("b").get_to(color.b); + j.at("a").get_to(color.a); } } diff --git a/SimoxUtility/math/regression/linear.hpp b/SimoxUtility/math/regression/linear.hpp index 3b878cbf98565c5b98e48696f65152695ed8f2da..eedd55667912d078c4f85bcff1577e728a19379f 100644 --- a/SimoxUtility/math/regression/linear.hpp +++ b/SimoxUtility/math/regression/linear.hpp @@ -70,6 +70,10 @@ namespace simox::math /** * @brief Fit a linear regression model to the given data. + * + * xs and ys must not be empty. All vectors in ys must have the same size + * even if Dim == Eigen::Dynamic. + * * @param xs The input variables. * @param ys The output variables. * @param offsetInput If true, the inputs are offset to x' = x - x_0. @@ -97,7 +101,7 @@ namespace simox::math return r; } - MatrixDX ysMatrix(Dim, ys.size()); + MatrixDX ysMatrix(ys.at(0).size(), ys.size()); for (long col = 0; col < ysMatrix.cols(); ++col) { ysMatrix.col(col) = ys.at(col); @@ -111,13 +115,13 @@ namespace simox::math linFuncMatrix.col(1) = Eigen::Map<const VectorX>(xs.data(), xs.size()); // `linFuncMatrix` is poorly conditioned for xs that are close together - // (e.g. time stamps), so the normal equation would loose a lot of precision. + // (e.g. time stamps), so the normal equation would lose a lot of precision. auto qrDecomp = linFuncMatrix.colPivHouseholderQr(); // Each coordinate can be treated individually (general multivariate regression). // `coeffs` contains a_i and b_i in a_0 + b_0 * t = x, a_1 + b_1 * t = y, etc. - CoefficientsMatrixT coeffs; - for (int dim = 0; dim < 3; ++dim) + CoefficientsMatrixT coeffs(ysMatrix.rows(), 2); + for (int dim = 0; dim < ysMatrix.rows(); ++dim) { VectorX coords = ysMatrix.row(dim).transpose(); coeffs.row(dim) = qrDecomp.solve(coords); diff --git a/VirtualRobot/CMakeLists.txt b/VirtualRobot/CMakeLists.txt index d0e59fd2fbb1c7e41470d7e34f68e65dfee41684..d3c3363035ef3ca72c1ef13c97da3c7a0814c346 100644 --- a/VirtualRobot/CMakeLists.txt +++ b/VirtualRobot/CMakeLists.txt @@ -43,13 +43,13 @@ if (Simox_USE_COIN_VISUALIZATION) MESSAGE(STATUS "Searching Coin3D, Qt and SoQt...") ##### Coin3D - FIND_PACKAGE(Coin3D REQUIRED) - if (COIN3D_FOUND) - MESSAGE (STATUS "Found Coin3D: " ${COIN3D_INCLUDE_DIRS}) + FIND_PACKAGE(Coin REQUIRED) + if (Coin_FOUND) + MESSAGE (STATUS "Found Coin3D: " ${Coin_INCLUDE_DIR} ", " ${Coin_LIB_DIR}) set(Simox_VISUALIZATION TRUE CACHE BOOL "") - target_include_directories(VirtualRobot PUBLIC ${COIN3D_INCLUDE_DIRS}) - target_link_libraries(VirtualRobot PUBLIC ${COIN3D_LIBRARIES}) + target_include_directories(VirtualRobot PUBLIC ${Coin_INCLUDE_DIR}) + target_link_libraries(VirtualRobot PUBLIC ${Coin_LIBRARY_PATH}) target_compile_definitions(VirtualRobot PUBLIC -DCOIN_DLL) endif () @@ -61,24 +61,22 @@ if (Simox_USE_COIN_VISUALIZATION) MESSAGE (STATUS "Did not find Qt. Disabling Qt/SoQt support.") endif ( ) - if (Qt5_FOUND AND COIN3D_FOUND) + if (Qt5_FOUND AND Coin_FOUND) #### SoQt # This will set SoQt_INCLUDE_DIRS and SoQt_LIBRARIES - FIND_PACKAGE(SoQt) - set(SOQT_FOUND ${SOQT_FOUND} CACHE INTERNAL "") - - if (NOT SOQT_FOUND) + FIND_PACKAGE(SoQt REQUIRED) + + if (NOT SoQt_FOUND) MESSAGE (STATUS "Did not find SoQt. Disabling SoQt support.") else () - MESSAGE (STATUS "Found SoQt:" ${SoQt_INCLUDE_DIRS}) + MESSAGE (STATUS "Found SoQt:" ${SoQt_INCLUDE_DIRS} ", " ${SoQt_LIBRARY_DIR}) MESSAGE (STATUS "Enabling Coin3D/Qt/SoQt support") set(Simox_VISUALIZATION TRUE CACHE BOOL "") set(Simox_BUILD_EXAMPLES ON CACHE BOOL "Build example applications") - target_include_directories(VirtualRobot PUBLIC ${SoQt_INCLUDE_DIRS}) - target_link_libraries(VirtualRobot PUBLIC ${SoQt_LIBRARIES}) - target_compile_definitions(VirtualRobot PUBLIC -DSOQT_DLL -DSIMOX_USE_SOQT) + target_link_libraries(VirtualRobot PUBLIC SoQt::SoQt) + target_compile_definitions(VirtualRobot PUBLIC -DSoQt_DLL -DSIMOX_USE_SoQt) if (NOT UNIX) target_link_libraries(VirtualRobot PUBLIC opengl32) @@ -760,7 +758,7 @@ endif() # ----------------------------------------------------------------------------------- # Adding the UI files to the library -if (Simox_USE_COIN_VISUALIZATION AND SOQT_FOUND) +if (Simox_USE_COIN_VISUALIZATION AND SoQt_FOUND) MESSAGE (STATUS " ** Adding GraspEditor gui") diff --git a/VirtualRobot/Grasping/GraspEditor/GraspEditorWindow.cpp b/VirtualRobot/Grasping/GraspEditor/GraspEditorWindow.cpp index 93bbdebb722f324790ba20ecc7a76997dd71e840..ccd0ba98a17fd5847f627f345c77df29a1703401 100644 --- a/VirtualRobot/Grasping/GraspEditor/GraspEditorWindow.cpp +++ b/VirtualRobot/Grasping/GraspEditor/GraspEditorWindow.cpp @@ -278,10 +278,11 @@ namespace VirtualRobot int GraspEditorWindow::main() { + // initialize QCoreApp QCoreApplication::setOrganizationName("H2T"); QCoreApplication::setOrganizationDomain("h2t.anthropomatik.kit.edu"); - QCoreApplication::setApplicationName("GraspEditor"); QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL); + QCoreApplication::setApplicationName("GraspEditor"); QSettings settings; SoQt::show(this); diff --git a/VirtualRobot/IK/platform/OmniWheelPlatformKinematics.cpp b/VirtualRobot/IK/platform/OmniWheelPlatformKinematics.cpp index a185e194015c709deb560e9ca83d4b497bc66160..329648250c4683cdc13bb76f2b9411451112c64a 100755 --- a/VirtualRobot/IK/platform/OmniWheelPlatformKinematics.cpp +++ b/VirtualRobot/IK/platform/OmniWheelPlatformKinematics.cpp @@ -46,7 +46,13 @@ namespace VirtualRobot { Eigen::Matrix3f r = Eigen::Vector3f{-1, 1, 1}.asDiagonal(); - return r * B().transpose().inverse() * R / n; + // Rotation around platform center to define which direction is front + // For ARMAR-7, this is 60 degrees (between the two "front" wheels). + float relativeAngle = M_PI / 3.0f; + Eigen::Matrix3f relativeRotation = Eigen::Matrix3f::Identity(); + relativeRotation.block<2, 2>(0, 0) = Eigen::Rotation2Df(relativeAngle).toRotationMatrix(); + + return relativeRotation * r * B().transpose().inverse() * R / n; } // OmniWheelPlatformKinematics diff --git a/VirtualRobot/VirtualRobot.cpp b/VirtualRobot/VirtualRobot.cpp index b6d660846dbcfd599b4cb74e27c77f9b4d2cbf2d..af533ce88edf8785f306b70a901501d4f364279b 100644 --- a/VirtualRobot/VirtualRobot.cpp +++ b/VirtualRobot/VirtualRobot.cpp @@ -21,6 +21,7 @@ namespace VirtualRobot void init(int &argc, char* argv[], const std::string &appName) { globalAppName = appName; + std::shared_ptr<VisualizationFactory> v = VisualizationFactory::first(NULL); if (v) { diff --git a/VirtualRobot/Visualization/CoinVisualization/CoinVisualizationFactory.cpp b/VirtualRobot/Visualization/CoinVisualization/CoinVisualizationFactory.cpp index 70bdc2ca4a02aa6727996ac3bd8363fd8893cca0..0fda278382a4495000d3f721a89197d67f7cd4cd 100644 --- a/VirtualRobot/Visualization/CoinVisualization/CoinVisualizationFactory.cpp +++ b/VirtualRobot/Visualization/CoinVisualization/CoinVisualizationFactory.cpp @@ -77,7 +77,7 @@ #endif #include <GL/gl.h> -#ifdef SIMOX_USE_SOQT +#ifdef SIMOX_USE_SoQt #include <Inventor/Qt/SoQt.h> #endif @@ -113,7 +113,7 @@ namespace VirtualRobot { SoDB::init(); } -#ifdef SIMOX_USE_SOQT +#ifdef SIMOX_USE_SoQt SoQt::init(argc, argv, appName.c_str()); #endif // enable Coin3D extension: transparent settings without color diff --git a/python/convert_meshes/pyproject.toml b/python/convert_meshes/pyproject.toml index 19d157fe1d9bca6498a6d4ad7b0a8cfe8ceaf860..ed3da4d2cd79d7a332f28030f349c6d4590007be 100644 --- a/python/convert_meshes/pyproject.toml +++ b/python/convert_meshes/pyproject.toml @@ -6,7 +6,7 @@ authors = ["Rainer Kartmann <rainer dot kartmann at kit dot edu>"] [tool.poetry.dependencies] python = "^3.6.2" -ipython = "5.5" +ipython = "*" pymeshlab = "^2021.10" click = "^8.0.4" rich = "^11.2.0"