9#ifndef CROCODDYL_CORE_GUIDANCE_SMOOTH_SATURATION_HPP_ 10#define CROCODDYL_CORE_GUIDANCE_SMOOTH_SATURATION_HPP_ 12#include "crocoddyl/core/guidance-base.hpp" 13#include "crocoddyl/core/utils/conversions.hpp" 33template <
typename _Scalar>
37 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
40 typedef _Scalar Scalar;
42 typedef typename Base::GuidanceDataAbstract GuidanceDataAbstract;
45 typedef typename MathBase::VectorXs VectorXs;
46 typedef typename MathBase::MatrixXs MatrixXs;
57 const Scalar& max_rate,
58 const Scalar epsilon = Scalar(1e-6));
67 virtual void calc(
const std::shared_ptr<GuidanceDataAbstract>& data,
68 const Eigen::Ref<const VectorXs>& error)
const override;
76 virtual void calcDiff(
const std::shared_ptr<GuidanceDataAbstract>& data,
77 const Eigen::Ref<const VectorXs>& error)
const override;
85 virtual std::shared_ptr<GuidanceDataAbstract>
createData()
const override;
97 template <
typename NewScalar>
140 virtual void print(std::ostream& os)
const override;
143 void checkParameters(
const Scalar& gain,
const Scalar& max_rate,
144 const Scalar& epsilon)
const;
150 using Base::checkErrorDimension;
151 using Base::checkJacobianDimension;
152 using Base::checkRateDimension;
162template <
typename _Scalar>
163struct GuidanceDataSmoothSaturationTpl
165 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
167 typedef _Scalar Scalar;
170 typedef typename MathBase::VectorXs VectorXs;
171 typedef typename MathBase::MatrixXs MatrixXs;
173 template <
typename Gu
idance>
174 explicit GuidanceDataSmoothSaturationTpl(Guidance*
const guidance)
180 virtual ~GuidanceDataSmoothSaturationTpl() =
default;
194#include "crocoddyl/core/guidance/smooth-saturation.hxx" 196CROCODDYL_DECLARE_EXTERN_TEMPLATE_CLASS(
198CROCODDYL_DECLARE_EXTERN_TEMPLATE_STRUCT(
GuidanceModelAbstractTpl(const std::size_t nr)
Initialize the guidance-model dimension.
Direction-preserving, smoothly bounded guidance model.
const Scalar & get_gain() const
Return the local linear gain.
virtual void calc(const std::shared_ptr< GuidanceDataAbstract > &data, const Eigen::Ref< const VectorXs > &error) const override
Compute the smooth-saturation guidance output.
void set_max_rate(const Scalar &max_rate)
Update the maximum desired-rate norm.
GuidanceModelSmoothSaturationTpl< NewScalar > cast() const
Cast the guidance model to a different scalar type.
const Scalar & get_max_rate() const
Return the maximum desired-rate norm.
virtual void calcDiff(const std::shared_ptr< GuidanceDataAbstract > &data, const Eigen::Ref< const VectorXs > &error) const override
Compute the Jacobian of the smooth-saturation law.
virtual std::shared_ptr< GuidanceDataAbstract > createData() const override
Allocate the cached guidance data.
GuidanceModelSmoothSaturationTpl(const std::size_t nr, const Scalar &gain, const Scalar &max_rate, const Scalar epsilon=Scalar(1e-6))
Initialize the smoothly saturated guidance model.
const Scalar & get_epsilon() const
Return the smoothing parameter.
void set_gain(const Scalar &gain)
Update the local linear gain.
virtual void print(std::ostream &os) const override
Print the model parameters.
void set_epsilon(const Scalar &epsilon)
Update the smoothing parameter.
GuidanceDataAbstractTpl(const GuidanceModelAbstract *const model)
Allocate guidance data with the size inferred from the model.
Cached values for the smooth saturation guidance model.
Scalar tanh_z
Cached value of .
Scalar radius
Cached radial term .
Scalar z
Cached saturation argument .
Scalar scale
Cached scalar scale .