placo 0.5.0__tar.gz → 0.5.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 (166) hide show
  1. {placo-0.5.0 → placo-0.5.1}/CMakeLists.txt +1 -0
  2. {placo-0.5.0 → placo-0.5.1}/PKG-INFO +1 -1
  3. {placo-0.5.0 → placo-0.5.1}/bindings/expose-dynamics.cpp +3 -0
  4. {placo-0.5.0 → placo-0.5.1}/bindings/expose-kinematics.cpp +10 -0
  5. {placo-0.5.0 → placo-0.5.1}/bindings/expose-robot-wrapper.cpp +6 -0
  6. {placo-0.5.0 → placo-0.5.1}/placo.pyi +140 -1
  7. {placo-0.5.0 → placo-0.5.1}/pyproject.toml +1 -1
  8. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/dynamics_solver.cpp +8 -1
  9. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/dynamics_solver.h +22 -0
  10. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/kinematics_solver.cpp +29 -0
  11. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/kinematics_solver.h +16 -0
  12. placo-0.5.1/src/placo/kinematics/manipulability_task.cpp +73 -0
  13. placo-0.5.1/src/placo/kinematics/manipulability_task.h +50 -0
  14. {placo-0.5.0 → placo-0.5.1}/src/placo/model/robot_wrapper.cpp +21 -0
  15. {placo-0.5.0 → placo-0.5.1}/src/placo/model/robot_wrapper.h +10 -0
  16. {placo-0.5.0 → placo-0.5.1}/.clang-format +0 -0
  17. {placo-0.5.0 → placo-0.5.1}/.gitattributes +0 -0
  18. {placo-0.5.0 → placo-0.5.1}/.gitignore +0 -0
  19. {placo-0.5.0 → placo-0.5.1}/.readthedocs.yaml +0 -0
  20. {placo-0.5.0 → placo-0.5.1}/Doxyfile +0 -0
  21. {placo-0.5.0 → placo-0.5.1}/LICENSE +0 -0
  22. {placo-0.5.0 → placo-0.5.1}/Makefile +0 -0
  23. {placo-0.5.0 → placo-0.5.1}/README.md +0 -0
  24. {placo-0.5.0 → placo-0.5.1}/bindings/expose-eigen.cpp +0 -0
  25. {placo-0.5.0 → placo-0.5.1}/bindings/expose-footsteps.cpp +0 -0
  26. {placo-0.5.0 → placo-0.5.1}/bindings/expose-parameters.cpp +0 -0
  27. {placo-0.5.0 → placo-0.5.1}/bindings/expose-problem.cpp +0 -0
  28. {placo-0.5.0 → placo-0.5.1}/bindings/expose-tools.cpp +0 -0
  29. {placo-0.5.0 → placo-0.5.1}/bindings/expose-utils.hpp +0 -0
  30. {placo-0.5.0 → placo-0.5.1}/bindings/expose-walk-pattern-generator.cpp +0 -0
  31. {placo-0.5.0 → placo-0.5.1}/bindings/module.cpp +0 -0
  32. {placo-0.5.0 → placo-0.5.1}/bindings/module.h +0 -0
  33. {placo-0.5.0 → placo-0.5.1}/bindings/registry.cpp +0 -0
  34. {placo-0.5.0 → placo-0.5.1}/bindings/registry.h +0 -0
  35. {placo-0.5.0 → placo-0.5.1}/doxygen_parse.py +0 -0
  36. {placo-0.5.0 → placo-0.5.1}/python/.vscode/settings.json +0 -0
  37. {placo-0.5.0 → placo-0.5.1}/python/Makefile +0 -0
  38. {placo-0.5.0 → placo-0.5.1}/python/placo_utils/__init__.py +0 -0
  39. {placo-0.5.0 → placo-0.5.1}/python/placo_utils/tf.py +0 -0
  40. {placo-0.5.0 → placo-0.5.1}/python/placo_utils/visualization.py +0 -0
  41. {placo-0.5.0 → placo-0.5.1}/python/run_tests.sh +0 -0
  42. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/avoid_self_collisions_constraint.cpp +0 -0
  43. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/avoid_self_collisions_constraint.h +0 -0
  44. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/com_task.cpp +0 -0
  45. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/com_task.h +0 -0
  46. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/constraint.cpp +0 -0
  47. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/constraint.h +0 -0
  48. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/contacts.cpp +0 -0
  49. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/contacts.h +0 -0
  50. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/frame_task.cpp +0 -0
  51. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/frame_task.h +0 -0
  52. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/gear_task.cpp +0 -0
  53. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/gear_task.h +0 -0
  54. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/joints_task.cpp +0 -0
  55. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/joints_task.h +0 -0
  56. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/orientation_task.cpp +0 -0
  57. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/orientation_task.h +0 -0
  58. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/position_task.cpp +0 -0
  59. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/position_task.h +0 -0
  60. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/reaction_ratio_constraint.cpp +0 -0
  61. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/reaction_ratio_constraint.h +0 -0
  62. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/relative_frame_task.cpp +0 -0
  63. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/relative_frame_task.h +0 -0
  64. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/relative_orientation_task.cpp +0 -0
  65. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/relative_orientation_task.h +0 -0
  66. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/relative_position_task.cpp +0 -0
  67. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/relative_position_task.h +0 -0
  68. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/task.cpp +0 -0
  69. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/task.h +0 -0
  70. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/torque_task.cpp +0 -0
  71. {placo-0.5.0 → placo-0.5.1}/src/placo/dynamics/torque_task.h +0 -0
  72. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/foot_trajectory.cpp +0 -0
  73. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/foot_trajectory.h +0 -0
  74. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/footsteps_planner.cpp +0 -0
  75. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/footsteps_planner.h +0 -0
  76. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/footsteps_planner_naive.cpp +0 -0
  77. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/footsteps_planner_naive.h +0 -0
  78. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/footsteps_planner_repetitive.cpp +0 -0
  79. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/footsteps_planner_repetitive.h +0 -0
  80. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/humanoid_parameters.cpp +0 -0
  81. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/humanoid_parameters.h +0 -0
  82. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/humanoid_robot.cpp +0 -0
  83. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/humanoid_robot.h +0 -0
  84. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/kick.cpp +0 -0
  85. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/kick.h +0 -0
  86. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/lipm.cpp +0 -0
  87. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/lipm.h +0 -0
  88. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/swing_foot.cpp +0 -0
  89. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/swing_foot.h +0 -0
  90. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/swing_foot_cubic.cpp +0 -0
  91. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/swing_foot_cubic.h +0 -0
  92. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/swing_foot_quintic.cpp +0 -0
  93. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/swing_foot_quintic.h +0 -0
  94. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/walk_pattern_generator.cpp +0 -0
  95. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/walk_pattern_generator.h +0 -0
  96. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/walk_tasks.cpp +0 -0
  97. {placo-0.5.0 → placo-0.5.1}/src/placo/humanoid/walk_tasks.h +0 -0
  98. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/avoid_self_collisions_constraint.cpp +0 -0
  99. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/avoid_self_collisions_constraint.h +0 -0
  100. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/axis_align_task.cpp +0 -0
  101. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/axis_align_task.h +0 -0
  102. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/centroidal_momentum_task.cpp +0 -0
  103. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/centroidal_momentum_task.h +0 -0
  104. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/com_polygon_constraint.cpp +0 -0
  105. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/com_polygon_constraint.h +0 -0
  106. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/com_task.cpp +0 -0
  107. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/com_task.h +0 -0
  108. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/cone_constraint.cpp +0 -0
  109. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/cone_constraint.h +0 -0
  110. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/constraint.cpp +0 -0
  111. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/constraint.h +0 -0
  112. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/distance_task.cpp +0 -0
  113. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/distance_task.h +0 -0
  114. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/frame_task.cpp +0 -0
  115. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/frame_task.h +0 -0
  116. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/gear_task.cpp +0 -0
  117. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/gear_task.h +0 -0
  118. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/joints_task.cpp +0 -0
  119. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/joints_task.h +0 -0
  120. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/kinetic_energy_regularization_task.cpp +0 -0
  121. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/kinetic_energy_regularization_task.h +0 -0
  122. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/orientation_task.cpp +0 -0
  123. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/orientation_task.h +0 -0
  124. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/position_task.cpp +0 -0
  125. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/position_task.h +0 -0
  126. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/regularization_task.cpp +0 -0
  127. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/regularization_task.h +0 -0
  128. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/relative_frame_task.cpp +0 -0
  129. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/relative_frame_task.h +0 -0
  130. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/relative_orientation_task.cpp +0 -0
  131. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/relative_orientation_task.h +0 -0
  132. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/relative_position_task.cpp +0 -0
  133. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/relative_position_task.h +0 -0
  134. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/task.cpp +0 -0
  135. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/task.h +0 -0
  136. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/wheel_task.cpp +0 -0
  137. {placo-0.5.0 → placo-0.5.1}/src/placo/kinematics/wheel_task.h +0 -0
  138. {placo-0.5.0 → placo-0.5.1}/src/placo/problem/constraint.cpp +0 -0
  139. {placo-0.5.0 → placo-0.5.1}/src/placo/problem/constraint.h +0 -0
  140. {placo-0.5.0 → placo-0.5.1}/src/placo/problem/expression.cpp +0 -0
  141. {placo-0.5.0 → placo-0.5.1}/src/placo/problem/expression.h +0 -0
  142. {placo-0.5.0 → placo-0.5.1}/src/placo/problem/integrator.cpp +0 -0
  143. {placo-0.5.0 → placo-0.5.1}/src/placo/problem/integrator.h +0 -0
  144. {placo-0.5.0 → placo-0.5.1}/src/placo/problem/polygon_constraint.cpp +0 -0
  145. {placo-0.5.0 → placo-0.5.1}/src/placo/problem/polygon_constraint.h +0 -0
  146. {placo-0.5.0 → placo-0.5.1}/src/placo/problem/problem.cpp +0 -0
  147. {placo-0.5.0 → placo-0.5.1}/src/placo/problem/problem.h +0 -0
  148. {placo-0.5.0 → placo-0.5.1}/src/placo/problem/qp_error.cpp +0 -0
  149. {placo-0.5.0 → placo-0.5.1}/src/placo/problem/qp_error.h +0 -0
  150. {placo-0.5.0 → placo-0.5.1}/src/placo/problem/sparsity.cpp +0 -0
  151. {placo-0.5.0 → placo-0.5.1}/src/placo/problem/sparsity.h +0 -0
  152. {placo-0.5.0 → placo-0.5.1}/src/placo/problem/variable.cpp +0 -0
  153. {placo-0.5.0 → placo-0.5.1}/src/placo/problem/variable.h +0 -0
  154. {placo-0.5.0 → placo-0.5.1}/src/placo/tools/axises_mask.cpp +0 -0
  155. {placo-0.5.0 → placo-0.5.1}/src/placo/tools/axises_mask.h +0 -0
  156. {placo-0.5.0 → placo-0.5.1}/src/placo/tools/cubic_spline.cpp +0 -0
  157. {placo-0.5.0 → placo-0.5.1}/src/placo/tools/cubic_spline.h +0 -0
  158. {placo-0.5.0 → placo-0.5.1}/src/placo/tools/cubic_spline_3d.cpp +0 -0
  159. {placo-0.5.0 → placo-0.5.1}/src/placo/tools/cubic_spline_3d.h +0 -0
  160. {placo-0.5.0 → placo-0.5.1}/src/placo/tools/prioritized.cpp +0 -0
  161. {placo-0.5.0 → placo-0.5.1}/src/placo/tools/prioritized.h +0 -0
  162. {placo-0.5.0 → placo-0.5.1}/src/placo/tools/utils.cpp +0 -0
  163. {placo-0.5.0 → placo-0.5.1}/src/placo/tools/utils.h +0 -0
  164. {placo-0.5.0 → placo-0.5.1}/stubs.py +0 -0
  165. {placo-0.5.0 → placo-0.5.1}/tweak_sdist.sh +0 -0
  166. {placo-0.5.0 → placo-0.5.1}/wks.yml +0 -0
@@ -78,6 +78,7 @@ add_library(libplaco SHARED
78
78
  src/placo/kinematics/gear_task.cpp
79
79
  src/placo/kinematics/wheel_task.cpp
80
80
  src/placo/kinematics/regularization_task.cpp
81
+ src/placo/kinematics/manipulability_task.cpp
81
82
  src/placo/kinematics/kinetic_energy_regularization_task.cpp
82
83
  src/placo/kinematics/constraint.cpp
83
84
  src/placo/kinematics/avoid_self_collisions_constraint.cpp
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: placo
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: PlaCo: Rhoban Planning and Control
5
5
  Requires-Python: >= 3.8
6
6
  License-Expression: MIT
@@ -24,6 +24,8 @@ void exposeDynamics()
24
24
  "tau", +[](const DynamicsSolver::Result& result) { return result.tau; })
25
25
  .add_property(
26
26
  "qdd", +[](const DynamicsSolver::Result& result) { return result.qdd; })
27
+ .add_property(
28
+ "tau_contacts", +[](const DynamicsSolver::Result& result) { return result.tau_contacts; })
27
29
  .def(
28
30
  "tau_dict", +[](const DynamicsSolver::Result& result, RobotWrapper& robot) {
29
31
  boost::python::dict dict;
@@ -81,6 +83,7 @@ void exposeDynamics()
81
83
  .def_readwrite("dt", &DynamicsSolver::dt)
82
84
  .def_readwrite("qdd_safe", &DynamicsSolver::qdd_safe)
83
85
  .def_readwrite("gravity_only", &DynamicsSolver::gravity_only)
86
+ .def_readwrite("torque_cost", &DynamicsSolver::torque_cost)
84
87
  .def("mask_fbase", &DynamicsSolver::mask_fbase)
85
88
  .def("add_point_contact", &DynamicsSolver::add_point_contact, return_internal_reference<>())
86
89
  .def("add_unilateral_point_contact", &DynamicsSolver::add_unilateral_point_contact, return_internal_reference<>())
@@ -76,6 +76,10 @@ void exposeKinematics()
76
76
  // Regularization task
77
77
  .def("add_regularization_task", &KinematicsSolver::add_regularization_task, return_internal_reference<>())
78
78
 
79
+ // Manipulability task
80
+ .def<ManipulabilityTask& (KinematicsSolver::*)(std::string, std::string, double)>(
81
+ "add_manipulability_task", &KinematicsSolver::add_manipulability_task, return_internal_reference<>())
82
+
79
83
  // Kinetic energy regularization task
80
84
  .def("add_kinetic_energy_regularization_task", &KinematicsSolver::add_kinetic_energy_regularization_task,
81
85
  return_internal_reference<>())
@@ -216,6 +220,12 @@ void exposeKinematics()
216
220
 
217
221
  class__<RegularizationTask, bases<Task>>("RegularizationTask");
218
222
 
223
+ class__<ManipulabilityTask, bases<Task>>("ManipulabilityTask",
224
+ init<RobotWrapper::FrameIndex, ManipulabilityTask::Type, double>())
225
+ .def_readwrite("lambda", &ManipulabilityTask::lambda)
226
+ .def_readwrite("minimize", &ManipulabilityTask::minimize)
227
+ .def_readonly("manipulability", &ManipulabilityTask::manipulability);
228
+
219
229
  class__<KineticEnergyRegularizationTask, bases<RegularizationTask>>("KineticEnergyRegularizationTask");
220
230
 
221
231
  class__<Constraint, bases<tools::Prioritized>, boost::noncopyable>("KinematicsConstraint", no_init);
@@ -43,6 +43,12 @@ void exposeRobotType(class_<RobotType, W1>& type)
43
43
  .def("set_torque_limit", &RobotType::set_torque_limit)
44
44
  .def("set_joint_limits", &RobotType::set_joint_limits)
45
45
  .def("update_kinematics", &RobotType::update_kinematics)
46
+ .def("compute_hessians", &RobotType::compute_hessians)
47
+ .def(
48
+ "get_frame_hessian",
49
+ +[](RobotType& robot, const std::string frame, const std::string joint) {
50
+ return robot.get_frame_hessian(robot.model.getFrameId(frame), robot.get_joint_v_offset(joint));
51
+ })
46
52
  .def("get_T_world_fbase", &RobotType::get_T_world_fbase)
47
53
  .def("set_T_world_fbase", &RobotType::set_T_world_fbase)
48
54
  .def("com_world", &RobotType::com_world)
@@ -52,6 +52,7 @@ KinematicsSolver = typing.NewType("KinematicsSolver", None)
52
52
  KineticEnergyRegularizationTask = typing.NewType("KineticEnergyRegularizationTask", None)
53
53
  LIPM = typing.NewType("LIPM", None)
54
54
  LIPMTrajectory = typing.NewType("LIPMTrajectory", None)
55
+ ManipulabilityTask = typing.NewType("ManipulabilityTask", None)
55
56
  OrientationTask = typing.NewType("OrientationTask", None)
56
57
  PointContact = typing.NewType("PointContact", None)
57
58
  PolygonConstraint = typing.NewType("PolygonConstraint", None)
@@ -2206,6 +2207,10 @@ class DynamicsSolver:
2206
2207
  ) -> DynamicsSolverResult:
2207
2208
  ...
2208
2209
 
2210
+ torque_cost: float # double
2211
+ """Cost for torque regularization.
2212
+ """
2213
+
2209
2214
 
2210
2215
  class DynamicsSolverResult:
2211
2216
  def __init__(
@@ -2220,6 +2225,8 @@ class DynamicsSolverResult:
2220
2225
 
2221
2226
  tau: numpy.ndarray # Eigen::VectorXd
2222
2227
 
2228
+ tau_contacts: numpy.ndarray # Eigen::VectorXd
2229
+
2223
2230
  def tau_dict(
2224
2231
  arg1: DynamicsSolverResult,
2225
2232
  arg2: RobotWrapper,
@@ -3256,6 +3263,13 @@ class HumanoidRobot:
3256
3263
  """Gets the CoM position in the world."""
3257
3264
  ...
3258
3265
 
3266
+ def compute_hessians(
3267
+ self: HumanoidRobot,
3268
+
3269
+ ) -> None:
3270
+ """Compute kinematics hessians."""
3271
+ ...
3272
+
3259
3273
  def dcm(
3260
3274
  self: HumanoidRobot,
3261
3275
  com_velocity: numpy.ndarray, # Eigen::Vector2d
@@ -3406,6 +3420,15 @@ class HumanoidRobot:
3406
3420
  :return: Center of mass velocity"""
3407
3421
  ...
3408
3422
 
3423
+ def get_frame_hessian(
3424
+ self: HumanoidRobot,
3425
+ frame: any, # pinocchio::FrameIndex
3426
+ joint_v_index: int, # int
3427
+
3428
+ ) -> numpy.ndarray:
3429
+ """Get the component for the hessian of a given frame for a given joint."""
3430
+ ...
3431
+
3409
3432
  def get_joint(
3410
3433
  self: HumanoidRobot,
3411
3434
  name: str, # const std::string &
@@ -4351,6 +4374,23 @@ class KinematicsSolver:
4351
4374
  :return: regularization task"""
4352
4375
  ...
4353
4376
 
4377
+ def add_manipulability_task(
4378
+ self: KinematicsSolver,
4379
+ frame: str, # std::string
4380
+ type: str = "both", # std::string
4381
+ lambda_: float = 1.0, # double
4382
+
4383
+ ) -> ManipulabilityTask:
4384
+ """Adds a manipulability regularization task for a given magnitude.
4385
+
4386
+
4387
+ :param frame: the reference frame
4388
+
4389
+ :param type: type (position, orientation or both)
4390
+
4391
+ :return: manipulability task"""
4392
+ ...
4393
+
4354
4394
  def add_orientation_task(
4355
4395
  self: KinematicsSolver,
4356
4396
  frame: str, # std::string
@@ -4823,6 +4863,89 @@ class LIPMTrajectory:
4823
4863
  ...
4824
4864
 
4825
4865
 
4866
+ class ManipulabilityTask:
4867
+ A: numpy.ndarray # Eigen::MatrixXd
4868
+ """Matrix A in the task Ax = b, where x are the joint delta positions.
4869
+ """
4870
+
4871
+ def __init__(
4872
+ self: ManipulabilityTask,
4873
+ frame_index: any, # pinocchio::FrameIndex
4874
+ type: any, # placo::kinematics::ManipulabilityTask::Type
4875
+ lambda: float = 1.0, # double
4876
+
4877
+ ) -> any:
4878
+ ...
4879
+
4880
+ b: numpy.ndarray # Eigen::MatrixXd
4881
+ """Vector b in the task Ax = b, where x are the joint delta positions.
4882
+ """
4883
+
4884
+ def configure(
4885
+ self: ManipulabilityTask,
4886
+ name: str, # std::string
4887
+ priority: any, # placo::kinematics::ConeConstraint::Priority
4888
+ weight: float = 1.0, # double
4889
+
4890
+ ) -> None:
4891
+ """Configures the object.
4892
+
4893
+
4894
+ :param name: task name
4895
+
4896
+ :param priority: task priority (hard, soft or scaled)
4897
+
4898
+ :param weight: task weight"""
4899
+ ...
4900
+
4901
+ def error(
4902
+ self: ManipulabilityTask,
4903
+
4904
+ ) -> numpy.ndarray:
4905
+ """Task errors (vector)
4906
+
4907
+
4908
+ :return: task errors"""
4909
+ ...
4910
+
4911
+ def error_norm(
4912
+ self: ManipulabilityTask,
4913
+
4914
+ ) -> float:
4915
+ """The task error norm.
4916
+
4917
+
4918
+ :return: task error norm"""
4919
+ ...
4920
+
4921
+ lambda: float # double
4922
+ """Importance of the hessian regularization.
4923
+ """
4924
+
4925
+ manipulability: bool # bool
4926
+ """The last computed manipulability value.
4927
+ """
4928
+
4929
+ minimize: bool # bool
4930
+ """Should the manipulability be minimized (can be useful to find singularities)
4931
+ """
4932
+
4933
+ name: str # std::string
4934
+ """Object name.
4935
+ """
4936
+
4937
+ priority: any # placo::kinematics::ConeConstraint::Priority
4938
+ """Object priority.
4939
+ """
4940
+
4941
+ def update(
4942
+ self: ManipulabilityTask,
4943
+
4944
+ ) -> None:
4945
+ """Update the task A and b matrices from the robot state and targets."""
4946
+ ...
4947
+
4948
+
4826
4949
  class OrientationTask:
4827
4950
  A: numpy.ndarray # Eigen::MatrixXd
4828
4951
  """Matrix A in the task Ax = b, where x are the joint delta positions.
@@ -5699,6 +5822,13 @@ class RobotWrapper:
5699
5822
  """Gets the CoM position in the world."""
5700
5823
  ...
5701
5824
 
5825
+ def compute_hessians(
5826
+ self: RobotWrapper,
5827
+
5828
+ ) -> None:
5829
+ """Compute kinematics hessians."""
5830
+ ...
5831
+
5702
5832
  def distances(
5703
5833
  self: RobotWrapper,
5704
5834
 
@@ -5792,6 +5922,15 @@ class RobotWrapper:
5792
5922
  :return: transformation"""
5793
5923
  ...
5794
5924
 
5925
+ def get_frame_hessian(
5926
+ self: RobotWrapper,
5927
+ frame: any, # pinocchio::FrameIndex
5928
+ joint_v_index: int, # int
5929
+
5930
+ ) -> numpy.ndarray:
5931
+ """Get the component for the hessian of a given frame for a given joint."""
5932
+ ...
5933
+
5795
5934
  def get_joint(
5796
5935
  self: RobotWrapper,
5797
5936
  name: str, # const std::string &
@@ -7309,4 +7448,4 @@ def wrap_angle(
7309
7448
  ...
7310
7449
 
7311
7450
 
7312
- __groups__ = {'placo::dynamics': ['AvoidSelfCollisionsDynamicsConstraint', 'Contact', 'Contact6D', 'DynamicsCoMTask', 'DynamicsConstraint', 'DynamicsFrameTask', 'DynamicsGearTask', 'DynamicsJointsTask', 'DynamicsOrientationTask', 'DynamicsPositionTask', 'DynamicsReactionRatioConstraint', 'DynamicsRelativeFrameTask', 'DynamicsRelativeOrientationTask', 'DynamicsRelativePositionTask', 'DynamicsSolver', 'DynamicsSolverResult', 'DynamicsTask', 'DynamicsTorqueTask', 'ExternalWrenchContact', 'PointContact', 'PuppetContact', 'Relative6DContact', 'RelativePointContact', 'TaskContact'], 'placo::kinematics': ['AvoidSelfCollisionsKinematicsConstraint', 'AxisAlignTask', 'CentroidalMomentumTask', 'CoMPolygonConstraint', 'CoMTask', 'ConeConstraint', 'DistanceTask', 'FrameTask', 'GearTask', 'JointsTask', 'KinematicsConstraint', 'KinematicsSolver', 'KineticEnergyRegularizationTask', 'OrientationTask', 'PositionTask', 'RegularizationTask', 'RelativeFrameTask', 'RelativeOrientationTask', 'RelativePositionTask', 'Task', 'WheelTask'], 'placo::tools': ['AxisesMask', 'CubicSpline', 'CubicSpline3D', 'Prioritized'], 'placo::model': ['Collision', 'Distance', 'RobotWrapper', 'RobotWrapper_State'], 'placo::problem': ['Expression', 'Integrator', 'IntegratorTrajectory', 'PolygonConstraint', 'Problem', 'ProblemConstraint', 'QPError', 'Sparsity', 'SparsityInterval', 'Variable'], 'placo::humanoid': ['Footstep', 'FootstepsPlanner', 'FootstepsPlannerNaive', 'FootstepsPlannerRepetitive', 'HumanoidParameters', 'HumanoidRobot', 'LIPM', 'LIPMTrajectory', 'Support', 'SwingFoot', 'SwingFootCubic', 'SwingFootCubicTrajectory', 'SwingFootQuintic', 'SwingFootQuinticTrajectory', 'SwingFootTrajectory', 'WalkPatternGenerator', 'WalkTasks', 'WalkTrajectory']}
7451
+ __groups__ = {'placo::dynamics': ['AvoidSelfCollisionsDynamicsConstraint', 'Contact', 'Contact6D', 'DynamicsCoMTask', 'DynamicsConstraint', 'DynamicsFrameTask', 'DynamicsGearTask', 'DynamicsJointsTask', 'DynamicsOrientationTask', 'DynamicsPositionTask', 'DynamicsReactionRatioConstraint', 'DynamicsRelativeFrameTask', 'DynamicsRelativeOrientationTask', 'DynamicsRelativePositionTask', 'DynamicsSolver', 'DynamicsSolverResult', 'DynamicsTask', 'DynamicsTorqueTask', 'ExternalWrenchContact', 'PointContact', 'PuppetContact', 'Relative6DContact', 'RelativePointContact', 'TaskContact'], 'placo::kinematics': ['AvoidSelfCollisionsKinematicsConstraint', 'AxisAlignTask', 'CentroidalMomentumTask', 'CoMPolygonConstraint', 'CoMTask', 'ConeConstraint', 'DistanceTask', 'FrameTask', 'GearTask', 'JointsTask', 'KinematicsConstraint', 'KinematicsSolver', 'KineticEnergyRegularizationTask', 'ManipulabilityTask', 'OrientationTask', 'PositionTask', 'RegularizationTask', 'RelativeFrameTask', 'RelativeOrientationTask', 'RelativePositionTask', 'Task', 'WheelTask'], 'placo::tools': ['AxisesMask', 'CubicSpline', 'CubicSpline3D', 'Prioritized'], 'placo::model': ['Collision', 'Distance', 'RobotWrapper', 'RobotWrapper_State'], 'placo::problem': ['Expression', 'Integrator', 'IntegratorTrajectory', 'PolygonConstraint', 'Problem', 'ProblemConstraint', 'QPError', 'Sparsity', 'SparsityInterval', 'Variable'], 'placo::humanoid': ['Footstep', 'FootstepsPlanner', 'FootstepsPlannerNaive', 'FootstepsPlannerRepetitive', 'HumanoidParameters', 'HumanoidRobot', 'LIPM', 'LIPMTrajectory', 'Support', 'SwingFoot', 'SwingFootCubic', 'SwingFootCubicTrajectory', 'SwingFootQuintic', 'SwingFootQuinticTrajectory', 'SwingFootTrajectory', 'WalkPatternGenerator', 'WalkTasks', 'WalkTrajectory']}
@@ -23,7 +23,7 @@ description = "PlaCo: Rhoban Planning and Control"
23
23
  license = "MIT"
24
24
  name = "placo"
25
25
  requires-python = ">= 3.8"
26
- version = "0.5.0"
26
+ version = "0.5.1"
27
27
 
28
28
  [project.urls]
29
29
  changelog = "https://github.com/rhoban/placo/blob/main/CHANGELOG.md"
@@ -462,6 +462,11 @@ DynamicsSolver::Result DynamicsSolver::solve(bool integrate)
462
462
  tau = tau + robot.non_linear_effects();
463
463
  }
464
464
 
465
+ if (extra_force.size() > 0)
466
+ {
467
+ tau = tau + extra_force;
468
+ }
469
+
465
470
  // J^T F
466
471
  for (auto& contact : contacts)
467
472
  {
@@ -563,7 +568,7 @@ DynamicsSolver::Result DynamicsSolver::solve(bool integrate)
563
568
  }
564
569
 
565
570
  // We want to minimize torques
566
- problem.add_constraint(tau == 0).configure(ProblemConstraint::Soft, 1e-3);
571
+ problem.add_constraint(tau == 0).configure(ProblemConstraint::Soft, torque_cost);
567
572
 
568
573
  try
569
574
  {
@@ -574,12 +579,14 @@ DynamicsSolver::Result DynamicsSolver::solve(bool integrate)
574
579
  // Exporting result values
575
580
  result.tau = tau.value(problem.x);
576
581
  result.qdd = qdd.value(problem.x);
582
+ result.tau_contacts = Eigen::VectorXd::Zero(N);
577
583
 
578
584
  for (auto& contact : contacts)
579
585
  {
580
586
  if (contact->active)
581
587
  {
582
588
  contact->wrench = contact->f.value(problem.x);
589
+ result.tau_contacts += contact->J.transpose() * contact->wrench;
583
590
  }
584
591
  }
585
592
 
@@ -38,11 +38,23 @@ public:
38
38
  // Checks if the gravity computation is a success
39
39
  bool success;
40
40
 
41
+ // The following equation should hold: M qdd + b = tau + tau_contacts
42
+
43
+ // With:
44
+ // - M: the mass matrix
45
+ // - qdd: joint-space acceleration
46
+ // - b: non-linear (bias) terms
47
+ // - tau: applied torques vector
48
+ // - tau_contacts: contact forces
49
+
41
50
  // Torques computed by the solver
42
51
  Eigen::VectorXd tau;
43
52
 
44
53
  // Accelerations computed by the solver
45
54
  Eigen::VectorXd qdd;
55
+
56
+ // Contact forces computed by the solver
57
+ Eigen::VectorXd tau_contacts;
46
58
  };
47
59
 
48
60
  struct OverrideJoint
@@ -426,6 +438,16 @@ public:
426
438
  */
427
439
  bool gravity_only = false;
428
440
 
441
+ /**
442
+ * @brief Cost for torque regularization
443
+ */
444
+ double torque_cost = 1e-3;
445
+
446
+ /**
447
+ * @brief Extra force to be added to the system (similar to non-linear terms)
448
+ */
449
+ Eigen::VectorXd extra_force = Eigen::VectorXd::Zero(0);
450
+
429
451
  /**
430
452
  * @brief Instance of the problem
431
453
  */
@@ -162,6 +162,35 @@ RegularizationTask& KinematicsSolver::add_regularization_task(double magnitude)
162
162
  return task;
163
163
  }
164
164
 
165
+ ManipulabilityTask& KinematicsSolver::add_manipulability_task(model::RobotWrapper::FrameIndex frame,
166
+ ManipulabilityTask::Type type, double lambda)
167
+ {
168
+ return add_task(new ManipulabilityTask(frame, type, lambda));
169
+ }
170
+
171
+ ManipulabilityTask& KinematicsSolver::add_manipulability_task(std::string frame, std::string type, double lambda)
172
+ {
173
+ ManipulabilityTask::Type type_;
174
+ if (type == "position")
175
+ {
176
+ type_ = ManipulabilityTask::Type::POSITION;
177
+ }
178
+ else if (type == "orientation")
179
+ {
180
+ type_ = ManipulabilityTask::Type::ORIENTATION;
181
+ }
182
+ else if (type == "both")
183
+ {
184
+ type_ = ManipulabilityTask::Type::BOTH;
185
+ }
186
+ else
187
+ {
188
+ throw std::runtime_error("Unknown manipulability type: " + type);
189
+ }
190
+
191
+ return add_manipulability_task(robot.get_frame_index(frame), type_, lambda);
192
+ }
193
+
165
194
  KineticEnergyRegularizationTask& KinematicsSolver::add_kinetic_energy_regularization_task(double magnitude)
166
195
  {
167
196
  KineticEnergyRegularizationTask& task = add_task(new KineticEnergyRegularizationTask());
@@ -19,6 +19,7 @@
19
19
  #include "placo/kinematics/gear_task.h"
20
20
  #include "placo/kinematics/wheel_task.h"
21
21
  #include "placo/kinematics/regularization_task.h"
22
+ #include "placo/kinematics/manipulability_task.h"
22
23
  #include "placo/kinematics/kinetic_energy_regularization_task.h"
23
24
  #include "placo/kinematics/centroidal_momentum_task.h"
24
25
  #include "placo/kinematics/axis_align_task.h"
@@ -249,6 +250,21 @@ public:
249
250
  */
250
251
  RegularizationTask& add_regularization_task(double magnitude = 1e-6);
251
252
 
253
+ /**
254
+ * @brief Adds a manipulability regularization task for a given magnitude
255
+ * @return manipulability task
256
+ */
257
+ ManipulabilityTask& add_manipulability_task(model::RobotWrapper::FrameIndex frame, ManipulabilityTask::Type type,
258
+ double lambda = 1.0);
259
+
260
+ /**
261
+ * @brief Adds a manipulability regularization task for a given magnitude
262
+ * @param frame the reference frame
263
+ * @param type type (position, orientation or both)
264
+ * @return manipulability task
265
+ */
266
+ ManipulabilityTask& add_manipulability_task(std::string frame, std::string type = "both", double lambda_ = 1.0);
267
+
252
268
  /**
253
269
  * @brief Adds a kinetic energy regularization task for a given magnitude
254
270
  * @param magnitude regularization magnitude
@@ -0,0 +1,73 @@
1
+ #include "placo/kinematics/manipulability_task.h"
2
+ #include "placo/kinematics/kinematics_solver.h"
3
+
4
+ namespace placo::kinematics
5
+ {
6
+ ManipulabilityTask::ManipulabilityTask(model::RobotWrapper::FrameIndex frame_index, Type type, double lambda)
7
+ : frame_index(frame_index), type(type), lambda(lambda)
8
+ {
9
+ }
10
+
11
+ Eigen::MatrixXd ManipulabilityTask::mask_matrix(Eigen::MatrixXd M)
12
+ {
13
+ if (type == POSITION)
14
+ {
15
+ return M.block(0, 6, 3, M.cols() - 6);
16
+ }
17
+ else if (type == ORIENTATION)
18
+ {
19
+ return M.block(3, 6, 3, M.cols() - 6);
20
+ }
21
+ else
22
+ {
23
+ return M.block(0, 6, 6, M.cols() - 6);
24
+ }
25
+ }
26
+
27
+ void ManipulabilityTask::update()
28
+ {
29
+ // Computing the Jacobian matrix
30
+ Eigen::MatrixXd J_unmasked = solver->robot.frame_jacobian(frame_index, pinocchio::LOCAL);
31
+ Eigen::MatrixXd J = mask_matrix(J_unmasked);
32
+ Eigen::MatrixXd JJT_inv = (J * J.transpose()).inverse();
33
+ double manipulability = sqrt(fmax(0., (J * J.transpose()).determinant()));
34
+ solver->robot.compute_hessians();
35
+
36
+ Eigen::VectorXd manipulability_gradient(solver->N - 6);
37
+ manipulability_gradient.setZero();
38
+
39
+ for (int dof = 6; dof < solver->N; dof++)
40
+ {
41
+ Eigen::MatrixXd H_dof_unmasked = solver->robot.get_frame_hessian(frame_index, dof);
42
+ Eigen::MatrixXd H_dof = mask_matrix(H_dof_unmasked);
43
+ Eigen::MatrixXd JH = J * H_dof.transpose();
44
+
45
+ manipulability_gradient(dof - 6) = manipulability * JH.cwiseProduct(JJT_inv).sum();
46
+ }
47
+
48
+ // Regularization magnitude is handled through the task weight (see add_regularization_task)
49
+ // Floating base is not regularized by this task
50
+ Eigen::MatrixXd I = Eigen::MatrixXd(solver->N, solver->N);
51
+ I.setIdentity();
52
+
53
+ A = Eigen::MatrixXd(solver->N - 6, solver->N);
54
+ A.block(0, 0, solver->N - 6, solver->N) = I.block(6, 0, solver->N - 6, solver->N) * lambda;
55
+
56
+ b = (1 / (2. * lambda)) * manipulability_gradient;
57
+
58
+ if (minimize)
59
+ {
60
+ b = -b;
61
+ }
62
+ }
63
+
64
+ std::string ManipulabilityTask::type_name()
65
+ {
66
+ return "manipulability";
67
+ }
68
+
69
+ std::string ManipulabilityTask::error_unit()
70
+ {
71
+ return "none";
72
+ }
73
+ } // namespace placo::kinematics
@@ -0,0 +1,50 @@
1
+ #pragma once
2
+
3
+ #include "placo/kinematics/task.h"
4
+
5
+ namespace placo::kinematics
6
+ {
7
+ class KinematicsSolver;
8
+ struct ManipulabilityTask : public Task
9
+ {
10
+ enum Type
11
+ {
12
+ POSITION = 0,
13
+ ORIENTATION = 1,
14
+ BOTH = 2
15
+ };
16
+
17
+ ManipulabilityTask(model::RobotWrapper::FrameIndex frame_index, Type type, double lambda = 1.0);
18
+
19
+ virtual void update();
20
+ virtual std::string type_name();
21
+ virtual std::string error_unit();
22
+
23
+ Eigen::MatrixXd mask_matrix(Eigen::MatrixXd M);
24
+
25
+ /**
26
+ * @brief Index of the frame we want to set manipulability
27
+ */
28
+ model::RobotWrapper::FrameIndex frame_index;
29
+
30
+ /**
31
+ * @brief Importance of the hessian regularization
32
+ */
33
+ double lambda;
34
+
35
+ /**
36
+ * @brief Type of frame manipulability to compute
37
+ */
38
+ Type type;
39
+
40
+ /**
41
+ * @brief Should the manipulability be minimized (can be useful to find singularities)
42
+ */
43
+ bool minimize = false;
44
+
45
+ /**
46
+ * @brief The last computed manipulability value
47
+ */
48
+ bool manipulability = 0.;
49
+ };
50
+ } // namespace placo::kinematics
@@ -3,6 +3,7 @@
3
3
  #include "pinocchio/algorithm/center-of-mass.hpp"
4
4
  #include "pinocchio/algorithm/compute-all-terms.hpp"
5
5
  #include "pinocchio/algorithm/geometry.hpp"
6
+ #include "pinocchio/algorithm/kinematics-derivatives.hpp"
6
7
  #include "pinocchio/algorithm/rnea.hpp"
7
8
  #include "pinocchio/algorithm/crba.hpp"
8
9
  #include "pinocchio/algorithm/centroidal.hpp"
@@ -253,6 +254,26 @@ void RobotWrapper::update_kinematics()
253
254
  pinocchio::framesForwardKinematics(model, *data, state.q);
254
255
  pinocchio::computeJointJacobians(model, *data, state.q);
255
256
  pinocchio::computeJointJacobiansTimeVariation(model, *data, state.q, state.qd);
257
+ pinocchio::updateFramePlacements(model, *data);
258
+ }
259
+
260
+ void RobotWrapper::compute_hessians()
261
+ {
262
+ pinocchio::computeJointKinematicHessians(model, *data);
263
+ }
264
+
265
+ Eigen::MatrixXd RobotWrapper::get_frame_hessian(FrameIndex frame, int joint_v_index)
266
+ {
267
+ // Frame parent joint index
268
+ pinocchio::JointIndex joint_id = model.frames[frame].parent;
269
+ pinocchio::SE3 T = model.frames[frame].placement;
270
+
271
+ pinocchio::Tensor<double, 3, 0> H = pinocchio::getJointKinematicHessian(model, *data, joint_id, pinocchio::LOCAL);
272
+ const Eigen::DenseIndex matrix_offset = 6 * model.nv;
273
+
274
+ Eigen::Map<Eigen::MatrixXd> hessian(H.data() + joint_v_index * matrix_offset, 6, model.nv);
275
+
276
+ return T.inverse().toActionMatrix() * hessian;
256
277
  }
257
278
 
258
279
  RobotWrapper::State RobotWrapper::neutral_state()
@@ -224,6 +224,16 @@ public:
224
224
  */
225
225
  void update_kinematics();
226
226
 
227
+ /**
228
+ * @brief Compute kinematics hessians
229
+ */
230
+ void compute_hessians();
231
+
232
+ /**
233
+ * @brief Get the component for the hessian of a given frame for a given joint
234
+ */
235
+ Eigen::MatrixXd get_frame_hessian(FrameIndex frame, int joint_v_index);
236
+
227
237
  /**
228
238
  * @brief Gets the CoM position in the world
229
239
  */
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes