Crocoddyl
 
Loading...
Searching...
No Matches
euclidean.hpp
1
2// BSD 3-Clause License
3//
4// Copyright (C) 2019-2025, LAAS-CNRS, Heriot-Watt University
5// Copyright note valid unless otherwise stated in individual files.
6// All rights reserved.
8
9#ifndef CROCODDYL_CORE_STATES_EUCLIDEAN_HPP_
10#define CROCODDYL_CORE_STATES_EUCLIDEAN_HPP_
11
12#include "crocoddyl/core/fwd.hpp"
13#include "crocoddyl/core/state-base.hpp"
14
15namespace crocoddyl {
16
17template <typename _Scalar>
18class StateVectorTpl : public StateAbstractTpl<_Scalar> {
19 public:
20 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
21 CROCODDYL_DERIVED_CAST(StateBase, StateVectorTpl)
22
23 typedef _Scalar Scalar;
25 typedef typename MathBase::VectorXs VectorXs;
26 typedef typename MathBase::MatrixXs MatrixXs;
27
28 explicit StateVectorTpl(const std::size_t nx);
29 virtual ~StateVectorTpl();
30
31 virtual VectorXs zero() const override;
32 virtual VectorXs rand() const override;
33 virtual void diff(const Eigen::Ref<const VectorXs>& x0,
34 const Eigen::Ref<const VectorXs>& x1,
35 Eigen::Ref<VectorXs> dxout) const override;
36 virtual void integrate(const Eigen::Ref<const VectorXs>& x,
37 const Eigen::Ref<const VectorXs>& dx,
38 Eigen::Ref<VectorXs> xout) const override;
39 virtual void Jdiff(const Eigen::Ref<const VectorXs>&,
40 const Eigen::Ref<const VectorXs>&,
41 Eigen::Ref<MatrixXs> Jfirst, Eigen::Ref<MatrixXs> Jsecond,
42 const Jcomponent firstsecond = both) const override;
43 virtual void Jintegrate(const Eigen::Ref<const VectorXs>& x,
44 const Eigen::Ref<const VectorXs>& dx,
45 Eigen::Ref<MatrixXs> Jfirst,
46 Eigen::Ref<MatrixXs> Jsecond,
47 const Jcomponent firstsecond = both,
48 const AssignmentOp = setto) const override;
49 virtual void JintegrateTransport(const Eigen::Ref<const VectorXs>& x,
50 const Eigen::Ref<const VectorXs>& dx,
51 Eigen::Ref<MatrixXs> Jin,
52 const Jcomponent firstsecond) const override;
53
54 template <typename NewScalar>
55 StateVectorTpl<NewScalar> cast() const;
56
62 virtual void print(std::ostream& os) const override;
63
64 protected:
65 using StateAbstractTpl<Scalar>::nx_;
66 using StateAbstractTpl<Scalar>::ndx_;
67 using StateAbstractTpl<Scalar>::nq_;
68 using StateAbstractTpl<Scalar>::nv_;
69 using StateAbstractTpl<Scalar>::lb_;
70 using StateAbstractTpl<Scalar>::ub_;
72};
73
74} // namespace crocoddyl
75
76/* --- Details -------------------------------------------------------------- */
77/* --- Details -------------------------------------------------------------- */
78/* --- Details -------------------------------------------------------------- */
79#include "crocoddyl/core/states/euclidean.hxx"
80
81CROCODDYL_DECLARE_EXTERN_TEMPLATE_CLASS(crocoddyl::StateVectorTpl)
82
83#endif // CROCODDYL_CORE_STATES_EUCLIDEAN_HPP_
Abstract class for the state representation.
std::size_t nv_
Velocity dimension.
std::size_t nx_
State dimension.
bool has_limits_
Indicates whether any of the state limits is finite.
std::size_t nq_
Configuration dimension.
VectorXs lb_
Lower state limits.
VectorXs ub_
Upper state limits.
std::size_t ndx_
State rate dimension.
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=setto) const override
Compute the Jacobian of the state manifold integration.
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.
virtual void Jdiff(const Eigen::Ref< const VectorXs > &, const Eigen::Ref< const VectorXs > &, Eigen::Ref< MatrixXs > Jfirst, Eigen::Ref< MatrixXs > Jsecond, const Jcomponent firstsecond=both) const override
Compute the Jacobian of the state manifold differentiation.
virtual VectorXs rand() const override
Generate a random state.
virtual void JintegrateTransport(const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &dx, Eigen::Ref< MatrixXs > Jin, const Jcomponent firstsecond) const override
Parallel transport from integrate(x, dx) to x.
virtual VectorXs zero() const override
Generate a zero 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.
virtual void print(std::ostream &os) const override
Print relevant information of the state vector.