From 013e1609d916f8c9b1923a6073644cebe3bcf919 Mon Sep 17 00:00:00 2001 From: Wessel Tip Date: Mon, 15 Sep 2025 08:08:54 +0200 Subject: [PATCH] feat(cpp-convention): Add Tilmann requirements --- CPP_CODE_CONVENTION.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/CPP_CODE_CONVENTION.md b/CPP_CODE_CONVENTION.md index 07b24e8..38b4ebc 100644 --- a/CPP_CODE_CONVENTION.md +++ b/CPP_CODE_CONVENTION.md @@ -1,5 +1,5 @@ # C++ Code Conventions -> Rev. 1, 12-09-2025, Wessel T +> Rev. 2, 15-09-2025, Wessel T > Proposals can be made in the form of a merge request to the `main` branch. > Don't forget to update the [Changelog](#Changelog) when doing so. @@ -89,6 +89,16 @@ For C++ file types we use the following conventions: Using C libraries is allowed, but any includes must be in an `extern c` block. +### ROS2 specific naming conventions + +> **NOTE** Year is always in YYYY format (2025) + +* Workspace names are snake_case, named as `__ws`. +* Package names are snake_case, named as `___pkg`. +This name has to be approved by the project manager. +* Interface package names are snake_case, named as either `__machine_interfaces` +or `__assessment_interfaces` + ## Comments * Comments are lines starting with `//`. @@ -160,6 +170,7 @@ nested if statements are 4) `if (is_charging && (!is_free || moving))`). Instead wrap parts in a variable or simplify the if statement by removing the second part and wrapping that and the underlying code in a function. +* Any relevant calculation should output a log message of severity `DEBUG`. ## Variables @@ -175,6 +186,11 @@ nested if statements are 4) 3. ternary statements (e.g. int module = is_connected ? 5 : 4) 4. boundary condition in loops (e.g. uint loop_end = vector.size() - 1) * Prefer constexpr variables over macros. +* Avoid double pointers. + +## Dates + +Dates should always be written in `DD[-/]MM[-/]YYYY HH[:]mm[:]ss` or epoch format. ## Example file @@ -249,4 +265,7 @@ void ComplexIdea::some_function(int lower_limit) { ## Changelog +[15-09-2025] Wessel T: Add ROS2 naming standard + [12-09-2025] Wessel T: Create initial document +