19 #ifndef ROBOTIS_MANIPULATOR_LOG_H 20 #define ROBOTIS_MANIPULATOR_LOG_H 25 #if defined(__OPENCR__) 30 #define DEBUG SerialBT2 34 #define ANSI_COLOR_RED "\x1b[31m" 35 #define ANSI_COLOR_GREEN "\x1b[32m" 36 #define ANSI_COLOR_YELLOW "\x1b[33m" 37 #define ANSI_COLOR_BLUE "\x1b[34m" 38 #define ANSI_COLOR_MAGENTA "\x1b[35m" 39 #define ANSI_COLOR_CYAN "\x1b[36m" 40 #define ANSI_COLOR_RESET "\x1b[0m" 43 #if defined(__OPENCR__) 54 void print(
STRING str,
double data, uint8_t decimal_point = 3,
STRING color =
"DEFAULT");
55 void print(
const char* str,
STRING color =
"DEFAULT");
56 void print(
const char* str,
double data, uint8_t decimal_point = 3,
STRING color =
"DEFAULT");
61 void println(
const char* str,
double data, uint8_t decimal_point = 3,
STRING color =
"DEFAULT");
64 void info(
STRING str,
double data, uint8_t decimal_point = 3);
65 void info(
const char* str);
66 void info(
const char* str,
double data, uint8_t decimal_point = 3);
68 void warn(
STRING str,
double data, uint8_t decimal_point = 3);
69 void warn(
const char* str);
70 void warn(
const char* str,
double data, uint8_t decimal_point = 3);
72 void error(
STRING str,
double data, uint8_t decimal_point = 3);
73 void error(
const char* str);
74 void error(
const char* str,
double data, uint8_t decimal_point = 3);
76 template <
typename T>
void print_vector(std::vector<T> &vec, uint8_t decimal_point = 3)
78 #if defined(__OPENCR__) 80 for (uint8_t i = 0; i < vec.size(); i++)
82 DEBUG.print(vec.at(i), decimal_point);
90 for (uint8_t i = 0; i < vec.size(); i++)
92 printf(
"%.*lf", decimal_point, vec.at(i));
101 template <
typename vector>
void print_vector(vector &vec, uint8_t decimal_point = 3)
103 #if defined(__OPENCR__) 105 for (uint8_t i = 0; i < vec.size(); i++)
107 DEBUG.print(vec(i), decimal_point);
108 if(i != vec.size()-1)
115 for (uint8_t i = 0; i < vec.size(); i++)
117 printf(
"%.*lf", decimal_point, vec(i));
118 if(i != vec.size()-1)
126 template <
typename matrix>
void print_matrix(matrix &m, uint8_t decimal_point = 3)
128 #if defined(__OPENCR__) 130 for (uint8_t i = 0; i < m.rows(); i++)
136 for (uint8_t j = 0; j < m.cols(); j++)
138 DEBUG.print(m(i, j), decimal_point);
149 for (uint8_t i = 0; i < m.rows(); i++)
155 for (uint8_t j = 0; j < m.cols(); j++)
157 printf(
"%.*lf", decimal_point, m(i, j));
172 #endif // ROBOTIS_MANIPULATOR_LOG_H
void println(STRING str, STRING color="DEFAULT")
void print_vector(std::vector< T > &vec, uint8_t decimal_point=3)
void print(STRING str, STRING color="DEFAULT")
void print_matrix(matrix &m, uint8_t decimal_point=3)