Comments (6)
I went through the google style guide and PEP8 and further specified the style where there were multiple options. I also added suggestions for package and directory naming convention based off ROS standards.
Packages, files and directories
- Package names in lower case with underscores and exotica prefix:
exotica
exotica_python
exotica_examples
exotica_core_taskmaps
exotica_aico_solver
exotica_ik_solver
exotica_collision_scene_fcl
...
- All solver packages with
_solver
suffix. - All task map packages with
_taskmaps
suffix. - File names -
with_underscores.cpp
,with_underscores.h
,with_underscores.py
(don't use *.cc, *.hpp, ... file types) - Directory structure:
package_name\
package_name\launch\ (*.launch)
package_name\src\ (*.cpp)
package_name\include\package_name\ (*.h)
package_name\scripts\ (*.py)
package_name\init\ (*.in)
package_name\cmake\ (*.cmake and supporting scripts)
package_name\doc\ (doxygen and other files)
package_name\resources\ (urdf/srdf/meshes/scenes/trajectories/...)
package_name\test\ (c++/python test scripts)
package_name\test\resources\ (test resources)
For files in scripts/
, if they are Python file:
- Make the script executable (
chmod +x filename
) - Add an appropriate shebang
- Do not include the file ending
C++
-
Use override instead of virtual when overriding a function in a child class.
-
Order output parameters after inputs if returning values via arguments.
-
Avoid boost.
-
Always use c++11
-
Type names -
CamelCasedWithFirstCapitalLetter
-
Variable names -
with_underscores
-
Member variables -
with_underscores_and_trailing_underscore_
-
Struct data members -
with_underscores
-
Constants -
kCamelCasedWithPrefix
-
Function names -
CamelCasedWithFirstCapitalLetter
-
Namespace names (always single word) -
lowercase
-
Enum names -
CamelCasedWithFirstCapitalLetter
-
Enum data members -
ALL_CAPS
-
Macro names -
ALL_CAPS
-
Comments -
// always use double slash
-
File comments - include author, copyright, and license
-
File/class/function/variable comments -
/// always use doxygen documentation style comments
-
Implementation comments -
// always use regular double slash comments on a separate line
-
TODO -
// TODO(githubusername or email) use comments with enough detail - the name references who added it or who is responsible for fixing it
Formatting:
- No line length limit
- Use provided clang-format:
- Use UTF-8 encoding.
- Use 4 spaces instead of tabs.
- Opening { on a new line on the same level as the conditional/function/loop and the closing brace
- Use vertical white space to separate code blocks/declarations.
Python
- Packages/Modules - short lower case (avoid underscores), eg.,
pyexotica
- Class names -
CamelCased
- Function and variable names -
lower_case_with_underscores
- Non-public members -
_lower_case_with_leading_underscore
- Constants -
ALL_CAPS
- Getters/setters - always replace with attributes
- Always include explicit exports (
__all__
) - Apply PEP8
from exotica.
On top of that, we also need to revisit the naming conventions:
- Static/member/local/argument variable names.
- Consistent use of underscores and capitalization.
- Class, struct, enum naming.
- Static/member and public/private function names.
from exotica.
So here are some proposals:
Formatting:
- Google style - available as CLang format but the curly bracket placement bothers me.
- ROS style - not officially supported and untested CLang, most of the current code uses this format now, I prefer this format.
Naming convention:
- ROS convention.
- ETH convention more detailed, couple of minor differences in capitalization (compared to ROS).
Additional convention for humanoid robots.
from exotica.
I'd opt for clang-format-3.8 Google style. ROS style is not uniform and changing, the CLang isn't really tested. clang-format (and the different versions) is available on all platforms.
Regarding naming convention, no major preference but I'd go with a big standard as well. Not to be 100% strict with that but good to keep as a guideline.
from exotica.
Formatting fixed in #141.
Todo: fix naming the convention.
from exotica.
C++
Python
from exotica.
Related Issues (20)
- Add Octomap collision checking example
- Support for differential drive robots HOT 1
- roslaunch exotica_examples cpp_ik_minimal.launch does not work HOT 9
- Tensor contraction fails when 2nd-order dynamics terms are used
- Obstacle does not display in RViz HOT 3
- [exotica_examples] Python attach example: Goal State is not valid! HOT 2
- Python warning exotica/Frame: Ignoring property ... HOT 1
- Full 20.04 compatibility
- ParsePath does not work for generated files in a devel workspace HOT 2
- CollisionSceneFCL won't work on Noetic HOT 1
- Build failure HOT 9
- Noetic exotica_pinocchio failing to build - cc1plus killed HOT 4
- Redundant task-maps: EffPositionXY == LookAt
- Demos for the task map `interaction mesh`?
- pyexotica import error due to missing libmoveit_rdf_loader HOT 2
- Constrain roll and pitch, leave yaw unconstrained HOT 4
- Is position only IK possible? HOT 2
- Could Anyone provide a Demo about how to use the Interaction Mesh?
- arm64 binaries segfault
- [Noetic] exotica_pinocchio_dynamics_solver fails to build on armhf HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from exotica.