# Visualize data in LCM

System blocks communicate with opening ports. Data flow from one port to another through LCM pipelines. We could visualize the data.

{% hint style="info" %}
The order of executing the command matters in this example. Pay attention to following the order here.
{% endhint %}

### Open the visualizer

Ensure that you have installed the drake visualizer with

```
cd drake
bazel build //tools:drake_visualizer
bazel-bin/tools/drake_visualizer
```

### Open LCM data inspector

In another terminal, we open the LCM data inspector by

```
cd drake
bazel-bin/lcmtypes/drake-lcm-spy
```

### Execute the robot

To visualize data, we need data. Controlling a robot to move is a good way to get data flowing. We start a KUKA arm simulation in another terminal:

```
bazel-bin/examples/kuka_iiwa_arm/kuka_simulation
```

![KUKA arm in Drake simulation](/files/-LhGsTVYQi8ueM0JLU_X)

Then in another terminal we open up a "planner and runner".

```
bazel-bin/examples/kuka_iiwa_arm/kuka_plan_runner
```

Finally we need to send command to the planner, it will run the KUKA arm.

```
bazel-bin/examples/kuka_iiwa_arm/move_iiwa_ee -x 0.8 -y 0.3 -z 0.25 -yaw 1.57
```

You should see the robot arm moving with the commanding data in the LCM inspector change simultaneously. For more detailed data stream, you can double click on each LCM channel.

![The data channels on the left show each joint's control command](/files/-LhJQsQLlSIty5iywZxX)

### Links

The KUKA Manipulation example is [here](https://github.com/RobotLocomotion/drake/tree/master/examples/kuka_iiwa_arm).


---

# 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://drake.guzhaoyuan.com/thing-to-do-in-drake/visualize-data-in-lcm.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.
