当前位置: 首页>>代码示例>>Python>>正文


Python ProblemSolver.nodes方法代码示例

本文整理汇总了Python中hpp.corbaserver.ProblemSolver.nodes方法的典型用法代码示例。如果您正苦于以下问题:Python ProblemSolver.nodes方法的具体用法?Python ProblemSolver.nodes怎么用?Python ProblemSolver.nodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hpp.corbaserver.ProblemSolver的用法示例。


在下文中一共展示了ProblemSolver.nodes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: list

# 需要导入模块: from hpp.corbaserver import ProblemSolver [as 别名]
# 或者: from hpp.corbaserver.ProblemSolver import nodes [as 别名]
# test
jp = [-4.016784835909555, -4.671737012514295, 0.9493205942691932, -0.19838422293030356, 0.17672477884262752, -0.35476407311266434, 0.8964120174695772]
ps.createPositionConstraint ("l_gripper", "l_gripper_tool_joint", "", [0,0,0], jp[:3], [1,1,1])
ps.client.problem.setGoalNumericalConstraints ("test",["l_gripper",], [0,])

# qq = [-3.2736323380281704, -4.919012557067956, -0.5645503720485425, 0.8253986172873397, 0.31, 2.4756472106318212, -0.10231121294734401, 0.5832544388135313, 0.9877368674476137, 0.351352194158052, -1.1240948972856866, 0.9832501749355624, -0.1822610586197337, -0.8650504112999698, 0.6602954608097523, -0.7510059283614456, 0.28134369878719734, 0.5218218893957427, 0.5020748972660279, 0.34837002692202573, 0.39307871732911037, 0.012744229982022303, 0.33261894418886817, -0.7484151440244099, -1.5567378515100605, -0.2601290957285226, -0.1203692551331449, -1.9576008301144934, 0.8124905337042794, -0.5829743842064892, -1.8222188044396315, -0.7752624281039475, -0.63163927013001, 0.5474106358659504, 0.11960478411037699, 0.2810869521336104, 0.45983350461154876, 0.3357266282624224, 0.026642845592760873, 0.34937864270125457]
# ps.addGoalConfig (qq)

time = list()
nbNode = list()
nbIter = 1
for i in range(nbIter):
    ps.clearRoadmap ()
    time.append (ps.solve ())
    nbNode.append(len(ps.nodes()))
    print i, time[-1], nbNode[-1]

i = -1
indexes=[]
while True:
    try:
        i = nbNode.index(2, i+1)
    except ValueError:
        break
    indexes.append (i)

import numpy as np
m = np.mean(np.array(time)[indexes],0)
print (m[2]*1000 + m[3]) / 1000., "sec."
开发者ID:florent-lamiraux,项目名称:florent-lamiraux.github.io,代码行数:31,代码来源:tutorial_1.py

示例2: plotConesRoadmap

# 需要导入模块: from hpp.corbaserver import ProblemSolver [as 别名]
# 或者: from hpp.corbaserver.ProblemSolver import nodes [as 别名]
# Plot cones and edges in viewer
plotConesRoadmap (cl, r, 'cone_rm_group', "friction_cone2")
plotEdgesRoadmap (cl, r, 'edgeGroup', 70, [0,1,0.2,1])

gui.writeNodeFile('cone_rm_group','cones_RM.dae')

## Write EDGES in a file, which will be parsed by a Blender-Python script
writeEdgeSamples (cl, 'edges.txt', 70)

## Write PATH samples in a file, which will be parsed by a Blender-Python script
pathSamples = plotSampleSubPath (cl, r, pathId, 70, "path0", [0,0,1,1])
writePathSamples (pathSamples, 'path.txt')

## Write RM edge and node index associated to solution-path:
writeSkipList (cl, 'indexes.txt') #[0, 3, 12, 16, 24, 21, 10, 8] #[0, 0, 6, 15, 17, 18, 13, 14]

# Write nodes to file: PROBLEM when displaying them in Blender (like a small shift before rot...)
#from euler_quat_math import Quaternion, test_q2e
node_blender_k = []
f = open('nodes.txt','a')
for k in range (0,ps.numberNodes()):
    print ("Node number: " + str(k))
    node_k = ps.nodes() [k]
    node_blender_k = node_k [0:7]
    #euler = test_q2e (Quaternion(node_k [3],node_k [4],node_k [5],node_k [6])) # in degrees
    #node_blender_k [3] = euler.x; node_blender_k [4] = euler.y; node_blender_k [5] = euler.z
    f.write(str(node_blender_k).strip('[]')+'\n') # write node k

f.close()

开发者ID:pFernbach,项目名称:animals_description,代码行数:31,代码来源:benchmark2mesh_blender.py

示例3: RuntimeError

# 需要导入模块: from hpp.corbaserver import ProblemSolver [as 别名]
# 或者: from hpp.corbaserver.ProblemSolver import nodes [as 别名]
res = ps.applyConstraints (q2)
if res [0]:
    q2proj = res [1]
else:
    raise RuntimeError ("Failed to apply constraint.")

cl.obstacle.loadObstacleModel('room_description','room','')
ps.setInitialConfig (q1proj); ps.addGoalConfig (q2proj)
ps.solve ()
begin=time.time()
ps.optimizePath (0)
end=time.time()
print "Solving time: "+str(end-begin)


len(ps.nodes ())
ps.pathLength(0)
ps.pathLength(1)

pp (1)


## DEBUG commands
cl.obstacle.getObstaclePosition('obstacle_base')
cl.robot.getJointOuterObjects('CHEST_JOINT1')
cl.robot.getCurrentConfig()
cl.robot.setCurrentConfig(q1)
cl.robot.collisionTest()
res = cl.robot.distancesToCollision()
cl.problem.pathLength(1)
r( cl.problem.configAtDistance(1,5) )
开发者ID:mylene-campana,项目名称:room_description,代码行数:33,代码来源:room.py


注:本文中的hpp.corbaserver.ProblemSolver.nodes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。