GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: bindings/python/crocoddyl/multibody/actuations/floating-base.cpp Lines: 17 17 100.0 %
Date: 2024-02-13 11:12:33 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
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
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
      .def("calc", &ActuationModelFloatingBase::calc,
33
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
10
           ":param u: joint-torque input (dim. nu)")
41
      .def("calcDiff", &ActuationModelFloatingBase::calcDiff,
42
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
10
           ":param u: joint-torque input (dim. nu)")
53
      .def("commands", &ActuationModelFloatingBase::commands,
54
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
10
           ":param tau: generalized torques (dim state.nv)")
60
      .def("torqueTransform", &ActuationModelFloatingBase::torqueTransform,
61
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
10
           ":param tau: generalized torques (dim state.nv)")
68
      .def("createData", &ActuationModelFloatingBase::createData,
69
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
10
           ":return AM data.")
75
10
      .def(CopyableVisitor<ActuationModelFloatingBase>());
76
10
}
77
78
}  // namespace python
79
}  // namespace crocoddyl