Skip to content

Commit b5d1b44

Browse files
authored
Use gradient bio_ik solver and fix memory issues (#705)
2 parents 963cac6 + 6219ff1 commit b5d1b44

File tree

3 files changed

+17
-57
lines changed

3 files changed

+17
-57
lines changed

bitbots_motion/bitbots_splines/src/Spline/pose_spline.cpp

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -30,49 +30,19 @@ geometry_msgs::msg::Quaternion PoseSpline::getGeometryMsgOrientation(double time
3030
return msg;
3131
}
3232

33-
tf2::Vector3 PoseSpline::getPositionPos(double time) {
34-
tf2::Vector3 pos;
35-
pos[0] = x_.pos(time);
36-
pos[1] = y_.pos(time);
37-
pos[2] = z_.pos(time);
38-
return pos;
39-
}
33+
tf2::Vector3 PoseSpline::getPositionPos(double time) { return tf2::Vector3(x_.pos(time), y_.pos(time), z_.pos(time)); }
4034

41-
tf2::Vector3 PoseSpline::getPositionVel(double time) {
42-
tf2::Vector3 vel;
43-
vel[0] = x_.vel(time);
44-
vel[1] = y_.vel(time);
45-
vel[2] = z_.vel(time);
46-
return vel;
47-
}
48-
tf2::Vector3 PoseSpline::getPositionAcc(double time) {
49-
tf2::Vector3 acc;
50-
acc[0] = x_.acc(time);
51-
acc[1] = y_.acc(time);
52-
acc[2] = z_.acc(time);
53-
return acc;
54-
}
35+
tf2::Vector3 PoseSpline::getPositionVel(double time) { return tf2::Vector3(x_.vel(time), y_.vel(time), z_.vel(time)); }
36+
tf2::Vector3 PoseSpline::getPositionAcc(double time) { return tf2::Vector3(x_.acc(time), y_.acc(time), z_.acc(time)); }
5537

5638
tf2::Vector3 PoseSpline::getEulerAngles(double time) {
57-
tf2::Vector3 pos;
58-
pos[0] = roll_.pos(time);
59-
pos[1] = pitch_.pos(time);
60-
pos[2] = yaw_.pos(time);
61-
return pos;
39+
return tf2::Vector3(roll_.pos(time), pitch_.pos(time), yaw_.pos(time));
6240
}
6341
tf2::Vector3 PoseSpline::getEulerVel(double time) {
64-
tf2::Vector3 vel;
65-
vel[0] = roll_.vel(time);
66-
vel[1] = pitch_.vel(time);
67-
vel[2] = yaw_.vel(time);
68-
return vel;
42+
return tf2::Vector3(roll_.vel(time), pitch_.vel(time), yaw_.vel(time));
6943
}
7044
tf2::Vector3 PoseSpline::getEulerAcc(double time) {
71-
tf2::Vector3 acc;
72-
acc[0] = roll_.acc(time);
73-
acc[1] = pitch_.acc(time);
74-
acc[2] = yaw_.acc(time);
75-
return acc;
45+
return tf2::Vector3(roll_.acc(time), pitch_.acc(time), yaw_.acc(time));
7646
}
7747

7848
tf2::Quaternion PoseSpline::getOrientation(double time) {

bitbots_motion/bitbots_splines/src/Spline/position_spline.cpp

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,10 @@ geometry_msgs::msg::Point PositionSpline::getGeometryMsgPosition(double time) {
1111
return msg;
1212
}
1313

14-
tf2::Vector3 PositionSpline::getPos(double time) {
15-
tf2::Vector3 pos;
16-
pos[0] = x_.pos(time);
17-
pos[1] = y_.pos(time);
18-
pos[2] = z_.pos(time);
19-
return pos;
20-
}
14+
tf2::Vector3 PositionSpline::getPos(double time) { return tf2::Vector3(x_.pos(time), y_.pos(time), z_.pos(time)); }
2115

22-
tf2::Vector3 PositionSpline::getVel(double time) {
23-
tf2::Vector3 vel;
24-
vel[0] = x_.vel(time);
25-
vel[1] = y_.vel(time);
26-
vel[2] = z_.vel(time);
27-
return vel;
28-
}
29-
tf2::Vector3 PositionSpline::getAcc(double time) {
30-
tf2::Vector3 acc;
31-
acc[0] = x_.acc(time);
32-
acc[1] = y_.acc(time);
33-
acc[2] = z_.acc(time);
34-
return acc;
35-
}
16+
tf2::Vector3 PositionSpline::getVel(double time) { return tf2::Vector3(x_.vel(time), y_.vel(time), z_.vel(time)); }
17+
tf2::Vector3 PositionSpline::getAcc(double time) { return tf2::Vector3(x_.acc(time), y_.acc(time), z_.acc(time)); }
3618

3719
SmoothSpline *PositionSpline::x() { return &x_; }
3820

bitbots_robot/wolfgang_moveit_config/config/kinematics.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,36 @@ LeftLeg:
22
kinematics_solver: bio_ik/BioIKKinematicsPlugin # kdl_kinematics_plugin/KDLKinematicsPlugin
33
kinematics_solver_search_resolution: 0.00001
44
kinematics_solver_timeout: 0.01
5+
mode: gd_c
56
RightLeg:
67
kinematics_solver: bio_ik/BioIKKinematicsPlugin # kdl_kinematics_plugin/KDLKinematicsPlugin
78
kinematics_solver_search_resolution: 0.00001
89
kinematics_solver_timeout: 0.01
10+
mode: gd_c
911
Legs:
1012
kinematics_solver_search_resolution: 0.0001
1113
kinematics_solver_timeout: 0.005
14+
mode: gd_c
1215
RightArm:
1316
kinematics_solver: bio_ik/BioIKKinematicsPlugin
1417
kinematics_solver_search_resolution: 0.00001
1518
kinematics_solver_timeout: 0.01
19+
mode: gd_c
1620
LeftArm:
1721
kinematics_solver: bio_ik/BioIKKinematicsPlugin
1822
kinematics_solver_search_resolution: 0.00001
1923
kinematics_solver_timeout: 0.01
24+
mode: gd_c
2025
Arms:
2126
kinematics_solver_search_resolution: 0.00001
2227
kinematics_solver_timeout: 0.01
28+
mode: gd_c
2329
Head:
2430
kinematics_solver: bio_ik/BioIKKinematicsPlugin
2531
kinematics_solver_search_resolution: 0.001
2632
kinematics_solver_timeout: 0.001
33+
mode: gd_c
2734
All:
2835
kinematics_solver_search_resolution: 0.005
2936
kinematics_solver_timeout: 0.005
37+
mode: gd_c

0 commit comments

Comments
 (0)