From b8d5b04649af20be1bea99779746a05de755c815 Mon Sep 17 00:00:00 2001
From: Naomi Pentrel <5212232+npentrel@users.noreply.github.com>
Date: Mon, 11 Nov 2024 22:47:51 +0100
Subject: [PATCH] Update front page for new module generator (#3669)
---
docs/_index.md | 82 ++++++++++++++++++++++++--------------------------
1 file changed, 39 insertions(+), 43 deletions(-)
diff --git a/docs/_index.md b/docs/_index.md
index fae25357ad..d49822e78b 100644
--- a/docs/_index.md
+++ b/docs/_index.md
@@ -362,26 +362,25 @@ Configure it as an arm component. Then you can move it using the arm API.
{{< tabs >}}
-{{% tab name="Shell" %}}
+{{% tab name="Python" %}}
+
+```python
+my_button = Generic.from_robot(robot=machine, name="my_button")
+
+# Use a custom command to push the button 5
+command = {"cmd": "push_button", "button": 5}
+result = await my_button.do_command(command)
+```
-```sh {class="command-line" data-prompt="$" data-output="3-20"}
-yo viam-module
-? Create module structure within current directory? If no, will create a new directory with current directory matching the module name
-you select No
-? Your model triplet in the format namespace:family:modelname acme:rovers:base
-? The language your module will be written in, must match Viam SDK language selected (python currently supported) python
-? The API triplet this module uses (for example: rdk:component:motor). Expectation is that the second element is 'component' or 'service'.
- rdk:component:base
-? Is this a viam-sdk built-in API? Yes
-Will create module scaffolding for module - base
-API - rdk:component:base
-Model - acme:rovers:base
- create base-base/run.sh
- create base-base/requirements.txt
- create base-base/src/__main__.py
- create base-base/src/__init__.py
- create base-base/src/base.py
- create base-base/README.md
+{{% /tab %}}
+{{% tab name="Go" %}}
+
+```go
+myButton, err := generic.FromRobot(machine, "my_button")
+
+// Use a custom command to push the button 5
+command := map[string]interface{}{"cmd": "push_button", "button": 5}
+result, err := myButton.DoCommand(context.Background(), command)
```
{{% /tab %}}
@@ -391,9 +390,9 @@ Model - acme:rovers:base
Using the Viam Registry you can create _{{< glossary_tooltip term_id="resource" text="resources" >}}_ for additional hardware types or models and then deploy them to your machines.
-There are also a variety of community-supplied resources you can use.
+You can use an existing component or service type or create generic resources.
-[Create a module →](/how-tos/create-module/)
+[Create a module →](/how-tos/hello-world-module/)
@@ -661,28 +660,25 @@ Use the navigation service to autonomously navigate a machine to defined waypoin
{{< tabs >}}
-{{% tab name="Shell" %}}
+{{% tab name="Python" %}}
+
+```python
+my_twilio_svc = Generic.from_robot(robot=machine, name="my_twilio_svc")
+
+# Use a custom command to send a text message with Twilio
+command = {"to": "+1 234 567 8901", "body": "Hello world!"}
+result = await my_button.do_command(command)
+```
+
+{{% /tab %}}
+{{% tab name="Go" %}}
+
+```go
+myTwilioSvc, err := generic.FromRobot(machine, "my_twilio_svc")
-```sh {class="command-line" data-prompt="$" data-output="3-20"}
-npm install -g generator-viam-module
-yo viam-module
-? Create module structure within current directory? If no, will create a new directory with current directory matching the module name
-you select No
-? Your model triplet in the format namespace:family:modelname acme:services:slam
-? The language your module will be written in, must match Viam SDK language selected (python currently supported) python
-? The API triplet this module uses (for example: rdk:component:motor). Expectation is that the second element is 'component' or 'service'.
- rdk:services:slam
-? Is this a viam-sdk built-in API? No
-? Is this an new API you will define now? No
-Will create module scaffolding for module - slam
-API - rdk:services:slam
-Model - acme:services:slam
- create slam-slam/run.sh
- create slam-slam/requirements.txt
- create slam-slam/src/__main__.py
- create slam-slam/src/slam/__init__.py
- create slam-slam/src/slam/slam.py
- create slam-slam/README.md
+// Use a custom command to push the button 5
+command := map[string]interface{}{"to": "+1 234 567 8901", "body": "Hello world!"}
+result, err := myButton.DoCommand(context.Background(), command)
```
{{% /tab %}}
@@ -691,7 +687,7 @@ Model - acme:services:slam
-Using the Viam Registry you can turn your own custom business logic into _{{< glossary_tooltip term_id="module" text="modules" >}}_. You can then deploy your modules to your machines.
+Using the Viam Registry you can turn services and your own custom business logic into _{{< glossary_tooltip term_id="module" text="modules" >}}_. You can then deploy your modules to your machines.
[Create a module →](/how-tos/create-module/)