| Directory: | ./ |
|---|---|
| File: | bindings/python/algorithm/expose-energy.cpp |
| Date: | 2025-02-12 21:03:38 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 14 | 14 | 100.0% |
| Branches: | 6 | 12 | 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/energy.hpp" | ||
| 7 | |||
| 8 | namespace pinocchio | ||
| 9 | { | ||
| 10 | namespace python | ||
| 11 | { | ||
| 12 | |||
| 13 | 69 | void exposeEnergy() | |
| 14 | { | ||
| 15 | typedef context::Scalar Scalar; | ||
| 16 | typedef context::VectorXs VectorXs; | ||
| 17 | enum | ||
| 18 | { | ||
| 19 | Options = context::Options | ||
| 20 | }; | ||
| 21 | |||
| 22 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def( |
| 23 | "computeKineticEnergy", | ||
| 24 | &computeKineticEnergy<Scalar, Options, JointCollectionDefaultTpl, VectorXs, VectorXs>, | ||
| 25 | 138 | bp::args("model", "data", "q", "v"), | |
| 26 | "Computes the forward kinematics and the kinematic energy of the system for the " | ||
| 27 | "given joint configuration and velocity given as input. The result is accessible " | ||
| 28 | "through data.kinetic_energy."); | ||
| 29 | |||
| 30 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def( |
| 31 | "computeKineticEnergy", &computeKineticEnergy<Scalar, Options, JointCollectionDefaultTpl>, | ||
| 32 | 138 | bp::args("model", "data"), | |
| 33 | "Computes the kinematic energy of the system for the " | ||
| 34 | "given joint placement and velocity stored in data. The result is accessible through " | ||
| 35 | "data.kinetic_energy."); | ||
| 36 | |||
| 37 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def( |
| 38 | "computePotentialEnergy", | ||
| 39 | &computePotentialEnergy<Scalar, Options, JointCollectionDefaultTpl, VectorXs>, | ||
| 40 | 138 | bp::args("model", "data", "q"), | |
| 41 | "Computes the potential energy of the system for the " | ||
| 42 | "given the joint configuration given as input. The result is accessible through " | ||
| 43 | "data.potential_energy."); | ||
| 44 | |||
| 45 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def( |
| 46 | "computePotentialEnergy", | ||
| 47 | &computePotentialEnergy<Scalar, Options, JointCollectionDefaultTpl>, | ||
| 48 | 138 | bp::args("model", "data"), | |
| 49 | "Computes the potential energy of the system for the " | ||
| 50 | "given joint placement stored in data. The result is accessible through " | ||
| 51 | "data.potential_energy."); | ||
| 52 | |||
| 53 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def( |
| 54 | "computeMechanicalEnergy", | ||
| 55 | &computeMechanicalEnergy<Scalar, Options, JointCollectionDefaultTpl, VectorXs, VectorXs>, | ||
| 56 | 138 | bp::args("model", "data", "q", "v"), | |
| 57 | "Computes the forward kinematics and the kinematic energy of the system for the " | ||
| 58 | "given joint configuration and velocity given as input. The result is accessible through " | ||
| 59 | "data.mechanical_energy.\n" | ||
| 60 | "A byproduct of this function is the computation of both data.kinetic_energy and " | ||
| 61 | "data.potential_energy too."); | ||
| 62 | |||
| 63 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def( |
| 64 | "computeMechanicalEnergy", | ||
| 65 | &computeMechanicalEnergy<Scalar, Options, JointCollectionDefaultTpl>, | ||
| 66 | 138 | bp::args("model", "data"), | |
| 67 | "Computes the mechanical energy of the system for the " | ||
| 68 | "given joint placement and velocity stored in data. The result is accessible through " | ||
| 69 | "data.mechanical_energy.\n" | ||
| 70 | "A byproduct of this function is the computation of both data.kinetic_energy and " | ||
| 71 | "data.potential_energy too."); | ||
| 72 | 69 | } | |
| 73 | |||
| 74 | } // namespace python | ||
| 75 | } // namespace pinocchio | ||
| 76 |