You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/dev/reference/apis/components/generic.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,12 @@ aliases:
14
14
15
15
The generic API allows you to give commands to your [generic components](/operate/reference/components/generic/) for running model-specific commands using [`DoCommand`](/dev/reference/apis/components/generic/#docommand).
16
16
17
+
{{% alert title="Example usage" color="tip" %}}
18
+
19
+
See [Deploy control logic](/manage/software/control-logic/) for an example of how to use the generic component API, including how to call `DoCommand()` from the Viam SDKs or from the Viam app.
20
+
21
+
{{% /alert %}}
22
+
17
23
The generic component supports the following method:
@@ -158,12 +158,10 @@ For complete examples that implement control logic, see:
158
158
159
159
Once you have implemented your control logic, commit and push your changes to a GitHub repository.
160
160
161
-
If you are not using GitHub, see [Upload your module](/operate/get-started/other-hardware/#upload-your-module) and [Update an existing module](/operate/get-started/other-hardware/manage-modules/#update-automatically) for more information on alternatives.
162
-
163
161
Follow the steps in [Upload your module](/operate/get-started/other-hardware/#upload-your-module) using cloud build.
162
+
When you create a release, your module will be built, packaged and pushed to the Viam Registry.
164
163
165
-
Then [create a new release](https://docs.github.com/en/repositories/releasing-projects-on-github) with a tag of the form `1.0.0`.
166
-
Your module will now be built, packaged and pushed to the Viam Registry.
164
+
If you are not using GitHub or cloud build, see [Upload your module](/operate/get-started/other-hardware/#upload-your-module) and [Update an existing module](/operate/get-started/other-hardware/manage-modules/#update-automatically) for more information on alternatives.
167
165
168
166
## Deploy your control logic
169
167
@@ -177,3 +175,41 @@ Your module will now be built, packaged and pushed to the Viam Registry.
177
175
1. Click **Save**.
178
176
179
177
Your control logic will now be added to your machine.
178
+
179
+
## Start and stop your control logic with Viam SDKs
180
+
181
+
You can start and stop your control logic with the Viam SDKs by calling `DoCommand()`.
182
+
183
+
For example, in Python, you can start and stop your control logic with the following code:
184
+
185
+
```python
186
+
# Start your control logic
187
+
await control_logic.do_command({"start": ""})
188
+
189
+
# Stop your control logic
190
+
await control_logic.do_command({"stop": ""})
191
+
```
192
+
193
+
## Start and stop your control logic with the Viam app
194
+
195
+
You can start and stop your control logic from your machine's **CONTROL** tab in the Viam app:
196
+
197
+
{{<imgprocsrc="/components/generic/generic-control.png"alt="The generic component in the test panel."resize="900x"style="width:500px"class="imgzoom shadow">}}<br>
198
+
199
+
1. To start your control logic, copy and paste the following command input:
Copy file name to clipboardExpand all lines: docs/operate/reference/components/generic/_index.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,12 @@ If you want to use most of an existing API but need just a few other functions,
39
39
40
40
{{% /alert %}}
41
41
42
+
{{% alert title="Example usage" color="tip" %}}
43
+
44
+
See [Deploy control logic](/manage/software/control-logic/) for an example of how to use the generic component API, including how to call `DoCommand()` from the Viam SDKs or from the Viam app.
45
+
46
+
{{% /alert %}}
47
+
42
48
## Configuration
43
49
44
50
To use a generic component, check whether one of the following models supports it.
After you configure your generic component, open the generic's **TEST**panel on the **CONFIGURE** or [**CONTROL**](/manage/troubleshoot/teleoperate/default-interface/#viam-app)tabs.
3
+
After you configure your generic component, open the generic's panel on the [**CONTROL**](/manage/troubleshoot/teleoperate/default-interface/#viam-app)tab.
4
4
Use the card to send arbitrary commands to the resource with [`DoCommand()`](/dev/reference/apis/components/generic/#docommand).
5
5
6
-
{{<imgprocsrc="/components/generic/generic-control.png"alt="The generic component in the test panel."resize="800x"style="width:500px"class="imgzoom">}}
6
+
{{<imgprocsrc="/components/generic/generic-control.png"alt="The generic component in control panel."resize="900x"style="width:500px"class="imgzoom shadow">}}
7
+
8
+
The example above works for interacting with the generic component model shown in [Deploy control logic](/manage/software/control-logic/), but other components require different commands depending on how `DoCommand()` is implemented.
0 commit comments