GCC Code Coverage Report


Directory: ./
File: include/crocoddyl/multibody/force-base.hpp
Date: 2025-03-26 19:23:43
Exec Total Coverage
Lines: 15 15 100.0%
Branches: 14 28 50.0%

Line Branch Exec Source
1 ///////////////////////////////////////////////////////////////////////////////
2 // BSD 3-Clause License
3 //
4 // Copyright (C) 2021-2025, University of Edinburgh, Heriot-Watt University
5 // Copyright note valid unless otherwise stated in individual files.
6 // All rights reserved.
7 ///////////////////////////////////////////////////////////////////////////////
8
9 #ifndef CROCODDYL_MULTIBODY_FORCE_BASE_HPP_
10 #define CROCODDYL_MULTIBODY_FORCE_BASE_HPP_
11
12 #include <pinocchio/multibody/data.hpp>
13 #include <pinocchio/spatial/force.hpp>
14
15 #include "crocoddyl/core/mathbase.hpp"
16 #include "crocoddyl/multibody/fwd.hpp"
17
18 namespace crocoddyl {
19
20 template <typename _Scalar>
21 struct ForceDataAbstractTpl {
22 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
23
24 typedef _Scalar Scalar;
25 typedef MathBaseTpl<Scalar> MathBase;
26 typedef typename MathBase::VectorXs VectorXs;
27 typedef typename MathBase::MatrixXs MatrixXs;
28 typedef typename pinocchio::DataTpl<Scalar> PinocchioData;
29 typedef typename pinocchio::SE3Tpl<Scalar> SE3;
30 typedef typename pinocchio::ForceTpl<Scalar> Force;
31
32 template <template <typename Scalar> class Model>
33 174034 ForceDataAbstractTpl(Model<Scalar>* const model, PinocchioData* const data)
34 174034 : pinocchio(data),
35 174034 frame(0),
36 348068 type(model->get_type()),
37 174034 jMf(SE3::Identity()),
38
2/4
✓ Branch 4 taken 173802 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 173802 times.
✗ Branch 8 not taken.
174034 Jc(model->get_nc(), model->get_state()->get_nv()),
39
1/2
✓ Branch 1 taken 173802 times.
✗ Branch 2 not taken.
174034 f(Force::Zero()),
40
1/2
✓ Branch 1 taken 173802 times.
✗ Branch 2 not taken.
174034 fext(Force::Zero()),
41
4/8
✓ Branch 1 taken 173802 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 173802 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 173802 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 173802 times.
✗ Branch 12 not taken.
174034 df_dx(model->get_nc(), model->get_state()->get_ndx()),
42
3/6
✓ Branch 2 taken 173802 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 173802 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 173802 times.
✗ Branch 9 not taken.
348068 df_du(model->get_nc(), model->get_nu()) {
43
1/2
✓ Branch 1 taken 173802 times.
✗ Branch 2 not taken.
174034 Jc.setZero();
44
1/2
✓ Branch 1 taken 173802 times.
✗ Branch 2 not taken.
174034 df_dx.setZero();
45
1/2
✓ Branch 1 taken 173802 times.
✗ Branch 2 not taken.
174034 df_du.setZero();
46 174034 }
47 345016 virtual ~ForceDataAbstractTpl() = default;
48
49 PinocchioData* pinocchio; //!< Pinocchio data
50 pinocchio::FrameIndex frame; //!< Frame index of the contact frame
51 pinocchio::ReferenceFrame type; //!< Type of contact
52 SE3 jMf; //!< Local frame placement of the contact frame
53 MatrixXs Jc; //!< Contact Jacobian
54 Force f; //!< Contact force expressed in the coordinate defined by type
55 Force fext; //!< External spatial force at the parent joint level
56 MatrixXs df_dx; //!< Jacobian of the contact forces expressed in the
57 //!< coordinate defined by type
58 MatrixXs df_du; //!< Jacobian of the contact forces expressed in the
59 //!< coordinate defined by type
60 };
61
62 } // namespace crocoddyl
63
64 CROCODDYL_DECLARE_EXTERN_TEMPLATE_STRUCT(crocoddyl::ForceDataAbstractTpl)
65
66 #endif // CROCODDYL_MULTIBODY_FORCE_BASE_HPP_
67