Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .codex/CODEX.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# ROS2 Clean Architecture Project

This project is set up with a comprehensive set of **Codex Skills** designed to facilitate ROS2 development following **Clean Architecture** principles.

## Authoritative References

- ROS2 Humble docs: `https://docs.ros.org/en/humble/index.html`
- Codex Skills docs: `https://developers.openai.com/codex/skills`
- Codex Rules docs: `https://developers.openai.com/codex/rules`
- OpenAI skills repository: `https://github.com/openai/skills`
- For ROS2 APIs and behavior, prioritize Humble documentation.
- For skill layout and conventions, follow Codex Skills docs first, then align with `openai/skills`.
- For command approval policies, follow Codex Rules docs and maintain `.codex/rules/default.rules`.

## Available Skills

The following skills are available in `.codex/skills` and can be used to guide development:

| Skill Name | Description | Key Components |
| ----------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------- |
| **ros2-node-creation** | Create Clean Architecture compliant nodes | `BaseNode` template, dependency injection, QoS profiles (Python & C++) |
| **ros2-launch-config** | Modular launch files | Composition, `IncludeLaunchDescription`, parameter management, C++ executable support |
| **ros2-service-action** | Services and actions | Server/client wrappers, domain use case integration (Python & C++) |
| **ros2-messaging** | Pub/sub patterns | Domain-driven publishers, generic subscribers, thread-safe buffers, synchronization |
| **ros2-testing** | Testing strategy | Unit (domain), integration (node), E2E (launch), GTest/GMock support |
| **ros2-lifecycle** | Managed nodes | Lifecycle node templates, state transition management, lifecycle clients |
| **ros2-transforms** | TF2 management | TF2 wrappers avoiding domain dependency on `geometry_msgs` |
| **ros2-diagnostics** | Health monitoring | `diagnostic_updater` integration, health entities, frequency monitoring |
| **ros2-bag** | Data recording | Programmatic bag recording and replay utilities (`rosbag2`) |
| **ros2-dockerfile** | Docker build patterns | ROS2 Humble base images, rosdep/colcon layers, multi-stage runtime images |

## Project Structure

The project follows a strict separation of concerns:

- **src/domain/**: Pure business logic, entities, and use cases. No ROS2 dependencies.
- **src/application/**: Application services and interfaces. Orchestrates logic.
- **src/infrastructure/**: ROS2 specific implementations (Nodes, Publishers, Subscribers).

## Getting Started

To use a skill, reference the skill file (e.g., `.codex/skills/ros2-node-creation/SKILL.md`) for templates and best practices.
For containerization, use `.codex/skills/ros2-dockerfile/SKILL.md` with `.codex/rules/ros2_dockerfile.md`.

## Common Commands

For a comprehensive list of ROS2 commands, build instructions, and debugging tools, please refer to:

- **[ROS2 Commands Reference](.codex/commands/ros2.md)**: `colcon`, `ros2`, `rqt`, etc.

### Quick Reference

- **Build**: `colcon build --symlink-install`
- **Test**: `colcon test`
- **Source**: `source install/setup.bash`
72 changes: 72 additions & 0 deletions .codex/commands/ros2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# ROS2 Common Commands

## Build System (colcon)

| Action | Command | Description |
| ------------------- | ------------------------------------------- | ------------------------------------------------------------------------ |
| **Build Workspace** | `colcon build --symlink-install` | Build all packages with symlinks (allows python changes without rebuild) |
| **Build Package** | `colcon build --packages-select <pkg_name>` | Build a specific package only |
| **Build Up To** | `colcon build --packages-up-to <pkg_name>` | Build a package and its dependencies |
| **Clean Build** | `rm -rf build/ install/ log/` | Remove build artifacts (use with caution) |
| **Test** | `colcon test` | Run tests for all packages |
| **Test Output** | `colcon test-result --all` | Show test results |

## Environment

| Action | Command | Description |
| ------------------ | --------------------------- | ---------------------------- | ------------------------------- |
| **Source Overlay** | `source install/setup.bash` | Source the workspace overlay |
| **Check Env** | `printenv | grep ROS` | Check ROS environment variables |

## Introspection (ros2)

### Nodes

| Command | Description |
| ---------------------------- | ------------------------------------------------ |
| `ros2 node list` | List all running nodes |
| `ros2 node info <node_name>` | Show subscribers, publishers, services of a node |

### Topics

| Command | Description |
| -------------------------------------- | ------------------------------------------------ |
| `ros2 topic list` | List all active topics |
| `ros2 topic echo <topic>` | Print messages from a topic to screen |
| `ros2 topic info <topic>` | Show message type and publisher/subscriber count |
| `ros2 topic pub <topic> <type> <args>` | Publish a message manually |
| `ros2 topic hz <topic>` | Check publishing frequency |
| `ros2 topic bw <topic>` | Check bandwidth usage |

### Services

| Command | Description |
| ------------------------------------------- | ----------------------- |
| `ros2 service list` | List available services |
| `ros2 service call <service> <type> <args>` | Call a service manually |
| `ros2 service type <service>` | Show service type |

### Actions

| Command | Description |
| ---------------------------------------------- | ---------------------- |
| `ros2 action list` | List available actions |
| `ros2 action send_goal <action> <type> <goal>` | Send an action goal |

### Parameters

| Command | Description |
| --------------------------------------- | ------------------------------------- |
| `ros2 param list` | List all parameters |
| `ros2 param get <node> <param>` | Get a parameter value |
| `ros2 param set <node> <param> <value>` | Set a parameter value dynamically |
| `ros2 param dump <node>` | Dump all parameters of a node to YAML |

## Debugging Implementation

| Tool | Command | Description |
| --------------- | -------------------------------- | ----------------------------------------- |
| **RQT Graph** | `rqt_graph` | Visualize node and topic connections |
| **RQT Console** | `rqt_console` | View log messages with filtering |
| **TF Tree** | `ros2 run tf2_tools view_frames` | Generate PDF of TF tree |
| **Doctor** | `ros2 doctor` | Check for system issues/misconfigurations |
Loading