25 #ifndef ROBOTIS_MANIPULATOR_LOG_H 26 #define ROBOTIS_MANIPULATOR_LOG_H 31 #if defined(__OPENCR__) 36 #define DEBUG SerialBT2 40 #define ANSI_COLOR_RED "\x1b[31m" 41 #define ANSI_COLOR_GREEN "\x1b[32m" 42 #define ANSI_COLOR_YELLOW "\x1b[33m" 43 #define ANSI_COLOR_BLUE "\x1b[34m" 44 #define ANSI_COLOR_MAGENTA "\x1b[35m" 45 #define ANSI_COLOR_CYAN "\x1b[36m" 46 #define ANSI_COLOR_RESET "\x1b[0m" 49 #if defined(__OPENCR__) 71 void print(
STRING str,
double data, uint8_t decimal_point = 3,
STRING color =
"DEFAULT");
77 void print(
const char* str,
STRING color =
"DEFAULT");
85 void print(
const char* str,
double data, uint8_t decimal_point = 3,
STRING color =
"DEFAULT");
100 void println(
STRING str,
double data, uint8_t decimal_point = 3,
STRING color =
"DEFAULT");
114 void println(
const char* str,
double data, uint8_t decimal_point = 3,
STRING color =
"DEFAULT");
127 void info(
STRING str,
double data, uint8_t decimal_point = 3);
132 void info(
const char* str);
139 void info(
const char* str,
double data, uint8_t decimal_point = 3);
152 void warn(
STRING str,
double data, uint8_t decimal_point = 3);
157 void warn(
const char* str);
164 void warn(
const char* str,
double data, uint8_t decimal_point = 3);
177 void error(
STRING str,
double data, uint8_t decimal_point = 3);
182 void error(
const char* str);
189 void error(
const char* str,
double data, uint8_t decimal_point = 3);
196 template <
typename T>
void print_vector(std::vector<T> &vec, uint8_t decimal_point = 3)
198 #if defined(__OPENCR__) 200 for (uint8_t i = 0; i < vec.size(); i++)
202 DEBUG.print(vec.at(i), decimal_point);
203 if(i != vec.size()-1)
210 for (uint8_t i = 0; i < vec.size(); i++)
212 printf(
"%.*lf", decimal_point, vec.at(i));
213 if(i != vec.size()-1)
226 template <
typename vector>
void print_vector(vector &vec, uint8_t decimal_point = 3)
228 #if defined(__OPENCR__) 230 for (uint8_t i = 0; i < vec.size(); i++)
232 DEBUG.print(vec(i), decimal_point);
233 if(i != vec.size()-1)
240 for (uint8_t i = 0; i < vec.size(); i++)
242 printf(
"%.*lf", decimal_point, vec(i));
243 if(i != vec.size()-1)
256 template <
typename matrix>
void print_matrix(matrix &m, uint8_t decimal_point = 3)
258 #if defined(__OPENCR__) 260 for (uint8_t i = 0; i < m.rows(); i++)
266 for (uint8_t j = 0; j < m.cols(); j++)
268 DEBUG.print(m(i, j), decimal_point);
279 for (uint8_t i = 0; i < m.rows(); i++)
285 for (uint8_t j = 0; j < m.cols(); j++)
287 printf(
"%.*lf", decimal_point, m(i, j));
302 #endif // ROBOTIS_MANIPULATOR_LOG_H void info(STRING str)
info
void println(STRING str, STRING color="DEFAULT")
println
void print_vector(std::vector< T > &vec, uint8_t decimal_point=3)
print_vector
void print(STRING str, STRING color="DEFAULT")
print
void error(STRING str)
error
void warn(STRING str)
warn
void print_matrix(matrix &m, uint8_t decimal_point=3)
print_matrix