9#ifndef CROCODDYL_CORE_TASK_BASE_HPP_ 10#define CROCODDYL_CORE_TASK_BASE_HPP_ 12#include "crocoddyl/core/data-collector-base.hpp" 13#include "crocoddyl/core/fwd.hpp" 14#include "crocoddyl/core/state-base.hpp" 15#include "crocoddyl/core/utils/exception.hpp" 46template <
typename _Scalar>
49 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
51 typedef _Scalar Scalar;
56 typedef typename MathBase::VectorXs VectorXs;
57 typedef typename MathBase::MatrixXs MatrixXs;
71 const std::size_t nr,
const std::size_t nu,
72 const bool q_dependent =
true,
73 const bool v_dependent =
true,
74 const bool u_dependent =
true,
75 const bool has_acceleration =
true);
81 virtual void calc(
const std::shared_ptr<TaskDataAbstract>& data,
82 const Eigen::Ref<const VectorXs>& x,
83 const Eigen::Ref<const VectorXs>& u) = 0;
88 virtual void calcDiff(
const std::shared_ptr<TaskDataAbstract>& data,
89 const Eigen::Ref<const VectorXs>& x,
90 const Eigen::Ref<const VectorXs>& u) = 0;
96 DataCollectorAbstract*
const data);
98 const std::shared_ptr<StateAbstract>& get_state()
const;
99 std::size_t get_nr()
const;
100 std::size_t get_nu()
const;
101 bool get_q_dependent()
const;
102 bool get_v_dependent()
const;
103 bool get_u_dependent()
const;
110 virtual void print(std::ostream& os)
const;
113 std::shared_ptr<StateAbstract> state_;
119 bool has_acceleration_;
125template <
typename _Scalar>
127 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
129 typedef _Scalar Scalar;
133 typedef typename MathBase::VectorXs VectorXs;
134 typedef typename MathBase::MatrixXs MatrixXs;
146 DataCollectorAbstract*
const data)
152 Yx(model->get_nr(), model->get_state()->get_ndx()),
153 Yu(model->get_nr(), model->get_nu()),
154 Vx(model->get_nr(), model->get_state()->get_ndx()),
155 Vu(model->get_nr(), model->get_nu()),
156 Ax(model->get_nr(), model->get_state()->get_ndx()),
157 Au(model->get_nr(), model->get_nu()) {
185template <
typename Scalar>
186std::ostream& operator<<(std::ostream& os,
192#include "crocoddyl/core/task-base.hxx" Abstract class for the state representation.
Abstract task model for convergence residuals.
bool get_has_acceleration() const
Return whether the task defines an acceleration component.
virtual std::shared_ptr< TaskDataAbstract > createData(DataCollectorAbstract *const data)
Allocate task data and bind it to the action model's shared data.
virtual void print(std::ostream &os) const
Print relevant information about the task model.
virtual void calcDiff(const std::shared_ptr< TaskDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)=0
Compute task Jacobians using values stored by calc().
TaskModelAbstractTpl(std::shared_ptr< StateAbstract > state, const std::size_t nr, const std::size_t nu, const bool q_dependent=true, const bool v_dependent=true, const bool u_dependent=true, const bool has_acceleration=true)
Initialize the task model.
virtual void calc(const std::shared_ptr< TaskDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)=0
Compute the task quantity, rate, and acceleration.
Preallocated values and derivatives produced by a task model.
TaskDataAbstractTpl(TaskModelAbstract *const model, DataCollectorAbstract *const data)
Allocate and initialize the common task data.
DataCollectorAbstract * shared
bool compute_acceleration