Directory: | ./ |
---|---|
File: | tests/convex-shape-contact-function.hh |
Date: | 2025-05-05 12:19:30 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 72 | 72 | 100.0% |
Branches: | 67 | 134 | 50.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // Copyright (c) 2014, LAAS-CNRS | ||
2 | // Authors: Joseph Mirabel (joseph.mirabel@laas.fr) | ||
3 | // | ||
4 | |||
5 | // Redistribution and use in source and binary forms, with or without | ||
6 | // modification, are permitted provided that the following conditions are | ||
7 | // met: | ||
8 | // | ||
9 | // 1. Redistributions of source code must retain the above copyright | ||
10 | // notice, this list of conditions and the following disclaimer. | ||
11 | // | ||
12 | // 2. Redistributions in binary form must reproduce the above copyright | ||
13 | // notice, this list of conditions and the following disclaimer in the | ||
14 | // documentation and/or other materials provided with the distribution. | ||
15 | // | ||
16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
20 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||
27 | // DAMAGE. | ||
28 | |||
29 | #include <hpp/constraints/convex-shape-contact.hh> | ||
30 | |||
31 | 2 | hpp::constraints::ConvexShapeContactPtr_t createConvexShapeContact_punctual( | |
32 | hpp::pinocchio::DevicePtr_t d, hpp::pinocchio::JointPtr_t j, | ||
33 | std::string name) { | ||
34 | using namespace hpp::constraints; | ||
35 | /** Floor = penta + square | ||
36 | * + | ||
37 | * / \ | ||
38 | * / +-----+ | ||
39 | * + | | | ||
40 | * \ +-----+ | ||
41 | * \ / | ||
42 | * + | ||
43 | * | ||
44 | * Object = point | ||
45 | **/ | ||
46 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | std::vector<vector3_t> square(4); |
47 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | square[0] = vector3_t(5, 5, 0); |
48 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | square[1] = vector3_t(5, -5, 0); |
49 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | square[2] = vector3_t(0, -5, 0); |
50 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | square[3] = vector3_t(0, 5, 0); |
51 | |||
52 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | std::vector<vector3_t> penta(5); |
53 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | penta[0] = vector3_t(0, 5, 0); |
54 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | penta[1] = vector3_t(0, -5, 0); |
55 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | penta[2] = vector3_t(-2, -6, 0); |
56 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | penta[3] = vector3_t(-5, 0, 0); |
57 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | penta[4] = vector3_t(-2, 6, 0); |
58 | |||
59 |
2/4✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
2 | std::vector<vector3_t> point(1, vector3_t(0, 0, 0)); |
60 | |||
61 | 2 | JointAndShapes_t os; | |
62 |
2/4✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | os.push_back(JointAndShape_t(j, point)); |
63 | 2 | JointAndShapes_t fs; | |
64 |
2/4✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
2 | fs.push_back(JointAndShape_t(JointPtr_t(), square)); |
65 |
2/4✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
2 | fs.push_back(JointAndShape_t(JointPtr_t(), penta)); |
66 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | ConvexShapeContactPtr_t fptr = ConvexShapeContact::create(name, d, fs, os); |
67 | 4 | return fptr; | |
68 | 2 | } | |
69 | |||
70 | 2 | hpp::constraints::ConvexShapeContactPtr_t createConvexShapeContact_convex( | |
71 | hpp::pinocchio::DevicePtr_t d, hpp::pinocchio::JointPtr_t j, | ||
72 | std::string name) { | ||
73 | using namespace hpp::constraints; | ||
74 | /** Floor = penta + square | ||
75 | * + | ||
76 | * / \ | ||
77 | * / +-----+ | ||
78 | * + | | | ||
79 | * \ +-----+ | ||
80 | * \ / | ||
81 | * + | ||
82 | * | ||
83 | * Object = trapezium | ||
84 | * +--+ | ||
85 | * | \ | ||
86 | * +----+ | ||
87 | **/ | ||
88 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | std::vector<vector3_t> square(4); |
89 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | square[0] = vector3_t(5, 5, 0); |
90 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | square[1] = vector3_t(5, -5, 0); |
91 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | square[2] = vector3_t(0, -5, 0); |
92 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | square[3] = vector3_t(0, 5, 0); |
93 | |||
94 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | std::vector<vector3_t> penta(5); |
95 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | penta[0] = vector3_t(0, 5, 0); |
96 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | penta[1] = vector3_t(0, -5, 0); |
97 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | penta[2] = vector3_t(-2, -6, 0); |
98 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | penta[3] = vector3_t(-5, 0, 0); |
99 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | penta[4] = vector3_t(-2, 6, 0); |
100 | |||
101 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | std::vector<vector3_t> trapeze(4); |
102 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | trapeze[0] = vector3_t(-0.1, 0.1, 0); |
103 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | trapeze[1] = vector3_t(0.1, 0.1, 0); |
104 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | trapeze[2] = vector3_t(0.2, -0.1, 0); |
105 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | trapeze[3] = vector3_t(-0.1, -0.1, 0); |
106 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | ConvexShape tCs(trapeze, j); |
107 | |||
108 | 2 | JointAndShapes_t os; | |
109 |
2/4✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | os.push_back(JointAndShape_t(j, trapeze)); |
110 | 2 | JointAndShapes_t fs; | |
111 |
2/4✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
2 | fs.push_back(JointAndShape_t(JointPtr_t(), square)); |
112 |
2/4✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
2 | fs.push_back(JointAndShape_t(JointPtr_t(), penta)); |
113 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | ConvexShapeContactPtr_t fptr = ConvexShapeContact::create(name, d, fs, os); |
114 | 4 | return fptr; | |
115 | 2 | } | |
116 | |||
117 | 2 | hpp::constraints::ConvexShapeContactPtr_t createConvexShapeContact_triangles( | |
118 | hpp::pinocchio::DevicePtr_t d, hpp::pinocchio::JointPtr_t j, | ||
119 | std::string name) { | ||
120 | using namespace hpp::constraints; | ||
121 | /** Floor = penta + square | ||
122 | * + | ||
123 | * / \ | ||
124 | * / +-----+ | ||
125 | * + | | | ||
126 | * \ +-----+ | ||
127 | * \ / | ||
128 | * + | ||
129 | * | ||
130 | * Object = point | ||
131 | * +--+ | ||
132 | * | \ | ||
133 | * +----+ | ||
134 | **/ | ||
135 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | std::vector<vector3_t> square(4); |
136 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | square[0] = vector3_t(5, 5, 0); |
137 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | square[1] = vector3_t(5, -5, 0); |
138 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | square[2] = vector3_t(0, -5, 0); |
139 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | square[3] = vector3_t(0, 5, 0); |
140 | |||
141 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | std::vector<vector3_t> penta(5); |
142 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | penta[0] = vector3_t(0, 5, 0); |
143 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | penta[1] = vector3_t(0, -5, 0); |
144 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | penta[2] = vector3_t(-2, -6, 0); |
145 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | penta[3] = vector3_t(-5, 0, 0); |
146 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | penta[4] = vector3_t(-2, 6, 0); |
147 | |||
148 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | std::vector<vector3_t> trapeze(4); |
149 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | trapeze[0] = vector3_t(-0.1, 0.1, 0); |
150 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | trapeze[1] = vector3_t(0.1, 0.1, 0); |
151 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | trapeze[2] = vector3_t(0.2, -0.1, 0); |
152 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | trapeze[3] = vector3_t(-0.1, -0.1, 0); |
153 | |||
154 | 2 | JointAndShapes_t os; | |
155 |
2/4✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | os.push_back(JointAndShape_t(j, trapeze)); |
156 | 2 | JointAndShapes_t fs; | |
157 |
2/4✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
2 | fs.push_back(JointAndShape_t(JointPtr_t(), square)); |
158 |
2/4✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
2 | fs.push_back(JointAndShape_t(JointPtr_t(), penta)); |
159 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | ConvexShapeContactPtr_t fptr = ConvexShapeContact::create(name, d, fs, os); |
160 | 4 | return fptr; | |
161 | 2 | } | |
162 |