scripts/geometric_shapes.py
Go to the documentation of this file.
1 # Datas for compare_convex_box
2 from gepetto import Quaternion
3 from gepetto.corbaserver import Client
4 
5 
6 def translate(tr, t, d):
7  return [tr[i] + d * t[i] for i in range(3)] + tr[3:]
8 
9 
10 cl = Client()
11 try:
12  cl.gui.getWindowID("fcl")
13 except Exception:
14  cl.gui.createWindow("fcl")
15 
16 cl.gui.addBox("fcl/b0", 2, 2, 2, [1, 0, 0, 0.5])
17 cl.gui.addBox("fcl/b1", 2, 2, 2, [0, 1, 0, 0.5])
18 cl.gui.setWireFrameMode("fcl/b1", "WIREFRAME")
19 cl.gui.addBox("fcl/b1_0", 2, 2, 2, [0, 0, 1, 0.5])
20 cl.gui.addBox("fcl/b1_1", 2, 2, 2, [0, 0.5, 1, 0.5])
21 
22 cl.gui.addSphere("fcl/p0", 0.01, [1, 0, 1, 1])
23 cl.gui.addSphere("fcl/p1", 0.01, [0, 1, 1, 1])
24 
25 cl.gui.addArrow("fcl/n0", 0.01, 1.0, [1, 0, 1, 1])
26 cl.gui.addArrow("fcl/n1", 0.01, 1.0, [0, 1, 1, 1])
27 
28 eps = 0.0
29 d0 = 1.5183589910964868 + eps
30 n0 = [0.0310588, 0.942603, -0.332467]
31 d1 = 1.7485932899646754 + eps
32 n1 = [0.132426, -0.0219519, -0.99095]
33 
34 qn0 = Quaternion()
35 qn1 = Quaternion()
36 qn0.fromTwoVector([1, 0, 0], n0)
37 qn1.fromTwoVector([1, 0, 0], n1)
38 
39 pb1 = [0.135584, 0.933659, 0.290395, 0.119895, 0.977832, -0.164725, 0.0483272]
40 pb1_0 = translate(pb1, n0, d0)
41 pb1_1 = translate(pb1, n1, -d1)
42 cl.gui.applyConfiguration("fcl/b1", pb1)
43 cl.gui.applyConfiguration("fcl/b1_0", pb1_0)
44 cl.gui.applyConfiguration("fcl/b1_1", pb1_1)
45 
46 cl.gui.applyConfigurations(
47  ["fcl/p0", "fcl/p1"],
48  [
49  [0.832569, 0.259513, -0.239598, 0, 0, 0, 1],
50  [-0.879579, 0.719545, 0.171906, 0, 0, 0, 1],
51  ],
52 )
53 cl.gui.applyConfigurations(
54  ["fcl/n0", "fcl/n1"],
55  [
56  (
57  0.832569,
58  0.259513,
59  -0.239598,
60  )
61  + qn0.toTuple(),
62  (
63  -0.879579,
64  0.719545,
65  0.171906,
66  )
67  + qn1.toTuple(),
68  ],
69 )
70 
71 cl.gui.refresh()
geometric_shapes.translate
def translate(tr, t, d)
Definition: scripts/geometric_shapes.py:6


hpp-fcl
Author(s):
autogenerated on Sat Nov 23 2024 03:44:58