GCC Code Coverage Report


Directory: ./
File: unittest/factory/actuation.hpp
Date: 2025-01-16 08:47:40
Exec Total Coverage
Lines: 6 6 100.0%
Branches: 4 6 66.7%

Line Branch Exec Source
1 ///////////////////////////////////////////////////////////////////////////////
2 // BSD 3-Clause License
3 //
4 // Copyright (C) 2019-2024, 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_ACTUATION_FACTORY_HPP_
10 #define CROCODDYL_ACTUATION_FACTORY_HPP_
11
12 #include "crocoddyl/core/actuation-base.hpp"
13 #include "crocoddyl/core/numdiff/actuation.hpp"
14 #include "state.hpp"
15
16 namespace crocoddyl {
17 namespace unittest {
18
19 struct ActuationModelTypes {
20 enum Type {
21 ActuationModelFull,
22 ActuationModelFloatingBase,
23 ActuationModelFloatingBaseThrusters,
24 ActuationModelSquashingFull,
25 NbActuationModelTypes
26 };
27 23 static std::vector<Type> init_all() {
28 23 std::vector<Type> v;
29
1/2
✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
23 v.reserve(NbActuationModelTypes);
30
2/2
✓ Branch 0 taken 92 times.
✓ Branch 1 taken 23 times.
115 for (int i = 0; i < NbActuationModelTypes; ++i) {
31
1/2
✓ Branch 1 taken 92 times.
✗ Branch 2 not taken.
92 v.push_back((Type)i);
32 }
33 23 return v;
34 }
35 static const std::vector<Type> all;
36 };
37
38 std::ostream& operator<<(std::ostream& os, ActuationModelTypes::Type type);
39
40 class ActuationModelFactory {
41 public:
42 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
43
44 explicit ActuationModelFactory();
45 ~ActuationModelFactory();
46
47 boost::shared_ptr<crocoddyl::ActuationModelAbstract> create(
48 ActuationModelTypes::Type actuation_type,
49 StateModelTypes::Type state_type) const;
50 };
51
52 /**
53 * @brief Update the actuation model needed for numerical differentiation.
54 * We use the address of the object to avoid a copy from the
55 * "boost::bind".
56 *
57 * @param model[in] Pinocchio model
58 * @param data[out] Pinocchio data
59 * @param x[in] State vector
60 * @param u[in] Control vector
61 */
62 void updateActuation(
63 const boost::shared_ptr<crocoddyl::ActuationModelAbstract>& model,
64 const boost::shared_ptr<crocoddyl::ActuationDataAbstract>& data,
65 const Eigen::VectorXd& x, const Eigen::VectorXd& u);
66
67 } // namespace unittest
68 } // namespace crocoddyl
69
70 #endif // CROCODDYL_ACTUATION_FACTORY_HPP_
71