Commit 40a5b9c0 authored by Justin Carpentier's avatar Justin Carpentier

python/constrained-dynamics: update signatures

parent 506ef5e3
......@@ -25,20 +25,41 @@ namespace pinocchio
BOOST_PYTHON_FUNCTION_OVERLOADS(forwardDynamics_overloads, forwardDynamics_proxy, 7, 9)
// TODO: overloading impulseDynamics directly, as done for forwardDynamics, was apparently not working (it crashed for 5 arguments)
// Therefore, it was necessary to resort to a proxy
// // TODO: overloading impulseDynamics directly, as done for forwardDynamics, was apparently not working (it crashed for 5 arguments)
// // Therefore, it was necessary to resort to a proxy
// static const Eigen::VectorXd impulseDynamics_proxy(const Model & model,
// Data & data,
// const Eigen::VectorXd & q,
// const Eigen::VectorXd & v_before,
// const Eigen::MatrixXd & J,
// const double r_coeff = 0.0,
// const bool updateKinematics = true)
// {
// return impulseDynamics(model, data, q, v_before, J, r_coeff, updateKinematics);
// }
//
// BOOST_PYTHON_FUNCTION_OVERLOADS(impulseDynamics_overloads, impulseDynamics_proxy, 5, 7)
static const Eigen::VectorXd impulseDynamics_proxy(const Model & model,
Data & data,
const Eigen::VectorXd & q,
const Eigen::VectorXd & v_before,
const Eigen::MatrixXd & J,
const double r_coeff = 0.0,
const bool updateKinematics = true)
const double inv_damping,
const double r_coeff)
{
return impulseDynamics(model, data, q, v_before, J, r_coeff, updateKinematics);
return impulseDynamics(model, data, q, v_before, J, inv_damping, r_coeff);
}
static const Eigen::VectorXd impulseDynamics_proxy_no_q(const Model & model,
Data & data,
const Eigen::VectorXd & v_before,
const Eigen::MatrixXd & J,
const double inv_damping,
const double r_coeff)
{
return impulseDynamics(model, data, v_before, J, inv_damping, r_coeff);
}
BOOST_PYTHON_FUNCTION_OVERLOADS(impulseDynamics_overloads, impulseDynamics_proxy, 5, 7)
static const Eigen::MatrixXd getKKTContactDynamicMatrixInverse_proxy(const Model & model,
Data & data,
......@@ -70,15 +91,24 @@ namespace pinocchio
bp::def("impulseDynamics",
&impulseDynamics_proxy,
impulseDynamics_overloads(
bp::args("Model","Data",
"Joint configuration q (size Model::nq)",
"Joint velocity before impact v_before (size Model::nv)",
"Contact Jacobian J (size nb_constraint * Model::nv)",
"Coefficient of restitution r_coeff (0 = rigid impact; 1 = fully elastic impact)",
"Update kinematics (if true, it updates only the joint space inertia matrix)"),
"Solve the impact dynamics problem with contacts, put the result in Data::dq_after and return it. The contact impulses are stored in data.impulse_c"
));
"Damping factor when J is rank deficient.",
"Coefficient of restitution r_coeff (0 = rigid impact; 1 = fully elastic impact)"),
"Solves the impact dynamics problem with contacts, put the result in Data::dq_after and return it. The contact impulses are stored in data.impulse_c"
);
bp::def("impulseDynamics",
&impulseDynamics_proxy_no_q,
bp::args("Model","Data",
"Joint velocity before impact v_before (size Model::nv)",
"Contact Jacobian J (size nb_constraint * Model::nv)",
"Damping factor when J is rank deficient.",
"Coefficient of restitution r_coeff (0 = rigid impact; 1 = fully elastic impact)"),
"Solves the impact dynamics problem with contacts, put the result in Data::dq_after and return it. The contact impulses are stored in data.impulse_c"
);
bp::def("getKKTContactDynamicMatrixInverse",getKKTContactDynamicMatrixInverse_proxy,
bp::args("Model","Data",
......
#
# Copyright (c) 2018 CNRS INRIA
# Copyright (c) 2018-2019 CNRS INRIA
#
## In this file, are reported some deprecated functions that are still maintained until the next important future releases ##
......@@ -195,3 +195,42 @@ def log6FromSE3(transform):
@deprecated("This function will be removed in future releases of Pinocchio. You can use log or log6.")
def log6FromMatrix(matrix4):
return pin.log6(matrix4)
@deprecated("This function has been renamed getJointJacobian and will be removed in future releases of Pinocchio. Please change for new getJointJacobian function.")
def getJacobian(model,data,jointId,local):
if local:
return pin.getJointJacobian(model,data,jointId,pin.ReferenceFrame.LOCAL)
else:
return pin.getJointJacobian(model,data,jointId,pin.ReferenceFrame.WORLD)
# This function is only deprecated when using a specific signature. Therefore, it needs special care
# Marked as deprecated on 16 Sept 2019
def impactDynamics(model, data, q = None, *args):
v_before = args[0]
J = args[1]
if q is None:
inv_damping = args[2]
r_coeff = args[3]
return pin.impactDynamics(model,data,v_before,J,inv_damping,r_coeff)
elif len(args)==4:
if type(args[3]) is bool:
message = ("This function signature has been deprecated and will be removed in future releases of Pinocchio. "
"Please change for the new signature of impactDynamics(model,data,[q],v_before,J,inv_damping,r_coeff).")
_warnings.warn(message, category=DeprecatedWarning, stacklevel=2)
inv_damping = 0.
r_coeff = args[2]
if(args[3])
return pîn.impactDynamics(model,data,q,v_before,J,inv_damping,r_coeff)
else:
return pîn.impactDynamics(model,data,v_before,J,inv_damping,r_coeff)
else:
inv_damping = args[2]
r_coeff = args[3]
return pîn.impactDynamics(model,data,q,v_before,J,inv_damping,r_coeff)
impactDynamics.__doc__ = (
pin.impactDynamics.__doc__
+ '\n\nimpactDynamics( (Model)Model, (Data)Data, (object)Joint configuration q (size Model::nq), (object)Joint velocity before impact v_before (size Model::nv), (object)Contact Jacobian J (size nb_constraint * Model::nv), (float)Coefficient of restitution r_coeff (0 = rigid impact; 1 = fully elastic impact), (bool)updateKinematics) -> object :'
+ '\n This function signature has been deprecated and will be removed in future releases of Pinocchio.'
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment