# Ros2 Testing

> Testing: launch_testing, gtest/pytest, rosbag2 C++/Python APIs, ros2trace profiling.

- **Type:** Skill
- **Install:** `agentstack add skill-leehyunbin0131-claude-ros2-skills-ros2-testing`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [Leehyunbin0131](https://agentstack.voostack.com/s/leehyunbin0131)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [Leehyunbin0131](https://github.com/Leehyunbin0131)
- **Source:** https://github.com/Leehyunbin0131/claude-ros2-skills/tree/main/skills/ros2-testing

## Install

```sh
agentstack add skill-leehyunbin0131-claude-ros2-skills-ros2-testing
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# ROS 2 Testing, Rosbag2 & Tracing Instructions (Ubuntu 24.04 LTS & ROS 2 Jazzy)

## 1. Core Principles & Architecture
- **Target OS & ROS Distro**: **Ubuntu 24.04 LTS & ROS 2 Jazzy Jalisco**.
- **Quality & Diagnostics Stack**: Integration testing via `launch_testing`, unit testing via `ament_cmake_gtest` / `pytest`, data recording/playback programmatically via `rosbag2` C++/Python APIs, and performance profiling via `ros2trace`.
- **Zero-Hallucination Policy**: Never speculate about `rosbag2` C++/Python API methods (`open`, `write`, `create_topic`) or `launch_testing` assertions. Verify all signatures against official ROS 2 Jazzy documentation.

## 2. Official Documentation Catalog

### A. Master Documentation & Tutorials
- **Writing Integration Tests with `launch_testing`**: `https://docs.ros.org/en/jazzy/Tutorials/Intermediate/Testing/Integration.html`
- **`launch_testing` API Docs**: `https://docs.ros.org/en/jazzy/p/launch_testing/`
- **`rosbag2_cpp` API Docs**: `https://docs.ros.org/en/jazzy/p/rosbag2_cpp/`
- **`rosbag2_py` API Docs**: `https://docs.ros.org/en/jazzy/p/rosbag2_py/`
- **ROS 2 Tracing Guide (`ros2_tracing`)**: `https://docs.ros.org/en/jazzy/Tutorials/Advanced/ROS2-Tracing-Trace-and-Analyze.html`
- **Rosbag2 Official Repository**: `https://github.com/ros2/rosbag2`

## 3. Key Concepts & Code Patterns

### A. Programmatic Rosbag2 Writer (C++)
```cpp
#include 
#include 

rosbag2_cpp::Writer writer;
writer.open("my_bag");
writer.create_topic({0, "chatter", "std_msgs/msg/String", "cdr", {}, ""});
writer.write(msg, "chatter", clock.now());
```

### B. Integration Testing (`launch_testing` Python)
```python
import unittest
import launch
import launch_ros.actions
import launch_testing
import launch_testing.actions
import launch_testing.asserts
def generate_test_description():
    node = launch_ros.actions.Node(package='demo_nodes_cpp', executable='talker')
    return launch.LaunchDescription([
        node,
        launch_testing.actions.ReadyToTest()
    ]), {'talker_node': node}

class TestTalkerNode(unittest.TestCase):
    def test_node_start(self, talker_node):
        self.assertIsNotNone(talker_node)

@launch_testing.post_shutdown_test()
class TestShutdown(unittest.TestCase):
    def test_exit_code(self, proc_info):
        launch_testing.asserts.assertExitCodes(proc_info)
```

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [Leehyunbin0131](https://github.com/Leehyunbin0131)
- **Source:** [Leehyunbin0131/claude-ros2-skills](https://github.com/Leehyunbin0131/claude-ros2-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-leehyunbin0131-claude-ros2-skills-ros2-testing
- Seller: https://agentstack.voostack.com/s/leehyunbin0131
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
