31 static bp::tuple getinitargs(
const Data &)
33 return bp::make_tuple();
36 static bp::tuple getstate(
const Data & data)
38 const std::string str(data.saveToString());
39 return bp::make_tuple(bp::str(str));
42 static void setstate(Data & data, bp::tuple tup)
44 if (bp::len(tup) == 0 || bp::len(tup) > 1)
46 throw eigenpy::Exception(
47 "Pickle was not able to reconstruct the model from the loaded data.\n" 48 "The pickle data structure contains too many elements.");
51 bp::object py_obj = tup[0];
52 boost::python::extract<std::string> obj_as_string(py_obj.ptr());
53 if (obj_as_string.check())
55 const std::string str = obj_as_string;
56 data.loadFromString(str);
60 throw eigenpy::Exception(
61 "Pickle was not able to reconstruct the model from the loaded data.\n" 62 "The entry is not a string.");
66 static bool getstate_manages_dict()
75 typedef typename Data::Matrix6 Matrix6;
76 typedef typename Data::Matrix6x Matrix6x;
77 typedef typename Data::Matrix3x Matrix3x;
78 typedef typename Data::Vector3 Vector3;
81#define ADD_DATA_PROPERTY(NAME, DOC) PINOCCHIO_ADD_PROPERTY(Data, NAME, DOC) 83#define ADD_DATA_PROPERTY_READONLY(NAME, DOC) PINOCCHIO_ADD_PROPERTY_READONLY(Data, NAME, DOC) 85#define ADD_DATA_PROPERTY_READONLY_BYVALUE(NAME, DOC) \ 86 PINOCCHIO_ADD_PROPERTY_READONLY_BYVALUE(Data, NAME, DOC) 89 PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH
90 PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS
91 template<
class PyClass>
92 void visit(PyClass & cl)
const 94 cl.def(bp::init<>(bp::arg(
"self"),
"Default constructor."))
96 bp::init<const context::Model &>(
97 bp::args(
"self",
"model"),
"Constructs a data structure from a given model."))
101 "Vector of JointData associated to each JointModel stored in the related model.")
102 .ADD_DATA_PROPERTY(q_in,
"Input joint configuration vector.")
103 .ADD_DATA_PROPERTY(v_in,
"Input joint velocity vector.")
104 .ADD_DATA_PROPERTY(a_in,
"Input joint acceleration vector.")
105 .ADD_DATA_PROPERTY(tau_in,
"Input joint torque vector.")
107 a,
"Vector of joint accelerations expressed in the local frame of the joint.")
109 oa,
"Joint spatial acceleration expressed at the origin of the world frame.")
111 a_gf,
"Joint spatial acceleration containing also the contribution of the gravity " 114 oa_gf,
"Joint spatial acceleration containing also the contribution of the gravity " 115 "acceleration, but expressed at the origin of the world frame.")
118 v,
"Vector of joint velocities expressed in the local frame of the joint.")
119 .ADD_DATA_PROPERTY(ov,
"Vector of joint velocities expressed at the origin of the world.")
121 .ADD_DATA_PROPERTY(f,
"Vector of body forces expressed in the local frame of the joint.")
122 .ADD_DATA_PROPERTY(of,
"Vector of body forces expressed at the origin of the world.")
124 of_augmented,
"Vector of body forces expressed at the origin of the world, in the " 125 "context of lagrangian formulation")
127 h,
"Vector of spatial momenta expressed in the local frame of the joint.")
128 .ADD_DATA_PROPERTY(oh,
"Vector of spatial momenta expressed at the origin of the world.")
129 .ADD_DATA_PROPERTY(oMi,
"Body absolute placement (wrt world)")
130 .ADD_DATA_PROPERTY(oMf,
"frames absolute placement (wrt world)")
131 .ADD_DATA_PROPERTY(liMi,
"Body relative placement (wrt parent)")
132 .ADD_DATA_PROPERTY(tau,
"Joint torques (output of RNEA)")
133 .ADD_DATA_PROPERTY(nle,
"Non Linear Effects (output of nle algorithm)")
134 .ADD_DATA_PROPERTY(ddq,
"Joint accelerations (output of ABA)")
135 .ADD_DATA_PROPERTY(Ycrb,
"Inertia of the sub-tree composit rigid body")
137 oYcrb,
"Composite Rigid Body Inertia of the sub-tree expressed in the WORLD coordinate " 139 .ADD_DATA_PROPERTY(Yaba,
"Articulated Body Inertia of the sub-tree")
142 "Articulated Body Inertia of the sub-tree expressed in the WORLD coordinate system.")
144 oYaba_augmented,
"Articulated Body Inertia matrix with constraint augmented inertia, " 145 "expressed in the WORLD coordinate system.")
146 .ADD_DATA_PROPERTY(oL,
"Acceleration propagator.")
147 .ADD_DATA_PROPERTY(oK,
"Inverse articulated inertia.")
148 .ADD_DATA_PROPERTY(M,
"The joint space inertia matrix")
149 .ADD_DATA_PROPERTY(Minv,
"The inverse of the joint space inertia matrix")
151 C,
"The Coriolis C(q,v) matrix such that the Coriolis effects are given by c(q,v) = " 153 .ADD_DATA_PROPERTY(g,
"Vector of generalized gravity (dim model.nv).")
154 .ADD_DATA_PROPERTY(Fcrb,
"Spatial forces set, used in CRBA")
155 .ADD_DATA_PROPERTY(lastChild,
"Index of the last child (for CRBA)")
156 .ADD_DATA_PROPERTY(nvSubtree,
"Dimension of the subtree motion space (for CRBA)")
157 .ADD_DATA_PROPERTY(U,
"Joint Inertia square root (upper triangle)")
158 .ADD_DATA_PROPERTY(D,
"Diagonal of UDUT inertia decomposition")
161 "Each element of this vector corresponds to the ordered list of indexes " 162 "belonging to the supporting tree of the given index at the row level. " 163 "It may be helpful to retrieve the sparsity pattern through it.")
164 .ADD_DATA_PROPERTY(start_idx_v_fromRow,
"Starting index of the Joint motion subspace")
165 .ADD_DATA_PROPERTY(end_idx_v_fromRow,
"End index of the Joint motion subspace")
166 .ADD_DATA_PROPERTY(parents_fromRow,
"First previous non-zero row in M (used in Cholesky)")
168 mimic_parents_fromRow,
169 "First previous non-zero row belonging to a mimic joint in M (used in Jacobian).")
171 non_mimic_parents_fromRow,
172 "First previous non-zero row belonging to a non mimic joint in M (used in Jacobian).")
174 idx_vExtended_to_idx_v_fromRow,
175 "Extended model mapping of the joint rows " 176 "(idx_vExtended_to_idx_v_fromRow[idx_vExtended] = idx_v)")
178 nvSubtree_fromRow,
"Subtree of the current row index (used in Cholesky)")
180 mimic_subtree_joint,
"When mimic joints are in the tree, this will store the index of " 181 "the first non mimic child of each mimic joint. (useful in crba)")
182 .ADD_DATA_PROPERTY(J,
"Jacobian of joint placement")
183 .ADD_DATA_PROPERTY(dJ,
"Time variation of the Jacobian of joint placement (data.J).")
184 .ADD_DATA_PROPERTY(iMf,
"Body placement wrt to algorithm end effector.")
186 .ADD_DATA_PROPERTY(Ivx,
"Right variation of the inertia matrix.")
187 .ADD_DATA_PROPERTY(vxI,
"Left variation of the inertia matrix.")
189 B,
"Combined variations of the inertia matrix consistent with Christoffel symbols.")
192 Ag,
"Centroidal matrix which maps from joint velocity to the centroidal momentum.")
193 .ADD_DATA_PROPERTY(dAg,
"Time derivative of the centroidal momentum matrix Ag.")
195 hg,
"Centroidal momentum (expressed in the frame centered at the CoM and aligned with " 198 dhg,
"Centroidal momentum time derivative (expressed in the frame centered at the CoM " 199 "and aligned with the world frame).")
200 .ADD_DATA_PROPERTY(Ig,
"Centroidal Composite Rigid Body Inertia.")
202 .ADD_DATA_PROPERTY(com,
"CoM position of the subtree starting at joint index i.")
203 .ADD_DATA_PROPERTY(vcom,
"CoM velocity of the subtree starting at joint index i.")
204 .ADD_DATA_PROPERTY(acom,
"CoM acceleration of the subtree starting at joint index i.")
205 .ADD_DATA_PROPERTY(mass,
"Mass of the subtree starting at joint index i.")
206 .ADD_DATA_PROPERTY(Jcom,
"Jacobian of center of mass.")
210 "Variation of the spatial acceleration set with respect to the joint configuration.")
212 dAdv,
"Variation of the spatial acceleration set with respect to the joint velocity.")
214 dHdq,
"Variation of the spatial momenta set with respect to the joint configuration.")
216 dFdq,
"Variation of the force set with respect to the joint configuration.")
217 .ADD_DATA_PROPERTY(dFdv,
"Variation of the force set with respect to the joint velocity.")
219 dFda,
"Variation of the force set with respect to the joint acceleration.")
222 dtau_dq,
"Partial derivative of the joint torque vector with respect to the joint " 226 "Partial derivative of the joint torque vector with respect to the joint velocity.")
228 ddq_dq,
"Partial derivative of the joint acceleration vector with respect to the joint " 231 ddq_dv,
"Partial derivative of the joint acceleration vector with respect to the joint " 235 "Partial derivative of the joint acceleration vector with respect to the joint torque.")
237 dvc_dq,
"Partial derivative of the constraint velocity vector with respect to the " 238 "joint configuration.")
241 dac_dq,
"Partial derivative of the contact acceleration vector with respect to the " 242 "joint configuration.")
244 dac_dv,
"Partial derivative of the contact acceleration vector vector with respect to " 245 "the joint velocity.")
247 dac_da,
"Partial derivative of the contact acceleration vector vector with respect to " 248 "the joint acceleration.")
250 .ADD_DATA_PROPERTY(osim,
"Operational space inertia matrix.")
252 .ADD_DATA_PROPERTY_READONLY_BYVALUE(
253 dlambda_dq,
"Partial derivative of the contact force vector with respect to the joint " 255 .ADD_DATA_PROPERTY_READONLY_BYVALUE(
257 "Partial derivative of the contact force vector with respect to the joint velocity.")
258 .ADD_DATA_PROPERTY_READONLY_BYVALUE(
260 "Partial derivative of the contact force vector with respect to the torque.")
262 kinetic_energy,
"Kinetic energy in [J] computed by computeKineticEnergy")
264 potential_energy,
"Potential energy in [J] computed by computePotentialEnergy")
267 "Mechanical energy in [J] of the system computed by computeMechanicalEnergy")
269 .ADD_DATA_PROPERTY(lambda_c,
"Lagrange Multipliers linked to contact forces")
270 .ADD_DATA_PROPERTY(impulse_c,
"Lagrange Multipliers linked to contact impulses")
271 .ADD_DATA_PROPERTY(constraint_chol,
"Contact Cholesky decomposition.")
275 +[](
const Data & self) {
return self.contact_chol; },
276 eigenpy::deprecated_member<>(
"Deprecated member. Use constraint_chol instead.")),
280 const typename Data::ConstraintCholeskyDecomposition & constraint_chol) {
281 self.contact_chol = constraint_chol;
283 eigenpy::deprecated_member<>(
"Deprecated member. Use constraint_chol instead.")),
284 "Deprecated member. Use constraint_chol instead.")
286 primal_dual_contact_solution,
287 "Right hand side vector when solving the contact dynamics KKT problem.")
289 lambda_c_prox,
"Proximal Lagrange Multipliers used in the computation of the Forward " 290 "Dynamics computations.")
291 .ADD_DATA_PROPERTY(primal_rhs_contact,
"Primal RHS in contact dynamic equations.")
293 .ADD_DATA_PROPERTY(dq_after,
"Generalized velocity after the impact.")
294 .ADD_DATA_PROPERTY(staticRegressor,
"Static regressor.")
295 .ADD_DATA_PROPERTY(jointTorqueRegressor,
"Joint torque regressor.")
296 .ADD_DATA_PROPERTY(kineticEnergyRegressor,
"Kinetic energy regressor.")
297 .ADD_DATA_PROPERTY(potentialEnergyRegressor,
"Potential energy regressor.")
299#ifndef PINOCCHIO_PYTHON_SKIP_COMPARISON_OPERATIONS 300 .def(bp::self == bp::self)
301 .def(bp::self != bp::self)
305 bp::register_ptr_to_python<std::shared_ptr<Data>>();
307 PINOCCHIO_COMPILER_DIAGNOSTIC_POP
314 "Articulated rigid body data related to a Model.\n" 315 "It contains all the data that can be modified by the Pinocchio algorithms.",
318 .def(::eigenpy::CopyableVisitor<Data>())
319#ifndef PINOCCHIO_PYTHON_NO_SERIALIZATION 325 typedef std::vector<Vector3> StdVec_Vector3;
326#ifndef PINOCCHIO_PYTHON_NO_SERIALIZATION 327 typedef std::vector<Matrix6x> StdVec_Matrix6x;
328 typedef std::vector<Matrix6> StdVec_Matrix6;
331 StdVectorPythonVisitor<std::vector<std::vector<int>>>::expose(
"StdVec_StdVec_Int");
339 eigenpy::register_symbolic_link_to_registered_type<StdVec_Vector3>(
342 bp::scope().attr(
"StdVec_Vector3") = bp::scope().attr(
"StdVec_Vec3s");
344 exposeStdVectorEigenSpecificType<Vector3>(
"Vector3");
345 exposeStdVectorEigenSpecificType<Matrix6x>(
"Matrix6x");
346 exposeStdVectorEigenSpecificType<Matrix6>(
"Matrix6");
348 StdVectorPythonVisitor<std::vector<int>,
true>::expose(
"StdVec_int");
349#ifndef PINOCCHIO_PYTHON_NO_SERIALIZATION 350 serialize<StdVec_Vector3>();
351 serialize<StdVec_Matrix6x>();
352 serialize<StdVec_Matrix6>();
353 serialize<std::vector<int>>();