# Visualizing Multi-Modal Data

Data visualization constitutes a vital component of data collection, particularly in scenarios where numerous data modalities exist. The rational presentation of data holds paramount significance in enhancing the efficiency of data collection and review. We provide a data viewer for users to watch the data streamed from MagiClaw in real-time or replay the recorded data to check the quality.

<figure><img src="/files/qTgCwtfXePpgkhOUXR3g" alt=""><figcaption></figcaption></figure>

## Install Data Viewer

First, you need to connect the control box and your PC to the same local network.

To set up the MagiClaw Viewer, first clone the repository:

```bash
git clone https://github.com/asMagiClaw/magiclaw-viewer.git
cd magiclaw-viewer
```

It's recommended to create conda environment, and install the required dependencies:

```bash
conda create -n magiclaw-viewer python=3.10
conda activate magiclaw-viewer
pip install -r requirements.txt
```

The viewer requires a configuration file to connect to the MagiClaw and visualize the data. The default configuration file is located at `configs/viewer.yaml`. You can modify this file to suit your setup, including the host and port of the control box. The file structure is as follows:

```yaml
magiclaw_0:
  host: xx.xx.xx.xx
  port: 6300
magiclaw_1:
  host: xx.xx.xx.xx
  port: 6400
```

where `magiclaw_0` and `magiclaw_1` refer to the ID of the grippers, `host` refers to the IP address of the control box, and `port` refers to the port number. You need to change the values of `host` with the actual IP address of the control box. The values of `port` do not need to be changed, which is the default data ports of the control box.

## Visualize Real-Time Data

After setting up the configuration, you can start the viewer by running the following command:

```bash
python viewer.py --mode live --number <number> --type <type>
```

where `<number>` refers to the number of the MagiClaw to connect to, including `1` and `2`, and `<type>` refers to the type of MagiClaw, including `magiclaw-in-hand` and `magiclaw-on-robot`.

Then a new window will show the data streamed from the MagiClaw.

<figure><img src="/files/pqDfZkplNFTVnXt5VCki" alt=""><figcaption></figcaption></figure>

## Review Recorded Data

To review recorded data, you can start the viewer by running the following command:

```bash
python viewer.py --mode replay --number <number> --type <type> --data_path <data_path>
```

where `<number>` refers to the number of the MagiClaw to connect to, including `1` and `2`, `<type>` refers to the type of MagiClaw, including `magiclaw-in-hand` and `magiclaw-on-robot`, and `<data_path>` refers to the path of the recorded data file.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://magiclaw.gitbook.io/magiclaw-docs/documentation/tutorials/visualizing-multi-modal-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
