placo 0.8.10__tar.gz → 0.9.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of placo might be problematic. Click here for more details.

Files changed (176) hide show
  1. {placo-0.8.10 → placo-0.9.1}/CMakeLists.txt +2 -0
  2. {placo-0.8.10 → placo-0.9.1}/PKG-INFO +1 -1
  3. {placo-0.8.10 → placo-0.9.1}/bindings/expose-kinematics.cpp +16 -0
  4. {placo-0.8.10 → placo-0.9.1}/bindings/expose-robot-wrapper.cpp +14 -13
  5. {placo-0.8.10 → placo-0.9.1}/bindings/expose-walk-pattern-generator.cpp +18 -11
  6. {placo-0.8.10 → placo-0.9.1}/pyproject.toml +1 -1
  7. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/footsteps_planner.h +12 -5
  8. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/humanoid_robot.cpp +0 -6
  9. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/humanoid_robot.h +4 -10
  10. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/walk_pattern_generator.cpp +55 -22
  11. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/walk_pattern_generator.h +27 -6
  12. placo-0.9.1/src/placo/kinematics/distance_constraint.cpp +41 -0
  13. placo-0.9.1/src/placo/kinematics/distance_constraint.h +43 -0
  14. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/kinematics_solver.cpp +24 -0
  15. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/kinematics_solver.h +43 -2
  16. placo-0.9.1/src/placo/kinematics/yaw_constraint.cpp +52 -0
  17. placo-0.9.1/src/placo/kinematics/yaw_constraint.h +42 -0
  18. {placo-0.8.10 → placo-0.9.1}/src/placo/model/robot_wrapper.cpp +0 -5
  19. {placo-0.8.10 → placo-0.9.1}/src/placo/model/robot_wrapper.h +1 -6
  20. {placo-0.8.10 → placo-0.9.1}/.clang-format +0 -0
  21. {placo-0.8.10 → placo-0.9.1}/.gitattributes +0 -0
  22. {placo-0.8.10 → placo-0.9.1}/.github/workflows/wheels.yml +0 -0
  23. {placo-0.8.10 → placo-0.9.1}/.gitignore +0 -0
  24. {placo-0.8.10 → placo-0.9.1}/.readthedocs.yaml +0 -0
  25. {placo-0.8.10 → placo-0.9.1}/Doxyfile +0 -0
  26. {placo-0.8.10 → placo-0.9.1}/LICENSE +0 -0
  27. {placo-0.8.10 → placo-0.9.1}/README.md +0 -0
  28. {placo-0.8.10 → placo-0.9.1}/bindings/doxystub.h +0 -0
  29. {placo-0.8.10 → placo-0.9.1}/bindings/expose-dynamics.cpp +0 -0
  30. {placo-0.8.10 → placo-0.9.1}/bindings/expose-eigen.cpp +0 -0
  31. {placo-0.8.10 → placo-0.9.1}/bindings/expose-footsteps.cpp +0 -0
  32. {placo-0.8.10 → placo-0.9.1}/bindings/expose-parameters.cpp +0 -0
  33. {placo-0.8.10 → placo-0.9.1}/bindings/expose-problem.cpp +0 -0
  34. {placo-0.8.10 → placo-0.9.1}/bindings/expose-tools.cpp +0 -0
  35. {placo-0.8.10 → placo-0.9.1}/bindings/expose-utils.hpp +0 -0
  36. {placo-0.8.10 → placo-0.9.1}/bindings/module.cpp +0 -0
  37. {placo-0.8.10 → placo-0.9.1}/bindings/module.h +0 -0
  38. {placo-0.8.10 → placo-0.9.1}/python/.vscode/settings.json +0 -0
  39. {placo-0.8.10 → placo-0.9.1}/python/Makefile +0 -0
  40. {placo-0.8.10 → placo-0.9.1}/python/placo_utils/__init__.py +0 -0
  41. {placo-0.8.10 → placo-0.9.1}/python/placo_utils/tf.py +0 -0
  42. {placo-0.8.10 → placo-0.9.1}/python/placo_utils/view.py +0 -0
  43. {placo-0.8.10 → placo-0.9.1}/python/placo_utils/visualization.py +0 -0
  44. {placo-0.8.10 → placo-0.9.1}/python/run_tests.sh +0 -0
  45. {placo-0.8.10 → placo-0.9.1}/scripts/requirements.sh +0 -0
  46. {placo-0.8.10 → placo-0.9.1}/scripts/robotpkg.sh +0 -0
  47. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/avoid_self_collisions_constraint.cpp +0 -0
  48. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/avoid_self_collisions_constraint.h +0 -0
  49. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/com_task.cpp +0 -0
  50. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/com_task.h +0 -0
  51. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/constraint.cpp +0 -0
  52. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/constraint.h +0 -0
  53. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/contacts.cpp +0 -0
  54. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/contacts.h +0 -0
  55. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/dynamics_solver.cpp +0 -0
  56. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/dynamics_solver.h +0 -0
  57. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/frame_task.cpp +0 -0
  58. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/frame_task.h +0 -0
  59. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/gear_task.cpp +0 -0
  60. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/gear_task.h +0 -0
  61. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/joints_task.cpp +0 -0
  62. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/joints_task.h +0 -0
  63. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/orientation_task.cpp +0 -0
  64. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/orientation_task.h +0 -0
  65. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/position_task.cpp +0 -0
  66. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/position_task.h +0 -0
  67. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/relative_frame_task.cpp +0 -0
  68. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/relative_frame_task.h +0 -0
  69. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/relative_orientation_task.cpp +0 -0
  70. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/relative_orientation_task.h +0 -0
  71. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/relative_position_task.cpp +0 -0
  72. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/relative_position_task.h +0 -0
  73. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/task.cpp +0 -0
  74. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/task.h +0 -0
  75. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/torque_task.cpp +0 -0
  76. {placo-0.8.10 → placo-0.9.1}/src/placo/dynamics/torque_task.h +0 -0
  77. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/foot_trajectory.cpp +0 -0
  78. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/foot_trajectory.h +0 -0
  79. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/footsteps_planner.cpp +0 -0
  80. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/footsteps_planner_naive.cpp +0 -0
  81. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/footsteps_planner_naive.h +0 -0
  82. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/footsteps_planner_repetitive.cpp +0 -0
  83. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/footsteps_planner_repetitive.h +0 -0
  84. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/humanoid_parameters.cpp +0 -0
  85. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/humanoid_parameters.h +0 -0
  86. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/kick.cpp +0 -0
  87. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/kick.h +0 -0
  88. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/lipm.cpp +0 -0
  89. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/lipm.h +0 -0
  90. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/swing_foot.cpp +0 -0
  91. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/swing_foot.h +0 -0
  92. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/swing_foot_cubic.cpp +0 -0
  93. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/swing_foot_cubic.h +0 -0
  94. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/swing_foot_quintic.cpp +0 -0
  95. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/swing_foot_quintic.h +0 -0
  96. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/walk_tasks.cpp +0 -0
  97. {placo-0.8.10 → placo-0.9.1}/src/placo/humanoid/walk_tasks.h +0 -0
  98. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/avoid_self_collisions_constraint.cpp +0 -0
  99. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/avoid_self_collisions_constraint.h +0 -0
  100. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/axis_align_task.cpp +0 -0
  101. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/axis_align_task.h +0 -0
  102. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/centroidal_momentum_task.cpp +0 -0
  103. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/centroidal_momentum_task.h +0 -0
  104. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/com_polygon_constraint.cpp +0 -0
  105. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/com_polygon_constraint.h +0 -0
  106. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/com_task.cpp +0 -0
  107. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/com_task.h +0 -0
  108. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/cone_constraint.cpp +0 -0
  109. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/cone_constraint.h +0 -0
  110. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/constraint.cpp +0 -0
  111. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/constraint.h +0 -0
  112. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/distance_task.cpp +0 -0
  113. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/distance_task.h +0 -0
  114. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/frame_task.cpp +0 -0
  115. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/frame_task.h +0 -0
  116. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/gear_task.cpp +0 -0
  117. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/gear_task.h +0 -0
  118. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/joint_space_half_spaces_constraint.cpp +0 -0
  119. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/joint_space_half_spaces_constraint.h +0 -0
  120. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/joints_task.cpp +0 -0
  121. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/joints_task.h +0 -0
  122. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/kinetic_energy_regularization_task.cpp +0 -0
  123. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/kinetic_energy_regularization_task.h +0 -0
  124. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/manipulability_task.cpp +0 -0
  125. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/manipulability_task.h +0 -0
  126. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/orientation_task.cpp +0 -0
  127. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/orientation_task.h +0 -0
  128. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/position_task.cpp +0 -0
  129. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/position_task.h +0 -0
  130. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/regularization_task.cpp +0 -0
  131. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/regularization_task.h +0 -0
  132. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/relative_frame_task.cpp +0 -0
  133. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/relative_frame_task.h +0 -0
  134. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/relative_orientation_task.cpp +0 -0
  135. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/relative_orientation_task.h +0 -0
  136. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/relative_position_task.cpp +0 -0
  137. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/relative_position_task.h +0 -0
  138. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/task.cpp +0 -0
  139. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/task.h +0 -0
  140. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/wheel_task.cpp +0 -0
  141. {placo-0.8.10 → placo-0.9.1}/src/placo/kinematics/wheel_task.h +0 -0
  142. {placo-0.8.10 → placo-0.9.1}/src/placo/problem/constraint.cpp +0 -0
  143. {placo-0.8.10 → placo-0.9.1}/src/placo/problem/constraint.h +0 -0
  144. {placo-0.8.10 → placo-0.9.1}/src/placo/problem/expression.cpp +0 -0
  145. {placo-0.8.10 → placo-0.9.1}/src/placo/problem/expression.h +0 -0
  146. {placo-0.8.10 → placo-0.9.1}/src/placo/problem/integrator.cpp +0 -0
  147. {placo-0.8.10 → placo-0.9.1}/src/placo/problem/integrator.h +0 -0
  148. {placo-0.8.10 → placo-0.9.1}/src/placo/problem/polygon_constraint.cpp +0 -0
  149. {placo-0.8.10 → placo-0.9.1}/src/placo/problem/polygon_constraint.h +0 -0
  150. {placo-0.8.10 → placo-0.9.1}/src/placo/problem/problem.cpp +0 -0
  151. {placo-0.8.10 → placo-0.9.1}/src/placo/problem/problem.h +0 -0
  152. {placo-0.8.10 → placo-0.9.1}/src/placo/problem/problem_polynom.cpp +0 -0
  153. {placo-0.8.10 → placo-0.9.1}/src/placo/problem/problem_polynom.h +0 -0
  154. {placo-0.8.10 → placo-0.9.1}/src/placo/problem/qp_error.cpp +0 -0
  155. {placo-0.8.10 → placo-0.9.1}/src/placo/problem/qp_error.h +0 -0
  156. {placo-0.8.10 → placo-0.9.1}/src/placo/problem/sparsity.cpp +0 -0
  157. {placo-0.8.10 → placo-0.9.1}/src/placo/problem/sparsity.h +0 -0
  158. {placo-0.8.10 → placo-0.9.1}/src/placo/problem/variable.cpp +0 -0
  159. {placo-0.8.10 → placo-0.9.1}/src/placo/problem/variable.h +0 -0
  160. {placo-0.8.10 → placo-0.9.1}/src/placo/tools/axises_mask.cpp +0 -0
  161. {placo-0.8.10 → placo-0.9.1}/src/placo/tools/axises_mask.h +0 -0
  162. {placo-0.8.10 → placo-0.9.1}/src/placo/tools/cubic_spline.cpp +0 -0
  163. {placo-0.8.10 → placo-0.9.1}/src/placo/tools/cubic_spline.h +0 -0
  164. {placo-0.8.10 → placo-0.9.1}/src/placo/tools/cubic_spline_3d.cpp +0 -0
  165. {placo-0.8.10 → placo-0.9.1}/src/placo/tools/cubic_spline_3d.h +0 -0
  166. {placo-0.8.10 → placo-0.9.1}/src/placo/tools/directions.cpp +0 -0
  167. {placo-0.8.10 → placo-0.9.1}/src/placo/tools/directions.h +0 -0
  168. {placo-0.8.10 → placo-0.9.1}/src/placo/tools/polynom.cpp +0 -0
  169. {placo-0.8.10 → placo-0.9.1}/src/placo/tools/polynom.h +0 -0
  170. {placo-0.8.10 → placo-0.9.1}/src/placo/tools/prioritized.cpp +0 -0
  171. {placo-0.8.10 → placo-0.9.1}/src/placo/tools/prioritized.h +0 -0
  172. {placo-0.8.10 → placo-0.9.1}/src/placo/tools/segment.cpp +0 -0
  173. {placo-0.8.10 → placo-0.9.1}/src/placo/tools/segment.h +0 -0
  174. {placo-0.8.10 → placo-0.9.1}/src/placo/tools/utils.cpp +0 -0
  175. {placo-0.8.10 → placo-0.9.1}/src/placo/tools/utils.h +0 -0
  176. {placo-0.8.10 → placo-0.9.1}/wks.yml +0 -0
@@ -89,6 +89,8 @@ add_library(libplaco SHARED
89
89
  src/placo/kinematics/com_polygon_constraint.cpp
90
90
  src/placo/kinematics/joint_space_half_spaces_constraint.cpp
91
91
  src/placo/kinematics/cone_constraint.cpp
92
+ src/placo/kinematics/yaw_constraint.cpp
93
+ src/placo/kinematics/distance_constraint.cpp
92
94
  src/placo/kinematics/axis_align_task.cpp
93
95
 
94
96
  # Dynamics QP solver
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: placo
3
- Version: 0.8.10
3
+ Version: 0.9.1
4
4
  Summary: PlaCo: Rhoban Planning and Control
5
5
  Requires-Python: >= 3.9
6
6
  License-Expression: MIT
@@ -101,6 +101,14 @@ void exposeKinematics()
101
101
  .def<ConeConstraint& (KinematicsSolver::*)(std::string, std::string, double)>(
102
102
  "add_cone_constraint", &KinematicsSolver::add_cone_constraint, return_internal_reference<>())
103
103
 
104
+ // Yaw constraint
105
+ .def<YawConstraint& (KinematicsSolver::*)(std::string, std::string, double)>(
106
+ "add_yaw_constraint", &KinematicsSolver::add_yaw_constraint, return_internal_reference<>())
107
+
108
+ // Distance constraint
109
+ .def<DistanceConstraint& (KinematicsSolver::*)(std::string, std::string, double)>(
110
+ "add_distance_constraint", &KinematicsSolver::add_distance_constraint, return_internal_reference<>())
111
+
104
112
  // Masking/unmasking DoFs
105
113
  .def("mask_dof", &KinematicsSolver::mask_dof)
106
114
  .def("unmask_dof", &KinematicsSolver::unmask_dof)
@@ -246,4 +254,12 @@ void exposeKinematics()
246
254
  .def_readwrite("angle_max", &ConeConstraint::angle_max)
247
255
  .def_readwrite("N", &ConeConstraint::N)
248
256
  .def_readwrite("range", &ConeConstraint::range);
257
+
258
+ class__<YawConstraint, bases<Constraint>>(
259
+ "YawConstraint", init<model::RobotWrapper::FrameIndex, model::RobotWrapper::FrameIndex, double>())
260
+ .def_readwrite("angle_max", &YawConstraint::angle_max);
261
+
262
+ class__<DistanceConstraint, bases<Constraint>>(
263
+ "DistanceConstraint", init<model::RobotWrapper::FrameIndex, model::RobotWrapper::FrameIndex, double>())
264
+ .def_readwrite("distance_max", &DistanceConstraint::distance_max);
249
265
  }
@@ -43,10 +43,12 @@ void exposeRobotType(class_<RobotType, W1>& type)
43
43
  .def("set_velocity_limits", &RobotType::set_velocity_limits)
44
44
  .def("set_torque_limit", &RobotType::set_torque_limit)
45
45
  .def("set_joint_limits", &RobotType::set_joint_limits)
46
- .def("get_joint_limits", +[](RobotType& robot, const std::string& joint) {
47
- auto limits = robot.get_joint_limits(joint);
48
- return Eigen::Vector2d(limits.first, limits.second);
49
- })
46
+ .def(
47
+ "get_joint_limits",
48
+ +[](RobotType& robot, const std::string& joint) {
49
+ auto limits = robot.get_joint_limits(joint);
50
+ return Eigen::Vector2d(limits.first, limits.second);
51
+ })
50
52
  .def("update_kinematics", &RobotType::update_kinematics)
51
53
  .def("compute_hessians", &RobotType::compute_hessians)
52
54
  .def(
@@ -57,7 +59,6 @@ void exposeRobotType(class_<RobotType, W1>& type)
57
59
  .def("get_T_world_fbase", &RobotType::get_T_world_fbase)
58
60
  .def("set_T_world_fbase", &RobotType::set_T_world_fbase)
59
61
  .def("com_world", &RobotType::com_world)
60
- .def("dcom_world", &RobotType::dcom_world)
61
62
  .def("centroidal_map", &RobotType::centroidal_map)
62
63
  .def("joint_names", &RobotType::joint_names, joint_names_overloads())
63
64
  .def("frame_names", &RobotType::frame_names)
@@ -180,14 +181,12 @@ void exposeRobotWrapper()
180
181
  .def<void (HumanoidRobot::*)(const std::string&)>("update_support_side", &HumanoidRobot::update_support_side)
181
182
  .def("ensure_on_floor", &HumanoidRobot::ensure_on_floor)
182
183
  .def("ensure_on_floor_oriented", &HumanoidRobot::ensure_on_floor_oriented)
184
+ .def("update_from_imu", &HumanoidRobot::update_from_imu)
183
185
  .def("get_T_world_left", &HumanoidRobot::get_T_world_left)
184
186
  .def("get_T_world_right", &HumanoidRobot::get_T_world_right)
185
187
  .def("get_T_world_trunk", &HumanoidRobot::get_T_world_trunk)
186
188
  .def("get_com_velocity", &HumanoidRobot::get_com_velocity)
187
- .def("dcm", +[](HumanoidRobot& robot, double omega) { return robot.dcm(omega); })
188
- .def("dcm_from_com_vel", +[](HumanoidRobot& robot, double omega, Eigen::Vector2d com_velocity) {
189
- return robot.dcm(omega, com_velocity);
190
- })
189
+ .def("dcm", &HumanoidRobot::dcm)
191
190
  .def("zmp", &HumanoidRobot::zmp)
192
191
  .def("other_side", &HumanoidRobot::other_side)
193
192
  .def(
@@ -213,10 +212,12 @@ void exposeRobotWrapper()
213
212
  "get_support_side", +[](const HumanoidRobot& robot) { return robot.support_side; })
214
213
  .add_property("support_is_both", &HumanoidRobot::support_is_both, &HumanoidRobot::support_is_both)
215
214
  .add_property("support_side", &HumanoidRobot::support_side)
216
- .def("get_T_world_support", +[](const HumanoidRobot& robot) { return robot.T_world_support; })
217
- .def("set_T_world_support", +[](HumanoidRobot& robot, const Eigen::Affine3d& T_world_support) {
218
- robot.T_world_support = T_world_support;
219
- });
215
+ .def(
216
+ "get_T_world_support", +[](const HumanoidRobot& robot) { return robot.T_world_support; })
217
+ .def(
218
+ "set_T_world_support", +[](HumanoidRobot& robot, const Eigen::Affine3d& T_world_support) {
219
+ robot.T_world_support = T_world_support;
220
+ });
220
221
 
221
222
  exposeStdVector<RobotWrapper::Collision>("vector_Collision");
222
223
  exposeStdVector<RobotWrapper::Distance>("vector_Distance");
@@ -23,9 +23,11 @@ using namespace placo::humanoid;
23
23
  void exposeWalkPatternGenerator()
24
24
  {
25
25
  class__<WalkPatternGenerator::TrajectoryPart>("WPGTrajectoryPart", init<FootstepsPlanner::Support, double>())
26
- .add_property("t_start", &WalkPatternGenerator::TrajectoryPart::t_start, &WalkPatternGenerator::TrajectoryPart::t_start)
26
+ .add_property("t_start", &WalkPatternGenerator::TrajectoryPart::t_start,
27
+ &WalkPatternGenerator::TrajectoryPart::t_start)
27
28
  .add_property("t_end", &WalkPatternGenerator::TrajectoryPart::t_end, &WalkPatternGenerator::TrajectoryPart::t_end)
28
- .add_property("support", &WalkPatternGenerator::TrajectoryPart::support, &WalkPatternGenerator::TrajectoryPart::support);
29
+ .add_property("support", &WalkPatternGenerator::TrajectoryPart::support,
30
+ &WalkPatternGenerator::TrajectoryPart::support);
29
31
 
30
32
  class__<WalkPatternGenerator::Trajectory>("WPGTrajectory", init<double, double, double, double>())
31
33
  .add_property("t_start", &WalkPatternGenerator::Trajectory::t_start)
@@ -46,6 +48,9 @@ void exposeWalkPatternGenerator()
46
48
  .def("get_p_world_ZMP", &WalkPatternGenerator::Trajectory::get_p_world_ZMP)
47
49
  .def("get_p_world_DCM", &WalkPatternGenerator::Trajectory::get_p_world_DCM)
48
50
  .def("get_R_world_trunk", &WalkPatternGenerator::Trajectory::get_R_world_trunk)
51
+ .def("get_p_support_CoM", &WalkPatternGenerator::Trajectory::get_p_support_CoM)
52
+ .def("get_v_support_CoM", &WalkPatternGenerator::Trajectory::get_v_support_CoM)
53
+ .def("get_p_support_DCM", &WalkPatternGenerator::Trajectory::get_p_support_DCM)
49
54
  .def("support_side", &WalkPatternGenerator::Trajectory::support_side)
50
55
  .def("support_is_both", &WalkPatternGenerator::Trajectory::support_is_both)
51
56
  .def("get_supports", &WalkPatternGenerator::Trajectory::get_supports)
@@ -67,7 +72,11 @@ void exposeWalkPatternGenerator()
67
72
  .def("get_optimal_zmp", &WalkPatternGenerator::get_optimal_zmp)
68
73
  .def("support_default_timesteps", &WalkPatternGenerator::support_default_timesteps)
69
74
  .def("support_default_duration", &WalkPatternGenerator::support_default_duration)
70
- .add_property("soft", &WalkPatternGenerator::soft, &WalkPatternGenerator::soft);
75
+ .add_property("soft", &WalkPatternGenerator::soft, &WalkPatternGenerator::soft)
76
+ .add_property("zmp_in_support_weight", &WalkPatternGenerator::zmp_in_support_weight,
77
+ &WalkPatternGenerator::zmp_in_support_weight)
78
+ .add_property("stop_end_support_weight", &WalkPatternGenerator::stop_end_support_weight,
79
+ &WalkPatternGenerator::stop_end_support_weight);
71
80
 
72
81
  class__<SwingFoot>("SwingFoot", init<>())
73
82
  .def("make_trajectory", &SwingFoot::make_trajectory)
@@ -134,14 +143,12 @@ void exposeWalkPatternGenerator()
134
143
  make_function(
135
144
  +[](WalkTasks& tasks) -> OrientationTask& { return *tasks.trunk_orientation_task; },
136
145
  return_value_policy<reference_existing_object>()))
137
- .add_property("com_task",
138
- make_function(
139
- +[](WalkTasks& tasks) -> CoMTask& { return *tasks.com_task; },
140
- return_value_policy<reference_existing_object>()))
141
- .add_property("trunk_task",
142
- make_function(
143
- +[](WalkTasks& tasks) -> PositionTask& { return *tasks.trunk_task; },
144
- return_value_policy<reference_existing_object>()));
146
+ .add_property("com_task", make_function(
147
+ +[](WalkTasks& tasks) -> CoMTask& { return *tasks.com_task; },
148
+ return_value_policy<reference_existing_object>()))
149
+ .add_property("trunk_task", make_function(
150
+ +[](WalkTasks& tasks) -> PositionTask& { return *tasks.trunk_task; },
151
+ return_value_policy<reference_existing_object>()));
145
152
 
146
153
  class__<LIPM::Trajectory>("LIPMTrajectory", init<>())
147
154
  .def("pos", &LIPM::Trajectory::pos)
@@ -23,7 +23,7 @@ description = "PlaCo: Rhoban Planning and Control"
23
23
  license = "MIT"
24
24
  name = "placo"
25
25
  requires-python = ">= 3.9"
26
- version = "0.8.10"
26
+ version = "0.9.1"
27
27
 
28
28
  [project.urls]
29
29
  changelog = "https://github.com/rhoban/placo/blob/main/CHANGELOG.md"
@@ -48,11 +48,17 @@ public:
48
48
 
49
49
  std::vector<Footstep> footsteps;
50
50
 
51
- double t_start = -1.; // Time at which the support starts. Is set to -1 if not initialized
52
- double elapsed_ratio = 0.; // Elapsed ratio of the support phase, ranging from 0 to 1
51
+ // Time at which the support starts. Is set to -1 if not initialized
52
+ double t_start = -1.;
53
53
 
54
- double time_ratio = 1.; // Time ratio for the remaining part of the support phase
55
- Eigen::Vector2d target_world_dcm = Eigen::Vector2d::Zero(); // Target DCM in the world frame at the end of the support phase
54
+ // Elapsed ratio of the support phase, ranging from 0 to 1
55
+ double elapsed_ratio = 0.;
56
+
57
+ // Time ratio for the remaining part of the support phase
58
+ double time_ratio = 1.;
59
+
60
+ // Target DCM in the world frame at the end of the support phase
61
+ Eigen::Vector2d target_world_dcm = Eigen::Vector2d::Zero();
56
62
 
57
63
  bool start = false;
58
64
  bool end = false;
@@ -119,7 +125,8 @@ public:
119
125
  * @return vector of supports to use. It starts with initial double supports,
120
126
  * and add double support phases between footsteps.
121
127
  */
122
- static std::vector<Support> make_supports(std::vector<Footstep> footsteps, double t_start, bool start = true, bool middle = false, bool end = true);
128
+ static std::vector<Support> make_supports(std::vector<Footstep> footsteps, double t_start, bool start = true,
129
+ bool middle = false, bool end = true);
123
130
 
124
131
  /**
125
132
  * @brief Return the type of footsteps planner
@@ -194,12 +194,6 @@ Eigen::VectorXd HumanoidRobot::get_torques(Eigen::VectorXd acc_a, Eigen::VectorX
194
194
  return M * acc + h - J_c * contact_forces;
195
195
  }
196
196
 
197
- Eigen::Vector2d HumanoidRobot::dcm(double omega)
198
- {
199
- // DCM = c + (1/omega) c_dot
200
- return com_world().head(2) + (1 / omega) * dcom_world().head(2);
201
- }
202
-
203
197
  Eigen::Vector2d HumanoidRobot::dcm(double omega, Eigen::Vector2d com_velocity)
204
198
  {
205
199
  // DCM = c + (1/omega) c_dot
@@ -39,7 +39,7 @@ public:
39
39
  void ensure_on_floor();
40
40
 
41
41
  /**
42
- * @brief Place the robot on its support on the floor according
42
+ * @brief Place the robot on its support on the floor according
43
43
  * to the trunk orientation and the kinematic configuration
44
44
  * @param R_world_trunk Orientation of the trunk
45
45
  */
@@ -70,14 +70,8 @@ public:
70
70
  * @param use_non_linear_effects If true, non linear effects are taken into account (state.qd necessary)
71
71
  * @return Torques of the motors
72
72
  */
73
- Eigen::VectorXd get_torques(Eigen::VectorXd acc_a, Eigen::VectorXd contact_forces, bool use_non_linear_effects = false);
74
-
75
- /**
76
- * @brief Compute the Divergent Component of Motion (DCM)
77
- * @param omega Natural frequency of the LIP (= sqrt(g/h))
78
- * @return DCM
79
- */
80
- Eigen::Vector2d dcm(double omega);
73
+ Eigen::VectorXd get_torques(Eigen::VectorXd acc_a, Eigen::VectorXd contact_forces,
74
+ bool use_non_linear_effects = false);
81
75
 
82
76
  /**
83
77
  * @brief Compute the Divergent Component of Motion (DCM)
@@ -145,4 +139,4 @@ public:
145
139
  double dist_z_pan_camera; // Distance along z between the pan DoF and the camera in the head
146
140
  double dist_y_trunk_foot; // Distance along y between the trunk and the left_foot frame in model
147
141
  };
148
- } // namespace placo::humanoid
142
+ } // namespace placo::humanoid
@@ -212,6 +212,25 @@ Eigen::Matrix3d WalkPatternGenerator::Trajectory::get_R_world_trunk(double t)
212
212
  return T.linear() * R_world_trunk;
213
213
  }
214
214
 
215
+ Eigen::Vector3d WalkPatternGenerator::Trajectory::get_p_support_CoM(double t)
216
+ {
217
+ TrajectoryPart& part = _findPart(parts, t);
218
+ Eigen::Affine3d T_support_world = placo::tools::flatten_on_floor(get_T_world_foot(part.support.side(), t)).inverse();
219
+ return T_support_world * get_p_world_CoM(t);
220
+ }
221
+
222
+ Eigen::Vector3d WalkPatternGenerator::Trajectory::get_v_support_CoM(double t)
223
+ {
224
+ TrajectoryPart& part = _findPart(parts, t);
225
+ Eigen::Affine3d T_support_world = placo::tools::flatten_on_floor(get_T_world_foot(part.support.side(), t)).inverse();
226
+ return T_support_world.linear() * get_v_world_CoM(t);
227
+ }
228
+
229
+ Eigen::Vector2d WalkPatternGenerator::Trajectory::get_p_support_DCM(double t, double omega)
230
+ {
231
+ return get_p_support_CoM(t).head(2) + (1 / omega) * get_v_support_CoM(t).head(2);
232
+ }
233
+
215
234
  HumanoidRobot::Side WalkPatternGenerator::Trajectory::support_side(double t)
216
235
  {
217
236
  return _findPart(parts, t).support.side();
@@ -402,7 +421,7 @@ void WalkPatternGenerator::constrain_lipm(problem::Problem& problem, LIPM& lipm,
402
421
  lipm.zmp(timestep, omega_2), support.support_polygon(), parameters.zmp_margin));
403
422
  if (soft)
404
423
  {
405
- zmp_constraint.configure(ProblemConstraint::Soft, 1e5);
424
+ zmp_constraint.configure(ProblemConstraint::Soft, zmp_in_support_weight);
406
425
  }
407
426
 
408
427
  // Optional offset for single supports
@@ -428,15 +447,15 @@ void WalkPatternGenerator::constrain_lipm(problem::Problem& problem, LIPM& lipm,
428
447
 
429
448
  if (soft)
430
449
  {
431
- pos_constraint.configure(ProblemConstraint::Soft, 1e3);
432
- vel_constraint.configure(ProblemConstraint::Soft, 1e3);
433
- acc_constraint.configure(ProblemConstraint::Soft, 1e3);
450
+ pos_constraint.configure(ProblemConstraint::Soft, stop_end_support_weight);
451
+ vel_constraint.configure(ProblemConstraint::Soft, stop_end_support_weight);
452
+ acc_constraint.configure(ProblemConstraint::Soft, stop_end_support_weight);
434
453
  }
435
454
  }
436
455
  }
437
456
  }
438
457
 
439
- void WalkPatternGenerator::plan_com(Trajectory& trajectory, std::vector<FootstepsPlanner::Support>& supports,
458
+ bool WalkPatternGenerator::plan_com(Trajectory& trajectory, std::vector<FootstepsPlanner::Support>& supports,
440
459
  Eigen::Vector2d initial_pos, Eigen::Vector2d initial_vel,
441
460
  Eigen::Vector2d initial_acc)
442
461
  {
@@ -476,14 +495,24 @@ void WalkPatternGenerator::plan_com(Trajectory& trajectory, std::vector<Footstep
476
495
  trajectory.t_end = t;
477
496
 
478
497
  // Solving the problem
479
- problem.solve();
498
+ try
499
+ {
500
+ problem.solve();
501
+ }
502
+ catch (const std::exception& e)
503
+ {
504
+ return false;
505
+ }
480
506
 
507
+ // Attributing the LIPM trajectories to the trajectory parts
481
508
  for (int i = 0; i < (int)trajectory.parts.size(); i++)
482
509
  {
483
510
  auto& part = trajectory.parts[i];
484
511
  part.com_trajectory = lipms[i].get_trajectory();
485
512
  part.support.target_world_dcm = part.com_trajectory.dcm(part.t_end, omega);
486
513
  }
514
+
515
+ return true;
487
516
  }
488
517
 
489
518
  WalkPatternGenerator::Trajectory WalkPatternGenerator::plan(std::vector<FootstepsPlanner::Support>& supports,
@@ -523,7 +552,12 @@ WalkPatternGenerator::Trajectory WalkPatternGenerator::replan(std::vector<Footst
523
552
  Eigen::Vector2d initial_pos = old_trajectory.get_p_world_CoM(t_replan).head(2);
524
553
  Eigen::Vector2d initial_vel = old_trajectory.get_v_world_CoM(t_replan).head(2);
525
554
  Eigen::Vector2d initial_acc = old_trajectory.get_a_world_CoM(t_replan).head(2);
526
- plan_com(trajectory, supports, initial_pos, initial_vel, initial_acc);
555
+ bool planned_com = plan_com(trajectory, supports, initial_pos, initial_vel, initial_acc);
556
+
557
+ if (!planned_com)
558
+ {
559
+ return old_trajectory;
560
+ }
527
561
 
528
562
  plan_feet_trajectories(trajectory, &old_trajectory);
529
563
 
@@ -539,9 +573,9 @@ bool WalkPatternGenerator::can_replan_supports(Trajectory& trajectory, double t_
539
573
  return false;
540
574
  }
541
575
 
576
+ // We can't replan if the current support is a double support
542
577
  if (trajectory.get_support(t_replan).is_both())
543
578
  {
544
- // We can't replan if the current support is a double support
545
579
  return false;
546
580
  }
547
581
 
@@ -613,7 +647,6 @@ std::vector<FootstepsPlanner::Support> WalkPatternGenerator::replan_supports(Foo
613
647
  current_support.elapsed_ratio +
614
648
  elapsed_duration / (support_default_duration(current_support) * current_support.time_ratio);
615
649
  supports[0].time_ratio = current_support.time_ratio;
616
- supports[0].target_world_dcm = current_support.target_world_dcm;
617
650
  return supports;
618
651
  }
619
652
 
@@ -651,9 +684,8 @@ void WalkPatternGenerator::Trajectory::print_parts_timings()
651
684
  }
652
685
  }
653
686
 
654
- std::vector<FootstepsPlanner::Support>
655
- WalkPatternGenerator::update_supports(double t, std::vector<FootstepsPlanner::Support> supports,
656
- Eigen::Vector2d world_target_zmp, Eigen::Vector2d world_measured_dcm)
687
+ std::vector<FootstepsPlanner::Support> WalkPatternGenerator::update_supports(
688
+ double t, std::vector<FootstepsPlanner::Support> supports, Eigen::Vector2d world_measured_dcm)
657
689
  {
658
690
  FootstepsPlanner::Support current_support = supports[0];
659
691
  if (current_support.is_both())
@@ -671,12 +703,15 @@ WalkPatternGenerator::update_supports(double t, std::vector<FootstepsPlanner::Su
671
703
  Eigen::Matrix2d R_world_support = current_support.frame().rotation().topLeftCorner(2, 2);
672
704
  Eigen::Vector2d p_world_support = current_support.frame().translation().head(2);
673
705
 
674
- // Decision variables
675
- placo::problem::Variable* support_next_zmp =
676
- &problem.add_variable(2); // ZMP of the next support expressed in the current support frame
677
- placo::problem::Variable* tau = &problem.add_variable(1); // exp(omega * T) where T is the end of the current support
678
- placo::problem::Variable* support_dcm_offset =
679
- &problem.add_variable(2); // Offset of the DCM from the ZMP in the current support frame
706
+ // ----------------- Decision variables: ------------------
707
+ // ZMP of the next support expressed in the current support frame
708
+ placo::problem::Variable* support_next_zmp = &problem.add_variable(2);
709
+
710
+ // exp(omega * T) where T is the end of the current support
711
+ placo::problem::Variable* tau = &problem.add_variable(1);
712
+
713
+ // Offset of the DCM from the ZMP in the current support frame
714
+ placo::problem::Variable* support_dcm_offset = &problem.add_variable(2);
680
715
 
681
716
  // ----------------- Objective functions: -----------------
682
717
  // Time reference
@@ -685,14 +720,11 @@ WalkPatternGenerator::update_supports(double t, std::vector<FootstepsPlanner::Su
685
720
 
686
721
  // ZMP Reference (expressed in the world frame)
687
722
  Expression world_next_zmp_expr = p_world_support + R_world_support * support_next_zmp->expr();
723
+ Eigen::Vector2d world_target_zmp = supports[1].frame().translation().head(2);
688
724
  problem.add_constraint(world_next_zmp_expr == world_target_zmp).configure(ProblemConstraint::Soft, w2);
689
725
 
690
726
  // DCM offset reference (expressed in the world frame)
691
- // XXX : l'offset doit être calculé par rapport à la cible mise à jour non ?
692
727
  Eigen::Vector2d world_target_dcm_offset = current_support.target_world_dcm - world_target_zmp;
693
- // Eigen::Vector2d world_target_dcm_offset = world_end_dcm - next_support.frame().translation().head(2);
694
- // std::cout << "world_target_dcm_offset: " << world_target_dcm_offset.transpose() << std::endl;
695
-
696
728
  Expression world_dcm_offset_expr = R_world_support * support_dcm_offset->expr();
697
729
  problem.add_constraint(world_dcm_offset_expr == world_target_dcm_offset).configure(ProblemConstraint::Soft, w3);
698
730
 
@@ -747,6 +779,7 @@ WalkPatternGenerator::update_supports(double t, std::vector<FootstepsPlanner::Su
747
779
  problem.solve();
748
780
 
749
781
  // Updating next support position
782
+ // XXX: Problème de transform T qui s'applique ?
750
783
  Eigen::Vector2d world_next_zmp_val = p_world_support + R_world_support * support_next_zmp->value;
751
784
  supports[1].footsteps[0].frame.translation().x() = world_next_zmp_val(0);
752
785
  supports[1].footsteps[0].frame.translation().y() = world_next_zmp_val(1);
@@ -78,6 +78,10 @@ public:
78
78
 
79
79
  Eigen::Matrix3d get_R_world_trunk(double t);
80
80
 
81
+ Eigen::Vector3d get_p_support_CoM(double t);
82
+ Eigen::Vector3d get_v_support_CoM(double t);
83
+ Eigen::Vector2d get_p_support_DCM(double t, double omega);
84
+
81
85
  HumanoidRobot::Side support_side(double t);
82
86
  bool support_is_both(double t);
83
87
  bool is_flying(HumanoidRobot::Side side, double t);
@@ -180,19 +184,14 @@ public:
180
184
  std::vector<FootstepsPlanner::Support> replan_supports(FootstepsPlanner& planner, Trajectory& trajectory,
181
185
  double t_replan, double t_last_replan);
182
186
 
183
- double last_com_planning_duration = 0.;
184
- double last_feet_planning_duration = 0.;
185
-
186
187
  /**
187
188
  * @brief Updates the supports to ensure DCM viability by adjusting the
188
189
  * duration and the target of the current swing trajectory.
189
190
  * @param t Current time
190
191
  * @param supports Planned supports
191
- * @param world_target_zmp Target ZMP for the flying foot in world frame
192
192
  * @param world_measured_dcm Measured DCM in world frame
193
193
  */
194
194
  std::vector<FootstepsPlanner::Support> update_supports(double t, std::vector<FootstepsPlanner::Support> supports,
195
- Eigen::Vector2d world_target_zmp,
196
195
  Eigen::Vector2d world_measured_dcm);
197
196
 
198
197
  /**
@@ -210,6 +209,8 @@ public:
210
209
  double support_default_duration(FootstepsPlanner::Support& support);
211
210
 
212
211
  bool soft = false;
212
+ double zmp_in_support_weight = 1e3;
213
+ double stop_end_support_weight = 1e3;
213
214
 
214
215
  protected:
215
216
  // Robot associated to the WPG
@@ -218,13 +219,33 @@ protected:
218
219
  // The parameters to use for planning. The values are forwarded to the relevant solvers when needed.
219
220
  HumanoidParameters& parameters;
220
221
 
222
+ // Natural frequency of the LIPM (omega = sqrt(g/h))
221
223
  double omega;
224
+
225
+ // Squared natural frequency of the LIPM (omega^2 = g/h)
222
226
  double omega_2;
223
227
 
228
+ /**
229
+ * @brief Constrains the LIPM to ensure that the ZMP stays in the support polygon and that the CoM stops at
230
+ * the end of an end support.
231
+ * @param problem Problem to add the constraints to
232
+ * @param lipm LIPM to constrain
233
+ * @param support Support to constrain
234
+ * @param omega_2 Squared natural frequency of the LIPM (omega^2 = g/h)
235
+ * @param parameters Humanoid parameters to use for the constraints
236
+ */
224
237
  void constrain_lipm(problem::Problem& problem, LIPM& lipm, FootstepsPlanner::Support& support, double omega_2,
225
238
  HumanoidParameters& parameters);
226
239
 
227
- void plan_com(Trajectory& trajectory, std::vector<FootstepsPlanner::Support>& supports, Eigen::Vector2d initial_pos,
240
+ /**
241
+ * @brief Plans the CoM trajectory for a given support. Returns false if the QP solver failed to solve the problem.
242
+ * @param trajectory Trajectory to fill
243
+ * @param support Support to plan
244
+ * @param initial_pos Initial position of the CoM in the world frame
245
+ * @param initial_vel Initial velocity of the CoM in the world frame
246
+ * @param initial_acc Initial acceleration of the CoM in the world frame
247
+ */
248
+ bool plan_com(Trajectory& trajectory, std::vector<FootstepsPlanner::Support>& supports, Eigen::Vector2d initial_pos,
228
249
  Eigen::Vector2d initial_vel = Eigen::Vector2d::Zero(),
229
250
  Eigen::Vector2d initial_acc = Eigen::Vector2d::Zero());
230
251
 
@@ -0,0 +1,41 @@
1
+ #include "placo/kinematics/distance_constraint.h"
2
+ #include "placo/kinematics/kinematics_solver.h"
3
+ #include "placo/problem/polygon_constraint.h"
4
+
5
+ namespace placo::kinematics
6
+ {
7
+ DistanceConstraint::DistanceConstraint(model::RobotWrapper::FrameIndex frame_a, model::RobotWrapper::FrameIndex frame_b,
8
+ double distance_max)
9
+ : frame_a(frame_a), frame_b(frame_b), distance_max(distance_max)
10
+ {
11
+ }
12
+
13
+ void DistanceConstraint::add_constraint(placo::problem::Problem& problem)
14
+ {
15
+ auto T_world_a = solver->robot.get_T_world_frame(frame_a);
16
+ auto T_world_b = solver->robot.get_T_world_frame(frame_b);
17
+
18
+ Eigen::Vector3d ab_world = T_world_b.translation() - T_world_a.translation();
19
+
20
+ double distance = ab_world.norm();
21
+ Eigen::Vector3d direction = ab_world.normalized();
22
+
23
+ Eigen::MatrixXd J_a = solver->robot.frame_jacobian(frame_a, pinocchio::LOCAL_WORLD_ALIGNED);
24
+ Eigen::MatrixXd J_b = solver->robot.frame_jacobian(frame_b, pinocchio::LOCAL_WORLD_ALIGNED);
25
+ Eigen::MatrixXd J_distance = direction.transpose() * (J_b - J_a).block(0, 0, 3, solver->N);
26
+
27
+ // Expression for the angle
28
+ problem::Expression e;
29
+ e.A.resize(1, solver->N);
30
+ e.b.resize(1);
31
+
32
+ e.A.row(0) = J_distance;
33
+ e.b(0) = distance;
34
+
35
+ problem.add_constraint(e <= distance_max)
36
+ .configure(priority == Prioritized::Priority::Hard ? problem::ProblemConstraint::Hard :
37
+ problem::ProblemConstraint::Soft,
38
+ weight);
39
+ }
40
+
41
+ } // namespace placo::kinematics
@@ -0,0 +1,43 @@
1
+ #pragma once
2
+
3
+ #include <vector>
4
+ #include "placo/problem/problem.h"
5
+ #include "placo/kinematics/constraint.h"
6
+
7
+ namespace placo::kinematics
8
+ {
9
+ class KinematicsSolver;
10
+
11
+ /**
12
+ * @brief Constraints the distance betweek two points in the robot
13
+ */
14
+ class DistanceConstraint : public Constraint
15
+ {
16
+ public:
17
+ /**
18
+ * @brief Constraints the distance betweek two points in the robot
19
+ * @param frame_a
20
+ * @param frame_b
21
+ * @param distance_max
22
+ */
23
+ DistanceConstraint(model::RobotWrapper::FrameIndex frame_a, model::RobotWrapper::FrameIndex frame_b,
24
+ double distance_max);
25
+
26
+ /**
27
+ * @brief Frame A
28
+ */
29
+ model::RobotWrapper::FrameIndex frame_a;
30
+
31
+ /**
32
+ * @brief Frame B
33
+ */
34
+ model::RobotWrapper::FrameIndex frame_b;
35
+
36
+ /**
37
+ * @brief Maximum distance allowed between frame A and frame B
38
+ */
39
+ double distance_max;
40
+
41
+ virtual void add_constraint(placo::problem::Problem& problem) override;
42
+ };
43
+ } // namespace placo::kinematics
@@ -226,6 +226,30 @@ ConeConstraint& KinematicsSolver::add_cone_constraint(std::string frame_a, std::
226
226
  return add_cone_constraint(robot.get_frame_index(frame_a), robot.get_frame_index(frame_b), angle_max);
227
227
  }
228
228
 
229
+ YawConstraint& KinematicsSolver::add_yaw_constraint(model::RobotWrapper::FrameIndex frame_a,
230
+ model::RobotWrapper::FrameIndex frame_b, double angle_max)
231
+ {
232
+ return add_constraint(new YawConstraint(frame_a, frame_b, angle_max));
233
+ }
234
+
235
+ YawConstraint& KinematicsSolver::add_yaw_constraint(std::string frame_a, std::string frame_b, double angle_max)
236
+ {
237
+ return add_yaw_constraint(robot.get_frame_index(frame_a), robot.get_frame_index(frame_b), angle_max);
238
+ }
239
+
240
+ DistanceConstraint& KinematicsSolver::add_distance_constraint(model::RobotWrapper::FrameIndex frame_a,
241
+ model::RobotWrapper::FrameIndex frame_b,
242
+ double distance_max)
243
+ {
244
+ return add_constraint(new DistanceConstraint(frame_a, frame_b, distance_max));
245
+ }
246
+
247
+ DistanceConstraint& KinematicsSolver::add_distance_constraint(std::string frame_a, std::string frame_b,
248
+ double distance_max)
249
+ {
250
+ return add_distance_constraint(robot.get_frame_index(frame_a), robot.get_frame_index(frame_b), distance_max);
251
+ }
252
+
229
253
  void KinematicsSolver::mask_dof(std::string dof)
230
254
  {
231
255
  masked_dof.insert(robot.get_joint_v_offset(dof));