expose-jacobian.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015-2020 CNRS INRIA
3 //
4 
6 #include "pinocchio/algorithm/jacobian.hpp"
7 
8 namespace pinocchio
9 {
10  namespace python
11  {
12 
13  static Data::Matrix6x
15  Data & data,
16  const Eigen::VectorXd & q,
17  Model::JointIndex jointId)
18  {
19  Data::Matrix6x J(6,model.nv); J.setZero();
20  computeJointJacobian(model,data,q,jointId,J);
21 
22  return J;
23  }
24 
25  static Data::Matrix6x
27  Data & data,
28  Model::JointIndex jointId,
29  ReferenceFrame rf)
30  {
31  Data::Matrix6x J(6,model.nv); J.setZero();
32  getJointJacobian(model,data,jointId,rf,J);
33 
34  return J;
35  }
36 
37  static Data::Matrix6x
39  Data & data,
40  Model::JointIndex jointId,
41  ReferenceFrame rf)
42  {
43  Data::Matrix6x dJ(6,model.nv); dJ.setZero();
44  getJointJacobianTimeVariation(model,data,jointId,rf,dJ);
45 
46  return dJ;
47  }
48 
50  {
51  using namespace Eigen;
52 
53  bp::def("computeJointJacobians",
54  &computeJointJacobians<double,0,JointCollectionDefaultTpl,VectorXd>,
55  bp::args("model","data","q"),
56  "Computes the full model Jacobian, i.e. the stack of all the motion subspaces expressed in the coordinate world frame.\n"
57  "The result is accessible through data.J. This function computes also the forward kinematics of the model.\n\n"
58  "Parameters:\n"
59  "\tmodel: model of the kinematic tree\n"
60  "\tdata: data related to the model\n"
61  "\tq: the joint configuration vector (size model.nq)\n",
62  bp::return_value_policy<bp::return_by_value>());
63 
64  bp::def("computeJointJacobians",
65  &computeJointJacobians<double,0,JointCollectionDefaultTpl>,
66  bp::args("model","data"),
67  "Computes the full model Jacobian, i.e. the stack of all motion subspace expressed in the world frame.\n"
68  "The result is accessible through data.J. This function assumes that forward kinematics (pinocchio.forwardKinematics) has been called first.\n\n"
69  "Parameters:\n"
70  "\tmodel: model of the kinematic tree\n"
71  "\tdata: data related to the model\n",
72  bp::return_value_policy<bp::return_by_value>());
73 
74  bp::def("computeJointJacobian",compute_jacobian_proxy,
75  bp::args("model","data","q","joint_id"),
76  "Computes the Jacobian of a specific joint frame expressed in the local frame of the joint according to the given input configuration.\n\n"
77  "Parameters:\n"
78  "\tmodel: model of the kinematic tree\n"
79  "\tdata: data related to the model\n"
80  "\tq: the joint configuration vector (size model.nq)\n"
81  "\tjoint_id: index of the joint\n");
82 
83  bp::def("getJointJacobian",get_jacobian_proxy,
84  bp::args("model","data","joint_id","reference_frame"),
85  "Computes the jacobian of a given given joint according to the given entries in data.\n"
86  "If reference_frame is set to LOCAL, it returns the Jacobian expressed in the local coordinate system of the joint.\n"
87  "If reference_frame is set to LOCAL_WORLD_ALIGNED, it returns the Jacobian expressed in the coordinate system of the frame centered on the joint, but aligned with the WORLD axes.\n"
88  "If reference_frame is set to WORLD, it returns the Jacobian expressed in the coordinate system of the frame associated to the WORLD.\n\n"
89  "Parameters:\n"
90  "\tmodel: model of the kinematic tree\n"
91  "\tdata: data related to the model\n"
92  "\tjoint_id: index of the joint\n"
93  "\treference_frame: reference frame in which the resulting derivatives are expressed\n");
94 
95  bp::def("computeJointJacobiansTimeVariation",computeJointJacobiansTimeVariation<double,0,JointCollectionDefaultTpl,VectorXd,VectorXd>,
96  bp::args("model","data","q","v"),
97  "Computes the full model Jacobian variations with respect to time. It corresponds to dJ/dt which depends both on q and v. It also computes the joint Jacobian of the model (similar to computeJointJacobians)."
98  "The result is accessible through data.dJ and data.J.\n\n"
99  "Parameters:\n"
100  "\tmodel: model of the kinematic tree\n"
101  "\tdata: data related to the model\n"
102  "\tq: the joint configuration vector (size model.nq)\n"
103  "\tv: the joint velocity vector (size model.nv)\n",
104  bp::return_value_policy<bp::return_by_value>());
105 
106  bp::def("getJointJacobianTimeVariation",get_jacobian_time_variation_proxy,
107  bp::args("model","data","joint_id","reference_frame"),
108  "Computes the Jacobian time variation of a specific joint expressed in the requested frame provided by the value of reference_frame."
109  "You have to call computeJointJacobiansTimeVariation first. This function also computes the full model Jacobian contained in data.J.\n"
110  "If reference_frame is set to LOCAL, it returns the Jacobian expressed in the local coordinate system of the joint.\n"
111  "If reference_frame is set to LOCAL_WORLD_ALIGNED, it returns the Jacobian expressed in the coordinate system of the frame centered on the joint, but aligned with the WORLD axes.\n"
112  "If reference_frame is set to WORLD, it returns the Jacobian expressed in the coordinate system of the frame associated to the WORLD.\n\n"
113  "Parameters:\n"
114  "\tmodel: model of the kinematic tree\n"
115  "\tdata: data related to the model\n"
116  "\tjoint_id: index of the joint\n"
117  "\treference_frame: reference frame in which the resulting derivatives are expressed\n");
118  }
119 
120  } // namespace python
121 } // namespace pinocchio
static Data::Matrix6x compute_jacobian_proxy(const Model &model, Data &data, const Eigen::VectorXd &q, Model::JointIndex jointId)
ReferenceFrame
List of Reference Frames supported by Pinocchio.
void getJointJacobian(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const typename ModelTpl< Scalar, Options, JointCollectionTpl >::JointIndex jointId, const ReferenceFrame rf, const Eigen::MatrixBase< Matrix6Like > &J)
Computes the Jacobian of a specific joint frame expressed either in the world (rf = WORLD) frame or i...
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
pinocchio::JointIndex JointIndex
void getJointJacobianTimeVariation(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const JointIndex jointId, const ReferenceFrame rf, const Eigen::MatrixBase< Matrix6Like > &dJ)
Computes the Jacobian time variation of a specific joint frame expressed either in the world frame (r...
Main pinocchio namespace.
Definition: timings.cpp:28
static Data::Matrix6x get_jacobian_time_variation_proxy(const Model &model, Data &data, Model::JointIndex jointId, ReferenceFrame rf)
int nv
Dimension of the velocity vector space.
static Data::Matrix6x get_jacobian_proxy(const Model &model, Data &data, Model::JointIndex jointId, ReferenceFrame rf)
void computeJointJacobian(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const JointIndex jointId, const Eigen::MatrixBase< Matrix6Like > &J)
Computes the Jacobian of a specific joint frame expressed in the local frame of the joint and store t...
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > VectorXd
Definition: conversions.cpp:14
Eigen::Matrix< Scalar, 6, Eigen::Dynamic, Options > Matrix6x
The 6d jacobian type (temporary)
JointCollectionTpl & model


pinocchio
Author(s):
autogenerated on Fri Jun 23 2023 02:38:30