# Command Reference

The `genesys` command-line interface (CLI) is the unified entry point for managing your ROS 2 projects. This page provides a comprehensive reference for every available command, its options, and examples.

***

#### `genesys new`

Creates a new, structured ROS 2 workspace with all the standard directories.

**Signature**

```bash
genesys new <project_name>
```

**Description** This command generates a new directory with the given `<project_name>`. Inside, it creates a standard ROS 2 workspace layout, including `src/`, `launch/`, `config/`, and `sim/` directories. This ensures your projects start with a consistent and clean structure.

**Example**

```bash
# Creates a new workspace directory named "my_robot_ws"
genesys new my_robot_ws

# Navigate into the new workspace
cd my_robot_ws
```

***

#### `genesys make pkg`

Interactively creates a new Python or C++ package within the `src/` directory.

**Signature**

```bash
genesys make pkg <pkg_name> [--with-node]
```

**Description** This command launches an interactive wizard to help you create a new ROS 2 package. It will prompt you for details like the package type (Python/C++) and description. It automatically generates the `package.xml`, [`setup.py`](code-assist-path:c:\Users\HP\Documents\genesys\Genesys\setup.py) (for Python), and `CMakeLists.txt` (for C++) files.

* `--with-node`: If specified, the wizard will ptompt you to know what type of node (publisher, Subscriber, Service, Action Service, Interface, etc) after that, it will immediately proceed to the `make node` flow after the package is created.

**Example**

```bash
# Starts the interactive wizard to create a Python package named "robot_brain"
genesys make pkg robot_brain
```

***

#### `genesys make node`

Creates a new node and automatically registers it within an existing package.

When creating it, you will be prompted to selecte the type of node you want to create (publisher/subscriber, actionservice, service, interface), etc.

**Signature**

```bash
genesys make node <node_name> --pkg <package_name>
```

**Description** This command generates a new node file and, more importantly, handles all the boilerplate for registering it. It will:

1. Create the node source file (e.g., `src/my_pkg/my_pkg/my_node.py`).
2. Add the node as an executable entry point in the package's [`setup.py`](code-assist-path:c:\Users\HP\Documents\genesys\Genesys\setup.py) or `CMakeLists.txt`.
3. Generate or update a launch file in the workspace's `launch/` directory to include the new node.

**Example**

```bash
# Creates a node named "camera_processor" inside the "robot_vision" package
genesys make node camera_processor --pkg robot_vision
```

***

#### `genesys build`

Builds the entire workspace using `colcon` and sources the environment.

**Signature**

```bash
genesys build
```

**Description** This is a convenience wrapper that runs `colcon build --symlink-install` and then automatically sources the `install/setup.bash` file for you. This means that after the build completes, your new nodes are immediately available as executables in your current terminal session.

**Example**

```bash
# Build all packages in the current workspace
genesys build
```

***

#### `genesys run`

Runs a node by its executable name without needing to specify the package.

**Signature**

```bash
genesys run <node_name>
```

**Description** This command searches your workspace for a node with the given executable name and runs it using `ros2 run`. It saves you from having to remember which package a specific node belongs to.

**Example**

```bash
# Assuming you have a node named "path_planner_node" somewhere in your workspace
genesys run path_planner_node

# This is equivalent to running `ros2 run <some_pkg> path_planner_node`
```

***

#### `genesys launch`

Launches a package's default launch file or a specific one.

**Signature**

```bash
genesys launch <pkg_name>[:<launch_file_name>]
genesys launch --all
```

**Description** This command simplifies launching your application.

* `genesys launch <pkg_name>`: Looks for and runs a default launch file named `<pkg_name>_launch.py` in the workspace's `launch/` directory.
* `genesys launch <pkg_name>:<file_name>`: Runs a specific launch file from the `launch/` directory (e.g., `launch/file_name.py`).
* `genesys launch --all`: Finds and executes a `default.launch.py` file in every package's launch directory.

**Example**

```bash
# Run the default launch file for the 'robot_brain' package
genesys launch robot_brain

# Run a specific launch file named 'navigation_launch.py'
genesys launch robot_brain:navigation
```

***

#### `genesys sim`

Starts a Gazebo simulation with a specified world and robot model.

**Signature**

```bash
genesys sim <world_file>
```

**Description** This command provides a one-step way to start a simulation. It launches Gazebo, loads the specified world file (e.g., from a `worlds/` directory), and automatically includes any robot models found in the `sim/models` directory of your workspace.

**Example**

```bash
# Start Gazebo and load the 'my_world.world' file
genesys sim my_world.world
```

***

#### `genesys doctor`

Checks the local environment for common configuration issues.

**Signature**

```bash
genesys doctor
```

**Description** A simple diagnostic tool to ensure your development environment is set up correctly. It checks for a sourced ROS 2 distribution, required dependencies, and other common setup problems.

**Example**

```bash
# Run a check on your environment
genesys doctor
```

#### Genesys Tooling Commands

Genesys provides a suite of commands that act as convenient aliases for common `ros2` CLI functions.

**Node Commands**

* `genesys node list`: Lists all active nodes. This is an equivalent to

  `ros2 node list`.
* `genesys node info <node>`: Displays detailed information about a specific node. This command mirrors

  `ros2 node info <node>`.

***

**Topic Commands**

* `genesys topic list`: Lists all active topics.
* `genesys topic info <topic>`: Displays information about a given topic, similar to `ros2 topic info <topic>`.
* `genesys topic echo <topic>`: Prints messages from a topic to the console, equivalent to `ros2 topic echo <topic>`.
* `genesys topic pub <topic> <msg_type> <args>`: Publishes a message to a topic directly from the command line. This is an alias for

  `ros2 topic pub <topic> <msg_type> <args>`.
* `genesys topic bw <topic>`: Shows the bandwidth usage for a specified topic, which is an alias for `ros2 topic bw <topic>`.
* `genesys topic find <msg_type>`: Finds all topics that use a specific message type, mirroring the functionality of `ros2 topic find <msg_type>`.

***

**Service Commands**

* `genesys service list`: Lists all active services.
* `genesys service type <srv>`: Prints the service type of a specific service, equivalent to `ros2 service type <srv>`.
* `genesys service info <srv>`: Displays information about a service, equivalent to `ros2 service info <srv>`.
* `genesys service find <srv_type>`: Finds services that use a specific service type.
* `genesys service call <srv> <srv_type> <args>`: Calls a service from the CLI, which is an alias for `ros2 service call <srv> <srv_type> <args>`.
* `genesys service echo <srv>`: Displays the service data, an alias for `ros2 service echo <srv>`.

***

**Action Commands**

* `genesys action list`: Lists all active actions, mirroring `ros2 action list`.
* `genesys action type <action>`: Prints the action type of a specified action.
* `genesys action info <action>`: Displays information about an action, similar to `ros2 action info <action>`.
* `genesys action send_goal <action> <args>`: Sends a goal to an action server from the CLI, an alias for `ros2 action send_goal <action> <args>`.
* `genesys action echo <action>`: Displays the action data, an alias for `ros2 action echo <action>`.

***

**Parameter Commands**

* `genesys param list`: Lists all parameters for a node.
* `genesys param get <node> <param>`: Gets the value of a specific parameter from a node.
* `genesys param set <node> <param> <value>`: Sets a parameter value on a node.
* `genesys param dump <node>`: Dumps all parameters from a node to a YAML file.
* `genesys param load <node> <file>`: Loads parameters from a file onto a node.

Debugging Tools:

* `genesys debug record <topics>`: Records data from specified topics, serving as a simplified version of `ros2 bag record`.
* `genesys debug replay <file>`: Replays recorded data from a `.db3` file, similar to `ros2 bag play`
