@@ -21,37 +21,29 @@ namespace
21
21
22
22
// -----------------------------------------------------------------------------
23
23
24
- PardosGotorOne::PardosGotorOne (int _id, const MatrixExponential & _exp, const KDL::Vector & _p)
25
- : id(_id),
26
- exp(_exp),
24
+ PardosGotorOne::PardosGotorOne (const MatrixExponential & _exp, const KDL::Vector & _p)
25
+ : exp(_exp),
27
26
p(_p)
28
27
{}
29
28
30
29
// -----------------------------------------------------------------------------
31
30
32
31
bool PardosGotorOne::solve (const KDL::Frame & rhs, const KDL::Frame & pointTransform, Solutions & solutions) const
33
32
{
34
- solutions.resize (PardosGotorOne::solutions ());
35
- JointIdsToSolutions jointIdsToSolutions (1 );
36
-
37
33
KDL::Vector f = pointTransform * p;
38
34
KDL::Vector k = rhs * p;
39
35
40
36
KDL::Vector diff = k - f;
41
37
double theta = KDL::dot (exp.getAxis (), diff);
42
38
43
- jointIdsToSolutions[0 ] = {id, theta};
44
- solutions[0 ] = jointIdsToSolutions;
45
-
39
+ solutions = {{theta}};
46
40
return true ;
47
41
}
48
42
49
43
// -----------------------------------------------------------------------------
50
44
51
- PardosGotorTwo::PardosGotorTwo (int _id1, int _id2, const MatrixExponential & _exp1, const MatrixExponential & _exp2, const KDL::Vector & _p)
52
- : id1(_id1),
53
- id2(_id2),
54
- exp1(_exp1),
45
+ PardosGotorTwo::PardosGotorTwo (const MatrixExponential & _exp1, const MatrixExponential & _exp2, const KDL::Vector & _p)
46
+ : exp1(_exp1),
55
47
exp2(_exp2),
56
48
p(_p),
57
49
crossPr2(exp2.getAxis() * exp1.getAxis()),
@@ -62,9 +54,6 @@ PardosGotorTwo::PardosGotorTwo(int _id1, int _id2, const MatrixExponential & _ex
62
54
63
55
bool PardosGotorTwo::solve (const KDL::Frame & rhs, const KDL::Frame & pointTransform, Solutions & solutions) const
64
56
{
65
- solutions.resize (PardosGotorTwo::solutions ());
66
- JointIdsToSolutions jointIdsToSolutions (2 );
67
-
68
57
KDL::Vector f = pointTransform * p;
69
58
KDL::Vector k = rhs * p;
70
59
@@ -85,19 +74,15 @@ bool PardosGotorTwo::solve(const KDL::Frame & rhs, const KDL::Frame & pointTrans
85
74
double theta1 = KDL::dot (exp1.getAxis (), k - c);
86
75
double theta2 = KDL::dot (exp2.getAxis (), c - f);
87
76
88
- jointIdsToSolutions[0 ] = {id1, theta1};
89
- jointIdsToSolutions[1 ] = {id2, theta2};
90
-
91
- solutions[0 ] = jointIdsToSolutions;
77
+ solutions = {{theta1, theta2}};
92
78
93
79
return true ;
94
80
}
95
81
96
82
// -----------------------------------------------------------------------------
97
83
98
- PardosGotorThree::PardosGotorThree (int _id, const MatrixExponential & _exp, const KDL::Vector & _p, const KDL::Vector & _k)
99
- : id(_id),
100
- exp(_exp),
84
+ PardosGotorThree::PardosGotorThree (const MatrixExponential & _exp, const KDL::Vector & _p, const KDL::Vector & _k)
85
+ : exp(_exp),
101
86
p(_p),
102
87
k(_k)
103
88
{}
@@ -106,9 +91,6 @@ PardosGotorThree::PardosGotorThree(int _id, const MatrixExponential & _exp, cons
106
91
107
92
bool PardosGotorThree::solve (const KDL::Frame & rhs, const KDL::Frame & pointTransform, Solutions & solutions) const
108
93
{
109
- solutions.resize (PardosGotorThree::solutions ());
110
- JointIdsToSolutions jointIdsToSolution1 (1 ), jointIdsToSolution2 (1 );
111
-
112
94
KDL::Vector f = pointTransform * p;
113
95
KDL::Vector rhsAsVector = rhs * p - k;
114
96
double delta = rhsAsVector.Norm ();
@@ -119,36 +101,29 @@ bool PardosGotorThree::solve(const KDL::Frame & rhs, const KDL::Frame & pointTra
119
101
double sq2 = std::pow (dotPr, 2 ) - std::pow (diff.Norm (), 2 ) + std::pow (delta, 2 );
120
102
bool sq2_zero = KDL::Equal (sq2, 0.0 );
121
103
122
- jointIdsToSolution1[0 ].first = jointIdsToSolution2[0 ].first = id;
123
-
124
104
bool ret;
125
105
126
106
if (!sq2_zero && sq2 > 0 )
127
107
{
128
108
double sq = std::sqrt (std::abs (sq2));
129
- jointIdsToSolution1[0 ].second = dotPr + sq;
130
- jointIdsToSolution2[0 ].second = dotPr - sq;
109
+ solutions = {{dotPr + sq}, {dotPr - sq}};
131
110
ret = true ;
132
111
}
133
112
else
134
113
{
135
114
KDL::Vector proy = vectorPow2 (exp.getAxis ()) * diff;
136
- jointIdsToSolution1[0 ].second = jointIdsToSolution2[0 ].second = proy.Norm ();
115
+ double norm = proy.Norm ();
116
+ solutions = {{norm}, {norm}};
137
117
ret = sq2_zero;
138
118
}
139
119
140
- solutions[0 ] = jointIdsToSolution1;
141
- solutions[1 ] = jointIdsToSolution2;
142
-
143
120
return ret;
144
121
}
145
122
146
123
// -----------------------------------------------------------------------------
147
124
148
- PardosGotorFour::PardosGotorFour (int _id1, int _id2, const MatrixExponential & _exp1, const MatrixExponential & _exp2, const KDL::Vector & _p)
149
- : id1(_id1),
150
- id2(_id2),
151
- exp1(_exp1),
125
+ PardosGotorFour::PardosGotorFour (const MatrixExponential & _exp1, const MatrixExponential & _exp2, const KDL::Vector & _p)
126
+ : exp1(_exp1),
152
127
exp2(_exp2),
153
128
p(_p),
154
129
n(computeNormal(exp1, exp2)),
@@ -159,9 +134,6 @@ PardosGotorFour::PardosGotorFour(int _id1, int _id2, const MatrixExponential & _
159
134
160
135
bool PardosGotorFour::solve (const KDL::Frame & rhs, const KDL::Frame & pointTransform, Solutions & solutions) const
161
136
{
162
- solutions.resize (PardosGotorFour::solutions ());
163
- JointIdsToSolutions jointIdsToSolution1 (2 ), jointIdsToSolution2 (2 );
164
-
165
137
KDL::Vector f = pointTransform * p;
166
138
KDL::Vector k = rhs * p;
167
139
@@ -190,9 +162,6 @@ bool PardosGotorFour::solve(const KDL::Frame & rhs, const KDL::Frame & pointTran
190
162
double c_test = u_p_norm + v_p_norm - c_norm;
191
163
bool c_zero = KDL::Equal (c_test, 0.0 );
192
164
193
- jointIdsToSolution1[0 ].first = jointIdsToSolution2[0 ].first = id1;
194
- jointIdsToSolution1[1 ].first = jointIdsToSolution2[1 ].first = id2;
195
-
196
165
bool ret;
197
166
198
167
if (!c_zero && c_test > 0.0 )
@@ -227,11 +196,10 @@ bool PardosGotorFour::solve(const KDL::Frame & rhs, const KDL::Frame & pointTran
227
196
double theta1_2 = std::atan2 (KDL::dot (exp1.getAxis (), n1_p * v_p), KDL::dot (n1_p, v_p));
228
197
double theta2_2 = std::atan2 (KDL::dot (exp2.getAxis (), u_p * n2_p), KDL::dot (u_p, n2_p));
229
198
230
- jointIdsToSolution1[0 ].second = normalizeAngle (theta1_1);
231
- jointIdsToSolution1[1 ].second = normalizeAngle (theta2_1);
232
-
233
- jointIdsToSolution2[0 ].second = normalizeAngle (theta1_2);
234
- jointIdsToSolution2[1 ].second = normalizeAngle (theta2_2);
199
+ solutions = {
200
+ {normalizeAngle (theta1_1), normalizeAngle (theta2_1)},
201
+ {normalizeAngle (theta1_2), normalizeAngle (theta2_2)}
202
+ };
235
203
236
204
ret = samePlane && KDL::Equal (m1_p.Norm (), v_p_norm);
237
205
}
@@ -240,15 +208,17 @@ bool PardosGotorFour::solve(const KDL::Frame & rhs, const KDL::Frame & pointTran
240
208
double theta1 = std::atan2 (KDL::dot (exp1.getAxis (), c_diff * v_p), KDL::dot (c_diff, v_p));
241
209
double theta2 = std::atan2 (KDL::dot (exp2.getAxis (), u_p * c_diff), KDL::dot (-c_diff, u_p));
242
210
243
- jointIdsToSolution1[0 ].second = jointIdsToSolution2[0 ].second = normalizeAngle (theta1);
244
- jointIdsToSolution1[1 ].second = jointIdsToSolution2[1 ].second = normalizeAngle (theta2);
211
+ double normalized1 = normalizeAngle (theta1);
212
+ double normalized2 = normalizeAngle (theta2);
213
+
214
+ solutions = {
215
+ {normalized1, normalized2},
216
+ {normalized1, normalized2}
217
+ };
245
218
246
219
ret = c_zero;
247
220
}
248
221
249
- solutions[0 ] = jointIdsToSolution1;
250
- solutions[1 ] = jointIdsToSolution2;
251
-
252
222
return ret;
253
223
}
254
224
0 commit comments