Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JT V3 edits #3759

Draft
wants to merge 5 commits into
base: v3.0
Choose a base branch
from
Draft
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
9 changes: 6 additions & 3 deletions docs/operate/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ overview: true
{{< /cards >}}
{{< /how-to-expand >}}

{{< how-to-expand "Build apps" "5" "BEGINNER-FRIENDLY" "middle" >}}
{{< how-to-expand "Build apps" "3" "BEGINNER-FRIENDLY" "middle" >}}
{{< cards >}}
{{% card link="/operate/control/web-app/" noimage="true" %}}
{{% card link="/operate/control/mobile-app/" noimage="true" %}}
{{% card link="/operate/control/mobile-app/" noimage="true" %}}
{{% card link="/operate/control/headless-app/" noimage="true" %}}

<!-- unlisting for now
{{% card link="/operate/control/voice-app/" noimage="true" %}}
{{% card link="/operate/control/kiosk-app/" noimage="true" %}}
-->

{{< /cards >}}
{{< /how-to-expand >}}

Expand All @@ -45,4 +48,4 @@ overview: true
{{% card link="/operate/mobility/move-gantry/" noimage="true" %}}
{{% card link="/operate/mobility/use-input-to-act/" noimage="true" %}}
{{< /cards >}}
{{< /how-to-expand >}}
{{< /how-to-expand >}}
65 changes: 64 additions & 1 deletion docs/operate/control/headless-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,68 @@ weight: 30
layout: "docs"
type: "docs"
no_list: true
description: "TODO"
description: "Run control logic on a machine."
---

To write control logic for your machine that will run without a user interface, you can use the Python SDK or the Go SDK.
Both SDKs include similar methods to hit standard component and service API endpoints, so choose the language you feel most comfortable scripting in.

{{% alert title="In this page" color="tip" %}}

1. [Install an SDK](#install-an-sdk)
1. [Authenticate your script to your machine with API keys](#authenticate-your-script)
1. [Write your control script](#write-your-control-script)
1. [Run your script](#run-your-script)

{{% /alert %}}

## Install an SDK

To install your preferred Viam SDK on your Linux or macOS development machine or [single-board computer](/components/board/), run one of the following commands in your terminal:

{{< tabs >}}
{{% tab name="Python" %}}

If you are using the Python SDK, [set up a virtual environment](/sdks/python/python-venv/) to package the SDK inside before running your code, avoiding conflicts with other projects or your system.

For macOS (both Intel `x86_64` and Apple Silicon) or Linux (`x86`, `aarch64`, `armv6l`), run the following commands:

```sh {class="command-line" data-prompt="$"}
python3 -m venv .venv
source .venv/bin/activate
pip install viam-sdk
```

Windows is not supported.
If you are using Windows, use the [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/install) and install the Python SDK using the preceding instructions for Linux.
For other unsupported systems, see [Installing from source](https://python.viam.dev/#installing-from-source).

If you intend to use the [ML (machine learning) model service](/services/ml/), use the following command instead, which installs additional required dependencies along with the Python SDK:

```sh {class="command-line" data-prompt="$"}
pip install 'viam-sdk[mlmodel]'
```

{{% /tab %}}
{{% tab name="Go" %}}

Run the following command to install the [Viam Go SDK](https://pkg.go.dev/go.viam.com/rdk):

```sh {class="command-line" data-prompt="$"}
go get go.viam.com/rdk/robot/client
```

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

## Authenticate your script

## Write your control script

### Examples

## Run your script

### Test by running it manually

### Configure your script to run as an automatic process
1 change: 1 addition & 0 deletions docs/operate/control/kiosk-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ layout: "docs"
type: "docs"
no_list: true
description: "TODO"
draft: true
---
9 changes: 0 additions & 9 deletions docs/operate/control/mobile-app.md

This file was deleted.

73 changes: 73 additions & 0 deletions docs/operate/control/mobile-app/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
linkTitle: "Create a mobile app"
title: "Create a mobile app"
weight: 20
layout: "docs"
type: "docs"
no_list: true
description: "Create a custom user interface for interacting with machines from a mobile device."
---

You can use Viam's [Flutter SDK](https://flutter.viam.dev/) to create a custom mobile application to interact with your devices.
The Flutter SDK includes:

- Implementation of the standard component and service APIs to control your hardware and software
- Widgets to ease the development process
- Authentication tools so users can log in securely

## Example usage

The following code, part of [Drive a rover in a square in 2 minutes](/how-tos/drive-rover/), shows how you could move a robotic rover base in a square using the base API's [`moveStraight`](https://flutter.viam.dev/viam_sdk/Base/moveStraight.html) and [`spin`](https://flutter.viam.dev/viam_sdk/Base/spin.html) methods:

```dart {class="line-numbers linkable-line-numbers"}
import 'package:flutter/material.dart';
import 'package:viam_sdk/viam_sdk.dart';
import 'package:viam_sdk/widgets.dart';

class BaseScreen extends StatelessWidget {
final Base base;

const BaseScreen(this.base, {super.key});

Future<void> moveSquare() async {
for (var i=0; i<4; i++) {
await base.moveStraight(500, 500);
await base.spin(90, 100);
}
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(base.name)),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: moveSquare,
child: const Text('Move Base in Square'),
),
]))
,);}}
```

{{<video webm_src="/tutorials/try-viam-sdk/square-test-rover.webm" mp4_src="/tutorials/try-viam-sdk/square-test-rover.mp4" alt="An example flutter app moving a Try Viam rover in a square" poster="/tutorials/try-viam-sdk/square-test-rover.jpg">}}

See the guide for full code and instructions to get started by building a simple app to control a rented Viam rover:

{{< cards >}}
{{% card link="/operate/control/mobile-app/drive-rover/" %}}
{{< /cards >}}

For a more in-depth guide with more screens, see the following guide:

{{< cards >}}
{{% card link="/tutorials/control/flutter-app/" %}}
{{< /cards >}}

## Set up authentication

Viam uses [FusionAuth](FusionAuth) for authentication and authorization.

Use the [Viam CLI `auth-app` command](/dev/tools/cli/#auth-app) to register your application with FusionAuth so that you or your users can log into your app with the same credentials they use to log into the [Viam app](https://app.viam.com).
Loading
Loading