GCC Code Coverage Report


Directory: ./
File: include/crocoddyl/core/diff-action-base.hpp
Date: 2025-02-24 23:41:29
Exec Total Coverage
Lines: 44 44 100.0%
Branches: 60 120 50.0%

Line Branch Exec Source
1 ///////////////////////////////////////////////////////////////////////////////
2 // BSD 3-Clause License
3 //
4 // Copyright (C) 2019-2024, LAAS-CNRS, University of Edinburgh,
5 // University of Oxford, Heriot-Watt University
6 // Copyright note valid unless otherwise stated in individual files.
7 // All rights reserved.
8 ///////////////////////////////////////////////////////////////////////////////
9
10 #ifndef CROCODDYL_CORE_DIFF_ACTION_BASE_HPP_
11 #define CROCODDYL_CORE_DIFF_ACTION_BASE_HPP_
12
13 #include <boost/make_shared.hpp>
14 #include <memory>
15 #include <stdexcept>
16
17 #include "crocoddyl/core/fwd.hpp"
18 #include "crocoddyl/core/state-base.hpp"
19 #include "crocoddyl/core/utils/math.hpp"
20
21 namespace crocoddyl {
22
23 /**
24 * @brief Abstract class for differential action model
25 *
26 * A differential action model combines dynamics, cost and constraints models.
27 * We can use it in each node of our optimal control problem thanks to dedicated
28 * integration rules (e.g., `IntegratedActionModelEulerTpl` or
29 * `IntegratedActionModelRK4Tpl`). These integrated action models produce action
30 * models (`ActionModelAbstractTpl`). Thus, every time that we want to describe
31 * a problem, we need to provide ways of computing the dynamics, cost,
32 * constraints functions and their derivatives. All these are described inside
33 * the differential action model.
34 *
35 * Concretely speaking, the differential action model is the time-continuous
36 * version of an action model, i.e., \f[ \begin{aligned}
37 * &\dot{\mathbf{v}} = \mathbf{f}(\mathbf{q}, \mathbf{v}, \mathbf{u}),
38 * &\textrm{(dynamics)}\\
39 * &\ell(\mathbf{q}, \mathbf{v},\mathbf{u}) = \int_0^{\delta t}
40 * a(\mathbf{r}(\mathbf{q}, \mathbf{v},\mathbf{u}))\,dt,
41 * &\textrm{(cost)}\\
42 * &\mathbf{g}(\mathbf{q}, \mathbf{v},\mathbf{u})<\mathbf{0},
43 * &\textrm{(inequality constraint)}\\
44 * &\mathbf{h}(\mathbf{q}, \mathbf{v},\mathbf{u})=\mathbf{0}, &\textrm{(equality
45 * constraint)} \end{aligned} \f] where
46 * - the configuration \f$\mathbf{q}\in\mathcal{Q}\f$ lies in the configuration
47 * manifold described with a `nq`-tuple,
48 * - the velocity \f$\mathbf{v}\in T_{\mathbf{q}}\mathcal{Q}\f$ is the tangent
49 * vector to the configuration manifold with `nv` dimension,
50 * - the control input \f$\mathbf{u}\in\mathbb{R}^{nu}\f$ is an Euclidean
51 * vector,
52 * - \f$\mathbf{r}(\cdot)\f$ and \f$a(\cdot)\f$ are the residual and activation
53 * functions (see `ResidualModelAbstractTpl` and `ActivationModelAbstractTpl`,
54 * respectively),
55 * - \f$\mathbf{g}(\cdot)\in\mathbb{R}^{ng}\f$ and
56 * \f$\mathbf{h}(\cdot)\in\mathbb{R}^{nh}\f$ are the inequality and equality
57 * vector functions, respectively.
58 *
59 * Both configuration and velocity describe the system space
60 * \f$\mathbf{x}=(\mathbf{q}, \mathbf{v})\in\mathcal{X}\f$ which lies in the
61 * state manifold. Note that the acceleration \f$\dot{\mathbf{v}}\in
62 * T_{\mathbf{q}}\mathcal{Q}\f$ lies also in the tangent space of the
63 * configuration manifold. The computation of these equations are carried out
64 * inside `calc()` function. In short, this function computes the system
65 * acceleration, cost and constraints values (also called constraints
66 * violations). This procedure is equivalent to running a forward pass of the
67 * action model.
68 *
69 * However, during numerical optimization, we also need to run backward passes
70 * of the differential action model. These calculations are performed by
71 * `calcDiff()`. In short, this function builds a linear-quadratic approximation
72 * of the differential action model, i.e., \f[ \begin{aligned}
73 * &\delta\dot{\mathbf{v}} =
74 * \mathbf{f_{q}}\delta\mathbf{q}+\mathbf{f_{v}}\delta\mathbf{v}+\mathbf{f_{u}}\delta\mathbf{u},
75 * &\textrm{(dynamics)}\\
76 * &\ell(\delta\mathbf{q},\delta\mathbf{v},\delta\mathbf{u}) = \begin{bmatrix}1
77 * \\ \delta\mathbf{q} \\ \delta\mathbf{v}
78 * \\ \delta\mathbf{u}\end{bmatrix}^T \begin{bmatrix}0 & \mathbf{\ell_q}^T &
79 * \mathbf{\ell_v}^T & \mathbf{\ell_u}^T \\ \mathbf{\ell_q} & \mathbf{\ell_{qq}}
80 * &
81 * \mathbf{\ell_{qv}} & \mathbf{\ell_{uq}}^T \\
82 * \mathbf{\ell_v} & \mathbf{\ell_{vq}} & \mathbf{\ell_{vv}} &
83 * \mathbf{\ell_{uv}}^T \\
84 * \mathbf{\ell_u} & \mathbf{\ell_{uq}} & \mathbf{\ell_{uv}} &
85 * \mathbf{\ell_{uu}}\end{bmatrix} \begin{bmatrix}1 \\ \delta\mathbf{q}
86 * \\ \delta\mathbf{v} \\
87 * \delta\mathbf{u}\end{bmatrix}, &\textrm{(cost)}\\
88 * &\mathbf{g_q}\delta\mathbf{q}+\mathbf{g_v}\delta\mathbf{v}+\mathbf{g_u}\delta\mathbf{u}\leq\mathbf{0},
89 * &\textrm{(inequality constraints)}\\
90 * &\mathbf{h_q}\delta\mathbf{q}+\mathbf{h_v}\delta\mathbf{v}+\mathbf{h_u}\delta\mathbf{u}=\mathbf{0},
91 * &\textrm{(equality constraints)} \end{aligned} \f] where
92 * - \f$\mathbf{f_x}=(\mathbf{f_q};\,\, \mathbf{f_v})\in\mathbb{R}^{nv\times
93 * ndx}\f$ and \f$\mathbf{f_u}\in\mathbb{R}^{nv\times nu}\f$ are the Jacobians
94 * of the dynamics,
95 * - \f$\mathbf{\ell_x}=(\mathbf{\ell_q};\,\,
96 * \mathbf{\ell_v})\in\mathbb{R}^{ndx}\f$ and
97 * \f$\mathbf{\ell_u}\in\mathbb{R}^{nu}\f$ are the Jacobians of the cost
98 * function,
99 * - \f$\mathbf{\ell_{xx}}=(\mathbf{\ell_{qq}}\,\, \mathbf{\ell_{qv}};\,\,
100 * \mathbf{\ell_{vq}}\, \mathbf{\ell_{vv}})\in\mathbb{R}^{ndx\times ndx}\f$,
101 * \f$\mathbf{\ell_{xu}}=(\mathbf{\ell_q};\,\,
102 * \mathbf{\ell_v})\in\mathbb{R}^{ndx\times nu}\f$ and
103 * \f$\mathbf{\ell_{uu}}\in\mathbb{R}^{nu\times nu}\f$ are the Hessians of the
104 * cost function,
105 * - \f$\mathbf{g_x}=(\mathbf{g_q};\,\, \mathbf{g_v})\in\mathbb{R}^{ng\times
106 * ndx}\f$ and \f$\mathbf{g_u}\in\mathbb{R}^{ng\times nu}\f$ are the Jacobians
107 * of the inequality constraints, and
108 * - \f$\mathbf{h_x}=(\mathbf{h_q};\,\, \mathbf{h_v})\in\mathbb{R}^{nh\times
109 * ndx}\f$ and \f$\mathbf{h_u}\in\mathbb{R}^{nh\times nu}\f$ are the Jacobians
110 * of the equality constraints.
111 *
112 * Additionally, it is important to note that `calcDiff()` computes the
113 * derivatives using the latest stored values by `calc()`. Thus, we need to
114 * first run `calc()`.
115 *
116 * \sa `ActionModelAbstractTpl`, `calc()`, `calcDiff()`, `createData()`
117 */
118 template <typename _Scalar>
119 class DifferentialActionModelAbstractTpl {
120 public:
121 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
122
123 typedef _Scalar Scalar;
124 typedef MathBaseTpl<Scalar> MathBase;
125 typedef DifferentialActionDataAbstractTpl<Scalar>
126 DifferentialActionDataAbstract;
127 typedef StateAbstractTpl<Scalar> StateAbstract;
128 typedef typename MathBase::VectorXs VectorXs;
129 typedef typename MathBase::MatrixXs MatrixXs;
130
131 /**
132 * @brief Initialize the differential action model
133 *
134 * @param[in] state State description
135 * @param[in] nu Dimension of control vector
136 * @param[in] nr Dimension of cost-residual vector
137 * @param[in] ng Number of inequality constraints (default 0)
138 * @param[in] nh Number of equality constraints (default 0)
139 * @param[in] ng_T Number of inequality terminal constraints (default 0)
140 * @param[in] nh_T Number of equality terminal constraints (default 0)
141 */
142 DifferentialActionModelAbstractTpl(std::shared_ptr<StateAbstract> state,
143 const std::size_t nu,
144 const std::size_t nr = 0,
145 const std::size_t ng = 0,
146 const std::size_t nh = 0,
147 const std::size_t ng_T = 0,
148 const std::size_t nh_T = 0);
149 virtual ~DifferentialActionModelAbstractTpl();
150
151 /**
152 * @brief Compute the system acceleration and cost value
153 *
154 * @param[in] data Differential action data
155 * @param[in] x State point \f$\mathbf{x}\in\mathbb{R}^{ndx}\f$
156 * @param[in] u Control input \f$\mathbf{u}\in\mathbb{R}^{nu}\f$
157 */
158 virtual void calc(const std::shared_ptr<DifferentialActionDataAbstract>& data,
159 const Eigen::Ref<const VectorXs>& x,
160 const Eigen::Ref<const VectorXs>& u) = 0;
161
162 /**
163 * @brief Compute the total cost value for nodes that depends only on the
164 * state
165 *
166 * It updates the total cost and the system acceleration is not updated as the
167 * control input is undefined. This function is used in the terminal nodes of
168 * an optimal control problem.
169 *
170 * @param[in] data Differential action data
171 * @param[in] x State point \f$\mathbf{x}\in\mathbb{R}^{ndx}\f$
172 */
173 virtual void calc(const std::shared_ptr<DifferentialActionDataAbstract>& data,
174 const Eigen::Ref<const VectorXs>& x);
175
176 /**
177 * @brief Compute the derivatives of the dynamics and cost functions
178 *
179 * It computes the partial derivatives of the dynamical system and the cost
180 * function. It assumes that `calc()` has been run first. This function builds
181 * a quadratic approximation of the time-continuous action model (i.e.
182 * dynamical system and cost function).
183 *
184 * @param[in] data Differential action data
185 * @param[in] x State point \f$\mathbf{x}\in\mathbb{R}^{ndx}\f$
186 * @param[in] u Control input \f$\mathbf{u}\in\mathbb{R}^{nu}\f$
187 */
188 virtual void calcDiff(
189 const std::shared_ptr<DifferentialActionDataAbstract>& data,
190 const Eigen::Ref<const VectorXs>& x,
191 const Eigen::Ref<const VectorXs>& u) = 0;
192
193 /**
194 * @brief Compute the derivatives of the cost functions with respect to the
195 * state only
196 *
197 * It updates the derivatives of the cost function with respect to the state
198 * only. This function is used in the terminal nodes of an optimal control
199 * problem.
200 *
201 * @param[in] data Differential action data
202 * @param[in] x State point \f$\mathbf{x}\in\mathbb{R}^{ndx}\f$
203 */
204 virtual void calcDiff(
205 const std::shared_ptr<DifferentialActionDataAbstract>& data,
206 const Eigen::Ref<const VectorXs>& x);
207
208 /**
209 * @brief Create the differential action data
210 *
211 * @return the differential action data
212 */
213 virtual std::shared_ptr<DifferentialActionDataAbstract> createData();
214
215 /**
216 * @brief Checks that a specific data belongs to this model
217 */
218 virtual bool checkData(
219 const std::shared_ptr<DifferentialActionDataAbstract>& data);
220
221 /**
222 * @brief Computes the quasic static commands
223 *
224 * The quasic static commands are the ones produced for a the reference
225 * posture as an equilibrium point, i.e. for
226 * \f$\mathbf{f}(\mathbf{q},\mathbf{v}=\mathbf{0},\mathbf{u})=\mathbf{0}\f$
227 *
228 * @param[in] data Differential action data
229 * @param[out] u Quasic static commands
230 * @param[in] x State point (velocity has to be zero)
231 * @param[in] maxiter Maximum allowed number of iterations
232 * @param[in] tol Tolerance
233 */
234 virtual void quasiStatic(
235 const std::shared_ptr<DifferentialActionDataAbstract>& data,
236 Eigen::Ref<VectorXs> u, const Eigen::Ref<const VectorXs>& x,
237 const std::size_t maxiter = 100, const Scalar tol = Scalar(1e-9));
238
239 /**
240 * @copybrief quasicStatic()
241 *
242 * @copydetails quasicStatic()
243 *
244 * @param[in] data Differential action data
245 * @param[in] x State point (velocity has to be zero)
246 * @param[in] maxiter Maximum allowed number of iterations
247 * @param[in] tol Tolerance
248 * @return Quasic static commands
249 */
250 VectorXs quasiStatic_x(
251 const std::shared_ptr<DifferentialActionDataAbstract>& data,
252 const VectorXs& x, const std::size_t maxiter = 100,
253 const Scalar tol = Scalar(1e-9));
254
255 /**
256 * @brief Return the dimension of the control input
257 */
258 std::size_t get_nu() const;
259
260 /**
261 * @brief Return the dimension of the cost-residual vector
262 */
263 std::size_t get_nr() const;
264
265 /**
266 * @brief Return the number of inequality constraints
267 */
268 virtual std::size_t get_ng() const;
269
270 /**
271 * @brief Return the number of equality constraints
272 */
273 virtual std::size_t get_nh() const;
274
275 /**
276 * @brief Return the number of inequality terminal constraints
277 */
278 virtual std::size_t get_ng_T() const;
279
280 /**
281 * @brief Return the number of equality terminal constraints
282 */
283 virtual std::size_t get_nh_T() const;
284
285 /**
286 * @brief Return the state
287 */
288 const std::shared_ptr<StateAbstract>& get_state() const;
289
290 /**
291 * @brief Return the lower bound of the inequality constraints
292 */
293 virtual const VectorXs& get_g_lb() const;
294
295 /**
296 * @brief Return the upper bound of the inequality constraints
297 */
298 virtual const VectorXs& get_g_ub() const;
299
300 /**
301 * @brief Return the control lower bound
302 */
303 const VectorXs& get_u_lb() const;
304
305 /**
306 * @brief Return the control upper bound
307 */
308 const VectorXs& get_u_ub() const;
309
310 /**
311 * @brief Indicates if there are defined control limits
312 */
313 bool get_has_control_limits() const;
314
315 /**
316 * @brief Modify the lower bound of the inequality constraints
317 */
318 void set_g_lb(const VectorXs& g_lb);
319
320 /**
321 * @brief Modify the upper bound of the inequality constraints
322 */
323 void set_g_ub(const VectorXs& g_ub);
324
325 /**
326 * @brief Modify the control lower bounds
327 */
328 void set_u_lb(const VectorXs& u_lb);
329
330 /**
331 * @brief Modify the control upper bounds
332 */
333 void set_u_ub(const VectorXs& u_ub);
334
335 /**
336 * @brief Print information on the differential action model
337 */
338 template <class Scalar>
339 friend std::ostream& operator<<(
340 std::ostream& os,
341 const DifferentialActionModelAbstractTpl<Scalar>& model);
342
343 /**
344 * @brief Print relevant information of the differential action model
345 *
346 * @param[out] os Output stream object
347 */
348 virtual void print(std::ostream& os) const;
349
350 private:
351 std::size_t ng_internal_; //!< Internal object for storing the number of
352 //!< inequality constraints
353 std::size_t nh_internal_; //!< Internal object for storing the number of
354 //!< equality constraints
355
356 protected:
357 std::size_t nu_; //!< Control dimension
358 std::size_t nr_; //!< Dimension of the cost residual
359 std::size_t ng_; //!< Number of inequality constraints
360 std::size_t nh_; //!< Number of equality constraints
361 std::size_t ng_T_; //!< Number of inequality terminal constraints
362 std::size_t nh_T_; //!< Number of equality terminal constraints
363 std::shared_ptr<StateAbstract> state_; //!< Model of the state
364 VectorXs unone_; //!< Neutral state
365 VectorXs g_lb_; //!< Lower bound of the inequality constraints
366 VectorXs g_ub_; //!< Lower bound of the inequality constraints
367 VectorXs u_lb_; //!< Lower control limits
368 VectorXs u_ub_; //!< Upper control limits
369 bool has_control_limits_; //!< Indicates whether any of the control limits is
370 //!< finite
371
372 /**
373 * @brief Update the status of the control limits (i.e. if there are defined
374 * limits)
375 */
376 void update_has_control_limits();
377
378 template <class Scalar>
379 friend class IntegratedActionModelAbstractTpl;
380 template <class Scalar>
381 friend class ConstraintModelManagerTpl;
382 };
383
384 template <typename _Scalar>
385 struct DifferentialActionDataAbstractTpl {
386 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
387
388 typedef _Scalar Scalar;
389 typedef MathBaseTpl<Scalar> MathBase;
390 typedef typename MathBase::VectorXs VectorXs;
391 typedef typename MathBase::MatrixXs MatrixXs;
392
393 template <template <typename Scalar> class Model>
394 224102 explicit DifferentialActionDataAbstractTpl(Model<Scalar>* const model)
395 224102 : cost(Scalar(0.)),
396
1/2
✓ Branch 3 taken 112051 times.
✗ Branch 4 not taken.
224102 xout(model->get_state()->get_nv()),
397
1/2
✓ Branch 7 taken 112051 times.
✗ Branch 8 not taken.
224102 Fx(model->get_state()->get_nv(), model->get_state()->get_ndx()),
398
1/2
✓ Branch 5 taken 112051 times.
✗ Branch 6 not taken.
224102 Fu(model->get_state()->get_nv(), model->get_nu()),
399
1/2
✓ Branch 2 taken 112051 times.
✗ Branch 3 not taken.
224102 r(model->get_nr()),
400
1/2
✓ Branch 4 taken 112051 times.
✗ Branch 5 not taken.
224102 Lx(model->get_state()->get_ndx()),
401
1/2
✓ Branch 2 taken 112051 times.
✗ Branch 3 not taken.
224102 Lu(model->get_nu()),
402
1/2
✓ Branch 7 taken 112051 times.
✗ Branch 8 not taken.
224102 Lxx(model->get_state()->get_ndx(), model->get_state()->get_ndx()),
403
1/2
✓ Branch 5 taken 112051 times.
✗ Branch 6 not taken.
224102 Lxu(model->get_state()->get_ndx(), model->get_nu()),
404
1/2
✓ Branch 3 taken 112051 times.
✗ Branch 4 not taken.
224102 Luu(model->get_nu(), model->get_nu()),
405
4/10
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 112051 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 112051 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 12 taken 112051 times.
✗ Branch 13 not taken.
448204 g(model->get_ng() > model->get_ng_T() ? model->get_ng()
406
1/2
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
224102 : model->get_ng_T()),
407
3/8
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 112051 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 9 taken 112051 times.
✗ Branch 10 not taken.
448204 Gx(model->get_ng() > model->get_ng_T() ? model->get_ng()
408
1/2
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
224102 : model->get_ng_T(),
409
1/2
✓ Branch 4 taken 112051 times.
✗ Branch 5 not taken.
224102 model->get_state()->get_ndx()),
410
3/8
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 112051 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 9 taken 112051 times.
✗ Branch 10 not taken.
448204 Gu(model->get_ng() > model->get_ng_T() ? model->get_ng()
411
1/2
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
224102 : model->get_ng_T(),
412
1/2
✓ Branch 2 taken 112051 times.
✗ Branch 3 not taken.
224102 model->get_nu()),
413
6/10
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 112051 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 34667 times.
✓ Branch 7 taken 77384 times.
✓ Branch 9 taken 34667 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 112051 times.
✗ Branch 13 not taken.
378870 h(model->get_nh() > model->get_nh_T() ? model->get_nh()
414
1/2
✓ Branch 1 taken 77384 times.
✗ Branch 2 not taken.
154768 : model->get_nh_T()),
415
5/8
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 34667 times.
✓ Branch 4 taken 77384 times.
✓ Branch 6 taken 34667 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 112051 times.
✗ Branch 10 not taken.
378870 Hx(model->get_nh() > model->get_nh_T() ? model->get_nh()
416
1/2
✓ Branch 1 taken 77384 times.
✗ Branch 2 not taken.
154768 : model->get_nh_T(),
417
1/2
✓ Branch 4 taken 112051 times.
✗ Branch 5 not taken.
224102 model->get_state()->get_ndx()),
418
5/8
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 34667 times.
✓ Branch 4 taken 77384 times.
✓ Branch 6 taken 34667 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 112051 times.
✗ Branch 10 not taken.
378870 Hu(model->get_nh() > model->get_nh_T() ? model->get_nh()
419
1/2
✓ Branch 1 taken 77384 times.
✗ Branch 2 not taken.
154768 : model->get_nh_T(),
420
1/2
✓ Branch 3 taken 112051 times.
✗ Branch 4 not taken.
448204 model->get_nu()) {
421
1/2
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
224102 xout.setZero();
422
1/2
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
224102 Fx.setZero();
423
1/2
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
224102 Fu.setZero();
424
1/2
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
224102 r.setZero();
425
1/2
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
224102 Lx.setZero();
426
1/2
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
224102 Lu.setZero();
427
1/2
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
224102 Lxx.setZero();
428
1/2
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
224102 Lxu.setZero();
429
1/2
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
224102 Luu.setZero();
430
1/2
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
224102 g.setZero();
431
1/2
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
224102 Gx.setZero();
432
1/2
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
224102 Gu.setZero();
433
1/2
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
224102 h.setZero();
434
1/2
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
224102 Hx.setZero();
435
1/2
✓ Branch 1 taken 112051 times.
✗ Branch 2 not taken.
224102 Hu.setZero();
436 224102 }
437 112051 virtual ~DifferentialActionDataAbstractTpl() {}
438
439 Scalar cost; //!< cost value
440 VectorXs xout; //!< evolution state
441 MatrixXs Fx; //!< Jacobian of the dynamics w.r.t. the state \f$\mathbf{x}\f$
442 MatrixXs
443 Fu; //!< Jacobian of the dynamics w.r.t. the control \f$\mathbf{u}\f$
444 VectorXs r; //!< Cost residual
445 VectorXs Lx; //!< Jacobian of the cost w.r.t. the state \f$\mathbf{x}\f$
446 VectorXs Lu; //!< Jacobian of the cost w.r.t. the control \f$\mathbf{u}\f$
447 MatrixXs Lxx; //!< Hessian of the cost w.r.t. the state \f$\mathbf{x}\f$
448 MatrixXs Lxu; //!< Hessian of the cost w.r.t. the state \f$\mathbf{x}\f$ and
449 //!< control u
450 MatrixXs Luu; //!< Hessian of the cost w.r.t. the control \f$\mathbf{u}\f$
451 VectorXs g; //!< Inequality constraint values
452 MatrixXs Gx; //!< Jacobian of the inequality constraint w.r.t. the state
453 //!< \f$\mathbf{x}\f$
454 MatrixXs Gu; //!< Jacobian of the inequality constraint w.r.t. the control
455 //!< \f$\mathbf{u}\f$
456 VectorXs h; //!< Equality constraint values
457 MatrixXs Hx; //!< Jacobian of the equality constraint w.r.t. the state
458 //!< \f$\mathbf{x}\f$
459 MatrixXs Hu; //!< Jacobian of the equality constraint w.r.t the control
460 //!< \f$\mathbf{u}\f$
461 };
462
463 } // namespace crocoddyl
464
465 /* --- Details -------------------------------------------------------------- */
466 /* --- Details -------------------------------------------------------------- */
467 /* --- Details -------------------------------------------------------------- */
468 #include "crocoddyl/core/diff-action-base.hxx"
469
470 #endif // CROCODDYL_CORE_DIFF_ACTION_BASE_HPP_
471