bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
print_utils.h File Reference

Print labelled values, one per line, as the examples do: two spaces, the label padded to a width, and the value. Numbers smaller than 5e-4 print as 0, so that round-off does not show as -0.000. The overloads for Chrono vectors, matrices and frames need bitsim built with Chrono. More...

#include "bitsim/bitsim_config.h"
#include "bitsim/bitsim_types.h"
#include <ostream>
#include <string>
#include <chrono/core/ChFrame.h>
#include <chrono/core/ChMatrix33.h>
#include <chrono/core/ChVector3.h>
Include dependency graph for print_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  bitsim
namespace  bitsim::utils
namespace  bitsim::utils::io

Functions

real_t bitsim::utils::io::clean (real_t x, real_t zero=5.0e-4)
 x, or 0 when \(|x| <\) zero
void bitsim::utils::io::print_title (const std::string &title, std::ostream &out)
 An empty line and then the title.
void bitsim::utils::io::print_title (const std::string &title)
void bitsim::utils::io::print_number (const std::string &label, real_t value, int width=26)
 The label and the value, with 3 decimals.
void bitsim::utils::io::print_flag (const std::string &label, bool value, int width=26)
 The label and true or false.
void bitsim::utils::io::print_error (const std::string &label, real_t value, int width=26)
 The label and the value in scientific notation with one decimal, for small errors.
void bitsim::utils::io::print_value (const std::string &label, real_t value, const std::string &unit, int precision=3, int width=30)
 The label, the value right-aligned with the given decimals, and the unit.
std::string bitsim::utils::io::to_string (const chrono::ChVector3d &v)
 "(x, y, z)" with 3 decimals
void bitsim::utils::io::print_vector (const std::string &label, const chrono::ChVector3d &v, int width=26)
 The label and the vector as "(x, y, z)".
void bitsim::utils::io::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.
void bitsim::utils::io::print_frame (const std::string &label, const chrono::ChFrame<> &frame, int width=14)
 The label, the origin of the frame and its three axes, as seen from its parent: the columns of its rotation matrix.
std::ostream & bitsim::operator<< (std::ostream &out, const Null &)
 Write "null" for the Null placeholder. It is in namespace bitsim, with Null, so that argument-dependent lookup finds it.

Detailed Description

Print labelled values, one per line, as the examples do: two spaces, the label padded to a width, and the value. Numbers smaller than 5e-4 print as 0, so that round-off does not show as -0.000. The overloads for Chrono vectors, matrices and frames need bitsim built with Chrono.