robotis_manipulator_log.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright 2018 ROBOTIS CO., LTD.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *******************************************************************************/
16 
17 /* Authors: Darby Lim, Hye-Jong KIM, Ryan Shim, Yong-Ho Na */
18 
19 #include "../../include/robotis_manipulator/robotis_manipulator_log.h"
20 
22 {
23 #if defined(__OPENCR__)
24  DEBUG.print(str);
25 #else
26  if(color == "RED") printf(ANSI_COLOR_RED);
27  else if(color == "GREEN") printf(ANSI_COLOR_GREEN);
28  else if(color == "YELLOW") printf(ANSI_COLOR_YELLOW);
29  else if(color == "BLUE") printf(ANSI_COLOR_BLUE);
30  else if(color == "MAGENTA") printf(ANSI_COLOR_MAGENTA);
31  else if(color == "CYAN") printf(ANSI_COLOR_CYAN);
32  printf("%s", str.c_str());
33  printf(ANSI_COLOR_RESET);
34 #endif
35 }
36 void robotis_manipulator::log::print(STRING str, double data, uint8_t decimal_point, STRING color)
37 {
38 #if defined(__OPENCR__)
39  DEBUG.print(str);
40  DEBUG.print(data, decimal_point);
41 #else
42  if(color == "RED") printf(ANSI_COLOR_RED);
43  else if(color == "GREEN") printf(ANSI_COLOR_GREEN);
44  else if(color == "YELLOW") printf(ANSI_COLOR_YELLOW);
45  else if(color == "BLUE") printf(ANSI_COLOR_BLUE);
46  else if(color == "MAGENTA") printf(ANSI_COLOR_MAGENTA);
47  else if(color == "CYAN") printf(ANSI_COLOR_CYAN);
48  printf("%s %.*lf", str.c_str(), decimal_point, data);
49  printf(ANSI_COLOR_RESET);
50 #endif
51 }
52 void robotis_manipulator::log::print(const char* str, STRING color)
53 {
54 #if defined(__OPENCR__)
55  DEBUG.print(str);
56 #else
57  if(color == "RED") printf(ANSI_COLOR_RED);
58  else if(color == "GREEN") printf(ANSI_COLOR_GREEN);
59  else if(color == "YELLOW") printf(ANSI_COLOR_YELLOW);
60  else if(color == "BLUE") printf(ANSI_COLOR_BLUE);
61  else if(color == "MAGENTA") printf(ANSI_COLOR_MAGENTA);
62  else if(color == "CYAN") printf(ANSI_COLOR_CYAN);
63  printf("%s", str);
64  printf(ANSI_COLOR_RESET);
65 #endif
66 }
67 void robotis_manipulator::log::print(const char* str, double data, uint8_t decimal_point, STRING color)
68 {
69 #if defined(__OPENCR__)
70  DEBUG.print(str);
71  DEBUG.print(data, decimal_point);
72 #else
73  if(color == "RED") printf(ANSI_COLOR_RED);
74  else if(color == "GREEN") printf(ANSI_COLOR_GREEN);
75  else if(color == "YELLOW") printf(ANSI_COLOR_YELLOW);
76  else if(color == "BLUE") printf(ANSI_COLOR_BLUE);
77  else if(color == "MAGENTA") printf(ANSI_COLOR_MAGENTA);
78  else if(color == "CYAN") printf(ANSI_COLOR_CYAN);
79  printf("%s %.*lf", str, decimal_point, data);
80  printf(ANSI_COLOR_RESET);
81 #endif
82 }
83 
84 
86 {
87 #if defined(__OPENCR__)
88  DEBUG.println(str);
89 #else
90  if(color == "RED") printf(ANSI_COLOR_RED);
91  else if(color == "GREEN") printf(ANSI_COLOR_GREEN);
92  else if(color == "YELLOW") printf(ANSI_COLOR_YELLOW);
93  else if(color == "BLUE") printf(ANSI_COLOR_BLUE);
94  else if(color == "MAGENTA") printf(ANSI_COLOR_MAGENTA);
95  else if(color == "CYAN") printf(ANSI_COLOR_CYAN);
96  printf("%s\n", str.c_str());
97  printf(ANSI_COLOR_RESET);
98 #endif
99 }
100 void robotis_manipulator::log::println(STRING str, double data, uint8_t decimal_point, STRING color)
101 {
102 #if defined(__OPENCR__)
103  DEBUG.print(str);
104  DEBUG.println(data, decimal_point);
105 #else
106  if(color == "RED") printf(ANSI_COLOR_RED);
107  else if(color == "GREEN") printf(ANSI_COLOR_GREEN);
108  else if(color == "YELLOW") printf(ANSI_COLOR_YELLOW);
109  else if(color == "BLUE") printf(ANSI_COLOR_BLUE);
110  else if(color == "MAGENTA") printf(ANSI_COLOR_MAGENTA);
111  else if(color == "CYAN") printf(ANSI_COLOR_CYAN);
112  printf("%s %.*lf\n", str.c_str(), decimal_point, data);
113  printf(ANSI_COLOR_RESET);
114 #endif
115 }
116 void robotis_manipulator::log::println(const char* str, STRING color)
117 {
118 #if defined(__OPENCR__)
119  DEBUG.println(str);
120 #else
121  if(color == "RED") printf(ANSI_COLOR_RED);
122  else if(color == "GREEN") printf(ANSI_COLOR_GREEN);
123  else if(color == "YELLOW") printf(ANSI_COLOR_YELLOW);
124  else if(color == "BLUE") printf(ANSI_COLOR_BLUE);
125  else if(color == "MAGENTA") printf(ANSI_COLOR_MAGENTA);
126  else if(color == "CYAN") printf(ANSI_COLOR_CYAN);
127  printf("%s\n", str);
128  printf(ANSI_COLOR_RESET);
129 #endif
130 }
131 void robotis_manipulator::log::println(const char* str, double data, uint8_t decimal_point, STRING color)
132 {
133 #if defined(__OPENCR__)
134  DEBUG.print(str);
135  DEBUG.println(data, decimal_point);
136 #else
137  if(color == "RED") printf(ANSI_COLOR_RED);
138  else if(color == "GREEN") printf(ANSI_COLOR_GREEN);
139  else if(color == "YELLOW") printf(ANSI_COLOR_YELLOW);
140  else if(color == "BLUE") printf(ANSI_COLOR_BLUE);
141  else if(color == "MAGENTA") printf(ANSI_COLOR_MAGENTA);
142  else if(color == "CYAN") printf(ANSI_COLOR_CYAN);
143  printf("%s %.*lf\n", str, decimal_point, data);
144  printf(ANSI_COLOR_RESET);
145 #endif
146 }
147 
149 {
150 #if defined(__OPENCR__)
151  DEBUG.print("[INFO] ");
152  DEBUG.println(str);
153 #else
154  printf("[INFO] %s\n", str.c_str());
155 #endif
156 }
157 void robotis_manipulator::log::info(STRING str, double data, uint8_t decimal_point)
158 {
159 #if defined(__OPENCR__)
160  DEBUG.print("[INFO] ");
161  DEBUG.print(str);
162  DEBUG.println(data, decimal_point);
163 #else
164  printf("[INFO] %s %.*lf\n", str.c_str(), decimal_point, data);
165 #endif
166 }
167 void robotis_manipulator::log::info(const char* str)
168 {
169 #if defined(__OPENCR__)
170  DEBUG.print("[INFO] ");
171  DEBUG.println(str);
172 #else
173  printf("[INFO] %s\n", str);
174 #endif
175 }
176 void robotis_manipulator::log::info(const char* str, double data, uint8_t decimal_point)
177 {
178 #if defined(__OPENCR__)
179  DEBUG.print("[INFO] ");
180  DEBUG.print(str);
181  DEBUG.println(data, decimal_point);
182 #else
183  printf("[INFO] %s %.*lf\n", str, decimal_point, data);
184 #endif
185 }
187 {
188 #if defined(__OPENCR__)
189  DEBUG.print("[WARN] ");
190  DEBUG.println(str);
191 #else
192  printf(ANSI_COLOR_YELLOW);
193  printf("[WARN] %s\n", str.c_str());
194  printf(ANSI_COLOR_RESET);
195 #endif
196 }
197 void robotis_manipulator::log::warn(STRING str, double data, uint8_t decimal_point)
198 {
199 #if defined(__OPENCR__)
200  DEBUG.print("[WARN] ");
201  DEBUG.print(str);
202  DEBUG.println(data, decimal_point);
203 #else
204  printf(ANSI_COLOR_YELLOW);
205  printf("[WARN] %s %.*lf\n",str.c_str(), decimal_point, data);
206  printf(ANSI_COLOR_RESET);
207 #endif
208 }
209 void robotis_manipulator::log::warn(const char* str)
210 {
211 #if defined(__OPENCR__)
212  DEBUG.print("[WARN] ");
213  DEBUG.println(str);
214 #else
215  printf(ANSI_COLOR_YELLOW);
216  printf("[WARN] %s\n", str);
217  printf(ANSI_COLOR_RESET);
218 #endif
219 }
220 void robotis_manipulator::log::warn(const char* str, double data, uint8_t decimal_point)
221 {
222 #if defined(__OPENCR__)
223  DEBUG.print("[WARN] ");
224  DEBUG.print(str);
225  DEBUG.println(data, decimal_point);
226 #else
227  printf(ANSI_COLOR_YELLOW);
228  printf("[WARN] %s %.*lf\n", str, decimal_point, data);
229  printf(ANSI_COLOR_RESET);
230 #endif
231 }
233 {
234 #if defined(__OPENCR__)
235  DEBUG.print("[ERROR] ");
236  DEBUG.println(str);
237 #else
238  printf(ANSI_COLOR_RED);
239  printf("[ERROR] %s\n", str.c_str());
240  printf(ANSI_COLOR_RESET);
241 #endif
242 }
243 void robotis_manipulator::log::error(STRING str, double data, uint8_t decimal_point)
244 {
245 #if defined(__OPENCR__)
246  DEBUG.print("[ERROR] ");
247  DEBUG.print(str);
248  DEBUG.println(data, decimal_point);
249 #else
250  printf(ANSI_COLOR_RED);
251  printf("[ERROR] %s %.*lf\n", str.c_str(), decimal_point, data);
252  printf(ANSI_COLOR_RESET);
253 #endif
254 }
255 
256 void robotis_manipulator::log::error(const char* str)
257 {
258 #if defined(__OPENCR__)
259  DEBUG.print("[ERROR] ");
260  DEBUG.println(str);
261 #else
262  printf(ANSI_COLOR_RED);
263  printf("[ERROR] %s\n", str);
264  printf(ANSI_COLOR_RESET);
265 #endif
266 }
267 void robotis_manipulator::log::error(const char* str, double data, uint8_t decimal_point)
268 {
269 #if defined(__OPENCR__)
270  DEBUG.print("[ERROR] ");
271  DEBUG.print(str);
272  DEBUG.println(data, decimal_point);
273 #else
274  printf(ANSI_COLOR_RED);
275  printf("[ERROR] %s %.*lf\n", str, decimal_point, data);
276  printf(ANSI_COLOR_RESET);
277 #endif
278 }
#define ANSI_COLOR_YELLOW
void println(STRING str, STRING color="DEFAULT")
#define ANSI_COLOR_RED
#define ANSI_COLOR_GREEN
#define ANSI_COLOR_CYAN
#define ANSI_COLOR_RESET
void print(STRING str, STRING color="DEFAULT")
#define ANSI_COLOR_MAGENTA
#define ANSI_COLOR_BLUE
std::string STRING


robotis_manipulator
Author(s): Hye-Jong KIM , Darby Lim , Yong-Ho Na , Ryan Shim
autogenerated on Sat Oct 3 2020 03:14:51