bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
print_utils.h
Go to the documentation of this file.
1#ifndef BITSIM_UTILS_IO_PRINT_UTILS_H
2#define BITSIM_UTILS_IO_PRINT_UTILS_H
3
11
12#include "bitsim/bitsim_config.h"
13#include "bitsim/bitsim_types.h"
14
15#include <ostream>
16#include <string>
17
18#ifdef BITSIM_CHRONO
19#include <chrono/core/ChFrame.h>
20#include <chrono/core/ChMatrix33.h>
21#include <chrono/core/ChVector3.h>
22#endif
23
24namespace bitsim
25{
26namespace utils
27{
28namespace io
29{
30
34real_t clean(real_t x, real_t zero = 5.0e-4);
35
39void print_title(const std::string &title, std::ostream &out);
40void print_title(const std::string &title);
41
45void print_number(const std::string &label, real_t value, int width = 26);
46
50void print_flag(const std::string &label, bool value, int width = 26);
51
55void print_error(const std::string &label, real_t value, int width = 26);
56
60void print_value(const std::string &label, real_t value, const std::string &unit, int precision = 3,
61 int width = 30);
62
63#ifdef BITSIM_CHRONO
64
68std::string to_string(const chrono::ChVector3d &v);
69
73void print_vector(const std::string &label, const chrono::ChVector3d &v, int width = 26);
74
78void print_matrix(const std::string &label, const chrono::ChMatrix33d &R);
79
84void print_frame(const std::string &label, const chrono::ChFrame<> &frame, int width = 14);
85
86#endif // BITSIM_CHRONO
87
88} // namespace io
89} // namespace utils
90
95std::ostream &operator<<(std::ostream &out, const Null &);
96
97} // namespace bitsim
98
99#endif // BITSIM_UTILS_IO_PRINT_UTILS_H
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
Definition csv_file_reader.cpp:12
void print_error(const std::string &label, real_t value, int width)
The label and the value in scientific notation with one decimal, for small errors.
Definition print_utils.cpp:33
void print_flag(const std::string &label, bool value, int width)
The label and true or false.
Definition print_utils.cpp:27
std::string to_string(const chrono::ChVector3d &v)
"(x, y, z)" with 3 decimals
Definition print_utils.cpp:48
void print_number(const std::string &label, real_t value, int width)
The label and the value, with 3 decimals.
Definition print_utils.cpp:21
std::ostream & print_vector(std::ostream &out, const std::vector< T > &obs)
Definition io_utils.h:21
void print_matrix(const std::string &label, const chrono::ChMatrix33d &R)
The label on a line of its own, then the three rows of the matrix.
Definition print_utils.cpp:61
real_t clean(real_t x, real_t zero)
x, or 0 when zero
Definition print_utils.cpp:15
void print_title(const std::string &title, std::ostream &out)
An empty line and then the title.
Definition print_utils.cpp:17
void print_value(const std::string &label, real_t value, const std::string &unit, int precision, int width)
The label, the value right-aligned with the given decimals, and the unit.
Definition print_utils.cpp:39
void print_frame(const std::string &label, const chrono::ChFrame<> &frame, int width)
The label, the origin of the frame and its three axes, as seen from its parent: the columns of its ro...
Definition print_utils.cpp:75
Definition bitsim_utils.h:11
Definition dc_motor_backend_base.h:9
std::ostream & operator<<(std::ostream &out, const std::chrono::system_clock::time_point &tp)
Definition io_utils.h:65
double real_t
real_t
Definition bitsim_types.h:20
Null placeholder.
Definition bitsim_types.h:179