From ad74f0e01ad01bae6c5e12a40445db336d5ef193 Mon Sep 17 00:00:00 2001 From: pFernbach <pierre.fernbach@gmail.com> Date: Sun, 28 Apr 2019 17:38:45 +0200 Subject: [PATCH] [python api] add API for fullBody param 'usePosturalTaskContactCreation' --- idl/hpp/corbaserver/rbprm/rbprmbuilder.idl | 4 ++++ src/hpp/corbaserver/rbprm/rbprmfullbody.py | 5 +++++ src/rbprmbuilder.impl.cc | 6 +++++- src/rbprmbuilder.impl.hh | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/idl/hpp/corbaserver/rbprm/rbprmbuilder.idl b/idl/hpp/corbaserver/rbprm/rbprmbuilder.idl index 82210bf7..b6e9f6de 100644 --- a/idl/hpp/corbaserver/rbprm/rbprmbuilder.idl +++ b/idl/hpp/corbaserver/rbprm/rbprmbuilder.idl @@ -110,6 +110,10 @@ module hpp void setPostureWeights(in floatSeq postureWeights) raises (Error); + /// If true, optimize the orientation of all the newly created contact using a postural task + void usePosturalTaskContactCreation(in boolean use) + raises (Error); + /// set a reference position of the end effector for the given ROM void setReferenceEndEffector(in string romName, in floatSeq ref) raises (Error); diff --git a/src/hpp/corbaserver/rbprm/rbprmfullbody.py b/src/hpp/corbaserver/rbprm/rbprmfullbody.py index 50b604cb..5a19c188 100755 --- a/src/hpp/corbaserver/rbprm/rbprmfullbody.py +++ b/src/hpp/corbaserver/rbprm/rbprmfullbody.py @@ -875,6 +875,11 @@ class FullBody (Robot): def setPostureWeights(self,postureWeights): return self.clientRbprm.rbprm.setPostureWeights(postureWeights) + ## If true, optimize the orientation of all the newly created contact using a postural task + # \param use bool + def usePosturalTaskContactCreation(self,use): + return self.clientRbprm.rbprm.usePosturalTaskContactCreation(use) + ## return the time at the given state index (in the path computed during the first phase) # \param stateId : index of the state def getTimeAtState(self,stateId): diff --git a/src/rbprmbuilder.impl.cc b/src/rbprmbuilder.impl.cc index 4528ca42..7ba83a41 100644 --- a/src/rbprmbuilder.impl.cc +++ b/src/rbprmbuilder.impl.cc @@ -651,7 +651,11 @@ namespace hpp { device->setEffectorReference(name,config); } - + void RbprmBuilder::usePosturalTaskContactCreation(const bool usePosturalTaskContactCreation) throw (hpp::Error){ + if(!fullBodyLoaded_) + throw Error ("No full body robot was loaded"); + fullBody()->usePosturalTaskContactCreation(usePosturalTaskContactCreation); + } void RbprmBuilder::setFilter(const hpp::Names_t& roms) throw (hpp::Error) { diff --git a/src/rbprmbuilder.impl.hh b/src/rbprmbuilder.impl.hh index 25d2ca5b..79b8ec80 100644 --- a/src/rbprmbuilder.impl.hh +++ b/src/rbprmbuilder.impl.hh @@ -198,6 +198,7 @@ namespace hpp { void setReferenceConfig(const hpp::floatSeq &referenceConfig) throw (hpp::Error); void setPostureWeights(const hpp::floatSeq &postureWeights) throw (hpp::Error); void setReferenceEndEffector(const char* romName, const hpp::floatSeq &ref) throw(hpp::Error); + void usePosturalTaskContactCreation(const bool usePosturalTaskContactCreation) throw (hpp::Error); virtual void setFilter(const hpp::Names_t& roms) throw (hpp::Error); virtual void setAffordanceFilter(const char* romName, const hpp::Names_t& affordances) throw (hpp::Error); -- GitLab