expose-jacobian.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015-2020 CNRS INRIA
3 //
4 
7 
8 namespace pinocchio
9 {
10  namespace python
11  {
12 
14  const context::Model & model,
16  const context::VectorXs & q,
17  JointIndex jointId)
18  {
20  J.setZero();
21  computeJointJacobian(model, data, q, jointId, J);
22 
23  return J;
24  }
25 
28  {
30  J.setZero();
31  getJointJacobian(model, data, jointId, rf, J);
32 
33  return J;
34  }
35 
38  {
40  dJ.setZero();
41  getJointJacobianTimeVariation(model, data, jointId, rf, dJ);
42 
43  return dJ;
44  }
45 
47  {
48  typedef context::Scalar Scalar;
50  enum
51  {
53  };
54 
55  bp::def(
56  "computeJointJacobians",
57  &computeJointJacobians<Scalar, Options, JointCollectionDefaultTpl, VectorXs>,
58  bp::args("model", "data", "q"),
59  "Computes the full model Jacobian, i.e. the stack of all the motion subspaces "
60  "expressed in the coordinate world frame.\n"
61  "The result is accessible through data.J. This function computes also the forward "
62  "kinematics of the model.\n\n"
63  "Parameters:\n"
64  "\tmodel: model of the kinematic tree\n"
65  "\tdata: data related to the model\n"
66  "\tq: the joint configuration vector (size model.nq)\n",
67  bp::return_value_policy<bp::return_by_value>());
68 
69  bp::def(
70  "computeJointJacobians", &computeJointJacobians<Scalar, Options, JointCollectionDefaultTpl>,
71  bp::args("model", "data"),
72  "Computes the full model Jacobian, i.e. the stack of all motion subspace expressed "
73  "in the world frame.\n"
74  "The result is accessible through data.J. This function assumes that forward "
75  "kinematics (pinocchio.forwardKinematics) has been called first.\n\n"
76  "Parameters:\n"
77  "\tmodel: model of the kinematic tree\n"
78  "\tdata: data related to the model\n",
79  bp::return_value_policy<bp::return_by_value>());
80 
81  bp::def(
82  "computeJointJacobian", compute_jacobian_proxy, bp::args("model", "data", "q", "joint_id"),
83  "Computes the Jacobian of a specific joint frame expressed in the local frame of the "
84  "joint according to the given input configuration.\n\n"
85  "Parameters:\n"
86  "\tmodel: model of the kinematic tree\n"
87  "\tdata: data related to the model\n"
88  "\tq: the joint configuration vector (size model.nq)\n"
89  "\tjoint_id: index of the joint\n");
90 
91  bp::def(
92  "getJointJacobian", get_jacobian_proxy,
93  bp::args("model", "data", "joint_id", "reference_frame"),
94  "Computes the jacobian of a given given joint according to the given entries in data.\n"
95  "If reference_frame is set to LOCAL, it returns the Jacobian expressed in the local "
96  "coordinate system of the joint.\n"
97  "If reference_frame is set to LOCAL_WORLD_ALIGNED, it returns the Jacobian expressed in "
98  "the coordinate system of the frame centered on the joint, but aligned with the WORLD "
99  "axes.\n"
100  "If reference_frame is set to WORLD, it returns the Jacobian expressed in the coordinate "
101  "system of the frame associated to the WORLD.\n\n"
102  "Parameters:\n"
103  "\tmodel: model of the kinematic tree\n"
104  "\tdata: data related to the model\n"
105  "\tjoint_id: index of the joint\n"
106  "\treference_frame: reference frame in which the resulting derivatives are expressed\n");
107 
108  bp::def(
109  "computeJointJacobiansTimeVariation",
112  bp::args("model", "data", "q", "v"),
113  "Computes the full model Jacobian variations with respect to time. It corresponds to "
114  "dJ/dt which depends both on q and v. It also computes the joint Jacobian of the "
115  "model (similar to computeJointJacobians)."
116  "The result is accessible through data.dJ and data.J.\n\n"
117  "Parameters:\n"
118  "\tmodel: model of the kinematic tree\n"
119  "\tdata: data related to the model\n"
120  "\tq: the joint configuration vector (size model.nq)\n"
121  "\tv: the joint velocity vector (size model.nv)\n",
122  bp::return_value_policy<bp::return_by_value>());
123 
124  bp::def(
125  "getJointJacobianTimeVariation", get_jacobian_time_variation_proxy,
126  bp::args("model", "data", "joint_id", "reference_frame"),
127  "Computes the Jacobian time variation of a specific joint expressed in the requested frame "
128  "provided by the value of reference_frame."
129  "You have to call computeJointJacobiansTimeVariation first. This function also computes "
130  "the full model Jacobian contained in data.J.\n"
131  "If reference_frame is set to LOCAL, it returns the Jacobian expressed in the local "
132  "coordinate system of the joint.\n"
133  "If reference_frame is set to LOCAL_WORLD_ALIGNED, it returns the Jacobian expressed in "
134  "the coordinate system of the frame centered on the joint, but aligned with the WORLD "
135  "axes.\n"
136  "If reference_frame is set to WORLD, it returns the Jacobian expressed in the coordinate "
137  "system of the frame associated to the WORLD.\n\n"
138  "Parameters:\n"
139  "\tmodel: model of the kinematic tree\n"
140  "\tdata: data related to the model\n"
141  "\tjoint_id: index of the joint\n"
142  "\treference_frame: reference frame in which the resulting derivatives are expressed\n");
143  }
144 
145  } // namespace python
146 } // namespace pinocchio
pinocchio::getJointJacobianTimeVariation
void getJointJacobianTimeVariation(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const JointIndex joint_id, const ReferenceFrame reference_frame, const Eigen::MatrixBase< Matrix6Like > &dJ)
Computes the Jacobian time variation of a specific joint frame expressed either in the world frame (r...
pinocchio::DataTpl
Definition: context/generic.hpp:25
pinocchio::ReferenceFrame
ReferenceFrame
Various conventions to express the velocity of a moving frame.
Definition: multibody/fwd.hpp:46
setup.data
data
Definition: cmake/cython/setup.in.py:48
pinocchio::python::Scalar
context::Scalar Scalar
Definition: admm-solver.cpp:29
inverse-kinematics-3d.J
J
Definition: inverse-kinematics-3d.py:28
pinocchio::computeJointJacobiansTimeVariation
const DataTpl< Scalar, Options, JointCollectionTpl >::Matrix6x & computeJointJacobiansTimeVariation(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType > &v)
Computes the full model Jacobian variations with respect to time. It corresponds to dJ/dt which depen...
pinocchio::python::get_jacobian_proxy
static context::Data::Matrix6x get_jacobian_proxy(const context::Model &model, context::Data &data, JointIndex jointId, ReferenceFrame rf)
Definition: expose-jacobian.cpp:26
pinocchio::python::VectorXs
context::VectorXs VectorXs
Definition: admm-solver.cpp:30
pinocchio::python::Options
@ Options
Definition: expose-contact-inverse-dynamics.cpp:22
pinocchio::python::exposeJacobian
void exposeJacobian()
Definition: expose-jacobian.cpp:46
pinocchio::context::VectorXs
Eigen::Matrix< Scalar, Eigen::Dynamic, 1, Options > VectorXs
Definition: context/generic.hpp:47
algorithms.hpp
pinocchio::getJointJacobian
void getJointJacobian(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const JointIndex joint_id, const ReferenceFrame reference_frame, const Eigen::MatrixBase< Matrix6Like > &J)
Computes the Jacobian of a specific joint frame expressed in one of the pinocchio::ReferenceFrame opt...
python
pinocchio::q
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
Definition: joint-configuration.hpp:1083
pinocchio::python::context::Options
@ Options
Definition: bindings/python/context/generic.hpp:40
pinocchio::python::get_jacobian_time_variation_proxy
static context::Data::Matrix6x get_jacobian_time_variation_proxy(const context::Model &model, context::Data &data, JointIndex jointId, ReferenceFrame rf)
Definition: expose-jacobian.cpp:36
pinocchio::computeJointJacobian
void computeJointJacobian(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const JointIndex joint_id, const Eigen::MatrixBase< Matrix6Like > &J)
Computes the Jacobian of a specific joint frame expressed in the local frame of the joint and store t...
pinocchio::JointIndex
Index JointIndex
Definition: multibody/fwd.hpp:26
pinocchio::DataTpl::Matrix6x
Eigen::Matrix< Scalar, 6, Eigen::Dynamic, Options > Matrix6x
The 6d jacobian type (temporary)
Definition: multibody/data.hpp:92
pinocchio::JointCollectionDefaultTpl
Definition: context/generic.hpp:15
pinocchio::python::compute_jacobian_proxy
static context::Data::Matrix6x compute_jacobian_proxy(const context::Model &model, context::Data &data, const context::VectorXs &q, JointIndex jointId)
Definition: expose-jacobian.cpp:13
jacobian.hpp
pinocchio::ModelTpl
Definition: context/generic.hpp:20
pinocchio::python::context::Scalar
PINOCCHIO_PYTHON_SCALAR_TYPE Scalar
Definition: bindings/python/context/generic.hpp:37
pinocchio::model
JointCollectionTpl & model
Definition: joint-configuration.hpp:1082
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Wed Dec 25 2024 03:41:15