GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: bindings/python/algorithm/expose-kinematics.cpp Lines: 22 22 100.0 %
Date: 2024-01-23 21:41:47 Branches: 10 20 50.0 %

Line Branch Exec Source
1
//
2
// Copyright (c) 2015-2020 CNRS INRIA
3
//
4
5
#include "pinocchio/bindings/python/algorithm/algorithms.hpp"
6
#include "pinocchio/algorithm/kinematics.hpp"
7
8
namespace pinocchio
9
{
10
  namespace python
11
  {
12
13
38
    BOOST_PYTHON_FUNCTION_OVERLOADS(getVelocity_overload, (getVelocity<double,0,JointCollectionDefaultTpl>), 3, 4)
14
19
    BOOST_PYTHON_FUNCTION_OVERLOADS(getAcceleration_overload, (getAcceleration<double,0,JointCollectionDefaultTpl>), 3, 4)
15
19
    BOOST_PYTHON_FUNCTION_OVERLOADS(getClassicalAcceleration_overload, (getClassicalAcceleration<double,0,JointCollectionDefaultTpl>), 3, 4)
16
17
19
    void exposeKinematics()
18
    {
19
      using namespace Eigen;
20
19
      bp::def("updateGlobalPlacements",
21
              &updateGlobalPlacements<double,0,JointCollectionDefaultTpl>,
22
38
              bp::args("model","data"),
23
              "Updates the global placements of all joint frames of the kinematic "
24
              "tree and store the results in data according to the relative placements of the joints.\n\n"
25
              "Parameters:\n"
26
              "\tmodel: model of the kinematic tree\n"
27
              "\tdata: data related to the model\n");
28
29
19
      bp::def("getVelocity",
30
              &getVelocity<double,0,JointCollectionDefaultTpl>,
31
19
              getVelocity_overload(
32
38
                bp::args("model","data","joint_id","reference_frame"),
33
                "Returns the spatial velocity of the joint expressed in the coordinate system given by reference_frame.\n"
34
                "forwardKinematics(model,data,q,v[,a]) should be called first to compute the joint spatial velocity stored in data.v"));
35
36
19
      bp::def("getAcceleration",
37
              &getAcceleration<double,0,JointCollectionDefaultTpl>,
38
19
              getAcceleration_overload(
39
38
                bp::args("model","data","joint_id","reference_frame"),
40
                "Returns the spatial acceleration of the joint expressed in the coordinate system given by reference_frame.\n"
41
                "forwardKinematics(model,data,q,v,a) should be called first to compute the joint spatial acceleration stored in data.a ."));
42
43
19
      bp::def("getClassicalAcceleration",
44
              &getClassicalAcceleration<double,0,JointCollectionDefaultTpl>,
45
19
              getClassicalAcceleration_overload(
46
38
                bp::args("model","data","joint_id","reference_frame"),
47
                "Returns the \"classical\" acceleration of the joint expressed in the coordinate system given by reference_frame.\n"
48
                "forwardKinematics(model,data,q,v,a) should be called first to compute the joint spatial acceleration stored in data.a ."));
49
50
19
      bp::def("forwardKinematics",
51
              &forwardKinematics<double,0,JointCollectionDefaultTpl,VectorXd>,
52
38
              bp::args("model","data","q"),
53
              "Compute the global placements of all the joints of the kinematic "
54
              "tree and store the results in data.\n\n"
55
              "Parameters:\n"
56
              "\tmodel: model of the kinematic tree\n"
57
              "\tdata: data related to the model\n"
58
              "\tq: the joint configuration vector (size model.nq)\n");
59
60
19
      bp::def("forwardKinematics",
61
              &forwardKinematics<double,0,JointCollectionDefaultTpl,VectorXd,VectorXd>,
62
38
              bp::args("model","data","q","v"),
63
              "Compute the global placements and local spatial velocities of all the joints of the kinematic "
64
              "tree and store the results in data.\n\n"
65
              "Parameters:\n"
66
              "\tmodel: model of the kinematic tree\n"
67
              "\tdata: data related to the model\n"
68
              "\tq: the joint configuration vector (size model.nq)\n"
69
              "\tv: the joint velocity vector (size model.nv)\n");
70
71
19
      bp::def("forwardKinematics",
72
              &forwardKinematics<double,0,JointCollectionDefaultTpl,VectorXd,VectorXd,VectorXd>,
73
38
              bp::args("model","data","q","v","a"),
74
              "Compute the global placements, local spatial velocities and spatial accelerations of all the joints of the kinematic "
75
              "tree and store the results in data.\n\n"
76
              "Parameters:\n"
77
              "\tmodel: model of the kinematic tree\n"
78
              "\tdata: data related to the model\n"
79
              "\tq: the joint configuration vector (size model.nq)\n"
80
              "\tv: the joint velocity vector (size model.nv)\n"
81
              "\ta: the joint acceleration vector (size model.nv)\n");
82
19
    }
83
84
  } // namespace python
85
} // namespace pinocchio