crocoddyl 1.9.0
Contact RObot COntrol by Differential DYnamic programming Library (Crocoddyl)
 
Loading...
Searching...
No Matches
callbacks.cpp
1
2// BSD 3-Clause License
3//
4// Copyright (C) 2019-2021, LAAS-CNRS, University of Edinburgh
5// Copyright note valid unless otherwise stated in individual files.
6// All rights reserved.
8
9#include "crocoddyl/core/utils/callbacks.hpp"
10
11namespace crocoddyl {
12
13CallbackVerbose::CallbackVerbose(VerboseLevel level) : CallbackAbstract(), level(level) {}
14
15CallbackVerbose::~CallbackVerbose() {}
16
17void CallbackVerbose::operator()(SolverAbstract& solver) {
18 if (solver.get_iter() % 10 == 0) {
19 std::cout << "iter cost stop grad xreg ureg step ||ffeas||";
20 switch (level) {
21 case _2: {
22 std::cout << " dV-exp dV";
23 break;
24 }
25 default: {}
26 }
27 std::cout << std::endl;
28 }
29
30 std::cout << std::setw(4) << solver.get_iter() << " ";
31 std::cout << std::scientific << std::setprecision(5) << solver.get_cost() << " ";
32 std::cout << solver.get_stop() << " " << -solver.get_d()[1] << " ";
33 std::cout << solver.get_xreg() << " " << solver.get_ureg() << " ";
34 std::cout << std::fixed << std::setprecision(4) << solver.get_steplength() << " ";
35 std::cout << std::scientific << std::setprecision(5) << solver.get_ffeas();
36 switch (level) {
37 case _2: {
38 std::cout << " " << std::scientific << std::setprecision(5) << solver.get_dVexp() << " ";
39 std::cout << solver.get_dV();
40 break;
41 }
42 default: {}
43 }
44 std::cout << std::endl;
45 std::cout << std::flush;
46}
47
48} // namespace crocoddyl
Abstract class for optimal control solvers.
Definition: solver-base.hpp:51
double get_cost() const
Return the total cost.
double get_xreg() const
Return the state regularization value.
std::size_t get_iter() const
Return the number of iterations performed by the solver.
double get_dVexp() const
Return the expected cost reduction .
double get_steplength() const
Return the step length .
const Eigen::Vector2d & get_d() const
Return the LQ approximation of the expected improvement.
double get_ffeas() const
Return the feasibility of the dynamic constraints of the current guess.
double get_ureg() const
Return the control regularization value.
double get_stop() const
Return the value computed by stoppingCriteria()
double get_dV() const
Return the cost reduction .