8000 fix rand_q method · LiamMZ/robotics-toolbox-python@15b4ebe · GitHub
[go: up one dir, main page]

Skip to content
10000

Commit 15b4ebe

Browse files
committed
fix rand_q method
1 parent 20cded0 commit 15b4ebe

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

roboticstoolbox/core/ik.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ extern "C"
6969
}
7070
else
7171
{
72-
q = _rand_q(ets);
72+
_rand_q(ets, q);
7373
}
7474

7575
// Global search up to slimit
@@ -138,7 +138,7 @@ extern "C"
138138
*it += iter;
139139
iter = 0;
140140
*search += 1;
141-
q = _rand_q(ets);
141+
_rand_q(ets, q);
142142
}
143143

144144
free(np_e);
@@ -203,7 +203,7 @@ extern "C"
203203
}
204204
else
205205
{
206-
q = _rand_q(ets);
206+
_rand_q(ets, q);
207207
}
208208

209209
// Global search up to slimit
@@ -272,7 +272,7 @@ extern "C"
272272
*it += iter;
273273
iter = 0;
274274
*search += 1;
275-
q = _rand_q(ets);
275+
_rand_q(ets, q);
276276
}
277277

278278
free(np_e);
@@ -326,7 +326,7 @@ extern "C"
326326
}
327327
else
328328
{
329-
q = _rand_q(ets);
329+
_rand_q(ets, q);
330330
}
331331

332332
// Global search up to slimit
@@ -392,7 +392,7 @@ extern "C"
392392
*it += iter;
393393
iter = 0;
394394
*search += 1;
395-
q = _rand_q(ets);
395+
_rand_q(ets, q);
396396
}
397397

398398
free(np_e);
@@ -440,7 +440,7 @@ extern "C"
440440
}
441441
else
442442
{
443-
q = _rand_q(ets);
443+
_rand_q(ets, q);
444444
}
445445

446446
// Global search up to slimit
@@ -503,7 +503,7 @@ extern "C"
503503
*it += iter;
504504
iter = 0;
505505
*search += 1;
506-
q = _rand_q(ets);
506+
_rand_q(ets, q);
507507
}
508508

509509
free(np_e);
@@ -552,7 +552,7 @@ extern "C"
552552
}
553553
else
554554
{
555-
q = _rand_q(ets);
555+
_rand_q(ets, q);
556556
}
557557

558558
// Global search up to slimit
@@ -618,7 +618,7 @@ extern "C"
618618
*it += iter;
619619
iter = 0;
620620
*search += 1;
621-
q = _rand_q(ets);
621+
_rand_q(ets, q);
622622
}
623623

624624
free(np_e);
@@ -703,17 +703,17 @@ extern "C"
703703
}
704704
}
705705

706-
VectorX _rand_q(ETS *ets)
706+
void _rand_q(ETS *ets, MapVectorX q)
707707
{
708708
Eigen::Map<Eigen::ArrayXd> qlim_l(ets->qlim_l, ets->n);
709709
Eigen::Map<Eigen::ArrayXd> q_range2(ets->q_range2, ets->n);
710710

711-
VectorX q = VectorX::Random(ets->n);
711+
q = VectorX::Random(ets->n);
712712

713713
q = (q.array() + 1) * q_range2;
714714
q = q.array() + qlim_l;
715715

716-
return q;
716+
// return q;
717717
}
718718

719719
} /* extern "C" */

roboticstoolbox/core/ik.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ extern "C"
4848
double lambda, MapVectorX we);
4949

5050
void _pseudo_inverse(Eigen::Map<Eigen::MatrixXd> J, Eigen::Map<Eigen::MatrixXd> J_pinv, double damping);
51-
VectorX _rand_q(ETS *ets);
51+
void _rand_q(ETS *ets, MapVectorX q);
5252
int _check_lim(ETS *ets, MapVectorX q);
5353
void _angle_axis(MapMatrix4dc Te, Matrix4dc Tep, MapVectorX e);
5454

roboticstoolbox/core/methods.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ extern "C"
1717
{
1818
#endif /* __cplusplus */
1919

20-
VectorX _rand_q(ETS *ets);
2120
int _check_lim(ETS *ets, MapVectorX q);
2221
void _angle_axis(MapMatrix4dc Te, Matrix4dc Tep, MapVectorX e);
2322
void _ETS_hessian(int n, MapMatrixJc &J, MapMatrixHr &H);

0 commit comments

Comments
 (0)
0