# Genesys vs ROS2

## Genesys vs ROS 2: CLI & Developer Flow

Genesys is an **opinionated, developer-friendly framework for ROS 2**.\
It wraps ROS 2’s powerful but verbose toolchain in a streamlined CLI and decorator-based API, removing boilerplate while keeping full ROS 2 compatibility.

This page compares the **developer and CLI workflow** in **vanilla ROS 2** vs **Genesys**.

***

### 🚀 1. Creating a Workspace

ROS 2

```bash
# Create workspace
mkdir -p my_ws/src
cd my_ws

# Create a package
ros2 pkg create --build-type ament_python my_pkg

# Build
colcon build
```

Genesys

```bash
# Create a new workspace
genesys new my_project
cd my_project

# Create a package with an initial node
genesys make pkg my_pkg --with-node

# Build and auto-source environment
genesys build
```

✅ Genesys scaffolds a full workspace (`src/`, `launch/`, `config/`, `sim/`, `tests/`, etc.) automatically.

***

### 📝 2. Creating a Node

ROS 2 (Python)

```python
import rclpy
from rclpy.node import Node
from std_msgs.msg import String

class MinimalPublisher(Node):
    def __init__(self):
        super().__init__('minimal_publisher')
        self.publisher_ = self.create_publisher(String, 'topic', 10)
        self.timer = self.create_timer(1.0, self.timer_callback)

    def timer_callback(self):
        msg = String()
        msg.data = "Hello, ROS 2"
        self.publisher_.publish(msg)
        self.get_logger().info(f"Publishing: {msg.data}")

def main(args=None):
    rclpy.init(args=args)
    rclpy.spin(MinimalPublisher())
    rclpy.shutdown()
```

Genesys (Python)

```python
from genesys.decorators import node, timer, publisher
from genesys.helpers import spin_node
from std_msgs.msg import String

@node("demo_publisher")
class DemoPublisher:
    def __init__(self):
        self.counter = 0

    @timer(1.0)
    @publisher("chatter", String)
    def publish_message(self):
        msg = String()
        msg.data = f"Hello from Genesys! #{self.counter}"
        self.logger.info(f"Publishing: {msg.data}")
        self.counter += 1
        return msg

def main(args=None):
    spin_node(DemoPublisher, args)
```

✅ Genesys decorators remove `create_publisher`/`create_timer` boilerplate.\
✅ `spin_node()` auto-handles init/spin/shutdown.

***

### ▶️ 3. Running Nodes

ROS 2

```bash
ros2 run my_pkg my_node
```

Genesys

```bash
genesys run my_node
```

✅ Genesys auto-detects the package containing the node.\
✅ Supports simpler remapping:

```bash
genesys run my_node --remap chatter:=/robot/chatter
```

***

### 🛠️ 4. Building Packages

ROS 2

```bash
colcon build --packages-select my_pkg
```

Genesys

```bash
genesys build --packages my_pkg
```

✅ Genesys uses symlink install by default.\
✅ Handles sourcing & environment cleanup.

***

### 🚦 5. Launching Nodes

ROS 2

```bash
ros2 launch my_pkg my_launch.py
```

Genesys

```bash
# Launch one package
genesys launch my_pkg

# Launch all default.launch.py files
genesys launch --all
```

✅ Genesys auto-generates `default.launch.py`.\
✅ Launch multiple packages with a single command.

***

### 📡 6. Inspecting the Graph

ROS 2

```bash
ros2 node list
ros2 topic list
ros2 service call /add_two_ints example_interfaces/srv/AddTwoInts "{a: 2, b: 3}"
```

Genesys

```bash
genesys node list
genesys topic list
genesys service call /add_two_ints example_interfaces/srv/AddTwoInts "2 3"
```

✅ Genesys mirrors `ros2` CLI but adds:

* Auto-sourcing of environment
* Better logging & error messages
* Extra helpers (`genesys topic record`, `genesys param load`, etc.)

***

### 🕹️ 7. Simulation

ROS 2

```bash
gazebo --verbose worlds/my_world.world
```

Genesys

```bash
genesys sim my_world.world
```

✅ Genesys auto-detects:

* Worlds from `sim/worlds/`
* Models from `sim/models/`
* Generates temporary launch files for Gazebo.

***

### 📊 8. Development Flow Summary

| Task                | ROS 2 CLI             | Genesys CLI                              |
| ------------------- | --------------------- | ---------------------------------------- |
| Create workspace    | `mkdir src && colcon` | `genesys new my_project`                 |
| Create package      | `ros2 pkg create`     | `genesys make pkg my_pkg`                |
| Create node         | Manual boilerplate    | `genesys make node my_node --pkg my_pkg` |
| Build               | `colcon build`        | `genesys build`                          |
| Run node            | `ros2 run`            | `genesys run`                            |
| Launch              | `ros2 launch`         | `genesys launch`                         |
| Node list/info      | `ros2 node ...`       | `genesys node ...`                       |
| Topic list/echo/pub | `ros2 topic ...`      | `genesys topic ...`                      |
| Service call/find   | `ros2 service ...`    | `genesys service ...`                    |
| Actions             | `ros2 action ...`     | `genesys action ...`                     |
| Parameters          | `ros2 param ...`      | `genesys param ...`                      |
| Simulation          | manual gazebo launch  | `genesys sim`                            |

***

### ✅ Key Takeaways

* **ROS 2**: Flexible, low-level, verbose.
* **Genesys**: Opinionated, batteries-included, reduces setup/boilerplate.
* **Both**: Fully compatible Genesys runs on ROS 2, not instead of it.

***
