9 #ifndef CROCODDYL_CORE_SQUASHING_BASE_HPP_
10 #define CROCODDYL_CORE_SQUASHING_BASE_HPP_
12 #include <boost/make_shared.hpp>
13 #include <boost/shared_ptr.hpp>
16 #include "crocoddyl/core/fwd.hpp"
17 #include "crocoddyl/core/mathbase.hpp"
18 #include "crocoddyl/core/utils/exception.hpp"
22 template <
typename _Scalar>
25 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
27 typedef _Scalar Scalar;
30 typedef typename MathBase::VectorXs VectorXs;
34 throw_pretty(
"Invalid argument: "
35 <<
"ns cannot be zero");
40 virtual void calc(
const boost::shared_ptr<SquashingDataAbstract>& data,
41 const Eigen::Ref<const VectorXs>& s) = 0;
42 virtual void calcDiff(
const boost::shared_ptr<SquashingDataAbstract>& data,
43 const Eigen::Ref<const VectorXs>& s) = 0;
44 virtual boost::shared_ptr<SquashingDataAbstract> createData() {
45 return boost::allocate_shared<SquashingDataAbstract>(
46 Eigen::aligned_allocator<SquashingDataAbstract>(),
this);
49 std::size_t get_ns()
const {
return ns_; };
50 const VectorXs& get_s_lb()
const {
return s_lb_; };
51 const VectorXs& get_s_ub()
const {
return s_ub_; };
53 void set_s_lb(
const VectorXs& s_lb) { s_lb_ = s_lb; };
54 void set_s_ub(
const VectorXs& s_ub) { s_ub_ = s_ub; };
66 template <
typename _Scalar>
68 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
70 typedef _Scalar Scalar;
72 typedef typename MathBase::VectorXs VectorXs;
73 typedef typename MathBase::MatrixXs MatrixXs;
75 template <
template <
typename Scalar>
class Model>
77 : u(model->get_ns()), du_ds(model->get_ns(), model->get_ns()) {