placo 0.4.6__tar.gz → 0.4.7__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.
- {placo-0.4.6 → placo-0.4.7}/CMakeLists.txt +2 -0
- {placo-0.4.6 → placo-0.4.7}/PKG-INFO +1 -1
- {placo-0.4.6 → placo-0.4.7}/bindings/expose-dynamics.cpp +4 -2
- {placo-0.4.6 → placo-0.4.7}/bindings/expose-kinematics.cpp +6 -0
- {placo-0.4.6 → placo-0.4.7}/bindings/expose-robot-wrapper.cpp +18 -0
- {placo-0.4.6 → placo-0.4.7}/bindings/expose-tools.cpp +1 -0
- {placo-0.4.6 → placo-0.4.7}/placo.pyi +193 -18
- {placo-0.4.6 → placo-0.4.7}/pyproject.toml +1 -1
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/dynamics_solver.cpp +43 -111
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/dynamics_solver.h +7 -15
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/task.h +5 -0
- placo-0.4.7/src/placo/dynamics/torque_task.cpp +45 -0
- placo-0.4.7/src/placo/dynamics/torque_task.h +35 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/humanoid_robot.cpp +31 -1
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/humanoid_robot.h +8 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/kinematics_solver.cpp +10 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/kinematics_solver.h +8 -0
- placo-0.4.7/src/placo/kinematics/kinetic_energy_regularization_task.cpp +38 -0
- placo-0.4.7/src/placo/kinematics/kinetic_energy_regularization_task.h +14 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/model/robot_wrapper.cpp +2 -0
- {placo-0.4.6 → placo-0.4.7}/.clang-format +0 -0
- {placo-0.4.6 → placo-0.4.7}/.gitattributes +0 -0
- {placo-0.4.6 → placo-0.4.7}/.gitignore +0 -0
- {placo-0.4.6 → placo-0.4.7}/.readthedocs.yaml +0 -0
- {placo-0.4.6 → placo-0.4.7}/Doxyfile +0 -0
- {placo-0.4.6 → placo-0.4.7}/LICENSE +0 -0
- {placo-0.4.6 → placo-0.4.7}/Makefile +0 -0
- {placo-0.4.6 → placo-0.4.7}/README.md +0 -0
- {placo-0.4.6 → placo-0.4.7}/bindings/expose-eigen.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/bindings/expose-footsteps.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/bindings/expose-parameters.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/bindings/expose-problem.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/bindings/expose-utils.hpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/bindings/expose-walk-pattern-generator.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/bindings/module.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/bindings/module.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/bindings/registry.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/bindings/registry.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/doxygen_parse.py +0 -0
- {placo-0.4.6 → placo-0.4.7}/python/.vscode/settings.json +0 -0
- {placo-0.4.6 → placo-0.4.7}/python/Makefile +0 -0
- {placo-0.4.6 → placo-0.4.7}/python/placo_utils/__init__.py +0 -0
- {placo-0.4.6 → placo-0.4.7}/python/placo_utils/tf.py +0 -0
- {placo-0.4.6 → placo-0.4.7}/python/placo_utils/visualization.py +0 -0
- {placo-0.4.6 → placo-0.4.7}/python/run_tests.sh +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/avoid_self_collisions_constraint.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/avoid_self_collisions_constraint.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/com_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/com_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/constraint.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/constraint.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/contacts.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/contacts.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/frame_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/frame_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/gear_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/gear_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/joints_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/joints_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/orientation_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/orientation_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/position_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/position_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/reaction_ratio_constraint.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/reaction_ratio_constraint.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/relative_frame_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/relative_frame_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/relative_orientation_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/relative_orientation_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/relative_position_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/relative_position_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/dynamics/task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/foot_trajectory.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/foot_trajectory.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/footsteps_planner.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/footsteps_planner.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/footsteps_planner_naive.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/footsteps_planner_naive.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/footsteps_planner_repetitive.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/footsteps_planner_repetitive.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/humanoid_parameters.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/humanoid_parameters.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/kick.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/kick.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/lipm.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/lipm.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/swing_foot.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/swing_foot.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/swing_foot_cubic.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/swing_foot_cubic.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/swing_foot_quintic.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/swing_foot_quintic.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/walk_pattern_generator.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/walk_pattern_generator.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/walk_tasks.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/humanoid/walk_tasks.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/avoid_self_collisions_constraint.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/avoid_self_collisions_constraint.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/axis_align_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/axis_align_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/centroidal_momentum_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/centroidal_momentum_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/com_polygon_constraint.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/com_polygon_constraint.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/com_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/com_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/cone_constraint.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/cone_constraint.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/constraint.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/constraint.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/distance_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/distance_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/frame_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/frame_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/gear_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/gear_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/joints_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/joints_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/orientation_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/orientation_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/position_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/position_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/regularization_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/regularization_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/relative_frame_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/relative_frame_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/relative_orientation_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/relative_orientation_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/relative_position_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/relative_position_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/wheel_task.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/kinematics/wheel_task.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/model/robot_wrapper.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/problem/constraint.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/problem/constraint.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/problem/expression.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/problem/expression.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/problem/integrator.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/problem/integrator.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/problem/polygon_constraint.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/problem/polygon_constraint.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/problem/problem.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/problem/problem.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/problem/qp_error.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/problem/qp_error.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/problem/sparsity.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/problem/sparsity.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/problem/variable.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/problem/variable.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/tools/axises_mask.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/tools/axises_mask.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/tools/cubic_spline.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/tools/cubic_spline.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/tools/cubic_spline_3d.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/tools/cubic_spline_3d.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/tools/prioritized.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/tools/prioritized.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/tools/utils.cpp +0 -0
- {placo-0.4.6 → placo-0.4.7}/src/placo/tools/utils.h +0 -0
- {placo-0.4.6 → placo-0.4.7}/stubs.py +0 -0
- {placo-0.4.6 → placo-0.4.7}/tweak_sdist.sh +0 -0
- {placo-0.4.6 → placo-0.4.7}/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/kinetic_energy_regularization_task.cpp
|
|
81
82
|
src/placo/kinematics/constraint.cpp
|
|
82
83
|
src/placo/kinematics/avoid_self_collisions_constraint.cpp
|
|
83
84
|
src/placo/kinematics/com_polygon_constraint.cpp
|
|
@@ -93,6 +94,7 @@ add_library(libplaco SHARED
|
|
|
93
94
|
src/placo/dynamics/relative_orientation_task.cpp
|
|
94
95
|
src/placo/dynamics/relative_frame_task.cpp
|
|
95
96
|
src/placo/dynamics/joints_task.cpp
|
|
97
|
+
src/placo/dynamics/torque_task.cpp
|
|
96
98
|
src/placo/dynamics/gear_task.cpp
|
|
97
99
|
src/placo/dynamics/com_task.cpp
|
|
98
100
|
src/placo/dynamics/contacts.cpp
|
|
@@ -79,7 +79,6 @@ void exposeDynamics()
|
|
|
79
79
|
.def_readwrite("friction", &DynamicsSolver::friction)
|
|
80
80
|
.def_readwrite("dt", &DynamicsSolver::dt)
|
|
81
81
|
.def_readwrite("qdd_safe", &DynamicsSolver::qdd_safe)
|
|
82
|
-
.def_readwrite("optimize_contact_forces", &DynamicsSolver::optimize_contact_forces)
|
|
83
82
|
.def_readwrite("gravity_only", &DynamicsSolver::gravity_only)
|
|
84
83
|
.def("mask_fbase", &DynamicsSolver::mask_fbase)
|
|
85
84
|
.def("add_point_contact", &DynamicsSolver::add_point_contact, return_internal_reference<>())
|
|
@@ -102,7 +101,6 @@ void exposeDynamics()
|
|
|
102
101
|
.def("enable_joint_limits", &DynamicsSolver::enable_joint_limits)
|
|
103
102
|
.def("enable_torque_limits", &DynamicsSolver::enable_torque_limits)
|
|
104
103
|
.def("dump_status", &DynamicsSolver::dump_status)
|
|
105
|
-
.def("set_static", &DynamicsSolver::set_static)
|
|
106
104
|
.def("solve", &DynamicsSolver::solve, solve_overloads())
|
|
107
105
|
.def<void (DynamicsSolver::*)(Task&)>("add_task", &DynamicsSolver::add_task)
|
|
108
106
|
.def<void (DynamicsSolver::*)(Constraint&)>("add_constraint", &DynamicsSolver::add_constraint)
|
|
@@ -130,6 +128,8 @@ void exposeDynamics()
|
|
|
130
128
|
"add_relative_frame_task", &DynamicsSolver::add_relative_frame_task)
|
|
131
129
|
.def<JointsTask& (DynamicsSolver::*)()>("add_joints_task", &DynamicsSolver::add_joints_task,
|
|
132
130
|
return_internal_reference<>())
|
|
131
|
+
.def<TorqueTask& (DynamicsSolver::*)()>("add_torque_task", &DynamicsSolver::add_torque_task,
|
|
132
|
+
return_internal_reference<>())
|
|
133
133
|
.def<GearTask& (DynamicsSolver::*)()>("add_gear_task", &DynamicsSolver::add_gear_task,
|
|
134
134
|
return_internal_reference<>())
|
|
135
135
|
.def<CoMTask& (DynamicsSolver::*)(Eigen::Vector3d)>("add_com_task", &DynamicsSolver::add_com_task,
|
|
@@ -233,6 +233,8 @@ void exposeDynamics()
|
|
|
233
233
|
update_map<std::string, double>(task.djoints, py_dict);
|
|
234
234
|
});
|
|
235
235
|
|
|
236
|
+
class__<TorqueTask, bases<Task>>("DynamicsTorqueTask", init<>()).def("set_torque", &TorqueTask::set_torque);
|
|
237
|
+
|
|
236
238
|
class__<GearTask, bases<Task>>("DynamicsGearTask", init<>())
|
|
237
239
|
.def("set_gear", &GearTask::set_gear)
|
|
238
240
|
.def("add_gear", &GearTask::add_gear);
|
|
@@ -77,6 +77,10 @@ void exposeKinematics()
|
|
|
77
77
|
// Regularization task
|
|
78
78
|
.def("add_regularization_task", &KinematicsSolver::add_regularization_task, return_internal_reference<>())
|
|
79
79
|
|
|
80
|
+
// Kinetic energy regularization task
|
|
81
|
+
.def("add_kinetic_energy_regularization_task", &KinematicsSolver::add_kinetic_energy_regularization_task,
|
|
82
|
+
return_internal_reference<>())
|
|
83
|
+
|
|
80
84
|
// Avoid self collisions constraint
|
|
81
85
|
.def("add_avoid_self_collisions_constraint", &KinematicsSolver::add_avoid_self_collisions_constraint,
|
|
82
86
|
return_internal_reference<>())
|
|
@@ -212,6 +216,8 @@ void exposeKinematics()
|
|
|
212
216
|
|
|
213
217
|
class__<RegularizationTask, bases<Task>>("RegularizationTask");
|
|
214
218
|
|
|
219
|
+
class__<KineticEnergyRegularizationTask, bases<RegularizationTask>>("KineticEnergyRegularizationTask");
|
|
220
|
+
|
|
215
221
|
class__<Constraint, bases<tools::Prioritized>, boost::noncopyable>("KinematicsConstraint", no_init);
|
|
216
222
|
|
|
217
223
|
class__<AvoidSelfCollisionsConstraint, bases<Constraint>>("AvoidSelfCollisionsKinematicsConstraint", init<>())
|
|
@@ -173,6 +173,24 @@ void exposeRobotWrapper()
|
|
|
173
173
|
.def("dcm", &HumanoidRobot::dcm)
|
|
174
174
|
.def("zmp", &HumanoidRobot::zmp)
|
|
175
175
|
.def("other_side", &HumanoidRobot::other_side)
|
|
176
|
+
.def(
|
|
177
|
+
"get_torques",
|
|
178
|
+
+[](HumanoidRobot& robot, Eigen::VectorXd qdd_a, Eigen::VectorXd contact_forces) {
|
|
179
|
+
return robot.get_torques(qdd_a, contact_forces);
|
|
180
|
+
})
|
|
181
|
+
.def(
|
|
182
|
+
"get_torques_dict",
|
|
183
|
+
+[](HumanoidRobot& robot, Eigen::VectorXd qdd_a, Eigen::VectorXd contact_forces) {
|
|
184
|
+
auto torques = robot.get_torques(qdd_a, contact_forces);
|
|
185
|
+
boost::python::dict dict;
|
|
186
|
+
|
|
187
|
+
for (auto& dof : robot.joint_names())
|
|
188
|
+
{
|
|
189
|
+
dict[dof] = torques[robot.get_joint_v_offset(dof) - 6];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return dict;
|
|
193
|
+
})
|
|
176
194
|
#ifdef HAVE_RHOBAN_UTILS
|
|
177
195
|
.def("read_from_histories", &HumanoidRobot::read_from_histories, read_from_histories_overloads())
|
|
178
196
|
#endif
|
|
@@ -83,6 +83,7 @@ void exposeTools()
|
|
|
83
83
|
.def("biggestTimestamp", &HistoryCollection::biggestTimestamp)
|
|
84
84
|
.def("startNamedLog", &HistoryCollection::startNamedLog)
|
|
85
85
|
.def("stopNamedLog", &HistoryCollection::stopNamedLog)
|
|
86
|
+
.def("getTimestamps", &HistoryCollection::getTimestamps)
|
|
86
87
|
.def(
|
|
87
88
|
"number", +[](HistoryCollection& collection, std::string name,
|
|
88
89
|
double t) { return collection.number(name)->interpolate(t); })
|
|
@@ -29,6 +29,7 @@ DynamicsRelativePositionTask = typing.NewType("DynamicsRelativePositionTask", No
|
|
|
29
29
|
DynamicsSolver = typing.NewType("DynamicsSolver", None)
|
|
30
30
|
DynamicsSolverResult = typing.NewType("DynamicsSolverResult", None)
|
|
31
31
|
DynamicsTask = typing.NewType("DynamicsTask", None)
|
|
32
|
+
DynamicsTorqueTask = typing.NewType("DynamicsTorqueTask", None)
|
|
32
33
|
Exception = typing.NewType("Exception", None)
|
|
33
34
|
Expression = typing.NewType("Expression", None)
|
|
34
35
|
ExternalWrenchContact = typing.NewType("ExternalWrenchContact", None)
|
|
@@ -48,6 +49,7 @@ IntegratorTrajectory = typing.NewType("IntegratorTrajectory", None)
|
|
|
48
49
|
JointsTask = typing.NewType("JointsTask", None)
|
|
49
50
|
KinematicsConstraint = typing.NewType("KinematicsConstraint", None)
|
|
50
51
|
KinematicsSolver = typing.NewType("KinematicsSolver", None)
|
|
52
|
+
KineticEnergyRegularizationTask = typing.NewType("KineticEnergyRegularizationTask", None)
|
|
51
53
|
LIPM = typing.NewType("LIPM", None)
|
|
52
54
|
LIPMTrajectory = typing.NewType("LIPMTrajectory", None)
|
|
53
55
|
OrientationTask = typing.NewType("OrientationTask", None)
|
|
@@ -1796,8 +1798,6 @@ class DynamicsSolver:
|
|
|
1796
1798
|
"""Adds a joints task.
|
|
1797
1799
|
|
|
1798
1800
|
|
|
1799
|
-
:param target: target joints values
|
|
1800
|
-
|
|
1801
1801
|
:return: joints task"""
|
|
1802
1802
|
...
|
|
1803
1803
|
|
|
@@ -1994,6 +1994,16 @@ class DynamicsSolver:
|
|
|
1994
1994
|
:return: task contact"""
|
|
1995
1995
|
...
|
|
1996
1996
|
|
|
1997
|
+
def add_torque_task(
|
|
1998
|
+
self: DynamicsSolver,
|
|
1999
|
+
|
|
2000
|
+
) -> DynamicsTorqueTask:
|
|
2001
|
+
"""Adds a torque task.
|
|
2002
|
+
|
|
2003
|
+
|
|
2004
|
+
:return: torque task"""
|
|
2005
|
+
...
|
|
2006
|
+
|
|
1997
2007
|
def add_unilateral_point_contact(
|
|
1998
2008
|
self: DynamicsSolver,
|
|
1999
2009
|
position_task: DynamicsPositionTask, # placo::dynamics::PositionTask
|
|
@@ -2086,10 +2096,6 @@ class DynamicsSolver:
|
|
|
2086
2096
|
"""Decides if the floating base should be masked."""
|
|
2087
2097
|
...
|
|
2088
2098
|
|
|
2089
|
-
optimize_contact_forces: bool # bool
|
|
2090
|
-
"""If true, the solver will try to optimize the contact forces by removing variables.
|
|
2091
|
-
"""
|
|
2092
|
-
|
|
2093
2099
|
problem: Problem # placo::problem::Problem
|
|
2094
2100
|
"""Instance of the problem.
|
|
2095
2101
|
"""
|
|
@@ -2153,17 +2159,6 @@ class DynamicsSolver:
|
|
|
2153
2159
|
:param kd: kd gain if the joint is a spring (0 by default)"""
|
|
2154
2160
|
...
|
|
2155
2161
|
|
|
2156
|
-
def set_static(
|
|
2157
|
-
self: DynamicsSolver,
|
|
2158
|
-
is_static: bool, # bool
|
|
2159
|
-
|
|
2160
|
-
) -> None:
|
|
2161
|
-
"""Sets the robot as static, this will impose the joint accelerations to be zero.
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
:param is_static: whether the robot should be static"""
|
|
2165
|
-
...
|
|
2166
|
-
|
|
2167
2162
|
def solve(
|
|
2168
2163
|
self: DynamicsSolver,
|
|
2169
2164
|
integrate: bool = False, # bool
|
|
@@ -2253,6 +2248,81 @@ class DynamicsTask:
|
|
|
2253
2248
|
"""
|
|
2254
2249
|
|
|
2255
2250
|
|
|
2251
|
+
class DynamicsTorqueTask:
|
|
2252
|
+
A: numpy.ndarray # Eigen::MatrixXd
|
|
2253
|
+
"""A matrix in Ax = b, where x is the accelerations.
|
|
2254
|
+
"""
|
|
2255
|
+
|
|
2256
|
+
def __init__(
|
|
2257
|
+
arg1: object,
|
|
2258
|
+
|
|
2259
|
+
) -> None:
|
|
2260
|
+
...
|
|
2261
|
+
|
|
2262
|
+
b: numpy.ndarray # Eigen::MatrixXd
|
|
2263
|
+
"""b vector in Ax = b, where x is the accelerations
|
|
2264
|
+
"""
|
|
2265
|
+
|
|
2266
|
+
def configure(
|
|
2267
|
+
self: DynamicsTorqueTask,
|
|
2268
|
+
name: str, # std::string
|
|
2269
|
+
priority: any, # placo::kinematics::ConeConstraint::Priority
|
|
2270
|
+
weight: float = 1.0, # double
|
|
2271
|
+
|
|
2272
|
+
) -> None:
|
|
2273
|
+
"""Configures the object.
|
|
2274
|
+
|
|
2275
|
+
|
|
2276
|
+
:param name: task name
|
|
2277
|
+
|
|
2278
|
+
:param priority: task priority (hard, soft or scaled)
|
|
2279
|
+
|
|
2280
|
+
:param weight: task weight"""
|
|
2281
|
+
...
|
|
2282
|
+
|
|
2283
|
+
critically_damped: bool # bool
|
|
2284
|
+
"""If this is true, kd will be computed from kp to have a critically damped system.
|
|
2285
|
+
"""
|
|
2286
|
+
|
|
2287
|
+
derror: numpy.ndarray # Eigen::MatrixXd
|
|
2288
|
+
"""Current velocity error vector.
|
|
2289
|
+
"""
|
|
2290
|
+
|
|
2291
|
+
error: numpy.ndarray # Eigen::MatrixXd
|
|
2292
|
+
"""Current error vector.
|
|
2293
|
+
"""
|
|
2294
|
+
|
|
2295
|
+
kd: float # double
|
|
2296
|
+
"""D gain for position control.
|
|
2297
|
+
"""
|
|
2298
|
+
|
|
2299
|
+
kp: float # double
|
|
2300
|
+
"""K gain for position control.
|
|
2301
|
+
"""
|
|
2302
|
+
|
|
2303
|
+
name: str # std::string
|
|
2304
|
+
"""Object name.
|
|
2305
|
+
"""
|
|
2306
|
+
|
|
2307
|
+
priority: any # placo::kinematics::ConeConstraint::Priority
|
|
2308
|
+
"""Object priority.
|
|
2309
|
+
"""
|
|
2310
|
+
|
|
2311
|
+
def set_torque(
|
|
2312
|
+
self: DynamicsTorqueTask,
|
|
2313
|
+
joint: str, # std::string
|
|
2314
|
+
torque: float, # double
|
|
2315
|
+
|
|
2316
|
+
) -> None:
|
|
2317
|
+
"""Sets the target for a given joint.
|
|
2318
|
+
|
|
2319
|
+
|
|
2320
|
+
:param joint: joint name
|
|
2321
|
+
|
|
2322
|
+
:param torque: target torque"""
|
|
2323
|
+
...
|
|
2324
|
+
|
|
2325
|
+
|
|
2256
2326
|
class Exception:
|
|
2257
2327
|
def __init__(
|
|
2258
2328
|
arg1: object,
|
|
@@ -3363,6 +3433,30 @@ class HumanoidRobot:
|
|
|
3363
3433
|
) -> HumanoidRobot_Side:
|
|
3364
3434
|
...
|
|
3365
3435
|
|
|
3436
|
+
def get_torques(
|
|
3437
|
+
self: HumanoidRobot,
|
|
3438
|
+
acc_a: numpy.ndarray, # Eigen::VectorXd
|
|
3439
|
+
contact_forces: numpy.ndarray, # Eigen::VectorXd
|
|
3440
|
+
|
|
3441
|
+
) -> numpy.ndarray:
|
|
3442
|
+
"""Compute the torques of the motors from the contact forces.
|
|
3443
|
+
|
|
3444
|
+
|
|
3445
|
+
:param acc_a: Accelerations of the actuated DoFs
|
|
3446
|
+
|
|
3447
|
+
:param contact_forces: Contact forces from the feet (forces are supposed normal to the ground)
|
|
3448
|
+
|
|
3449
|
+
:return: Torques of the motors"""
|
|
3450
|
+
...
|
|
3451
|
+
|
|
3452
|
+
def get_torques_dict(
|
|
3453
|
+
arg1: HumanoidRobot,
|
|
3454
|
+
arg2: numpy.ndarray,
|
|
3455
|
+
arg3: numpy.ndarray,
|
|
3456
|
+
|
|
3457
|
+
) -> dict:
|
|
3458
|
+
...
|
|
3459
|
+
|
|
3366
3460
|
def integrate(
|
|
3367
3461
|
self: HumanoidRobot,
|
|
3368
3462
|
dt: float, # double
|
|
@@ -4180,6 +4274,19 @@ class KinematicsSolver:
|
|
|
4180
4274
|
:return: joints task"""
|
|
4181
4275
|
...
|
|
4182
4276
|
|
|
4277
|
+
def add_kinetic_energy_regularization_task(
|
|
4278
|
+
self: KinematicsSolver,
|
|
4279
|
+
magnitude: float = 1e-6, # double
|
|
4280
|
+
|
|
4281
|
+
) -> KineticEnergyRegularizationTask:
|
|
4282
|
+
"""Adds a kinetic energy regularization task for a given magnitude.
|
|
4283
|
+
|
|
4284
|
+
|
|
4285
|
+
:param magnitude: regularization magnitude
|
|
4286
|
+
|
|
4287
|
+
:return: regularization task"""
|
|
4288
|
+
...
|
|
4289
|
+
|
|
4183
4290
|
def add_orientation_task(
|
|
4184
4291
|
self: KinematicsSolver,
|
|
4185
4292
|
frame: str, # std::string
|
|
@@ -4431,6 +4538,74 @@ class KinematicsSolver:
|
|
|
4431
4538
|
...
|
|
4432
4539
|
|
|
4433
4540
|
|
|
4541
|
+
class KineticEnergyRegularizationTask:
|
|
4542
|
+
A: numpy.ndarray # Eigen::MatrixXd
|
|
4543
|
+
"""Matrix A in the task Ax = b, where x are the joint delta positions.
|
|
4544
|
+
"""
|
|
4545
|
+
|
|
4546
|
+
def __init__(
|
|
4547
|
+
arg1: object,
|
|
4548
|
+
|
|
4549
|
+
) -> None:
|
|
4550
|
+
...
|
|
4551
|
+
|
|
4552
|
+
b: numpy.ndarray # Eigen::MatrixXd
|
|
4553
|
+
"""Vector b in the task Ax = b, where x are the joint delta positions.
|
|
4554
|
+
"""
|
|
4555
|
+
|
|
4556
|
+
def configure(
|
|
4557
|
+
self: KineticEnergyRegularizationTask,
|
|
4558
|
+
name: str, # std::string
|
|
4559
|
+
priority: any, # placo::kinematics::ConeConstraint::Priority
|
|
4560
|
+
weight: float = 1.0, # double
|
|
4561
|
+
|
|
4562
|
+
) -> None:
|
|
4563
|
+
"""Configures the object.
|
|
4564
|
+
|
|
4565
|
+
|
|
4566
|
+
:param name: task name
|
|
4567
|
+
|
|
4568
|
+
:param priority: task priority (hard, soft or scaled)
|
|
4569
|
+
|
|
4570
|
+
:param weight: task weight"""
|
|
4571
|
+
...
|
|
4572
|
+
|
|
4573
|
+
def error(
|
|
4574
|
+
self: KineticEnergyRegularizationTask,
|
|
4575
|
+
|
|
4576
|
+
) -> numpy.ndarray:
|
|
4577
|
+
"""Task errors (vector)
|
|
4578
|
+
|
|
4579
|
+
|
|
4580
|
+
:return: task errors"""
|
|
4581
|
+
...
|
|
4582
|
+
|
|
4583
|
+
def error_norm(
|
|
4584
|
+
self: KineticEnergyRegularizationTask,
|
|
4585
|
+
|
|
4586
|
+
) -> float:
|
|
4587
|
+
"""The task error norm.
|
|
4588
|
+
|
|
4589
|
+
|
|
4590
|
+
:return: task error norm"""
|
|
4591
|
+
...
|
|
4592
|
+
|
|
4593
|
+
name: str # std::string
|
|
4594
|
+
"""Object name.
|
|
4595
|
+
"""
|
|
4596
|
+
|
|
4597
|
+
priority: any # placo::kinematics::ConeConstraint::Priority
|
|
4598
|
+
"""Object priority.
|
|
4599
|
+
"""
|
|
4600
|
+
|
|
4601
|
+
def update(
|
|
4602
|
+
self: KineticEnergyRegularizationTask,
|
|
4603
|
+
|
|
4604
|
+
) -> None:
|
|
4605
|
+
"""Update the task A and b matrices from the robot state and targets."""
|
|
4606
|
+
...
|
|
4607
|
+
|
|
4608
|
+
|
|
4434
4609
|
class LIPM:
|
|
4435
4610
|
"""LIPM is an helper that can be used to build problem involving LIPM dynamics. The decision variables introduced here are jerks, which is piecewise constant.
|
|
4436
4611
|
"""
|
|
@@ -7027,4 +7202,4 @@ def wrap_angle(
|
|
|
7027
7202
|
...
|
|
7028
7203
|
|
|
7029
7204
|
|
|
7030
|
-
__groups__ = {'placo::dynamics': ['AvoidSelfCollisionsDynamicsConstraint', 'Contact', 'Contact6D', 'DynamicsCoMTask', 'DynamicsConstraint', 'DynamicsFrameTask', 'DynamicsGearTask', 'DynamicsJointsTask', 'DynamicsOrientationTask', 'DynamicsPositionTask', 'DynamicsReactionRatioConstraint', 'DynamicsRelativeFrameTask', 'DynamicsRelativeOrientationTask', 'DynamicsRelativePositionTask', 'DynamicsSolver', 'DynamicsSolverResult', 'DynamicsTask', 'ExternalWrenchContact', 'PointContact', 'PuppetContact', 'Relative6DContact', 'RelativePointContact', 'TaskContact'], 'placo::kinematics': ['AvoidSelfCollisionsKinematicsConstraint', 'AxisAlignTask', 'CentroidalMomentumTask', 'CoMPolygonConstraint', 'CoMTask', 'ConeConstraint', 'DistanceTask', 'FrameTask', 'GearTask', 'JointsTask', 'KinematicsConstraint', 'KinematicsSolver', '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']}
|
|
7205
|
+
__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']}
|
|
@@ -139,14 +139,14 @@ CoMTask& DynamicsSolver::add_com_task(Eigen::Vector3d target_world)
|
|
|
139
139
|
return add_task(new CoMTask(target_world));
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
JointsTask& DynamicsSolver::add_joints_task()
|
|
143
143
|
{
|
|
144
|
-
|
|
144
|
+
return add_task(new JointsTask());
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
TorqueTask& DynamicsSolver::add_torque_task()
|
|
148
148
|
{
|
|
149
|
-
return add_task(new
|
|
149
|
+
return add_task(new TorqueTask());
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
GearTask& DynamicsSolver::add_gear_task()
|
|
@@ -231,11 +231,6 @@ void DynamicsSolver::compute_limits_inequalities(Expression& tau)
|
|
|
231
231
|
problem.add_constraint(tau.slice(6) >= -robot.model.effortLimit.bottomRows(N - 6));
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
if (is_static)
|
|
235
|
-
{
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
234
|
int constraints = 0;
|
|
240
235
|
if (joint_limits)
|
|
241
236
|
{
|
|
@@ -371,10 +366,7 @@ void DynamicsSolver::clear()
|
|
|
371
366
|
void DynamicsSolver::dump_status_stream(std::ostream& stream)
|
|
372
367
|
{
|
|
373
368
|
stream << "* Dynamics Tasks:" << std::endl;
|
|
374
|
-
|
|
375
|
-
{
|
|
376
|
-
std::cout << " * Solver is static (qdd is 0)" << std::endl;
|
|
377
|
-
}
|
|
369
|
+
|
|
378
370
|
for (auto task : tasks)
|
|
379
371
|
{
|
|
380
372
|
task->update();
|
|
@@ -422,50 +414,22 @@ DynamicsSolver::Result DynamicsSolver::solve(bool integrate)
|
|
|
422
414
|
double qd = robot.get_joint_velocity(joint);
|
|
423
415
|
int index = robot.get_joint_v_offset(joint);
|
|
424
416
|
passive_indices.push_back(index);
|
|
425
|
-
passive_taus[k++] = q * pj.kp
|
|
417
|
+
passive_taus[k++] = -q * pj.kp - qd * pj.kd;
|
|
426
418
|
}
|
|
427
419
|
|
|
428
420
|
Expression qdd;
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
qdd = Expression::from_vector(Eigen::VectorXd::Zero(robot.model.nv));
|
|
432
|
-
}
|
|
433
|
-
else
|
|
434
|
-
{
|
|
435
|
-
Variable& qdd_variable = problem.add_variable(robot.model.nv);
|
|
436
|
-
qdd = qdd_variable.expr();
|
|
421
|
+
Variable& qdd_variable = problem.add_variable(robot.model.nv);
|
|
422
|
+
qdd = qdd_variable.expr();
|
|
437
423
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
}
|
|
424
|
+
if (masked_fbase)
|
|
425
|
+
{
|
|
426
|
+
problem.add_constraint(qdd_variable.expr(0, 6) == 0.);
|
|
442
427
|
}
|
|
443
428
|
|
|
429
|
+
// Updating tasks
|
|
444
430
|
for (auto& task : tasks)
|
|
445
431
|
{
|
|
446
432
|
task->update();
|
|
447
|
-
if (task->A.rows() == 0)
|
|
448
|
-
{
|
|
449
|
-
continue;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
if (!is_static)
|
|
453
|
-
{
|
|
454
|
-
ProblemConstraint::Priority task_priority = ProblemConstraint::Hard;
|
|
455
|
-
if (task->priority == Task::Priority::Soft)
|
|
456
|
-
{
|
|
457
|
-
task_priority = ProblemConstraint::Soft;
|
|
458
|
-
}
|
|
459
|
-
else if (task->priority == Task::Priority::Scaled)
|
|
460
|
-
{
|
|
461
|
-
throw std::runtime_error("DynamicsSolver::solve: Scaled priority is not supported");
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
Expression e;
|
|
465
|
-
e.A = task->A;
|
|
466
|
-
e.b = -task->b;
|
|
467
|
-
problem.add_constraint(e == 0).configure(task_priority, task->weight);
|
|
468
|
-
}
|
|
469
433
|
}
|
|
470
434
|
|
|
471
435
|
// We build the expression for tau, given the equation of motion
|
|
@@ -486,13 +450,6 @@ DynamicsSolver::Result DynamicsSolver::solve(bool integrate)
|
|
|
486
450
|
|
|
487
451
|
// J^T F
|
|
488
452
|
|
|
489
|
-
// Contacts that will result in a decision variable
|
|
490
|
-
std::vector<Contact*> variable_contacts;
|
|
491
|
-
// Contacts that will be optimized out
|
|
492
|
-
std::vector<Contact*> determined_contacts;
|
|
493
|
-
std::vector<int> determined_indices;
|
|
494
|
-
int determined_contacts_count = 0;
|
|
495
|
-
|
|
496
453
|
for (auto& contact : contacts)
|
|
497
454
|
{
|
|
498
455
|
contact->update();
|
|
@@ -505,21 +462,10 @@ DynamicsSolver::Result DynamicsSolver::solve(bool integrate)
|
|
|
505
462
|
}
|
|
506
463
|
else
|
|
507
464
|
{
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
determined_contacts.push_back(contact);
|
|
513
|
-
determined_contacts_count += contact->size();
|
|
514
|
-
}
|
|
515
|
-
else
|
|
516
|
-
{
|
|
517
|
-
// This contact will be an actual decision variable
|
|
518
|
-
Variable& f_variable = problem.add_variable(contact->size());
|
|
519
|
-
contact->f = f_variable.expr();
|
|
520
|
-
contact->add_constraints(problem);
|
|
521
|
-
variable_contacts.push_back(contact);
|
|
522
|
-
}
|
|
465
|
+
// This contact will be an actual decision variable
|
|
466
|
+
Variable& f_variable = problem.add_variable(contact->size());
|
|
467
|
+
contact->f = f_variable.expr();
|
|
468
|
+
contact->add_constraints(problem);
|
|
523
469
|
}
|
|
524
470
|
}
|
|
525
471
|
|
|
@@ -530,55 +476,45 @@ DynamicsSolver::Result DynamicsSolver::solve(bool integrate)
|
|
|
530
476
|
|
|
531
477
|
// Now, tau = Ax + b with x = [qdd, f1, f2, ...], we copy J^T to the extended A
|
|
532
478
|
// for forces that are decision variables
|
|
533
|
-
k =
|
|
534
|
-
for (auto& contact :
|
|
479
|
+
k = N;
|
|
480
|
+
for (auto& contact : contacts)
|
|
535
481
|
{
|
|
536
482
|
tau.A.block(0, k, N, contact->J.rows()) = -contact->J.transpose();
|
|
537
483
|
tau.b -= contact->J.transpose() * contact->f.b;
|
|
538
484
|
k += contact->J.rows();
|
|
539
485
|
}
|
|
540
486
|
|
|
541
|
-
//
|
|
542
|
-
|
|
487
|
+
// Computing limit inequalitie
|
|
488
|
+
compute_limits_inequalities(tau);
|
|
543
489
|
|
|
544
|
-
|
|
490
|
+
// Adding tasks
|
|
491
|
+
for (auto& task : tasks)
|
|
545
492
|
{
|
|
546
|
-
|
|
547
|
-
Eigen::MatrixXd Jd = Eigen::MatrixXd::Zero(N, determined_contacts_count);
|
|
548
|
-
k = 0;
|
|
549
|
-
for (auto& contact : determined_contacts)
|
|
493
|
+
if (task->A.rows() == 0)
|
|
550
494
|
{
|
|
551
|
-
|
|
552
|
-
k += contact->J.rows();
|
|
495
|
+
continue;
|
|
553
496
|
}
|
|
554
497
|
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
Expression fd;
|
|
558
|
-
fd.A = tau.A(determined_indices, Eigen::all);
|
|
559
|
-
fd.b = tau.b(determined_indices);
|
|
560
|
-
fd.b -= passive_taus.topRows(determined_contacts_count);
|
|
561
|
-
|
|
562
|
-
// We use the inverse of the Jd matrix for those passive Dofs to express fd as a
|
|
563
|
-
// function of other variables
|
|
564
|
-
fd = Jd(determined_indices, Eigen::all).inverse() * fd;
|
|
565
|
-
|
|
566
|
-
// We feed the determined contacts with force expressed as other variables
|
|
567
|
-
k = 0;
|
|
568
|
-
for (auto& contact : determined_contacts)
|
|
498
|
+
ProblemConstraint::Priority task_priority = ProblemConstraint::Hard;
|
|
499
|
+
if (task->priority == Task::Priority::Soft)
|
|
569
500
|
{
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
501
|
+
task_priority = ProblemConstraint::Soft;
|
|
502
|
+
}
|
|
503
|
+
else if (task->priority == Task::Priority::Scaled)
|
|
504
|
+
{
|
|
505
|
+
throw std::runtime_error("DynamicsSolver::solve: Scaled priority is not supported");
|
|
573
506
|
}
|
|
574
507
|
|
|
575
|
-
|
|
576
|
-
|
|
508
|
+
Expression e;
|
|
509
|
+
e.A = task->A;
|
|
510
|
+
e.b = -task->b;
|
|
511
|
+
if (task->tau_task)
|
|
512
|
+
{
|
|
513
|
+
e.A = e.A * tau.A;
|
|
514
|
+
}
|
|
515
|
+
problem.add_constraint(e == 0).configure(task_priority, task->weight);
|
|
577
516
|
}
|
|
578
517
|
|
|
579
|
-
// Computing limit inequalitie
|
|
580
|
-
compute_limits_inequalities(tau);
|
|
581
|
-
|
|
582
518
|
// Add constraints
|
|
583
519
|
for (auto constraint : constraints)
|
|
584
520
|
{
|
|
@@ -593,14 +529,10 @@ DynamicsSolver::Result DynamicsSolver::solve(bool integrate)
|
|
|
593
529
|
}
|
|
594
530
|
|
|
595
531
|
// Passive joints that are not determined have a tau constraint
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
passive_tau_expr.b = tau.b(passive_indices);
|
|
601
|
-
problem.add_constraint(passive_tau_expr.slice(determined_contacts_count) ==
|
|
602
|
-
passive_taus.bottomRows(passive_taus.size() - determined_contacts_count));
|
|
603
|
-
}
|
|
532
|
+
Expression passive_tau_expr;
|
|
533
|
+
passive_tau_expr.A = tau.A(passive_indices, Eigen::all);
|
|
534
|
+
passive_tau_expr.b = tau.b(passive_indices);
|
|
535
|
+
problem.add_constraint(passive_tau_expr == passive_taus);
|
|
604
536
|
|
|
605
537
|
// We want to minimize torques
|
|
606
538
|
problem.add_constraint(tau == 0).configure(ProblemConstraint::Soft, 1e-3);
|