Template Class StateNumDiffTpl

Inheritance Relationships

Base Type

Class Documentation

template<typename _Scalar>
class StateNumDiffTpl : public crocoddyl::StateAbstractTpl<_Scalar>

Public Types

typedef MathBaseTpl<Scalar> MathBase
typedef StateAbstractTpl<_Scalar> Base
typedef MathBase::VectorXs VectorXs
typedef MathBase::MatrixXs MatrixXs

Public Functions

explicit StateNumDiffTpl(std::shared_ptr<Base> state)
virtual ~StateNumDiffTpl()
virtual VectorXs zero() const override

Generate a zero state.

virtual VectorXs rand() const override

Generate a random state.

virtual void diff(const Eigen::Ref<const VectorXs> &x0, const Eigen::Ref<const VectorXs> &x1, Eigen::Ref<VectorXs> dxout) const override

Compute the state manifold differentiation.

The state differentiation is defined as:

\[\begin{equation*} \delta\mathbf{x} = \mathbf{x}_{1} \ominus \mathbf{x}_{0}, \end{equation*}\]
where \(\mathbf{x}_{1}\), \(\mathbf{x}_{0}\) are the current and previous state which lie in a manifold \(\mathcal{M}\), and \(\delta\mathbf{x} \in T_\mathbf{x} \mathcal{M}\) is the rate of change in the state in the tangent space of the manifold.

Parameters:
  • x0[in] Previous state point (size nx)

  • x1[in] Current state point (size nx)

  • dxout[out] Difference between the current and previous state points (size ndx)

virtual void integrate(const Eigen::Ref<const VectorXs> &x, const Eigen::Ref<const VectorXs> &dx, Eigen::Ref<VectorXs> xout) const override

Compute the state manifold integration.

The state integration is defined as:

\[\begin{equation*} \mathbf{x}_{next} = \mathbf{x} \oplus \delta\mathbf{x}, \end{equation*}\]
where \(\mathbf{x}\), \(\mathbf{x}_{next}\) are the current and next state which lie in a manifold \(\mathcal{M}\), and \(\delta\mathbf{x} \in T_\mathbf{x} \mathcal{M}\) is the rate of change in the state in the tangent space of the manifold.

Parameters:
  • x[in] State point (size nx)

  • dx[in] Velocity vector (size ndx)

  • xout[out] Next state point (size nx)

virtual void Jdiff(const Eigen::Ref<const VectorXs> &x0, const Eigen::Ref<const VectorXs> &x1, Eigen::Ref<MatrixXs> Jfirst, Eigen::Ref<MatrixXs> Jsecond, Jcomponent firstsecond = both) const override

This computes the Jacobian of the diff method by finite differentiation:

\[\begin{equation} Jfirst[:,k] = diff(int(x_1, dx_dist), x_2) - diff(x_1, x_2)/disturbance \end{equation}\]
and
\[\begin{equation} Jsecond[:,k] = diff(x_1, int(x_2, dx_dist)) - diff(x_1, x_2)/disturbance \end{equation}\]

Parameters:
  • Jfirst

  • Jsecond

  • firstsecond

virtual void Jintegrate(const Eigen::Ref<const VectorXs> &x, const Eigen::Ref<const VectorXs> &dx, Eigen::Ref<MatrixXs> Jfirst, Eigen::Ref<MatrixXs> Jsecond, const Jcomponent firstsecond = both, const AssignmentOp op = setto) const override

This computes the Jacobian of the integrate method by finite differentiation:

\[\begin{equation} Jfirst[:,k] = diff( int(x, d_x), int( int(x, dx_dist), dx) )/disturbance \end{equation}\]
and
\[\begin{equation} Jsecond[:,k] = diff( int(x, d_x), int( x, dx + dx_dist) )/disturbance \end{equation}\]

Parameters:
  • Jfirst

  • Jsecond

  • firstsecond

virtual void JintegrateTransport(const Eigen::Ref<const VectorXs> &x, const Eigen::Ref<const VectorXs> &dx, Eigen::Ref<MatrixXs> Jin, const Jcomponent firstsecond = both) const override

Parallel transport from integrate(x, dx) to x.

This function performs the parallel transportation of an input matrix whose columns are expressed in the tangent space at \(\mathbf{x}\oplus\delta\mathbf{x}\) to the tangent space at \(\mathbf{x}\) point.

Parameters:
  • x[in] State point (size nx).

  • dx[in] Velocity vector (size ndx)

  • Jin[out] Input matrix (number of rows = nv).

  • firstsecond[in] Argument (either x or dx) with respect to which the differentiation of Jintegrate is performed.

template<typename NewScalar>
StateNumDiffTpl<NewScalar> cast() const
const Scalar get_disturbance() const

Return the disturbance constant used in the numerical differentiation routine.

void set_disturbance(const Scalar disturbance)

Modify the disturbance constant used by the numerical differentiation routine.

virtual void print(std::ostream &os) const override

Print relevant information of the state numdiff.

Parameters:

os[out] Output stream object

Public Members

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar

Protected Attributes

bool has_limits_

Indicates whether any of the state limits is finite.

VectorXs lb_

Lower state limits.

std::size_t ndx_

State rate dimension.

std::size_t nq_

Configuration dimension.

std::size_t nv_

Velocity dimension.

std::size_t nx_

State dimension.

VectorXs ub_

Upper state limits.