Template Class ConstraintModelNumDiffTpl
Defined in File constraint.hpp
Inheritance Relationships
Base Type
public crocoddyl::ConstraintModelAbstractTpl< _Scalar >(Template Class ConstraintModelAbstractTpl)
Class Documentation
-
template<typename _Scalar>
class ConstraintModelNumDiffTpl : public crocoddyl::ConstraintModelAbstractTpl<_Scalar> This class computes the numerical differentiation of a constraint model.
It computes the Jacobian of the constraint model via numerical differentiation, i.e., \(\mathbf{g_x}\), \(\mathbf{g_u}\) and \(\mathbf{h_x}\), \(\mathbf{h_u}\), which denote the Jacobians of the inequality and equality constraints, respectively.
See also
ConstraintModelAbstractTpl(),calcDiff()Public Types
-
typedef ConstraintDataAbstractTpl<Scalar> ConstraintDataAbstract
-
typedef ConstraintModelAbstractTpl<Scalar> Base
-
typedef ConstraintDataNumDiffTpl<Scalar> Data
-
typedef DataCollectorAbstractTpl<Scalar> DataCollectorAbstract
-
typedef MathBaseTpl<Scalar> MathBase
-
typedef MathBaseTpl<Scalar>::VectorXs VectorXs
Public Functions
Initialize the numdiff constraint model.
- Parameters:
model –
-
virtual ~ConstraintModelNumDiffTpl() = default
Initialize the numdiff constraint model.
Compute the constraint value.
- Parameters:
data – [in] Constraint data
x – [in] State point \(\mathbf{x}\in\mathbb{R}^{ndx}\)
u – [in] Control input \(\mathbf{u}\in\mathbb{R}^{nu}\)
Compute the Jacobian of the constraint.
It computes the Jacobian of the constraint function. It assumes that
calc()has been run first.- Parameters:
data – [in] Constraint data
x – [in] State point \(\mathbf{x}\in\mathbb{R}^{ndx}\)
u – [in] Control input \(\mathbf{u}\in\mathbb{R}^{nu}\)
-
virtual std::shared_ptr<ConstraintDataAbstract> createData(DataCollectorAbstract *const data) override
Create the constraint data.
The default data contains objects to store the values of the constraint, residual vector and their first derivatives. However, it is possible to specialize this function is we need to create additional data, for instance, to avoid dynamic memory allocation.
- Parameters:
data – Data collector
- Returns:
the constraint data
-
template<typename NewScalar>
ConstraintModelNumDiffTpl<NewScalar> cast() const Cast the constraint numdiff model to a different scalar type.
It is useful for operations requiring different precision or scalar types.
- Template Parameters:
NewScalar – The new scalar type to cast to.
- Returns:
ConstraintModelNumDiffTpl<NewScalar> A constraint model with the new scalar type.
-
const Scalar get_disturbance() const
Return the disturbance constant used by the numerical differentiation routine.
-
void set_disturbance(const Scalar disturbance)
Modify the disturbance constant used by the numerical differentiation routine.
-
void set_reevals(const std::vector<ReevaluationFunction> &reevals)
Register functions that updates the shared data computed for a system rollout The updated data is used to evaluate of the gradient and Hessian.
- Parameters:
reevals – are the registered functions.
Public Members
- EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar
Protected Attributes
-
std::size_t nu_
Control dimension.
-
std::shared_ptr<StateAbstract> state_
State description.
-
typedef ConstraintDataAbstractTpl<Scalar> ConstraintDataAbstract