diff --git a/CMakeLists.txt b/CMakeLists.txt index f3a3536dae892c5b76d6e61cf174da8e16c10a63..dd70c4b1be6f05e001d644092f1eeb5dcc0724a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,73 +1,35 @@ -# Copyright (c) 2012 CNRS -# Author: Florent Lamiraux -# -# This file is part of hpp-rbprm-corba. -# hpp-rbprm-corba is free software: you can redistribute it -# and/or modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation, either version -# 3 of the License, or (at your option) any later version. -# -# hpp-rbprm-corba is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Lesser Public License for more details. You should have -# received a copy of the GNU Lesser General Public License along with -# hpp-rbprm-corba. If not, see -# <http://www.gnu.org/licenses/>. - -# Requires at least CMake 2.6 to configure the package. -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) - -SET(CXX_DISABLE_WERROR true) +CMAKE_MINIMUM_REQUIRED(VERSION 3.1) SET(PROJECT_NAME anymal-rbprm) SET(PROJECT_DESCRIPTION "Database for anymal robot using hpp-rbprm") SET(PROJECT_URL "") +SET(CUSTOM_HEADER_DIR "hpp/anymal-rbprm") +SET(CXX_DISABLE_WERROR true) +SET(PROJECT_USE_CMAKE_EXPORT TRUE) -INCLUDE(cmake/base.cmake) -INCLUDE(cmake/idl.cmake) +INCLUDE(cmake/hpp.cmake) INCLUDE(cmake/python.cmake) +COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX) +PROJECT(${PROJECT_NAME} ${PROJECT_ARGS}) -SET(CUSTOM_HEADER_DIR "hpp/anymal-rbprm") - -SETUP_PROJECT () - -# search for python FINDPYTHON() -PKG_CONFIG_APPEND_LIBS(${PROJECT_NAME}) +ADD_LIBRARY(${PROJECT_NAME} INTERFACE) +INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib) -SET(CATKIN_PACKAGE_SHARE_DESTINATION - ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}) - +install(DIRECTORY data/ DESTINATION share/${PROJECT_NAME} ) -SET(CATKIN_PACKAGE_SHARE_DESTINATION - ${CMAKE_INSTALL_DATAROOTDIR}/anymal-rbprm) - - -install(DIRECTORY - data/ - DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} - ) - - -install (FILES - src/hpp/corbaserver/rbprm/anymal/robot.py - src/hpp/corbaserver/rbprm/anymal/__init__.py - DESTINATION ${PYTHON_SITELIB}/hpp/corbaserver/rbprm/anymal) - - -install (FILES - src/hpp/corbaserver/rbprm/anymal_contact6D/robot.py - src/hpp/corbaserver/rbprm/anymal_contact6D/__init__.py - DESTINATION ${PYTHON_SITELIB}/hpp/corbaserver/rbprm/anymal_contact6D) - -install (FILES - src/hpp/corbaserver/rbprm/anymal_abstract/robot.py - src/hpp/corbaserver/rbprm/anymal_abstract/__init__.py - DESTINATION ${PYTHON_SITELIB}/hpp/corbaserver/rbprm/anymal_abstract) +STRING(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME}) +SET(${PROJECT_NAME}_PYTHON_FILES + __init__.py + anymal.py + anymal_abstract.py + anymal_contact6D.py + ) -SETUP_PROJECT_FINALIZE() +FOREACH(SOURCE ${${PROJECT_NAME}_PYTHON_FILES}) + PYTHON_INSTALL_ON_SITE(${PY_NAME} ${SOURCE}) +ENDFOREACH(SOURCE ${${PROJECT_NAME}_PYTHON_SOURCES}) diff --git a/anymal_rbprm/__init__.py b/anymal_rbprm/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/hpp/corbaserver/rbprm/anymal/robot.py b/anymal_rbprm/anymal.py similarity index 90% rename from src/hpp/corbaserver/rbprm/anymal/robot.py rename to anymal_rbprm/anymal.py index b89b40961d02020c38cdb6860cf9f44f497d3472..4763bac4e0d9cbed50a659b5d472fc49b3aa0873 100644 --- a/src/hpp/corbaserver/rbprm/anymal/robot.py +++ b/anymal_rbprm/anymal.py @@ -23,7 +23,7 @@ import numpy as np class Robot (Parent): ## # Information to retrieve urdf and srdf files. - + name = "anymal" packageName = "anymal_data" meshPackageName = "anymal_data" rootJointType = "freeflyer" @@ -129,12 +129,10 @@ class Robot (Parent): kneeIds = {"LF":9,"LH":12,"RF":15,"RH":18} - def __init__ (self, name = None,load = True): - Parent.__init__ (self,load) - if load: - self.loadFullBodyModel(self.urdfName, self.rootJointType, self.meshPackageName, self.packageName, self.urdfSuffix, self.srdfSuffix) - if name != None: + def __init__(self, name=None, load=True, client=None, clientRbprm=None): + if name is not None: self.name = name + Parent.__init__(self, self.name, self.rootJointType, load, client, None, clientRbprm) # save original bounds of the urdf for futur reset self.LF_HAA_bounds = self.getJointBounds('LF_HAA') self.LF_HFE_bounds = self.getJointBounds('LF_HFE') @@ -166,7 +164,21 @@ class Robot (Parent): print("add limb : ",id) eff = self.dict_limb_joint[id] print("effector name = ",eff) - self.addLimb(id,self.dict_limb_rootJoint[id],eff,self.dict_offset[eff].translation.tolist(),self.dict_normal[eff],self.dict_size[eff][0]/2.,self.dict_size[eff][1]/2.,nbSamples,dict_heuristic[id],octreeSize,self.cType,disableEffectorCollision = disableEffectorCollision,kinematicConstraintsPath=self.kinematicConstraintsPath+self.dict_limb_rootJoint[id]+"_06_com_constraints.obj",limbOffset=self.dict_limb_offset[id],kinematicConstraintsMin=self.minDist) + self.addLimb(id, + self.dict_limb_rootJoint[id], + eff, + self.dict_offset[eff].translation.tolist(), + self.dict_normal[eff], + self.dict_size[eff][0]/2., + self.dict_size[eff][1]/2., + nbSamples, + dict_heuristic[id], + octreeSize, + self.cType, + disableEffectorCollision = disableEffectorCollision, + kinematicConstraintsPath=self.kinematicConstraintsPath+self.dict_limb_rootJoint[id]+"_06_com_constraints.obj", + limbOffset=self.dict_limb_offset[id], + kinematicConstraintsMin=self.minDist) if analysis : self.runLimbSampleAnalysis(id, analysis, True) diff --git a/src/hpp/corbaserver/rbprm/anymal_abstract/robot.py b/anymal_rbprm/anymal_abstract.py similarity index 87% rename from src/hpp/corbaserver/rbprm/anymal_abstract/robot.py rename to anymal_rbprm/anymal_abstract.py index 77f4ffd2885597221879242d7478404914f45d7a..94b42b122035bf9d2ffdc61be004fb8c47354e42 100644 --- a/src/hpp/corbaserver/rbprm/anymal_abstract/robot.py +++ b/anymal_rbprm/anymal_abstract.py @@ -30,6 +30,9 @@ class Robot (Parent): urdfNameRom = ['anymal_RFleg_rom','anymal_LHleg_rom','anymal_LFleg_rom','anymal_RHleg_rom'] urdfSuffix = "" srdfSuffix = "" + name = urdfName + + ref_height = 0.465 # TODO ref_EE_lLeg =[0.373, 0.264, -0.448] @@ -41,12 +44,10 @@ class Robot (Parent): #ref_EE_lArm = [-0.3, 0.165 , -0.44] #ref_EE_rArm = [-0.3, -0.165 , -0.44] - def __init__ (self, name = None, load = True): - Parent.__init__ (self,load) - if load: - self.loadModel(self.urdfName, self.urdfNameRom, self.rootJointType, self.meshPackageName, self.packageName, self.urdfSuffix, self.srdfSuffix) - if name != None: + def __init__(self, name=None, load=True, client=None, clientRbprm=None): + if name is not None: self.name = name + Parent.__init__(self, self.name, self.rootJointType, load, client, None, clientRbprm) self.setReferenceEndEffector('anymal_LFleg_rom',self.ref_EE_lLeg) self.setReferenceEndEffector('anymal_RFleg_rom',self.ref_EE_rLeg) self.setReferenceEndEffector('anymal_LHleg_rom',self.ref_EE_lArm) diff --git a/src/hpp/corbaserver/rbprm/anymal_contact6D/robot.py b/anymal_rbprm/anymal_contact6D.py similarity index 100% rename from src/hpp/corbaserver/rbprm/anymal_contact6D/robot.py rename to anymal_rbprm/anymal_contact6D.py diff --git a/cmake b/cmake index 2de34adfce816937d2403cb602261ade0c26f0cd..0ec0f542c02839bcbdf1faa8f5a4559dcf8632ec 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 2de34adfce816937d2403cb602261ade0c26f0cd +Subproject commit 0ec0f542c02839bcbdf1faa8f5a4559dcf8632ec diff --git a/src/hpp/corbaserver/rbprm/anymal/__init__.py b/src/hpp/corbaserver/rbprm/anymal/__init__.py deleted file mode 100644 index 7c4e3a8effd69a7b664b6f861b7a917bd9e7f3f9..0000000000000000000000000000000000000000 --- a/src/hpp/corbaserver/rbprm/anymal/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2019 CNRS -# Author : Pierre Fernbach - -from .robot import Robot diff --git a/src/hpp/corbaserver/rbprm/anymal_abstract/__init__.py b/src/hpp/corbaserver/rbprm/anymal_abstract/__init__.py deleted file mode 100644 index 7c4e3a8effd69a7b664b6f861b7a917bd9e7f3f9..0000000000000000000000000000000000000000 --- a/src/hpp/corbaserver/rbprm/anymal_abstract/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2019 CNRS -# Author : Pierre Fernbach - -from .robot import Robot diff --git a/src/hpp/corbaserver/rbprm/anymal_contact6D/__init__.py b/src/hpp/corbaserver/rbprm/anymal_contact6D/__init__.py deleted file mode 100644 index 7c4e3a8effd69a7b664b6f861b7a917bd9e7f3f9..0000000000000000000000000000000000000000 --- a/src/hpp/corbaserver/rbprm/anymal_contact6D/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2019 CNRS -# Author : Pierre Fernbach - -from .robot import Robot