From 201f85cf279b6d989bde0bc1399d479fbce1c7c4 Mon Sep 17 00:00:00 2001
From: pFernbach <pierre.fernbach@gmail.com>
Date: Fri, 7 Jun 2019 13:21:03 +0200
Subject: [PATCH] [script] update anymal scripts

---
 .../sandbox/ANYmal/anymal_flatGround_path.py  |  2 +-
 .../ANYmal/{plinth.py => anymal_plinth.py}    | 30 ++++++++++---------
 .../{plinth_path.py => anymal_plinth_path.py} | 10 +++----
 3 files changed, 22 insertions(+), 20 deletions(-)
 rename script/scenarios/sandbox/ANYmal/{plinth.py => anymal_plinth.py} (75%)
 rename script/scenarios/sandbox/ANYmal/{plinth_path.py => anymal_plinth_path.py} (94%)

diff --git a/script/scenarios/sandbox/ANYmal/anymal_flatGround_path.py b/script/scenarios/sandbox/ANYmal/anymal_flatGround_path.py
index e47aecfb..49d67593 100644
--- a/script/scenarios/sandbox/ANYmal/anymal_flatGround_path.py
+++ b/script/scenarios/sandbox/ANYmal/anymal_flatGround_path.py
@@ -91,7 +91,7 @@ print "Guide planning time : ",t
 from hpp.gepetto import PathPlayer
 pp = PathPlayer (v)
 pp.dt=0.1
-pp.displayVelocityPath(1)
+#pp.displayVelocityPath(1)
 #v.client.gui.setVisibility("path_1_root","ALWAYS_ON_TOP")
 pp.dt = 0.01
 #pp(1)
diff --git a/script/scenarios/sandbox/ANYmal/plinth.py b/script/scenarios/sandbox/ANYmal/anymal_plinth.py
similarity index 75%
rename from script/scenarios/sandbox/ANYmal/plinth.py
rename to script/scenarios/sandbox/ANYmal/anymal_plinth.py
index b8a4cef8..7f4a4806 100644
--- a/script/scenarios/sandbox/ANYmal/plinth.py
+++ b/script/scenarios/sandbox/ANYmal/anymal_plinth.py
@@ -1,9 +1,9 @@
-from hpp.corbaserver.rbprm.anymal_contact6D import Robot
+from hpp.corbaserver.rbprm.anymal import Robot
 from hpp.gepetto import Viewer
 from tools.display_tools import *
 import time
 print "Plan guide trajectory ..."
-import plinth_path as tp
+import anymal_plinth_path as tp
 print "Done."
 import time
 
@@ -17,9 +17,10 @@ root_bounds[0] -= 0.2
 root_bounds[1] += 0.2
 root_bounds[2] -= 0.2
 root_bounds[3] += 0.2
-root_bounds[-1] = 0.9
-root_bounds[-2] = 0.4
+root_bounds[-1] = 0.12
+root_bounds[-2] = 0.3
 fullBody.setJointBounds ("root_joint",  root_bounds)
+fullBody.setConstrainedJointsBounds()
 fullBody.setJointBounds("LF_KFE",[-1.4,0.])
 fullBody.setJointBounds("RF_KFE",[-1.4,0.])
 fullBody.setJointBounds("LH_KFE",[0.,1.4])
@@ -38,11 +39,13 @@ q_ref = fullBody.referenceConfig[::]+[0,0,0,0,0,0]
 q_init = q_ref[::]
 fullBody.setReferenceConfig(q_ref)
 fullBody.setCurrentConfig (q_init)
+fullBody.setPostureWeights(fullBody.postureWeights[::]+[0]*6)
+fullBody.usePosturalTaskContactCreation(True)
 
 dict_heuristic = {fullBody.rLegId:"static", fullBody.lLegId:"static", fullBody.rArmId:"fixedStep04", fullBody.lArmId:"fixedStep04"}
 print "Generate limb DB ..."
 tStart = time.time()
-fullBody.loadAllLimbs(dict_heuristic,"ReferenceConfigurationCustom",nbSamples=50000)
+fullBody.loadAllLimbs(dict_heuristic,"ReferenceConfiguration",nbSamples=50000)
 tGenerate =  time.time() - tStart
 print "Done."
 print "Databases generated in : "+str(tGenerate)+" s"
@@ -51,11 +54,11 @@ fullBody.setReferenceConfig(q_ref)
 #define initial and final configurations : 
 configSize = fullBody.getConfigSize() -fullBody.client.robot.getDimensionExtraConfigSpace()
 
-q_init[0:7] = tp.ps.configAtParam(pId,0.01)[0:7] # use this to get the correct orientation
+q_init[0:7] = tp.ps.configAtParam(pId,0)[0:7] # use this to get the correct orientation
 q_goal = q_init[::]; q_goal[0:7] = tp.ps.configAtParam(pId,tp.ps.pathLength(pId))[0:7]
-dir_init = tp.ps.configAtParam(pId,0.01)[tp.indexECS:tp.indexECS+3]
-acc_init = tp.ps.configAtParam(pId,0.01)[tp.indexECS+3:tp.indexECS+6]
-dir_goal = tp.ps.configAtParam(pId,tp.ps.pathLength(pId)-0.01)[tp.indexECS:tp.indexECS+3]
+dir_init = tp.ps.configAtParam(pId,0)[tp.indexECS:tp.indexECS+3]
+acc_init = tp.ps.configAtParam(pId,0)[tp.indexECS+3:tp.indexECS+6]
+dir_goal = tp.ps.configAtParam(pId,tp.ps.pathLength(pId))[tp.indexECS:tp.indexECS+3]
 acc_goal = [0,0,0]
 
 robTreshold = 2
@@ -85,14 +88,13 @@ fullBody.setEndState(q_goal,fullBody.limbs_names)
 
 print "Generate contact plan ..."
 tStart = time.time()
-configs = fullBody.interpolate(0.01,pathId=pId,robustnessTreshold = robTreshold, filterStates = True,testReachability=True,quasiStatic=True)
+configs = fullBody.interpolate(0.002,pathId=pId,robustnessTreshold = robTreshold, filterStates = True,testReachability=True,quasiStatic=True)
 tInterpolateConfigs = time.time() - tStart
 print "Done. "
 print "Contact sequence computed in "+str(tInterpolateConfigs)+" s."
 print "number of configs :", len(configs)
-raw_input("Press Enter to display the contact sequence ...")
-displayContactSequence(v,configs)
-
-import tools.createActionDRP as exp
+#raw_input("Press Enter to display the contact sequence ...")
+#displayContactSequence(v,configs)
 
+fullBody.resetJointsBounds()
 
diff --git a/script/scenarios/sandbox/ANYmal/plinth_path.py b/script/scenarios/sandbox/ANYmal/anymal_plinth_path.py
similarity index 94%
rename from script/scenarios/sandbox/ANYmal/plinth_path.py
rename to script/scenarios/sandbox/ANYmal/anymal_plinth_path.py
index b844b185..c17d9453 100644
--- a/script/scenarios/sandbox/ANYmal/plinth_path.py
+++ b/script/scenarios/sandbox/ANYmal/anymal_plinth_path.py
@@ -28,7 +28,7 @@ for rom in rbprmBuilder.urdfNameRom :
 rbprmBuilder.boundSO3([-0.1,0.1,-0.5,0.5,-0.1,0.1])
 # Add 6 extraDOF to the problem, used to store the linear velocity and acceleration of the root
 rbprmBuilder.client.robot.setDimensionExtraConfigSpace(extraDof)
-# We set the bounds of this extraDof with velocity and acceleration bounds (expect on z axis)
+c# We set the bounds of this extraDof with velocity and acceleration bounds (expect on z axis)
 rbprmBuilder.client.robot.setExtraConfigSpaceBounds([-vMax,vMax,-vMax,vMax,-vMax,vMax,-aMax,aMax,-aMax,aMax,-aMaxZ,aMaxZ])
 indexECS = rbprmBuilder.getConfigSize() - rbprmBuilder.client.robot.getDimensionExtraConfigSpace()
 
@@ -62,15 +62,15 @@ v.addLandmark(v.sceneName,1)
 
 # Setting initial configuration
 q_init = rbprmBuilder.getCurrentConfig ();
-q_init [0:3] = [-1.7,0,0.444]
-q_init[-6:-3] = [0.02,0,0]
+q_init [0:3] = [-1.7,0,0.465]
+q_init[-6:-3] = [0.,0,0]
 v (q_init)
 ps.setInitialConfig (q_init)
 # set goal config
 rbprmBuilder.setCurrentConfig (q_init)
 q_goal = q_init [::]
-q_goal[0:3] = [1.7,0,0.444]
-q_goal[-6:-3] = [0.02,0,0]
+q_goal[0:3] = [1.7,0,0.465]
+q_goal[-6:-3] = [0.,0,0]
 v(q_goal)
 
 
-- 
GitLab