Skip to content

Commit

Permalink
IA initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JessamyT committed Dec 12, 2024
1 parent 9afb7ae commit 67a299c
Show file tree
Hide file tree
Showing 16 changed files with 5,567 additions and 22 deletions.
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

0 comments on commit 67a299c

Please sign in to comment.