Crocoddyl
Loading...
Searching...
No Matches
ResidualModelTaskSecondOrderTpl< _Scalar > Class Template Reference

Second-order task residual for a generic task and guidance model. More...

#include <task-second-order.hpp>

Inheritance diagram for ResidualModelTaskSecondOrderTpl< _Scalar >:
ResidualModelAbstractTpl< _Scalar >ResidualModelBase

Public Types

typedef ResidualModelAbstractTpl< Scalar > Base
typedef ResidualDataTaskSecondOrderTpl< Scalar > Data
typedef DataCollectorAbstractTpl< Scalar > DataCollectorAbstract
typedef GuidanceModelAbstractTpl< Scalar > GuidanceModelAbstract
typedef MathBaseTpl< Scalar > MathBase
typedef MathBase::MatrixXs MatrixXs
typedef ResidualDataAbstractTpl< Scalar > ResidualDataAbstract
typedef TaskModelAbstractTpl< Scalar > TaskModelAbstract
typedef MathBase::VectorXs VectorXs
Public Types inherited from ResidualModelAbstractTpl< _Scalar >
typedef ActivationDataAbstractTpl< Scalar > ActivationDataAbstract
typedef CostDataAbstractTpl< Scalar > CostDataAbstract
typedef DataCollectorAbstractTpl< Scalar > DataCollectorAbstract
typedef MathBase::DiagonalMatrixXs DiagonalMatrixXs
typedef MathBaseTpl< Scalar > MathBase
typedef MathBase::MatrixXs MatrixXs
typedef ResidualDataAbstractTpl< Scalar > ResidualDataAbstract
typedef StateAbstractTpl< Scalar > StateAbstract
typedef MathBase::VectorXs VectorXs

Public Member Functions

 ResidualModelTaskSecondOrderTpl (std::shared_ptr< TaskModelAbstract > task, std::shared_ptr< GuidanceModelAbstract > guidance, const MatrixXs &gain)
 Initialize the second-order task residual with a full gain.
 ResidualModelTaskSecondOrderTpl (std::shared_ptr< TaskModelAbstract > task, std::shared_ptr< GuidanceModelAbstract > guidance, const Scalar &gain)
 Initialize the second-order task residual with a scalar gain.
 ResidualModelTaskSecondOrderTpl (std::shared_ptr< TaskModelAbstract > task, std::shared_ptr< GuidanceModelAbstract > guidance, const VectorXs &diagonal_gain)
 Initialize the second-order task residual with a diagonal gain.
virtual void calc (const std::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u) override
 Compute the second-order task residual.
virtual void calcDiff (const std::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u) override
 Compute the residual Jacobians.
template<typename NewScalar>
ResidualModelTaskSecondOrderTpl< NewScalar > cast () const
 Cast the residual model to a different scalar type.
virtual std::shared_ptr< ResidualDataAbstract > createData (DataCollectorAbstract *const data) override
 Allocate data for the residual.
const MatrixXs & get_gain () const
const std::shared_ptr< GuidanceModelAbstract > & get_guidance () const
const std::shared_ptr< TaskModelAbstract > & get_task () const
virtual void print (std::ostream &os) const override
 Print relevant information of the residual model.
void set_gain (const MatrixXs &gain)
void set_guidance (std::shared_ptr< GuidanceModelAbstract > guidance)
Public Member Functions inherited from ResidualModelAbstractTpl< _Scalar >
 ResidualModelAbstractTpl (std::shared_ptr< StateAbstract > state, const std::size_t nr, const bool q_dependent=true, const bool v_dependent=true, const bool u_dependent=true)
 Initialize the residual model.
 ResidualModelAbstractTpl (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)
 Initialize the residual model.
virtual void calc (const std::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
 Compute the residual vector for nodes that depends only on the state.
virtual void calcCostDiff (const std::shared_ptr< CostDataAbstract > &cdata, const std::shared_ptr< ResidualDataAbstract > &rdata, const std::shared_ptr< ActivationDataAbstract > &adata, const bool update_u=true)
 Compute the derivative of the cost function.
virtual void calcDiff (const std::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
 Compute the Jacobian of the residual functions with respect to the state only.
std::size_t get_nr () const
 Return the dimension of the residual vector.
std::size_t get_nu () const
 Return the dimension of the control input.
bool get_q_dependent () const
 Return true if the residual function depends on q.
const std::shared_ptr< StateAbstract > & get_state () const
 Return the state.
bool get_u_dependent () const
 Return true if the residual function depends on u.
bool get_v_dependent () const
 Return true if the residual function depends on v.

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar
Public Attributes inherited from ResidualModelAbstractTpl< _Scalar >
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar

Protected Member Functions

void checkDimensions () const

Protected Attributes

MatrixXs gain_
std::shared_ptr< GuidanceModelAbstract > guidance_
std::size_t nr_
 Residual vector dimension.
std::size_t nu_
 Control dimension.
bool q_dependent_
std::shared_ptr< StateAbstract > state_
 State description.
std::shared_ptr< TaskModelAbstract > task_
bool u_dependent_
bool v_dependent_
Protected Attributes inherited from ResidualModelAbstractTpl< _Scalar >
std::size_t nr_
 Residual vector dimension.
std::size_t nu_
 Control dimension.
bool q_dependent_
std::shared_ptr< StateAbstract > state_
 State description.
bool u_dependent_
VectorXs unone_
 No control vector.
bool v_dependent_

Detailed Description

template<typename _Scalar>
class crocoddyl::ResidualModelTaskSecondOrderTpl< _Scalar >

Second-order task residual for a generic task and guidance model.

The running residual is

\‍[  r = a(x, u) + K\big(v(x, u) - g(y(x, u))\big),
\‍]

where $a$ is the task acceleration, $v$ is the task rate, $g=\phi(y)$ is a guidance model, and $K$ is a task gain.

The gain can be supplied as a full matrix, a diagonal vector, or a scalar isotropic gain.

The residual Jacobians are

\‍[  R_x = A_x + K\big(V_x - G_e Y_x\big), \qquad
  R_u = A_u + K\big(V_u - G_e Y_u\big),
\‍]

where $G_e = \partial g / \partial y$.

Definition at line 40 of file task-second-order.hpp.

Member Typedef Documentation

◆ MathBase

template<typename _Scalar>
typedef MathBaseTpl<Scalar> MathBase

Definition at line 47 of file task-second-order.hpp.

◆ Base

template<typename _Scalar>
typedef ResidualModelAbstractTpl<Scalar> Base

Definition at line 48 of file task-second-order.hpp.

◆ Data

template<typename _Scalar>
typedef ResidualDataTaskSecondOrderTpl<Scalar> Data

Definition at line 49 of file task-second-order.hpp.

◆ ResidualDataAbstract

template<typename _Scalar>
typedef ResidualDataAbstractTpl<Scalar> ResidualDataAbstract

Definition at line 50 of file task-second-order.hpp.

◆ DataCollectorAbstract

template<typename _Scalar>
typedef DataCollectorAbstractTpl<Scalar> DataCollectorAbstract

Definition at line 51 of file task-second-order.hpp.

◆ GuidanceModelAbstract

template<typename _Scalar>
typedef GuidanceModelAbstractTpl<Scalar> GuidanceModelAbstract

Definition at line 52 of file task-second-order.hpp.

◆ TaskModelAbstract

template<typename _Scalar>
typedef TaskModelAbstractTpl<Scalar> TaskModelAbstract

Definition at line 53 of file task-second-order.hpp.

◆ VectorXs

template<typename _Scalar>
typedef MathBase::VectorXs VectorXs

Definition at line 54 of file task-second-order.hpp.

◆ MatrixXs

template<typename _Scalar>
typedef MathBase::MatrixXs MatrixXs

Definition at line 55 of file task-second-order.hpp.

Constructor & Destructor Documentation

◆ ResidualModelTaskSecondOrderTpl() [1/3]

template<typename _Scalar>
ResidualModelTaskSecondOrderTpl(std::shared_ptr< TaskModelAbstract >task,
std::shared_ptr< GuidanceModelAbstract >guidance,
const MatrixXs &gain )

Initialize the second-order task residual with a full gain.

The residual is

\‍[  r = a + K(v - g(y)),
\‍]

where $a$ is the task acceleration, $v$ is the task rate, and $g(y)$ is the guidance output.

The residual Jacobians are

\‍[  R_x = A_x + K\big(V_x - G_e Y_x\big), \qquad
  R_u = A_u + K\big(V_u - G_e Y_u\big),
\‍]

where $G_e = \partial g / \partial y$.

Parameters
[in]taskTask model
[in]guidanceGuidance model
[in]gainFull task gain matrix

◆ ResidualModelTaskSecondOrderTpl() [2/3]

template<typename _Scalar>
ResidualModelTaskSecondOrderTpl(std::shared_ptr< TaskModelAbstract >task,
std::shared_ptr< GuidanceModelAbstract >guidance,
const VectorXs &diagonal_gain )

Initialize the second-order task residual with a diagonal gain.

The diagonal entries are used to build the full gain matrix.

Parameters
[in]taskTask model
[in]guidanceGuidance model
[in]diagonal_gainDiagonal task gain

◆ ResidualModelTaskSecondOrderTpl() [3/3]

template<typename _Scalar>
ResidualModelTaskSecondOrderTpl(std::shared_ptr< TaskModelAbstract >task,
std::shared_ptr< GuidanceModelAbstract >guidance,
const Scalar &gain )

Initialize the second-order task residual with a scalar gain.

The gain is expanded to a scalar multiple of the identity matrix.

Parameters
[in]taskTask model
[in]guidanceGuidance model
[in]gainIsotropic task gain

Member Function Documentation

◆ calc()

template<typename _Scalar>
virtual void calc(const std::shared_ptr< ResidualDataAbstract > &data,
const Eigen::Ref< const VectorXs > &x,
const Eigen::Ref< const VectorXs > &u )
overridevirtual

Compute the second-order task residual.

This evaluates

\‍[  r = a + K(v - g(y)).
\‍]

Reimplemented from ResidualModelAbstractTpl< _Scalar >.

◆ calcDiff()

template<typename _Scalar>
virtual void calcDiff(const std::shared_ptr< ResidualDataAbstract > &data,
const Eigen::Ref< const VectorXs > &x,
const Eigen::Ref< const VectorXs > &u )
overridevirtual

Compute the residual Jacobians.

This evaluates

\‍[  R_x = A_x + K\big(V_x - G_e Y_x\big), \qquad
  R_u = A_u + K\big(V_u - G_e Y_u\big).
\‍]

Reimplemented from ResidualModelAbstractTpl< _Scalar >.

◆ createData()

template<typename _Scalar>
virtual std::shared_ptr< ResidualDataAbstract > createData(DataCollectorAbstract *constdata)
overridevirtual

Allocate data for the residual.

Reimplemented from ResidualModelAbstractTpl< _Scalar >.

◆ print()

template<typename _Scalar>
virtual void print(std::ostream &os)const
overridevirtual

Print relevant information of the residual model.

Parameters
[out]osOutput stream object

Reimplemented from ResidualModelAbstractTpl< _Scalar >.

Member Data Documentation

◆ Scalar

template<typename _Scalar>
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar

Definition at line 46 of file task-second-order.hpp.

◆ task_

template<typename _Scalar>
std::shared_ptr<TaskModelAbstract> task_
protected

Definition at line 164 of file task-second-order.hpp.

◆ guidance_

template<typename _Scalar>
std::shared_ptr<GuidanceModelAbstract> guidance_
protected

Definition at line 165 of file task-second-order.hpp.

◆ gain_

template<typename _Scalar>
MatrixXs gain_
protected

Definition at line 166 of file task-second-order.hpp.

◆ nr_

template<typename _Scalar>
std::size_t nr_
protected

Residual vector dimension.

Definition at line 231 of file residual-base.hpp.

◆ nu_

template<typename _Scalar>
std::size_t nu_
protected

Control dimension.

Definition at line 232 of file residual-base.hpp.

◆ q_dependent_

template<typename _Scalar>
bool q_dependent_
protected

Label that indicates if the residual function depends on q

Definition at line 234 of file residual-base.hpp.

◆ state_

template<typename _Scalar>
std::shared_ptr<StateAbstract> state_
protected

State description.

Definition at line 230 of file residual-base.hpp.

◆ u_dependent_

template<typename _Scalar>
bool u_dependent_
protected

Label that indicates if the residual function depends on u

Definition at line 238 of file residual-base.hpp.

◆ v_dependent_

template<typename _Scalar>
bool v_dependent_
protected

Label that indicates if the residual function depends on v

Definition at line 236 of file residual-base.hpp.


The documentation for this class was generated from the following files: