aligator  0.16.0
A versatile and efficient C++ library for real-time constrained trajectory optimization.
Loading...
Searching...
No Matches
linear-discrete-dynamics.hpp
Go to the documentation of this file.
1#pragma once
2
5
6namespace aligator {
7
8namespace dynamics {
9
11template <typename _Scalar>
13 using Scalar = _Scalar;
15 const MatrixXs A_;
16 const MatrixXs B_;
17 const VectorXs c_;
18
22
24 LinearDiscreteDynamicsTpl(const MatrixXs &A, const MatrixXs &B,
25 const VectorXs &c)
26 : Base(VectorSpaceType((int)A.cols()), (int)B.cols())
27 , A_(A)
28 , B_(B)
29 , c_(c) {}
30
31 void forward(const ConstVectorRef &x, const ConstVectorRef &u,
32 Data &data) const {
33 data.xnext_ = c_;
34 data.xnext_.noalias() += A_ * x;
35 data.xnext_.noalias() += B_ * u;
36 }
37
38 void dForward(const ConstVectorRef &, const ConstVectorRef &, Data &) const {}
39
40 shared_ptr<Data> createData() const {
41 shared_ptr<Data> data = Base::createData();
42 data->Jx() = A_;
43 data->Ju() = B_;
44 return data;
45 }
46};
47
48} // namespace dynamics
49
50} // namespace aligator
Namespace for modelling system dynamics.
Main package namespace.
Specific data struct for explicit dynamics ExplicitDynamicsModelTpl.
virtual shared_ptr< Data > createData() const
ExplicitDynamicsModelTpl(const polymorphic< Manifold > &space, const int nu)
Constructor requires providing the next state's manifold.
Standard Euclidean vector space.
LinearDiscreteDynamicsTpl(const MatrixXs &A, const MatrixXs &B, const VectorXs &c)
Constructor with state manifold and matrices.
void dForward(const ConstVectorRef &, const ConstVectorRef &, Data &) const
Compute the Jacobians of the forward dynamics.
void forward(const ConstVectorRef &x, const ConstVectorRef &u, Data &data) const
Evaluate the forward discrete dynamics.
VectorSpaceTpl< Scalar, Eigen::Dynamic > VectorSpaceType