Skip to content

Commit a1adcce

Browse files
committed
add agents.md
1 parent 42aa8ab commit a1adcce

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

agents.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# MRPT 3.0 AI Agent Instructions
2+
3+
Welcome, AI Agent! This file contains the architectural context and coding guidelines for the Mobile Robot Programming Toolkit (MRPT) 3.0. When generating, refactoring, or reviewing code in this repository, you must strictly adhere to the following rules.
4+
5+
## 1. Project Architecture
6+
* **MRPT 3.0 is highly modular.** It is designed to be built using **colcon** (similar to ROS 2 packages).
7+
* Each module (e.g., `mrpt_nanogui`, `mrpt_opengl`, `mrpt_math`) lives in its own directory and functions as an independent CMake project.
8+
* **Target OS/Compilers:** Cross-platform (Linux, Windows, macOS, WebAssembly/Emscripten).
9+
10+
## 2. Build System (CMake) Conventions
11+
MRPT 3.0 abstracts away standard CMake boilerplate using `mrpt_common`. Use standard CMake commands but prefer mrpt_common cmake helpers when possible for consistency.
12+
13+
* **Minimum CMake Version:** `cmake_minimum_required(VERSION 3.16)`
14+
* **Always include the MRPT common scripts:**
15+
16+
```cmake
17+
find_package(mrpt_common REQUIRED)
18+
```
19+
20+
* Target Definition: Use mrpt_add_library instead of add_library. This macro automatically handles C++ standard configurations, export targets, and installation steps.
21+
22+
```cmake
23+
mrpt_add_library(
24+
TARGET ${PROJECT_NAME}
25+
SOURCES ${LIB_SOURCES} ${LIB_PUBLIC_HEADERS}
26+
PUBLIC_LINK_LIBRARIES mrpt::another_module
27+
CMAKE_DEPENDENCIES another_module
28+
)
29+
```
30+
31+
Dependency Management:
32+
33+
* Use find_package(mrpt_<module_name> REQUIRED) to find other MRPT modules.
34+
35+
Link against namespaced targets (e.g., mrpt::mrpt_poses, Eigen3::Eigen).
36+
37+
## 3. C++ Coding Guidelines
38+
Standard: Use Modern C++ features where appropriate (C++17/C++20).
39+
40+
Namespaces: All core code must reside within the mrpt:: namespace or its sub-namespaces (e.g., mrpt::opengl::).
41+
42+
License Headers: Every new .cpp, .h, and CMakeLists.txt file must start with the standard MRPT SPDX-License-Identifier header:
43+
44+
```cpp
45+
/* _
46+
| | Mobile Robot Programming Toolkit (MRPT)
47+
_ __ ___ _ __ _ __ | |_
48+
| '_ ` _ \| '__| '_ \| __| https://www.mrpt.org/
49+
| | | | | | | | |_) | |_
50+
|_| |_| |_|_| | .__/ \__| https://github.com/MRPT/mrpt/
51+
| |
52+
|_|
53+
54+
Copyright (c) 2005-2026, Individual contributors, see AUTHORS file
55+
See: https://www.mrpt.org/Authors - All rights reserved.
56+
SPDX-License-Identifier: BSD-3-Clause
57+
*/
58+
```
59+
60+
## 4. Anti-Patterns to Avoid
61+
Do not manually configure .so versioning or write manual install() blocks for standard headers/libraries. mrpt_add_library does this.
62+
63+
Do not hardcode compiler flags (like -std=c++17 or -fPIC). The MRPT CMake wrappers handle these natively.
64+
65+
Do not use raw pointers for ownership. Default to std::shared_ptr or std::unique_ptr, and use MRPT's smart pointer macros where applicable.

0 commit comments

Comments
 (0)