Directory: | ./ |
---|---|
File: | include/crocoddyl/core/diff-action-base.hpp |
Date: | 2025-01-16 08:47:40 |
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 <boost/shared_ptr.hpp> | ||
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(boost::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( | ||
159 | const boost::shared_ptr<DifferentialActionDataAbstract>& data, | ||
160 | const Eigen::Ref<const VectorXs>& x, | ||
161 | const Eigen::Ref<const VectorXs>& u) = 0; | ||
162 | |||
163 | /** | ||
164 | * @brief Compute the total cost value for nodes that depends only on the | ||
165 | * state | ||
166 | * | ||
167 | * It updates the total cost and the system acceleration is not updated as the | ||
168 | * control input is undefined. This function is used in the terminal nodes of | ||
169 | * an optimal control problem. | ||
170 | * | ||
171 | * @param[in] data Differential action data | ||
172 | * @param[in] x State point \f$\mathbf{x}\in\mathbb{R}^{ndx}\f$ | ||
173 | */ | ||
174 | virtual void calc( | ||
175 | const boost::shared_ptr<DifferentialActionDataAbstract>& data, | ||
176 | const Eigen::Ref<const VectorXs>& x); | ||
177 | |||
178 | /** | ||
179 | * @brief Compute the derivatives of the dynamics and cost functions | ||
180 | * | ||
181 | * It computes the partial derivatives of the dynamical system and the cost | ||
182 | * function. It assumes that `calc()` has been run first. This function builds | ||
183 | * a quadratic approximation of the time-continuous action model (i.e. | ||
184 | * dynamical system and cost function). | ||
185 | * | ||
186 | * @param[in] data Differential action data | ||
187 | * @param[in] x State point \f$\mathbf{x}\in\mathbb{R}^{ndx}\f$ | ||
188 | * @param[in] u Control input \f$\mathbf{u}\in\mathbb{R}^{nu}\f$ | ||
189 | */ | ||
190 | virtual void calcDiff( | ||
191 | const boost::shared_ptr<DifferentialActionDataAbstract>& data, | ||
192 | const Eigen::Ref<const VectorXs>& x, | ||
193 | const Eigen::Ref<const VectorXs>& u) = 0; | ||
194 | |||
195 | /** | ||
196 | * @brief Compute the derivatives of the cost functions with respect to the | ||
197 | * state only | ||
198 | * | ||
199 | * It updates the derivatives of the cost function with respect to the state | ||
200 | * only. This function is used in the terminal nodes of an optimal control | ||
201 | * problem. | ||
202 | * | ||
203 | * @param[in] data Differential action data | ||
204 | * @param[in] x State point \f$\mathbf{x}\in\mathbb{R}^{ndx}\f$ | ||
205 | */ | ||
206 | virtual void calcDiff( | ||
207 | const boost::shared_ptr<DifferentialActionDataAbstract>& data, | ||
208 | const Eigen::Ref<const VectorXs>& x); | ||
209 | |||
210 | /** | ||
211 | * @brief Create the differential action data | ||
212 | * | ||
213 | * @return the differential action data | ||
214 | */ | ||
215 | virtual boost::shared_ptr<DifferentialActionDataAbstract> createData(); | ||
216 | |||
217 | /** | ||
218 | * @brief Checks that a specific data belongs to this model | ||
219 | */ | ||
220 | virtual bool checkData( | ||
221 | const boost::shared_ptr<DifferentialActionDataAbstract>& data); | ||
222 | |||
223 | /** | ||
224 | * @brief Computes the quasic static commands | ||
225 | * | ||
226 | * The quasic static commands are the ones produced for a the reference | ||
227 | * posture as an equilibrium point, i.e. for | ||
228 | * \f$\mathbf{f}(\mathbf{q},\mathbf{v}=\mathbf{0},\mathbf{u})=\mathbf{0}\f$ | ||
229 | * | ||
230 | * @param[in] data Differential action data | ||
231 | * @param[out] u Quasic static commands | ||
232 | * @param[in] x State point (velocity has to be zero) | ||
233 | * @param[in] maxiter Maximum allowed number of iterations | ||
234 | * @param[in] tol Tolerance | ||
235 | */ | ||
236 | virtual void quasiStatic( | ||
237 | const boost::shared_ptr<DifferentialActionDataAbstract>& data, | ||
238 | Eigen::Ref<VectorXs> u, const Eigen::Ref<const VectorXs>& x, | ||
239 | const std::size_t maxiter = 100, const Scalar tol = Scalar(1e-9)); | ||
240 | |||
241 | /** | ||
242 | * @copybrief quasicStatic() | ||
243 | * | ||
244 | * @copydetails quasicStatic() | ||
245 | * | ||
246 | * @param[in] data Differential action data | ||
247 | * @param[in] x State point (velocity has to be zero) | ||
248 | * @param[in] maxiter Maximum allowed number of iterations | ||
249 | * @param[in] tol Tolerance | ||
250 | * @return Quasic static commands | ||
251 | */ | ||
252 | VectorXs quasiStatic_x( | ||
253 | const boost::shared_ptr<DifferentialActionDataAbstract>& data, | ||
254 | const VectorXs& x, const std::size_t maxiter = 100, | ||
255 | const Scalar tol = Scalar(1e-9)); | ||
256 | |||
257 | /** | ||
258 | * @brief Return the dimension of the control input | ||
259 | */ | ||
260 | std::size_t get_nu() const; | ||
261 | |||
262 | /** | ||
263 | * @brief Return the dimension of the cost-residual vector | ||
264 | */ | ||
265 | std::size_t get_nr() const; | ||
266 | |||
267 | /** | ||
268 | * @brief Return the number of inequality constraints | ||
269 | */ | ||
270 | virtual std::size_t get_ng() const; | ||
271 | |||
272 | /** | ||
273 | * @brief Return the number of equality constraints | ||
274 | */ | ||
275 | virtual std::size_t get_nh() const; | ||
276 | |||
277 | /** | ||
278 | * @brief Return the number of inequality terminal constraints | ||
279 | */ | ||
280 | virtual std::size_t get_ng_T() const; | ||
281 | |||
282 | /** | ||
283 | * @brief Return the number of equality terminal constraints | ||
284 | */ | ||
285 | virtual std::size_t get_nh_T() const; | ||
286 | |||
287 | /** | ||
288 | * @brief Return the state | ||
289 | */ | ||
290 | const boost::shared_ptr<StateAbstract>& get_state() const; | ||
291 | |||
292 | /** | ||
293 | * @brief Return the lower bound of the inequality constraints | ||
294 | */ | ||
295 | virtual const VectorXs& get_g_lb() const; | ||
296 | |||
297 | /** | ||
298 | * @brief Return the upper bound of the inequality constraints | ||
299 | */ | ||
300 | virtual const VectorXs& get_g_ub() const; | ||
301 | |||
302 | /** | ||
303 | * @brief Return the control lower bound | ||
304 | */ | ||
305 | const VectorXs& get_u_lb() const; | ||
306 | |||
307 | /** | ||
308 | * @brief Return the control upper bound | ||
309 | */ | ||
310 | const VectorXs& get_u_ub() const; | ||
311 | |||
312 | /** | ||
313 | * @brief Indicates if there are defined control limits | ||
314 | */ | ||
315 | bool get_has_control_limits() const; | ||
316 | |||
317 | /** | ||
318 | * @brief Modify the lower bound of the inequality constraints | ||
319 | */ | ||
320 | void set_g_lb(const VectorXs& g_lb); | ||
321 | |||
322 | /** | ||
323 | * @brief Modify the upper bound of the inequality constraints | ||
324 | */ | ||
325 | void set_g_ub(const VectorXs& g_ub); | ||
326 | |||
327 | /** | ||
328 | * @brief Modify the control lower bounds | ||
329 | */ | ||
330 | void set_u_lb(const VectorXs& u_lb); | ||
331 | |||
332 | /** | ||
333 | * @brief Modify the control upper bounds | ||
334 | */ | ||
335 | void set_u_ub(const VectorXs& u_ub); | ||
336 | |||
337 | /** | ||
338 | * @brief Print information on the differential action model | ||
339 | */ | ||
340 | template <class Scalar> | ||
341 | friend std::ostream& operator<<( | ||
342 | std::ostream& os, | ||
343 | const DifferentialActionModelAbstractTpl<Scalar>& model); | ||
344 | |||
345 | /** | ||
346 | * @brief Print relevant information of the differential action model | ||
347 | * | ||
348 | * @param[out] os Output stream object | ||
349 | */ | ||
350 | virtual void print(std::ostream& os) const; | ||
351 | |||
352 | private: | ||
353 | std::size_t ng_internal_; //!< Internal object for storing the number of | ||
354 | //!< inequality constraints | ||
355 | std::size_t nh_internal_; //!< Internal object for storing the number of | ||
356 | //!< equality constraints | ||
357 | |||
358 | protected: | ||
359 | std::size_t nu_; //!< Control dimension | ||
360 | std::size_t nr_; //!< Dimension of the cost residual | ||
361 | std::size_t ng_; //!< Number of inequality constraints | ||
362 | std::size_t nh_; //!< Number of equality constraints | ||
363 | std::size_t ng_T_; //!< Number of inequality terminal constraints | ||
364 | std::size_t nh_T_; //!< Number of equality terminal constraints | ||
365 | boost::shared_ptr<StateAbstract> state_; //!< Model of the state | ||
366 | VectorXs unone_; //!< Neutral state | ||
367 | VectorXs g_lb_; //!< Lower bound of the inequality constraints | ||
368 | VectorXs g_ub_; //!< Lower bound of the inequality constraints | ||
369 | VectorXs u_lb_; //!< Lower control limits | ||
370 | VectorXs u_ub_; //!< Upper control limits | ||
371 | bool has_control_limits_; //!< Indicates whether any of the control limits is | ||
372 | //!< finite | ||
373 | |||
374 | /** | ||
375 | * @brief Update the status of the control limits (i.e. if there are defined | ||
376 | * limits) | ||
377 | */ | ||
378 | void update_has_control_limits(); | ||
379 | |||
380 | template <class Scalar> | ||
381 | friend class IntegratedActionModelAbstractTpl; | ||
382 | template <class Scalar> | ||
383 | friend class ConstraintModelManagerTpl; | ||
384 | }; | ||
385 | |||
386 | template <typename _Scalar> | ||
387 | struct DifferentialActionDataAbstractTpl { | ||
388 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW | ||
389 | |||
390 | typedef _Scalar Scalar; | ||
391 | typedef MathBaseTpl<Scalar> MathBase; | ||
392 | typedef typename MathBase::VectorXs VectorXs; | ||
393 | typedef typename MathBase::MatrixXs MatrixXs; | ||
394 | |||
395 | template <template <typename Scalar> class Model> | ||
396 | 224018 | explicit DifferentialActionDataAbstractTpl(Model<Scalar>* const model) | |
397 | 224018 | : cost(Scalar(0.)), | |
398 |
1/2✓ Branch 3 taken 112009 times.
✗ Branch 4 not taken.
|
224018 | xout(model->get_state()->get_nv()), |
399 |
1/2✓ Branch 7 taken 112009 times.
✗ Branch 8 not taken.
|
224018 | Fx(model->get_state()->get_nv(), model->get_state()->get_ndx()), |
400 |
1/2✓ Branch 5 taken 112009 times.
✗ Branch 6 not taken.
|
224018 | Fu(model->get_state()->get_nv(), model->get_nu()), |
401 |
1/2✓ Branch 2 taken 112009 times.
✗ Branch 3 not taken.
|
224018 | r(model->get_nr()), |
402 |
1/2✓ Branch 4 taken 112009 times.
✗ Branch 5 not taken.
|
224018 | Lx(model->get_state()->get_ndx()), |
403 |
1/2✓ Branch 2 taken 112009 times.
✗ Branch 3 not taken.
|
224018 | Lu(model->get_nu()), |
404 |
1/2✓ Branch 7 taken 112009 times.
✗ Branch 8 not taken.
|
224018 | Lxx(model->get_state()->get_ndx(), model->get_state()->get_ndx()), |
405 |
1/2✓ Branch 5 taken 112009 times.
✗ Branch 6 not taken.
|
224018 | Lxu(model->get_state()->get_ndx(), model->get_nu()), |
406 |
1/2✓ Branch 3 taken 112009 times.
✗ Branch 4 not taken.
|
224018 | Luu(model->get_nu(), model->get_nu()), |
407 |
4/10✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 112009 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 112009 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 12 taken 112009 times.
✗ Branch 13 not taken.
|
448036 | g(model->get_ng() > model->get_ng_T() ? model->get_ng() |
408 |
1/2✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
|
224018 | : model->get_ng_T()), |
409 |
3/8✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 112009 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 9 taken 112009 times.
✗ Branch 10 not taken.
|
448036 | Gx(model->get_ng() > model->get_ng_T() ? model->get_ng() |
410 |
1/2✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
|
224018 | : model->get_ng_T(), |
411 |
1/2✓ Branch 4 taken 112009 times.
✗ Branch 5 not taken.
|
224018 | model->get_state()->get_ndx()), |
412 |
3/8✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 112009 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 9 taken 112009 times.
✗ Branch 10 not taken.
|
448036 | Gu(model->get_ng() > model->get_ng_T() ? model->get_ng() |
413 |
1/2✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
|
224018 | : model->get_ng_T(), |
414 |
1/2✓ Branch 2 taken 112009 times.
✗ Branch 3 not taken.
|
224018 | model->get_nu()), |
415 |
6/10✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 112009 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 34667 times.
✓ Branch 7 taken 77342 times.
✓ Branch 9 taken 34667 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 112009 times.
✗ Branch 13 not taken.
|
378702 | h(model->get_nh() > model->get_nh_T() ? model->get_nh() |
416 |
1/2✓ Branch 1 taken 77342 times.
✗ Branch 2 not taken.
|
154684 | : model->get_nh_T()), |
417 |
5/8✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 34667 times.
✓ Branch 4 taken 77342 times.
✓ Branch 6 taken 34667 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 112009 times.
✗ Branch 10 not taken.
|
378702 | Hx(model->get_nh() > model->get_nh_T() ? model->get_nh() |
418 |
1/2✓ Branch 1 taken 77342 times.
✗ Branch 2 not taken.
|
154684 | : model->get_nh_T(), |
419 |
1/2✓ Branch 4 taken 112009 times.
✗ Branch 5 not taken.
|
224018 | model->get_state()->get_ndx()), |
420 |
5/8✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 34667 times.
✓ Branch 4 taken 77342 times.
✓ Branch 6 taken 34667 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 112009 times.
✗ Branch 10 not taken.
|
378702 | Hu(model->get_nh() > model->get_nh_T() ? model->get_nh() |
421 |
1/2✓ Branch 1 taken 77342 times.
✗ Branch 2 not taken.
|
154684 | : model->get_nh_T(), |
422 |
1/2✓ Branch 3 taken 112009 times.
✗ Branch 4 not taken.
|
448036 | model->get_nu()) { |
423 |
1/2✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
|
224018 | xout.setZero(); |
424 |
1/2✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
|
224018 | Fx.setZero(); |
425 |
1/2✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
|
224018 | Fu.setZero(); |
426 |
1/2✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
|
224018 | r.setZero(); |
427 |
1/2✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
|
224018 | Lx.setZero(); |
428 |
1/2✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
|
224018 | Lu.setZero(); |
429 |
1/2✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
|
224018 | Lxx.setZero(); |
430 |
1/2✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
|
224018 | Lxu.setZero(); |
431 |
1/2✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
|
224018 | Luu.setZero(); |
432 |
1/2✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
|
224018 | g.setZero(); |
433 |
1/2✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
|
224018 | Gx.setZero(); |
434 |
1/2✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
|
224018 | Gu.setZero(); |
435 |
1/2✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
|
224018 | h.setZero(); |
436 |
1/2✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
|
224018 | Hx.setZero(); |
437 |
1/2✓ Branch 1 taken 112009 times.
✗ Branch 2 not taken.
|
224018 | Hu.setZero(); |
438 | 224018 | } | |
439 | 112009 | virtual ~DifferentialActionDataAbstractTpl() {} | |
440 | |||
441 | Scalar cost; //!< cost value | ||
442 | VectorXs xout; //!< evolution state | ||
443 | MatrixXs Fx; //!< Jacobian of the dynamics w.r.t. the state \f$\mathbf{x}\f$ | ||
444 | MatrixXs | ||
445 | Fu; //!< Jacobian of the dynamics w.r.t. the control \f$\mathbf{u}\f$ | ||
446 | VectorXs r; //!< Cost residual | ||
447 | VectorXs Lx; //!< Jacobian of the cost w.r.t. the state \f$\mathbf{x}\f$ | ||
448 | VectorXs Lu; //!< Jacobian of the cost w.r.t. the control \f$\mathbf{u}\f$ | ||
449 | MatrixXs Lxx; //!< Hessian of the cost w.r.t. the state \f$\mathbf{x}\f$ | ||
450 | MatrixXs Lxu; //!< Hessian of the cost w.r.t. the state \f$\mathbf{x}\f$ and | ||
451 | //!< control u | ||
452 | MatrixXs Luu; //!< Hessian of the cost w.r.t. the control \f$\mathbf{u}\f$ | ||
453 | VectorXs g; //!< Inequality constraint values | ||
454 | MatrixXs Gx; //!< Jacobian of the inequality constraint w.r.t. the state | ||
455 | //!< \f$\mathbf{x}\f$ | ||
456 | MatrixXs Gu; //!< Jacobian of the inequality constraint w.r.t. the control | ||
457 | //!< \f$\mathbf{u}\f$ | ||
458 | VectorXs h; //!< Equality constraint values | ||
459 | MatrixXs Hx; //!< Jacobian of the equality constraint w.r.t. the state | ||
460 | //!< \f$\mathbf{x}\f$ | ||
461 | MatrixXs Hu; //!< Jacobian of the equality constraint w.r.t the control | ||
462 | //!< \f$\mathbf{u}\f$ | ||
463 | }; | ||
464 | |||
465 | } // namespace crocoddyl | ||
466 | |||
467 | /* --- Details -------------------------------------------------------------- */ | ||
468 | /* --- Details -------------------------------------------------------------- */ | ||
469 | /* --- Details -------------------------------------------------------------- */ | ||
470 | #include "crocoddyl/core/diff-action-base.hxx" | ||
471 | |||
472 | #endif // CROCODDYL_CORE_DIFF_ACTION_BASE_HPP_ | ||
473 |