Directory: | ./ |
---|---|
File: | bindings/python/crocoddyl/core/data/joint.cpp |
Date: | 2025-01-16 08:47:40 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 36 | 42 | 85.7% |
Branches: | 29 | 58 | 50.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | ||
2 | // BSD 3-Clause License | ||
3 | // | ||
4 | // Copyright (C) 2022-2023, University of Edinburgh, Heriot-Watt University | ||
5 | // Copyright note valid unless otherwise stated in individual files. | ||
6 | // All rights reserved. | ||
7 | /////////////////////////////////////////////////////////////////////////////// | ||
8 | |||
9 | #include "crocoddyl/core/data/joint.hpp" | ||
10 | |||
11 | #include "python/crocoddyl/core/core.hpp" | ||
12 | #include "python/crocoddyl/utils/copyable.hpp" | ||
13 | |||
14 | namespace crocoddyl { | ||
15 | namespace python { | ||
16 | |||
17 | 10 | void exposeDataCollectorJoint() { | |
18 | 10 | bp::register_ptr_to_python<boost::shared_ptr<JointDataAbstract> >(); | |
19 | |||
20 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | bp::class_<JointDataAbstract>( |
21 | "JointDataAbstract", | ||
22 | "Abstract class for joint datas.\n\n" | ||
23 | "A joint data contains all the required information about joint efforts " | ||
24 | "and accelerations.\n" | ||
25 | "The joint data typically is allocated once by running " | ||
26 | "model.createData().", | ||
27 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | bp::init<boost::shared_ptr<StateAbstract>, |
28 | boost::shared_ptr<ActuationModelAbstract>, std::size_t>( | ||
29 | 20 | bp::args("self", "state", "actuation", "nu"), | |
30 | "Create the joint data.\n\n" | ||
31 | "The joint data uses the model in order to first process it.\n" | ||
32 | ":param state: state description\n" | ||
33 | ":param actuation: actuation model\n" | ||
34 | ":param nu: dimension of control vector.")) | ||
35 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .add_property("tau", |
36 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | bp::make_getter(&JointDataAbstract::tau, |
37 | ✗ | bp::return_internal_reference<>()), | |
38 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | bp::make_setter(&JointDataAbstract::tau), "joint efforts") |
39 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .add_property("a", |
40 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | bp::make_getter(&JointDataAbstract::a, |
41 | ✗ | bp::return_internal_reference<>()), | |
42 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | bp::make_setter(&JointDataAbstract::a), |
43 | "generalized joint accelerations") | ||
44 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .add_property( |
45 | "dtau_dx", | ||
46 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | bp::make_getter(&JointDataAbstract::dtau_dx, |
47 | ✗ | bp::return_internal_reference<>()), | |
48 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | bp::make_setter(&JointDataAbstract::dtau_dx), |
49 | "partial derivatives of the joint efforts w.r.t. the state point") | ||
50 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .add_property( |
51 | "dtau_du", | ||
52 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | bp::make_getter(&JointDataAbstract::dtau_du, |
53 | ✗ | bp::return_internal_reference<>()), | |
54 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | bp::make_setter(&JointDataAbstract::dtau_du), |
55 | "partial derivatives of the joint efforts w.r.t. the control input") | ||
56 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .add_property("da_dx", |
57 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | bp::make_getter(&JointDataAbstract::da_dx, |
58 | ✗ | bp::return_internal_reference<>()), | |
59 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | bp::make_setter(&JointDataAbstract::da_dx), |
60 | "partial derivatives of the generalized joint " | ||
61 | "accelerations w.r.t. the state point") | ||
62 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .add_property("da_du", |
63 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | bp::make_getter(&JointDataAbstract::da_du, |
64 | ✗ | bp::return_internal_reference<>()), | |
65 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | bp::make_setter(&JointDataAbstract::da_du), |
66 | "partial derivatives of the generalized joint " | ||
67 | "accelerations w.r.t. the control input") | ||
68 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .def(CopyableVisitor<JointDataAbstract>()); |
69 | |||
70 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | bp::class_<DataCollectorJoint, bp::bases<DataCollectorAbstract> >( |
71 | "DataCollectorJoint", "Joint data collector.\n\n", | ||
72 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | bp::init<boost::shared_ptr<JointDataAbstract> >( |
73 | 20 | bp::args("self", "joint"), | |
74 | "Create joint data collection.\n\n" | ||
75 | ":param joint: joint data")) | ||
76 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .add_property( |
77 | "joint", | ||
78 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | bp::make_getter(&DataCollectorJoint::joint, |
79 | 10 | bp::return_value_policy<bp::return_by_value>()), | |
80 | "joint data") | ||
81 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .def(CopyableVisitor<DataCollectorJoint>()); |
82 | |||
83 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | bp::class_<DataCollectorJointActuation, bp::bases<DataCollectorActuation> >( |
84 | "DataCollectorJointActuation", "Joint-actuation data collector.\n\n", | ||
85 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | bp::init<boost::shared_ptr<ActuationDataAbstract>, |
86 | boost::shared_ptr<JointDataAbstract> >( | ||
87 | 20 | bp::args("self", "actuation", "joint"), | |
88 | "Create joint-actuation data collection.\n\n" | ||
89 | ":param actuation: actuation data" | ||
90 | ":param joint: joint data")) | ||
91 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .def(CopyableVisitor<DataCollectorJointActuation>()); |
92 | 10 | } | |
93 | |||
94 | } // namespace python | ||
95 | } // namespace crocoddyl | ||
96 |