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

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

#include <task-first-order.hpp>

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

Public Types

typedef ResidualModelAbstractTpl< Scalar > Base
typedef ResidualDataTaskFirstOrderTpl< Scalar > Data
typedef DataCollectorAbstractTpl< Scalar > DataCollectorAbstract
typedef GuidanceModelAbstractTpl< Scalar > GuidanceModelAbstract
typedef MathBaseTpl< Scalar > MathBase
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

 ResidualModelTaskFirstOrderTpl (std::shared_ptr< TaskModelAbstract > task, std::shared_ptr< GuidanceModelAbstract > guidance)
 Initialize the first-order task residual.
virtual void calc (const std::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u) override
 Compute the first-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>
ResidualModelTaskFirstOrderTpl< 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 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_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

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::ResidualModelTaskFirstOrderTpl< _Scalar >

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

The running residual is

\‍[  r = v(x, u) - g(y(x, u)),
\‍]

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

This class deliberately keeps the abstraction narrow: the task model owns the task geometry and its derivatives, while the guidance model owns the desired-rate profile.

The residual Jacobians are

\‍[  R_x = V_x - G_e Y_x, \qquad R_u = V_u - G_e Y_u,
\‍]

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

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

Member Typedef Documentation

◆ MathBase

template<typename _Scalar>
typedef MathBaseTpl<Scalar> MathBase

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

◆ Base

template<typename _Scalar>
typedef ResidualModelAbstractTpl<Scalar> Base

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

◆ Data

template<typename _Scalar>
typedef ResidualDataTaskFirstOrderTpl<Scalar> Data

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

◆ ResidualDataAbstract

template<typename _Scalar>
typedef ResidualDataAbstractTpl<Scalar> ResidualDataAbstract

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

◆ DataCollectorAbstract

template<typename _Scalar>
typedef DataCollectorAbstractTpl<Scalar> DataCollectorAbstract

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

◆ GuidanceModelAbstract

template<typename _Scalar>
typedef GuidanceModelAbstractTpl<Scalar> GuidanceModelAbstract

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

◆ TaskModelAbstract

template<typename _Scalar>
typedef TaskModelAbstractTpl<Scalar> TaskModelAbstract

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

◆ VectorXs

template<typename _Scalar>
typedef MathBase::VectorXs VectorXs

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

Constructor & Destructor Documentation

◆ ResidualModelTaskFirstOrderTpl()

template<typename _Scalar>
ResidualModelTaskFirstOrderTpl(std::shared_ptr< TaskModelAbstract >task,
std::shared_ptr< GuidanceModelAbstract >guidance )

Initialize the first-order task residual.

The residual is

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

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

The residual Jacobians are

\‍[  R_x = V_x - G_e Y_x, \qquad R_u = V_u - G_e Y_u,
\‍]

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

Parameters
[in]taskTask model
[in]guidanceGuidance model

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 first-order task residual.

This evaluates

\‍[  r = 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 = V_x - G_e Y_x, \qquad R_u = V_u - G_e Y_u.
\‍]

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-first-order.hpp.

◆ task_

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

Definition at line 132 of file task-first-order.hpp.

◆ guidance_

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

Definition at line 133 of file task-first-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: