Line |
Branch |
Exec |
Source |
1 |
|
|
/////////////////////////////////////////////////////////////////////////////// |
2 |
|
|
// BSD 3-Clause License |
3 |
|
|
// |
4 |
|
|
// Copyright (C) 2019-2025, University of Edinburgh, IRI: CSIC-UPC |
5 |
|
|
// Copyright note valid unless otherwise stated in individual files. |
6 |
|
|
// All rights reserved. |
7 |
|
|
/////////////////////////////////////////////////////////////////////////////// |
8 |
|
|
|
9 |
|
|
#ifndef BINDINGS_PYTHON_CROCODDYL_CORE_SQUASHING_BASE_HPP_ |
10 |
|
|
#define BINDINGS_PYTHON_CROCODDYL_CORE_SQUASHING_BASE_HPP_ |
11 |
|
|
|
12 |
|
|
#include "crocoddyl/core/actuation/squashing-base.hpp" |
13 |
|
|
#include "python/crocoddyl/core/core.hpp" |
14 |
|
|
|
15 |
|
|
namespace crocoddyl { |
16 |
|
|
namespace python { |
17 |
|
|
|
18 |
|
|
template <typename Scalar> |
19 |
|
|
class SquashingModelAbstractTpl_wrap |
20 |
|
|
: public SquashingModelAbstractTpl<Scalar>, |
21 |
|
|
public bp::wrapper<SquashingModelAbstractTpl<Scalar>> { |
22 |
|
|
public: |
23 |
|
|
EIGEN_MAKE_ALIGNED_OPERATOR_NEW |
24 |
|
✗ |
CROCODDYL_DERIVED_CAST(SquashingModelBase, SquashingModelAbstractTpl_wrap) |
25 |
|
|
|
26 |
|
|
typedef typename crocoddyl::SquashingModelAbstractTpl<Scalar> SquashingModel; |
27 |
|
|
typedef typename crocoddyl::SquashingDataAbstractTpl<Scalar> SquashingData; |
28 |
|
|
typedef typename SquashingModel::VectorXs VectorXs; |
29 |
|
|
using SquashingModel::ns_; |
30 |
|
|
|
31 |
|
2 |
SquashingModelAbstractTpl_wrap(const std::size_t ns) |
32 |
|
2 |
: SquashingModel(ns), bp::wrapper<SquashingModel>() {} |
33 |
|
|
|
34 |
|
✗ |
void calc(const std::shared_ptr<SquashingData>& data, |
35 |
|
|
const Eigen::Ref<const VectorXs>& s) override { |
36 |
|
✗ |
assert_pretty(static_cast<std::size_t>(s.size()) == ns_, |
37 |
|
|
"s has wrong dimension"); |
38 |
|
✗ |
return bp::call<void>(this->get_override("calc").ptr(), data, (VectorXs)s); |
39 |
|
|
} |
40 |
|
|
|
41 |
|
✗ |
void calcDiff(const std::shared_ptr<SquashingData>& data, |
42 |
|
|
const Eigen::Ref<const VectorXs>& s) override { |
43 |
|
✗ |
assert_pretty(static_cast<std::size_t>(s.size()) == ns_, |
44 |
|
|
"s has wrong dimension"); |
45 |
|
✗ |
return bp::call<void>(this->get_override("calcDiff").ptr(), data, |
46 |
|
✗ |
(VectorXs)s); |
47 |
|
|
} |
48 |
|
|
|
49 |
|
|
template <typename NewScalar> |
50 |
|
✗ |
SquashingModelAbstractTpl_wrap<NewScalar> cast() const { |
51 |
|
|
typedef SquashingModelAbstractTpl_wrap<NewScalar> ReturnType; |
52 |
|
✗ |
ReturnType ret(ns_); |
53 |
|
✗ |
return ret; |
54 |
|
|
} |
55 |
|
|
}; |
56 |
|
|
|
57 |
|
|
} // namespace python |
58 |
|
|
} // namespace crocoddyl |
59 |
|
|
|
60 |
|
|
#endif // BINDINGS_PYTHON_CROCODDYL_CORE_SQUASHING_BASE_HPP_ |
61 |
|
|
|