Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/tutorials/first-project/sim-viewer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/tutorials/first-project/viam-app-live.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 9 additions & 10 deletions docs/operate/hello-world/first-project/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: "Build a complete quality inspection system with Viam—from camera
date: "2025-01-30"
---

**Time:** ~60 minutes
**Time:** ~45 minutes

## Before You Begin

Expand All @@ -36,22 +36,21 @@ In this tutorial you will work through a series of tasks that are common to many

| Part | Time | What You'll Do |
| ---------------------------------- | ------- | ------------------------------------------------------ |
| [Part 1: Vision Pipeline](part-1/) | ~15 min | Set up camera, ML model, and vision service |
| [Part 2: Data Capture](part-2/) | ~10 min | Configure automatic image capture and cloud sync |
| [Part 3: Control Logic](part-3/) | ~15 min | Generate module, write inspection logic, test from CLI |
| [Part 1: Vision Pipeline](part-1/) | ~10 min | Set up camera, ML model, and vision service |
| [Part 2: Data Capture](part-2/) | ~5 min | Configure automatic image capture and cloud sync |
| [Part 3: Control Logic](part-3/) | ~10 min | Generate module, write inspection logic, test from CLI |
| [Part 4: Deploy a Module](part-4/) | ~10 min | Deploy module, configure detection data capture |
| [Part 5: Productize](part-5/) | ~10 min | Build monitoring dashboard with Teleop |

{{< expand "Full Section Outline" >}}

**[Part 1: Vision Pipeline](part-1/)** (~15 min)

- [1.1 Verify Your Machine is Online](part-1/#11-verify-your-machine-is-online)
- [1.2 Locate Your Machine Part](part-1/#12-locate-your-machine-part)
- [1.3 Configure the Camera](part-1/#13-configure-the-camera)
- [1.4 Test the Camera](part-1/#14-test-the-camera)
- [1.5 Add an ML Model Service](part-1/#15-add-an-ml-model-service)
- [1.6 Add a Vision Service](part-1/#16-add-a-vision-service)
- [1.1 Find Your Machine Part](part-1/#11-find-your-machine-part)
- [1.2 Configure the Camera](part-1/#12-configure-the-camera)
- [1.3 Test the Camera](part-1/#13-test-the-camera)
- [1.4 Add an ML Model Service](part-1/#14-add-an-ml-model-service)
- [1.5 Add a Vision Service](part-1/#15-add-a-vision-service)

**[Part 2: Data Capture](part-2/)** (~10 min)

Expand Down
152 changes: 26 additions & 126 deletions docs/operate/hello-world/first-project/gazebo-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,166 +13,66 @@ This guide walks you through setting up the Gazebo simulation used in the [Your
## Prerequisites

- **Docker Desktop** installed and running
- A free [Viam account](https://app.viam.com)
- ~5GB disk space for the Docker image

## Step 1: Build the Docker Image
## Step 1: Pull the Docker Image

The simulation runs in a Docker container with Gazebo Harmonic and viam-server pre-installed.

**Clone the simulation repository:**

```bash
git clone https://github.com/viamrobotics/can-inspection-simulation.git
cd can-inspection-simulation
```

**Build the Docker image:**

```bash
docker build -t gz-harmonic-viam .
docker pull ghcr.io/viamrobotics/can-inspection-simulation:latest-local
```

This takes 5-10 minutes depending on your internet connection.

## Step 2: Create a Machine in Viam

1. Go to [app.viam.com](https://app.viam.com) and log in
2. Click the **Locations** tab
3. Click **+ Add machine**
4. Name it `inspection-station-1`
5. Click **Add machine**

## Step 3: Create a credentials file

1. Click the **Awaiting setup** button
2. Click **Machine cloud credentials** to copy your machine's credentials
3. In the `can-inspection-simulation` directory, create a file called `station1-viam.json`
4. Paste your machine's credentials into this file and save

## Step 4: Start the Container
This downloads the pre-built image, which takes about a minute depending on your internet connection.

{{< tabs >}}
{{% tab name="Mac/Linux" %}}
## Step 2: Start the Container

```bash
docker run --name gz-station1 -d \
-p 8080:8080 -p 8081:8081 -p 8443:8443 \
-v "$(pwd)/station1-viam.json:/etc/viam.json" \
gz-harmonic-viam
ghcr.io/viamrobotics/can-inspection-simulation:latest-local
```

{{% /tab %}}
{{% tab name="Windows (PowerShell)" %}}

```powershell
docker run --name gz-station1 -d `
-p 8080:8080 -p 8081:8081 -p 8443:8443 `
-v "${PWD}\station1-viam.json:/etc/viam.json" `
gz-harmonic-viam
```

{{% /tab %}}
{{< /tabs >}}

## Step 5: Verify the Setup

**Check container logs:**

```bash
docker logs gz-station1
```

Look for:

- "Can Inspection Station 1 Running!"
- viam-server startup messages

**View the simulation:**
## Step 3: Verify the Simulation

Open your browser to `http://localhost:8081`

You should see a web-based 3D view of the inspection station with:
You should see two live camera feeds from the inspection station:

- A conveyor belt
- Cans moving along the belt
- An overhead camera view
{{<imgproc src="/tutorials/first-project/sim-viewer.png" resize="x1100" declaredimensions=true alt="Simulation web viewer showing the Can Inspection Station with Overview Camera and Inspection Camera feeds." class="imgzoom shadow">}}

{{<imgproc src="/tutorials/first-project/gazebo-simulation.png" resize="x1100" declaredimensions=true alt="Gazebo web viewer showing the Can Inspection Station with Overview Camera and Inspection Camera views." class="imgzoom shadow">}}
## Step 4: Create a Machine in Viam

**Verify machine connection:**

1. Go to [app.viam.com](https://app.viam.com)
2. Click on `inspection-station-1`
3. The status indicator should show **Live** (in green)

## Troubleshooting

{{< expand "Container won't start" >}}
**Check if ports are in use:**

{{< tabs >}}
{{% tab name="Mac/Linux" %}}

```bash
lsof -i :8080
lsof -i :8081
```

{{% /tab %}}
{{% tab name="Windows (PowerShell)" %}}

```powershell
netstat -ano | findstr :8080
netstat -ano | findstr :8081
```

{{% /tab %}}
{{< /tabs >}}
1. Go to [app.viam.com](https://app.viam.com) and create a free account or log in
2. Click the **Locations** tab
3. Click **+ Add machine**, name it `inspection-station-1`, and click **Add machine**

If something is using these ports, stop it or use different port mappings.
{{< /expand >}}
{{<imgproc src="/tutorials/first-project/fleet-add-machine.png" resize="x1100" declaredimensions=true alt="Viam app Fleet page showing First Location with no machines and the Add machine button." class="imgzoom shadow">}}

{{< expand "Machine shows Offline in Viam" >}}
## Step 5: Configure Machine Credentials

1. Check container is running: `docker ps`
2. Check logs for errors: `docker logs gz-station1`
3. Verify credentials in your config file match the Viam app
4. Try restarting: `docker restart gz-station1`
{{< /expand >}}
1. In the Viam app, click the **Awaiting setup** button on your new machine and click **Machine cloud credentials** to copy the credentials JSON

{{< expand "Simulation viewer is blank or slow" >}}
{{<imgproc src="/tutorials/first-project/awaiting-setup.png" resize="x1100" declaredimensions=true alt="Viam app showing the Awaiting setup dropdown with Machine cloud credentials option." class="imgzoom shadow">}}

- The web viewer requires WebGL support
- Try a different browser (Chrome usually works best)
- Check your system has adequate resources (4GB+ RAM recommended)
{{< /expand >}}
2. In the simulation viewer, click the **Configuration** button in the upper right corner

## Container Management
{{<imgproc src="/tutorials/first-project/sim-viewer-config-button.png" resize="x1100" declaredimensions=true alt="Simulation viewer showing the Configuration button in the upper right corner." class="imgzoom shadow">}}

**Stop the container:**
3. Paste your machine's credentials into the **Viam Configuration (viam.json)** text area and click **Update and Restart**

```bash
docker stop gz-station1
```
{{<imgproc src="/tutorials/first-project/sim-config-page.png" resize="x1100" declaredimensions=true alt="Simulation configuration page with machine cloud credentials pasted into the text area. Viam Server Status shows Stopped." class="imgzoom shadow">}}

**Start a stopped container:**

```bash
docker start gz-station1
```
A green banner will confirm the configuration was updated successfully and the status indicator will change to **Running**.

**Remove the container (to recreate):**
{{<imgproc src="/tutorials/first-project/sim-config-running.png" resize="x1100" declaredimensions=true alt="Simulation configuration page after restart, showing a green 'Configuration updated successfully' banner and Viam Server Status: Running." class="imgzoom shadow">}}

```bash
docker rm gz-station1
```
## Step 6: Verify Machine Connection

**View logs:**
Go back to your machine's page in the Viam app.
The status indicator should now show **Live**.

```bash
docker logs -f gz-station1
```
{{<imgproc src="/tutorials/first-project/viam-app-live.png" resize="x1100" declaredimensions=true alt="Viam app showing inspection-station-1 with a green Live status indicator." class="imgzoom shadow">}}

## Ready to Continue

Expand Down
Loading
Loading