humoto
solution.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4  @copyright 2014-2017 INRIA. Licensed under the Apache License, Version 2.0.
5  (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
6 
7  @brief
8 */
9 
10 
11 #pragma once
12 
13 
14 namespace humoto
15 {
16  namespace qpoases
17  {
18  /**
19  * @brief Solution of a QP.
20  */
22  {
23  public:
24  /// Number of iterations made by the solver
26 
27  /// The return value of qpOASES.
28  qpOASES::returnValue qpoases_return_value_;
29 
30 
31  public:
32  /**
33  * @brief Status description
34  *
35  * @return description of the status if available
36  */
37  std::string getStatusDescription() const
38  {
39  std::string description = qpOASES::MessageHandling::getErrorCodeMessage(qpoases_return_value_);
40 
41  std::stringstream description_stream;
42  description_stream << "(CODE: " << qpoases_return_value_ << ") " << description;
43 
44  return (description_stream.str());
45  }
46 
47 
48  /**
49  * @brief Log a QP problem
50  *
51  * @param[in,out] logger logger
52  * @param[in] parent parent
53  * @param[in] name name
54  */
56  const LogEntryName &parent = LogEntryName(),
57  const std::string &name = "solution") const
58  {
59  LogEntryName subname = parent; subname.add(name);
60 
61  humoto::Solution::log(logger, subname, "");
62 
63  logger.log(LogEntryName(subname).add("number_of_iterations"), number_of_iterations_);
64  logger.log(LogEntryName(subname).add("qpoases_return_value"), qpoases_return_value_);
65  }
66  };
67  }
68 }
#define HUMOTO_LOCAL
Definition: export_import.h:26
Solution of a QP.
Definition: solution.h:21
#define HUMOTO_GLOBAL_LOGGER_IF_DEFINED
Definition: logger.h:997
Container of the solution.
Definition: solution.h:176
Represents log entry name.
Definition: logger.h:169
int number_of_iterations_
Number of iterations made by the solver.
Definition: solution.h:25
qpOASES::returnValue qpoases_return_value_
The return value of qpOASES.
Definition: solution.h:28
void log(humoto::Logger &logger, const LogEntryName &parent=LogEntryName(), const std::string &name="solution") const
Log a QP problem.
Definition: solution.h:55
Threaded logger: any data sent to this logger is wrapped in a message and pushed to a queue...
Definition: logger.h:555
virtual void log(humoto::Logger &logger, const LogEntryName &parent=LogEntryName(), const std::string &name="solution") const
Log a QP problem.
Definition: solution.h:351
The root namespace of HuMoTo.
Definition: config.h:12
LogEntryName & add(const char *name)
extends entry name with a subname
Definition: logger.h:232
std::string getStatusDescription() const
Status description.
Definition: solution.h:37