Monthly Archives: November 2020

CMake-based C++工程

本文参考medium作者Aakash Mallik关于c++开发的文章。 1. https://medium.com/heuristics/c-application-development-part-1-project-structure-454b00f9eddc2. https://medium.com/heuristics/c-application-development-part-2-cmakelists-txt-e415b5b387dc3. https://medium.com/heuristics/c-application-development-part-3-cmakelists-txt-from-scratch-7678253e5e244. https://www.learncpp.com/cpp-tutorial/a1-static-and-dynamic-libraries/5. https://medium.com/@onur.dundar1/cmake-tutorial-585dd180109b6. https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/ 在开发C++大工程时,有两件事情要注意: Maintaining a project structure Dealing with third-party libraries 关注第一件事情:Maintaining a project structure 通常的c++工程结构如下: CMakeLists.txt include文件夹 src文件夹 libs文件夹 tests文件夹。 include文件夹 传统上,include文件夹是用于放header files, 但是modern practice 建议include文件夹必须strictly contain headers that need to be exposed publicly. 我们在include文件夹下,还特地加了一个与project名字相同的文件夹。这样做的目的是,由于include文件夹主要是为了方便外用的(供别人调用你写的这个library),所以我么希望当别人调用该project用于外用时是这样的:#include <Project_Name/public_header.h>,而不是#include <public_header.h>的。 src文件夹 src文件夹包含所有的源代码,以及所有那些仅用于internal use的header files。基本上,如果你注意third-party libraries时,基本都有类似的结构。 libs文件夹 libs文件夹包含了所有我们需要用到的third-party libraries。通常我们有两种方式来使用third-party libraries in C++:Static或者Dynamic。libs文件夹只包含通过static方式使用的third-party libraries。…

Read More

做好git工作流

每天写代码前的第一件事:要对你的工作的branch做git rebase 具体步骤就是: 换回到master branch pull最新的master branch上的更新 切回到你工作的branch 然后在更新的master上做rebase 如果不幸有冲突merge conflicts,那么我们需要额外三步。即第五步到第七步。第五步mergetool来查看冲突,第六步需要进入code进行修改,第七步继续rebase。 关于第一步mergetool,可以参照What’s the best visual merge tool for Git?。如何configure merge tool,可以用如下 如果依然有merge conflicts,重复第五步到第七步。 最后如果你后悔了,想撤销刚才做的: 正确地commit A best practice when using Git is to make sure each commit consists of only a single logical change. whether that’s a fix for a bug or a new feature….

Read More

HPP, FCL and Pinocchio

FCL(Flexible Collision Library) FCL是Flexible Collision Library的缩写,是A General Purpose Library for Collision and Proximity Queries,它具体的github repo在这里,相关的学术文章为FCL: A general purpose library for collision and proximity queries。 FCL is also used as the collision checking library for grasping and manipulation pipeline implemented on a PR2. In the course of the task, the overall algorithm makes multiple calls to…

Read More