diff --git a/affordance-tests/darpa_hyq_interp.py b/affordance-tests/darpa_hyq_interp.py index b279d8618ff6ec5cbc4dee00a0f08093d611a17e..8e1e62b0594e82f59f177a486050551da9b69b94 100755 --- a/affordance-tests/darpa_hyq_interp.py +++ b/affordance-tests/darpa_hyq_interp.py @@ -88,10 +88,13 @@ r.loadObstacleModel ('hpp-rbprm-corba', "darpa", "contact") i = 0; fullBody.draw(configs[i],r); i=i+1; i-1 -collisions = 0; -for config in configs: - if fullBody.isConfigValid(config)[0] == False: - collisions += 1 - -collisions +#~ collisions = 0; +#~ for config in configs: + #~ if fullBody.isConfigValid(config)[0] == False: + #~ collisions += 1 +#~ +#~ collisions + +from hpp.gepetto import PathPlayer +pp = PathPlayer (ps.robot.client.basic, r) diff --git a/script/scenarios/darpa_hyq_interp.py b/script/scenarios/darpa_hyq_interp.py index 5430f7c662732a1303fb8504fdf517d412848e6e..bec7f8445e399013d5b04b34ffd4c17bb9c01bfb 100755 --- a/script/scenarios/darpa_hyq_interp.py +++ b/script/scenarios/darpa_hyq_interp.py @@ -88,4 +88,5 @@ r.loadObstacleModel ('hpp-rbprm-corba', "darpa", "contact") i = 0; fullBody.draw(configs[i],r); i=i+1; i-1 - +from hpp.gepetto import PathPlayer +pp = PathPlayer (ps.robot.client.basic, r) diff --git a/script/scenarios/darpa_hyq_path.py b/script/scenarios/darpa_hyq_path.py index 3f3a30c027bbfd14c6ab312270b116767372ef78..cd5e4420f406f5740d5a179e283aa3671c5d60ac 100755 --- a/script/scenarios/darpa_hyq_path.py +++ b/script/scenarios/darpa_hyq_path.py @@ -21,11 +21,10 @@ rbprmBuilder.setJointBounds ("base_joint_xyz", [-2,5, -1, 1, 0.3, 4]) # The following lines set constraint on the valid configurations: # a configuration is valid only if all limbs can create a contact ... rbprmBuilder.setFilter(['hyq_rhleg_rom', 'hyq_lfleg_rom', 'hyq_rfleg_rom','hyq_lhleg_rom']) -# ... and only if a contact surface includes the gravity -rbprmBuilder.setNormalFilter('hyq_lhleg_rom', [0,0,1], 0.5) -rbprmBuilder.setNormalFilter('hyq_rfleg_rom', [0,0,1], 0.5) -rbprmBuilder.setNormalFilter('hyq_lfleg_rom', [0,0,1], 0.5) -rbprmBuilder.setNormalFilter('hyq_rhleg_rom', [0,0,1], 0.5) +rbprmBuilder.setAffordanceFilter('hyq_rhleg_rom', ['Support']) +rbprmBuilder.setAffordanceFilter('hyq_rfleg_rom', ['Support',]) +rbprmBuilder.setAffordanceFilter('hyq_lhleg_rom', ['Support']) +rbprmBuilder.setAffordanceFilter('hyq_lfleg_rom', ['Support',]) # We also bound the rotations of the torso. rbprmBuilder.boundSO3([-0.4,0.4,-3,3,-3,3]) @@ -45,6 +44,11 @@ ps.addPathOptimizer("RandomShortcut") ps.setInitialConfig (q_init) ps.addGoalConfig (q_goal) +from hpp.corbaserver.affordance.affordance import AffordanceTool +afftool = AffordanceTool () +afftool.loadObstacleModel (packageName, "darpa", "planning", r) +afftool.visualiseAffordances('Support', r, [0.25, 0.5, 0.5]) + # Choosing RBPRM shooter and path validation methods. # Note that the standard RRT algorithm is used. ps.client.problem.selectConFigurationShooter("RbprmShooter") diff --git a/script/scenarios/stair_bauzil_hrp2_interp.py b/script/scenarios/stair_bauzil_hrp2_interp.py index 2f80a41b2fbea38782e6729fe6dc26858c1dad46..6953a6e68fb94bf87af8d76c39bed9a8b1c9fbbe 100755 --- a/script/scenarios/stair_bauzil_hrp2_interp.py +++ b/script/scenarios/stair_bauzil_hrp2_interp.py @@ -88,8 +88,8 @@ fullBody.setCurrentConfig (q_init) q_init = [ 0.1, -0.82, 0.648702, 1.0, 0.0 , 0.0, 0.0, # Free flyer 0-6 0.0, 0.0, 0.0, 0.0, # CHEST HEAD 7-10 - 0.261799388, 0.174532925, 0.0, -0.523598776, 0.0, 0.0, 0.174532925, # LARM 11-17 - 0.261799388, -0.174532925, 0.0, -0.523598776, 0.0, 0.0, 0.174532925, # RARM 18-24 + 0.261799388, 0.174532925, 0.0, -0.523598776, 0.0, 0.0, 0.17, # LARM 11-17 + 0.261799388, -0.174532925, 0.0, -0.523598776, 0.0, 0.0, 0.17, # RARM 18-24 0.0, 0.0, -0.453785606, 0.872664626, -0.41887902, 0.0, # LLEG 25-30 0.0, 0.0, -0.453785606, 0.872664626, -0.41887902, 0.0, # RLEG 31-36 ]; r (q_init) @@ -127,3 +127,8 @@ r.loadObstacleModel ('hpp-rbprm-corba', "stair_bauzil", "contact") #~ f1.write(str(configs)) #~ f1.close() +from hpp.gepetto import PathPlayer +#~ pp = PathPlayer (ps.robot.client.basic, r, 0.001, 0.1) +pp = PathPlayer (ps.robot.client.basic, r) +#~ (self, client, publisher, dt=0.01, speed=1) + diff --git a/script/scenarios/stair_bauzil_hrp2_path.py b/script/scenarios/stair_bauzil_hrp2_path.py index d0978c9d47be495df9766fe059fae979a4e95358..e8e39dc16cbd3eb3e5f8a18464d30dde7c385bde 100755 --- a/script/scenarios/stair_bauzil_hrp2_path.py +++ b/script/scenarios/stair_bauzil_hrp2_path.py @@ -14,6 +14,9 @@ rbprmBuilder = Builder () rbprmBuilder.loadModel(urdfName, urdfNameRoms, rootJointType, meshPackageName, packageName, urdfSuffix, srdfSuffix) rbprmBuilder.setJointBounds ("base_joint_xyz", [0,2, -1, 1, 0, 2.2]) #~ rbprmBuilder.setFilter(['hrp2_rarm_rom','hrp2_lleg_rom','hrp2_rleg_rom']) +rbprmBuilder.setAffordanceFilter('3Rarm', ['Support']) +rbprmBuilder.setAffordanceFilter('0rLeg', ['Support',]) +rbprmBuilder.setAffordanceFilter('1lLeg', ['Support']) #~ rbprmBuilder.setNormalFilter('hrp2_rarm_rom', [0,0,1], 0.5) #~ rbprmBuilder.setNormalFilter('hrp2_lleg_rom', [0,0,1], 0.9) #~ rbprmBuilder.setNormalFilter('hrp2_rleg_rom', [0,0,1], 0.9) @@ -44,9 +47,16 @@ ps.addPathOptimizer("RandomShortcut") ps.setInitialConfig (q_init) ps.addGoalConfig (q_goal) +from hpp.corbaserver.affordance.affordance import AffordanceTool +afftool = AffordanceTool () +afftool.setAffordanceConfig('Support', [0.5, 0.03, 0.00005]) +afftool.loadObstacleModel (packageName, "stair_bauzil", "planning", r) +#~ afftool.analyseAll() +afftool.visualiseAffordances('Support', r, [0.25, 0.5, 0.5]) +#~ afftool.visualiseAffordances('Lean', r, [0, 0, 0.9]) + ps.client.problem.selectConFigurationShooter("RbprmShooter") ps.client.problem.selectPathValidation("RbprmPathValidation",0.05) -r.loadObstacleModel (packageName, "stair_bauzil", "planning") #~ ps.solve () t = ps.solve () diff --git a/src/rbprmbuilder.impl.cc b/src/rbprmbuilder.impl.cc index e2bed9f3606053bfdcbd7a4c21099dd4e2c3bb55..01713642e3320d763a942a5e6a8145b4a1768a5d 100755 --- a/src/rbprmbuilder.impl.cc +++ b/src/rbprmbuilder.impl.cc @@ -675,7 +675,6 @@ namespace hpp { throw std::runtime_error ("did not find a states at indicated indices: " + std::string(""+s1) + ", " + std::string(""+s2)); } //create helper -// /interpolation::LimbRRTHelper helper(fullBody_, problemSolver_->problem()); core::PathVectorPtr_t path = interpolation::interpolateStates(fullBody_,problemSolver_->problem(), lastStatesComputed_.begin()+s1,lastStatesComputed_.begin()+s2); problemSolver_->addPath(path);