Skip to content

Commit

Permalink
Use control code terminology (#3569)
Browse files Browse the repository at this point in the history
  • Loading branch information
npentrel authored Oct 15, 2024
1 parent 507eab2 commit 5d9695b
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions docs/architecture/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Now, imagine you want to change to a different model of temperature sensor from
- You power down your device, disconnect the old sensor from your SBC and connect the new one.
- You update your configuration in the Viam app to indicate what model you are using, and how it's connected (imagine this one uses USB instead of GPIO pins).
- You turn your device back on, and `viam-server` automatically fetches the config updates.
- You do not need to change your SDK code, because the API is the same for all models of sensor.
- You do not need to change your control code, because the API is the same for all models of sensor.

## Complex machines with multiple parts

Expand All @@ -178,7 +178,7 @@ These two options are very similar: in both cases, the parts communicate with ea
Any given part can be a remote part of multiple machines, whereas a part can only be a sub-part of one machine.
In other words, remote connections allow sharing of resources across multiple machines, whereas main parts and sub-parts are a way to hierarchically organize one machine.

Connecting parts (either as main part and sub-part, or as part and remote part) means that you can write SDK code that establishes a connection with the main part and controls all parts in a coordinated way.
Connecting parts (either as main part and sub-part, or as part and remote part) means that you can write control code that establishes a connection with the main part and controls all parts in a coordinated way.
This streamlines authentication because you do not need to provide multiple sets of API keys as you would if you were using separate API clients.
However, in some high-bandwidth cases it is better to establish a direct connection from an API client to a part, because connections to remotes and to sub-parts use the main part's bandwidth.

Expand Down
4 changes: 2 additions & 2 deletions docs/cloud/machines.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ To view logs in the Viam mobile app:
#### Code sample

To start programming your machine, go to the **CONNECT** tab and select the **Code sample** page.
This has sample code snippets you can copy and paste into your SDK code to connect to your machine.
This has sample code snippets you can copy and paste into your control code to connect to your machine.

{{% snippet "show-secret.md" %}}

For more information on the SDKs, see [Program your Machine with Viam's SDKs](/appendix/apis/).
For more information on the SDKs, see [Write control code with Viam's SDKs](/appendix/apis/).

#### Configure as remote part

Expand Down
2 changes: 1 addition & 1 deletion docs/components/motor/fake.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ component_description: "A model for testing, with no physical hardware."
---

Configuring a `fake` motor can be convenient for testing software without using any hardware.
For example, you can use a `fake` component as a placeholder while waiting on a hardware shipment, so that other components that depend on this motor (for example, a [base](/components/base/)) won't fail to initialize, and your SDK code won't throw errors when it fails to find a physical motor connected to your machine.
For example, you can use a `fake` component as a placeholder while waiting on a hardware shipment, so that other components that depend on this motor (for example, a [base](/components/base/)) won't fail to initialize, and your control code won't throw errors when it fails to find a physical motor connected to your machine.

{{< tabs name="fake-config">}}
{{% tab name="Config Builder" %}}
Expand Down
2 changes: 1 addition & 1 deletion docs/configure/processes.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To automatically run a specified command when your machine boots, configure a _{
A process can be any command, for example one that executes a binary or a script.
You can configure a process to run once when the machine first starts, or to run continuously alongside `viam-server`.

## Set up dependencies for Viam SDK code run as a process
## Set up dependencies for control code to run as a process

If you are configuring a process to run a script that does not use Viam SDKs, skip this section and continue to [Configure a process](#configure-a-process).
Due to the way processes are designed for stability, if you are configuring a process to run a [Viam SDK](/sdks/) script, you need to install the relevant SDK as well as other required dependencies in a specific way on your SBC:
Expand Down
2 changes: 1 addition & 1 deletion docs/how-tos/drive-rover.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ In this guide you'll write code that makes a rover drive in a square.

{{< alert title="You will learn" color="tip" >}}

- How to run SDK code
- How to run control code with Viam SDKs
- How to use the base API to move a rover in a square

{{< /alert >}}
Expand Down
2 changes: 1 addition & 1 deletion docs/how-tos/export-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ languages: []

You can download machine data from cloud storage to your computer with the Viam CLI.

If you prefer to manage your data with SDK code, see the [data client API documentation](/appendix/apis/data-client/).
If you prefer to manage your data with code, see the [data client API documentation](/appendix/apis/data-client/).

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

Expand Down
4 changes: 2 additions & 2 deletions docs/installation/viam-micro-server-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ For code examples and more information on `viam-micro-server`, see [GitHub](http

### Recommendations when using an SDK

As you use the ESP32, if you write [SDK code](/sdks/), you may experience instability.
If the connection to the ESP32 with an SDK is unstable, we recommend the following changes to the default settings in your SDK code when connecting to an ESP32.
As you use the ESP32, if you write [control code](/sdks/), you may experience instability.
If the connection to the ESP32 with an SDK is unstable, we recommend the following changes to the default settings in your connection code.
This will disable the SDK background task that monitors the connection to `viam-micro-server`, saving bandwidth.

{{< tabs >}}
Expand Down
10 changes: 5 additions & 5 deletions docs/sdks/_index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "SDKs"
title: "Write control code with Viam SDKs"
linkTitle: "SDKs"
weight: 650
type: "docs"
Expand All @@ -17,7 +17,7 @@ aliases:
---

Viam's SDK libraries wrap Viam's [gRPC APIs](https://github.com/viamrobotics/api) for interacting with a machine's [components](/appendix/apis/#component-apis) and [services](/appendix/apis/#service-apis), as well as for [cloud capabilities](/appendix/apis/robot/), such as [data management](/appendix/apis/data-client/) and [fleet management](/appendix/apis/fleet/).
You can run SDK code from anywhere; it does not necessarily have to be run on the same machine that runs `viam-server`.
You can run control code from anywhere; it does not necessarily have to be run on the same machine that runs `viam-server`.

![Diagram showing how a client connects to a machine with Viam. Diagram shows a client as a computer sending commands to a machine. Robot 1 then communicates with other robotic parts over gRPC and WebRTC and communicating that information back to the client.](/build/program/sdks/robot-client.png)

Expand Down Expand Up @@ -372,7 +372,7 @@ If the internet becomes unavailable to the machine or to your computer but a loc
{{< tabs >}}
{{% tab name="Deploy and run as a module" %}}

You can wrap SDK code by [creating a module](/how-tos/create-module/).
You can wrap control code by [creating a module](/how-tos/create-module/).
In wrapping your code into a module, you will be able to:

- deploy it across one or more machines
Expand All @@ -382,7 +382,7 @@ In wrapping your code into a module, you will be able to:
You can package any files, code, or executable into a module.
When you add a module to your machine's configuration, the entrypoint defined for the module is run which can start your code.

If your SDK code augments what a component does, such as, for example, adding an overlay to a camera stream, you can create your own camera model inside your module and amend the API methods to have your custom functionality.
If your control code augments what a component does, such as, for example, adding an overlay to a camera stream, you can create your own camera model inside your module and amend the API methods to have your custom functionality.
For an example of this, see the [facial-detection module](https://github.com/viam-labs/facial-detection) which wraps its logic into a custom vision service.

If your functionality does not conform to existing API types such as the motor or camera API, you can [use a generic API to wrap your code](https://docs.viam.com/how-tos/create-module/#choose-an-api-to-implement-in-your-model).
Expand All @@ -402,7 +402,7 @@ If you subsequently lose internet connectivity, but stay connected to LAN or WAN
{{% /tab %}}
{{% tab name="Run on-machine" %}}

You can run SDK code directly on your machine.
You can run control code directly on your machine.
If you run [PID control loops](https://en.wikipedia.org/wiki/PID_controller) or your machines have intermittent or no network connectivity, you can ensure lags in communication do not interfere with the machine's performance by running the control code on the same board that is running `viam-server`.
Running everything on one machine is also convenient if you have a machine (for example, an air quality sensor) that runs all the time, and you don't want to have to connect to it from a separate computer constantly.

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/services/color-detection-scuttle.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ We're using a [SCUTTLE rover](https://www.scuttlerobot.org/) for this tutorial b

{{< alert title="You will learn" color="tip" >}}

- How to run SDK code
- How to run control code with Viam SDKs
- How to use the base API and the vision API to follow a line with a rover

{{< /alert >}}
Expand Down

0 comments on commit 5d9695b

Please sign in to comment.