GCC Code Coverage Report


Directory: ./
File: include/crocoddyl/multibody/force-base.hpp
Date: 2025-01-16 08:47:40
Exec Total Coverage
Lines: 15 15 100.0%
Branches: 8 16 50.0%

Line Branch Exec Source
1 ///////////////////////////////////////////////////////////////////////////////
2 // BSD 3-Clause License
3 //
4 // Copyright (C) 2021-2023, 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 347567 ForceDataAbstractTpl(Model<Scalar>* const model, PinocchioData* const data)
34 347567 : pinocchio(data),
35 347567 frame(0),
36 695134 type(model->get_type()),
37 347567 jMf(SE3::Identity()),
38
1/2
✓ Branch 5 taken 173802 times.
✗ Branch 6 not taken.
347567 Jc(model->get_nc(), model->get_state()->get_nv()),
39
1/2
✓ Branch 1 taken 173802 times.
✗ Branch 2 not taken.
347567 f(Force::Zero()),
40
1/2
✓ Branch 1 taken 173802 times.
✗ Branch 2 not taken.
347567 fext(Force::Zero()),
41
1/2
✓ Branch 5 taken 173802 times.
✗ Branch 6 not taken.
347567 df_dx(model->get_nc(), model->get_state()->get_ndx()),
42
1/2
✓ Branch 4 taken 173802 times.
✗ Branch 5 not taken.
695134 df_du(model->get_nc(), model->get_nu()) {
43
1/2
✓ Branch 1 taken 173802 times.
✗ Branch 2 not taken.
347567 Jc.setZero();
44
1/2
✓ Branch 1 taken 173802 times.
✗ Branch 2 not taken.
347567 df_dx.setZero();
45
1/2
✓ Branch 1 taken 173802 times.
✗ Branch 2 not taken.
347567 df_du.setZero();
46 347567 }
47 174012 virtual ~ForceDataAbstractTpl() {}
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 #endif // CROCODDYL_MULTIBODY_FORCE_BASE_HPP_
65