GCC Code Coverage Report


Directory: ./
File: bindings/python/crocoddyl/multibody/actuations/floating-base.cpp
Date: 2025-01-16 08:47:40
Exec Total Coverage
Lines: 17 17 100.0%
Branches: 13 26 50.0%

Line Branch Exec Source
1 ///////////////////////////////////////////////////////////////////////////////
2 // BSD 3-Clause License
3 //
4 // Copyright (C) 2019-2023, LAAS-CNRS, University of Edinburgh
5 // Heriot-Watt University
6 // Copyright note valid unless otherwise stated in individual files.
7 // All rights reserved.
8 ///////////////////////////////////////////////////////////////////////////////
9
10 #include "crocoddyl/multibody/actuations/floating-base.hpp"
11
12 #include "python/crocoddyl/multibody/multibody.hpp"
13 #include "python/crocoddyl/utils/copyable.hpp"
14
15 namespace crocoddyl {
16 namespace python {
17
18 10 void exposeActuationFloatingBase() {
19 bp::register_ptr_to_python<
20 10 boost::shared_ptr<crocoddyl::ActuationModelFloatingBase> >();
21
22
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 bp::class_<ActuationModelFloatingBase, bp::bases<ActuationModelAbstract> >(
23 "ActuationModelFloatingBase",
24 "Floating-base actuation models.\n\n"
25 "It considers the first joint, defined in the Pinocchio model, as the "
26 "floating-base joints.\n"
27 "Then, this joint (that might have various DoFs) is unactuated.",
28
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 bp::init<boost::shared_ptr<StateMultibody> >(
29 20 bp::args("self", "state"),
30 "Initialize the floating-base actuation model.\n\n"
31 ":param state: state of multibody system"))
32
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 .def("calc", &ActuationModelFloatingBase::calc,
33
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
20 bp::args("self", "data", "x", "u"),
34 "Compute the floating-base actuation signal and actuation set from "
35 "the joint torque input u.\n\n"
36 "It describes the time-continuos evolution of the floating-base "
37 "actuation model.\n"
38 ":param data: floating-base actuation data\n"
39 ":param x: state point (dim. state.nx)\n"
40 ":param u: joint-torque input (dim. nu)")
41
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 .def("calcDiff", &ActuationModelFloatingBase::calcDiff,
42
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
20 bp::args("self", "data", "x", "u"),
43 "Compute the Jacobians of the floating-base actuation model.\n\n"
44 "It computes the partial derivatives of the floating-base "
45 "actuation. It assumes that calc\n"
46 "has been run first. The reason is that the derivatives are "
47 "constant and\n"
48 "defined in createData. The derivatives are constant, so we don't "
49 "write again these values.\n"
50 ":param data: floating-base actuation data\n"
51 ":param x: state point (dim. state.nx)\n"
52 ":param u: joint-torque input (dim. nu)")
53
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 .def("commands", &ActuationModelFloatingBase::commands,
54
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
20 bp::args("self", "data", "x", "tau"),
55 "Compute the joint-torque commands from the generalized torques.\n\n"
56 "It stores the results in data.u.\n"
57 ":param data: actuation data\n"
58 ":param x: state point (dim. state.nx)\n"
59 ":param tau: generalized torques (dim state.nv)")
60
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 .def("torqueTransform", &ActuationModelFloatingBase::torqueTransform,
61
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
20 bp::args("self", "data", "x", "tau"),
62 "Compute the torque transform from generalized torques to "
63 "joint-torque inputs.\n\n"
64 "It stores the results in data.Mtau.\n"
65 ":param data: actuation data\n"
66 ":param x: state point (dim. state.nx)\n"
67 ":param tau: generalized torques (dim state.nv)")
68
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 .def("createData", &ActuationModelFloatingBase::createData,
69
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
20 bp::args("self"),
70 "Create the floating-base actuation data.\n\n"
71 "Each actuation model (AM) has its own data that needs to be "
72 "allocated.\n"
73 "This function returns the allocated data for a predefined AM.\n"
74 ":return AM data.")
75
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 .def(CopyableVisitor<ActuationModelFloatingBase>());
76 10 }
77
78 } // namespace python
79 } // namespace crocoddyl
80