├── .charts
├── github_branch_2.graphml
└── github_branch_3.graphml
├── .gitignore
├── .images
├── github_branch_2.png
├── github_branch_3.png
└── github_description.png
├── LICENSE
├── README.md
├── md
├── xm_developer_cpp_sytleguide.md
├── xm_developer_github_sytleguide.md
├── xm_developer_python_styleguide.md
└── xm_developer_ros_styleguide.md
└── pdf
├── xm_developer_cpp_styleguide.pdf
├── xm_developer_github_styleguide.pdf
├── xm_developer_python_styleguide.pdf
└── xm_developer_ros_styleguide.pdf
/.charts/github_branch_2.graphml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | Develop/Stable
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 | Reserved b
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 | Master
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 | Reserved a
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
--------------------------------------------------------------------------------
/.charts/github_branch_3.graphml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | Stable
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 | Reserved b
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 | Merge
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 | Master
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 | Develop a
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 | Merge
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 | Develop b
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 | Reserved c
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 | Reserved a
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xm-project/xm_developer_guide/c0b425f394f666ad2c9efb322e05e441575ef292/.gitignore
--------------------------------------------------------------------------------
/.images/github_branch_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xm-project/xm_developer_guide/c0b425f394f666ad2c9efb322e05e441575ef292/.images/github_branch_2.png
--------------------------------------------------------------------------------
/.images/github_branch_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xm-project/xm_developer_guide/c0b425f394f666ad2c9efb322e05e441575ef292/.images/github_branch_3.png
--------------------------------------------------------------------------------
/.images/github_description.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xm-project/xm_developer_guide/c0b425f394f666ad2c9efb322e05e441575ef292/.images/github_description.png
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Software License Agreement (BSD License)
2 |
3 | Copyright (c) 2016, Team-Xmbot-Service-Robot
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions
8 | are met:
9 |
10 | * Redistributions of source code must retain the above copyright
11 | notice, this list of conditions and the following disclaimer.
12 | * Redistributions in binary form must reproduce the above
13 | copyright notice, this list of conditions and the following
14 | disclaimer in the documentation and/or other materials provided
15 | with the distribution.
16 | * Neither the name of the Team-Xmbot-Service-Robot nor the names
17 | of its contributors may be used to endorse or promote products
18 | derived from this software without specific prior written
19 | permission.
20 |
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 | POSSIBILITY OF SUCH DAMAGE.
33 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # xm_developer_guide
2 |
3 | ## Introduction:
4 |
5 | This developer's guide is that our team summarized in the process of developing the xmbot project. It includes C++/Python coding style guide, Github management guide, and ROS developer guide(such as package, CMakelists, msg, srv, aciton, etc).
6 |
7 | - md: Documents are in markdown format.
8 | - pdf: Documents are in pdf format.
9 |
10 | ## Usage:
11 |
12 | Please read these documents carefully!!!
13 |
--------------------------------------------------------------------------------
/md/xm_developer_cpp_sytleguide.md:
--------------------------------------------------------------------------------
1 | # Team-Xmbot-Service-Robot C++风格指南
2 |
3 | ## 0. 前言
4 |
5 | ### 0.1 版本
6 |
7 | - 1.0版本(2016.5.1):缪宇飏(myyerrol)创建团队 C++ 代码开发风格指南。本文档参考了 ROS 和 Google 的 C++ 风格指南,并根据实际的需求,对内容进行了适当的精简和改进。新队员应该认真学习本指南,掌握 C++ 基本的开发风格。如果有细节不统一的地方或者对本文档某处不是很认同,请在组内讨论统一之后,修改本指南。因为文档排版使用的是 Markdown 纯文本标记语言,也请后来者遵循本文档的开发方式,使用 Markdown 来修改、添加内容。
8 |
9 | ### 0.2 背景
10 |
11 | C++ 是 ROS 项目开发的主要编程语言。正如每个 C++ 开发者所知道的,C++ 有很多强大的特性,但这种强大不可避免的导致它走向复杂,使代码更容易产生 Bug,难以阅读和维护。
12 |
13 | 因此使代码易于管理的方法之一是加强代码一致性.。让任何其他开发者都可以快速读懂你的代码这点非常重要。保持统一编程风格并遵守约定意味着可以很容易根据“模式匹配”规则来推断各种标识符的含义。创建通用、必需的习惯用语和模式可以使代码更容易理解。在一些情况下可能有充分的理由改变某些编程风格,但我们还是应该遵循一致性原则,尽量不这么做。
14 |
15 | Team-Xmbot-Service-Robot(晓萌家庭服务机器人团队)作为开源项目,需要团队队员贡献代码,但是如果队员之间的代码编程风格不一致,便会给团队其他模块负责人造成不小的困扰。我们认为整洁、一致的代码风格可以使代码更加可读、更加可调试以及更加可维护。因此,我们应该编写优雅的代码使其不仅能够在现在发挥作用,而且在将来的若干年之后其依旧能够存在、可以被复用、或者是能够被未来的新队员改进。
16 |
17 | ## 1. 头文件
18 |
19 | 通常每一个 `.cpp` 文件都有一个对应的 `.h` 文件。也有一些常见例外,如单元测试代码和只包含 `main()` 函数的 `.cpp` 文件。
20 | 正确使用头文件可令代码在可读性、文件大小和性能上大为改观。下面的规则将引导你规避使用头文件时的各种陷阱。
21 |
22 | ### 1.1 \#define 保护
23 |
24 | > **Tip**
25 | >
26 | > 所有头文件都应该使用 `#define` 来防止头文件被多重包含,命名格式当是: `_H` 。
27 |
28 | 为保证唯一性, 头文件的命名应该与头文件的命名一致。例如,`xm_arm_robot_hardware.h` 头文件可按如下方式保护:
29 |
30 | ``` cpp
31 | #ifndef XM_ARM_ROBOT_HARDWARE_H
32 | #define XM_ARM_ROBOT_HARDWARE_H
33 | …
34 | #endif // XM_ARM_ROBOT_HARDWARE_H
35 | ```
36 |
37 | ### 1.2 `#include` 的路径及顺序
38 |
39 | > **Tip**
40 | >
41 | > 使用标准的头文件包含顺序可增强可读性,避免隐藏依赖:相关头文件、C 库、C++ 库、其他库的 .h,本项目内的 .h。
42 |
43 | `#include` 中包含头文件的次序如下:
44 |
45 | 1. ROS 系统文件
46 | 2. C 系统文件
47 | 3. C++ 系统文件
48 | 4. 其他库的 `.h` 文件
49 | 5. 本项目内 `.h` 文件
50 |
51 | 按字母顺序对头文件包含进行二次排序是不错的主意。注意较老的代码可不符合这条规则,要在方便的时候改正它们。
52 |
53 | 举例来说,头文件包含次序如下:
54 |
55 | ``` cpp
56 | #include
57 | #include
58 | #include
59 | #include
60 | #include
61 | #include
62 | #include
63 | #include
64 | #include
65 | #include
66 |
67 | #include
68 | #include
69 | #include
70 | #include