expose-frames-derivatives.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 INRIA
3 //
4 
5 #include <boost/python/tuple.hpp>
6 
9 
11 
12 namespace pinocchio
13 {
14  namespace python
15  {
16  namespace bp = boost::python;
17 
19  const context::Model & model,
22  ReferenceFrame rf)
23  {
25 
26  Matrix6x partial_dq(Matrix6x::Zero(6, model.nv));
27  Matrix6x partial_dv(Matrix6x::Zero(6, model.nv));
28 
29  getFrameVelocityDerivatives(model, data, frame_id, rf, partial_dq, partial_dv);
30 
31  return bp::make_tuple(partial_dq, partial_dv);
32  }
33 
35  const context::Model & model,
38  const context::SE3 & placement,
39  ReferenceFrame rf)
40  {
42 
43  Matrix6x partial_dq(Matrix6x::Zero(6, model.nv));
44  Matrix6x partial_dv(Matrix6x::Zero(6, model.nv));
45 
46  getFrameVelocityDerivatives(model, data, joint_id, placement, rf, partial_dq, partial_dv);
47 
48  return bp::make_tuple(partial_dq, partial_dv);
49  }
50 
52  const context::Model & model,
55  ReferenceFrame rf)
56  {
58 
59  Matrix6x v_partial_dq(Matrix6x::Zero(6, model.nv));
60  Matrix6x a_partial_dq(Matrix6x::Zero(6, model.nv));
61  Matrix6x a_partial_dv(Matrix6x::Zero(6, model.nv));
62  Matrix6x a_partial_da(Matrix6x::Zero(6, model.nv));
63 
65  model, data, frame_id, rf, v_partial_dq, a_partial_dq, a_partial_dv, a_partial_da);
66 
67  return bp::make_tuple(v_partial_dq, a_partial_dq, a_partial_dv, a_partial_da);
68  }
69 
71  const context::Model & model,
74  const context::SE3 & placement,
75  ReferenceFrame rf)
76  {
78 
79  Matrix6x v_partial_dq(Matrix6x::Zero(6, model.nv));
80  Matrix6x a_partial_dq(Matrix6x::Zero(6, model.nv));
81  Matrix6x a_partial_dv(Matrix6x::Zero(6, model.nv));
82  Matrix6x a_partial_da(Matrix6x::Zero(6, model.nv));
83 
85  model, data, joint_id, placement, rf, v_partial_dq, a_partial_dq, a_partial_dv,
86  a_partial_da);
87 
88  return bp::make_tuple(v_partial_dq, a_partial_dq, a_partial_dv, a_partial_da);
89  }
90 
92  {
93  using namespace Eigen;
94 
95  bp::def(
96  "getFrameVelocityDerivatives", getFrameVelocityDerivatives_proxy1,
97  bp::args("model", "data", "frame_id", "reference_frame"),
98  "Computes the partial derivatives of the spatial velocity of a given frame with respect "
99  "to\n"
100  "the joint configuration and velocity and returns them as a tuple.\n"
101  "The partial derivatives can be either expressed in the LOCAL frame of the joint, in the "
102  "LOCAL_WORLD_ALIGNED frame or in the WORLD coordinate frame depending on the value of "
103  "reference_frame.\n"
104  "You must first call computeForwardKinematicsDerivatives before calling this function.\n\n"
105  "Parameters:\n"
106  "\tmodel: model of the kinematic tree\n"
107  "\tdata: data related to the model\n"
108  "\tframe_id: index of the frame\n"
109  "\treference_frame: reference frame in which the resulting derivatives are expressed\n",
111 
112  bp::def(
113  "getFrameVelocityDerivatives", getFrameVelocityDerivatives_proxy2,
114  bp::args("model", "data", "joint_id", "placement", "reference_frame"),
115  "Computes the partial derivatives of the spatial velocity of a frame given by its relative "
116  "placement, with respect to\n"
117  "the joint configuration and velocity and returns them as a tuple.\n"
118  "The partial derivatives can be either expressed in the LOCAL frame of the joint, in the "
119  "LOCAL_WORLD_ALIGNED frame or in the WORLD coordinate frame depending on the value of "
120  "reference_frame.\n"
121  "You must first call computeForwardKinematicsDerivatives before calling this function.\n\n"
122  "Parameters:\n"
123  "\tmodel: model of the kinematic tree\n"
124  "\tdata: data related to the model\n"
125  "\tjoint_id: index of the joint\n"
126  "\tplacement: placement of the Frame w.r.t. the joint frame.\n"
127  "\treference_frame: reference frame in which the resulting derivatives are expressed\n",
129 
130  bp::def(
131  "getFrameAccelerationDerivatives", getFrameAccelerationDerivatives_proxy1,
132  bp::args("model", "data", "frame_id", "reference_frame"),
133  "Computes the partial derivatives of the spatial acceleration of a given frame with "
134  "respect to\n"
135  "the joint configuration, velocity and acceleration and returns them as a tuple.\n"
136  "The partial derivatives can be either expressed in the LOCAL frame of the joint, in the "
137  "LOCAL_WORLD_ALIGNED frame or in the WORLD coordinate frame depending on the value of "
138  "reference_frame.\n"
139  "You must first call computeForwardKinematicsDerivatives before calling this function.\n\n"
140  "Parameters:\n"
141  "\tmodel: model of the kinematic tree\n"
142  "\tdata: data related to the model\n"
143  "\tframe_id: index of the frame\n"
144  "\treference_frame: reference frame in which the resulting derivatives are expressed\n",
146 
147  bp::def(
148  "getFrameAccelerationDerivatives", getFrameAccelerationDerivatives_proxy2,
149  bp::args("model", "data", "joint_id", "placement", "reference_frame"),
150  "Computes the partial derivatives of the spatial acceleration of a frame given by its "
151  "relative placement, with respect to\n"
152  "the joint configuration, velocity and acceleration and returns them as a tuple.\n"
153  "The partial derivatives can be either expressed in the LOCAL frame of the joint, in the "
154  "LOCAL_WORLD_ALIGNED frame or in the WORLD coordinate frame depending on the value of "
155  "reference_frame.\n"
156  "You must first call computeForwardKinematicsDerivatives before calling this function.\n\n"
157  "Parameters:\n"
158  "\tmodel: model of the kinematic tree\n"
159  "\tdata: data related to the model\n"
160  "\tjoint_id: index of the joint\n"
161  "\tplacement: placement of the Frame w.r.t. the joint frame.\n"
162  "\treference_frame: reference frame in which the resulting derivatives are expressed\n",
164  }
165 
166  } // namespace python
167 } // namespace pinocchio
boost::python
Eigen
pinocchio::DataTpl
Definition: context/generic.hpp:25
pinocchio::getFrameAccelerationDerivatives
void getFrameAccelerationDerivatives(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const JointIndex joint_id, const SE3Tpl< Scalar, Options > &placement, const ReferenceFrame rf, const Eigen::MatrixBase< Matrix6xOut1 > &v_partial_dq, const Eigen::MatrixBase< Matrix6xOut2 > &a_partial_dq, const Eigen::MatrixBase< Matrix6xOut3 > &a_partial_dv, const Eigen::MatrixBase< Matrix6xOut4 > &a_partial_da)
Computes the partial derivatives of the spatial acceleration of a frame given by its relative placeme...
pinocchio::ReferenceFrame
ReferenceFrame
Various conventions to express the velocity of a moving frame.
Definition: multibody/fwd.hpp:46
pinocchio::SE3Tpl< Scalar, Options >
setup.data
data
Definition: cmake/cython/setup.in.py:48
pinocchio::python::getFrameAccelerationDerivatives_proxy2
bp::tuple getFrameAccelerationDerivatives_proxy2(const context::Model &model, context::Data &data, const context::Model::JointIndex joint_id, const context::SE3 &placement, ReferenceFrame rf)
Definition: expose-frames-derivatives.cpp:70
pinocchio::ModelTpl::JointIndex
pinocchio::JointIndex JointIndex
Definition: multibody/model.hpp:67
pinocchio::placement
const MotionDense< Motion2 > const SE3Tpl< SE3Scalar, SE3Options > & placement
Definition: spatial/classic-acceleration.hpp:122
algorithms.hpp
python
pinocchio::getFrameVelocityDerivatives
void getFrameVelocityDerivatives(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const JointIndex joint_id, const SE3Tpl< Scalar, Options > &placement, const ReferenceFrame rf, const Eigen::MatrixBase< Matrix6xOut1 > &v_partial_dq, const Eigen::MatrixBase< Matrix6xOut2 > &v_partial_dv)
Computes the partial derivatives of the spatial velocity of a frame given by its relative placement,...
pinocchio::ModelTpl::FrameIndex
pinocchio::FrameIndex FrameIndex
Definition: multibody/model.hpp:69
pinocchio::python::getFrameAccelerationDerivatives_proxy1
bp::tuple getFrameAccelerationDerivatives_proxy1(const context::Model &model, context::Data &data, const context::Model::FrameIndex frame_id, ReferenceFrame rf)
Definition: expose-frames-derivatives.cpp:51
contact-cholesky.frame_id
frame_id
Definition: contact-cholesky.py:19
Matrix6x
Eigen::Matrix< double, 6, Eigen::Dynamic > Matrix6x
Definition: joint-mimic.cpp:15
pinocchio::python::mimic_not_supported_function
Definition: model-checker.hpp:22
pinocchio::python::exposeFramesDerivatives
void exposeFramesDerivatives()
Definition: expose-frames-derivatives.cpp:91
pinocchio::python::getFrameVelocityDerivatives_proxy1
bp::tuple getFrameVelocityDerivatives_proxy1(const context::Model &model, context::Data &data, const context::Model::FrameIndex frame_id, ReferenceFrame rf)
Definition: expose-frames-derivatives.cpp:18
pinocchio::DataTpl::Matrix6x
Eigen::Matrix< Scalar, 6, Eigen::Dynamic, Options > Matrix6x
The 6d jacobian type (temporary)
Definition: multibody/data.hpp:92
append-urdf-model-with-another-model.joint_id
joint_id
Definition: append-urdf-model-with-another-model.py:34
model-checker.hpp
pinocchio::ModelTpl
Definition: context/generic.hpp:20
pinocchio::model
JointCollectionTpl & model
Definition: joint-configuration.hpp:1082
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:33
frames-derivatives.hpp
pinocchio::python::getFrameVelocityDerivatives_proxy2
bp::tuple getFrameVelocityDerivatives_proxy2(const context::Model &model, context::Data &data, const context::Model::JointIndex joint_id, const context::SE3 &placement, ReferenceFrame rf)
Definition: expose-frames-derivatives.cpp:34


pinocchio
Author(s):
autogenerated on Wed Apr 16 2025 02:41:46