Skip to content

Commit

Permalink
Merge branch 'main' into 908cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
JessamyT authored Aug 28, 2023
2 parents 4963467 + 272574d commit 89afed8
Show file tree
Hide file tree
Showing 18 changed files with 252 additions and 66 deletions.
Binary file added assets/components/board/upboard-ui-config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/components/encoder/configure-am5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/components/encoder/configure-fake.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/components/encoder/configure-incremental.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/components/encoder/configure-single.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/tutorials/scuttlebot/create-encoder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/components/board/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ For model-specific configuration information, click on one of the following mode
| [`jetson`](jetson/) | [NVIDIA Jetson AGX Orin](https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-orin/), [NVIDIA Jetson Orin Nano](https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-orin/), [NVIDIA Jetson Xavier NX](https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-xavier-nx/), [NVIDIA Jetson Nano](https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-nano/) |
| [`numato`](numato/) | [Numato GPIO Modules](https://numato.com/product-category/automation/gpio-modules/), peripherals for adding GPIO pins |
| [`pca9685`](pca9685/) | [PCA9685 Arduino I<sup>2</sup>C Interface](https://www.adafruit.com/product/815), a 16-channel [I<sup>2</sup>C](#i2cs) [PWM](https://docs.arduino.cc/learn/microcontrollers/analog-output)/[servo](/components/servo/) driver peripheral |
| [`upboard`](upboard/) | An Intel-based board like the [UP4000](https://github.com/up-board/up-community/wiki/Pinout_UP4000) |
| [`fake`](fake/) | A model used for testing, with no physical hardware |
| other | You can use other boards with modular components such as [`periph_board`](https://github.com/viam-labs/periph_board) |

Expand Down
65 changes: 65 additions & 0 deletions docs/components/board/upboard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: "Configure an upboard board"
linkTitle: "upboard"
weight: 70
type: "docs"
description: "Configure an upboard board."
images: ["/icons/components/board.svg"]
tags: ["board", "components"]
# SMEs: Susmita
---

Configure an `upboard` board to integrate an Intel-based board like the [UP4000](https://github.com/up-board/up-community/wiki/Pinout_UP4000) into your robot.

## Set up requirements

Flash your Intel-based board with:

1. The Ubuntu `"Server install image"` version of the operating system. For example, `ubuntu-22.04.2-live-server-amd64.iso`.
Follow [these instructions](https://ubuntu.com/tutorials/install-ubuntu-server) to do so.
1. The [pin control driver](https://github.com/up-division/pinctrl-upboard).
Follow [these instructions](https://github.com/up-division/pinctrl-upboard) to do so.
This driver stabilizes the [GPIO pin mapping definition](https://github.com/up-board/up-community/wiki/Pinout) on the board to make it identical to that of a [Raspberry Pi](/components/board/pi/).

{{< tabs name="Configure an upboard Board" >}}
{{% tab name="Config Builder" %}}

Navigate to the **Config** tab of your robot's page in [the Viam app](https://app.viam.com).
Click on the **Components** subtab and navigate to the **Create component** menu.
Enter a name for your board, select the type `board`, and select the `upboard` model.

Click **Create component**.

![An example configuration for a upboard board in the Viam app Config Builder.](/components/board/upboard-ui-config.png)

Edit and fill in the attributes as applicable.

{{% /tab %}}
{{% tab name="JSON Template" %}}

```json {class="line-numbers linkable-line-numbers"}
{
"components": [
{
"name": "<your-upboard-board>",
"type": "board",
"model": "upboard",
"attributes": {
"i2cs": [],
"digital_interrupts": []
},
"depends_on": []
}
]
}
```

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

The following attributes are available for `upboard` boards:

| Name | Type | Inclusion | Description |
| ---- | ---- | --------- | ----------- |
| `digital_interrupts` | object | Optional | Any digital interrupts's {{< glossary_tooltip term_id="pin-number" text="pin number" >}} and name. See [configuration info](/components/board/#digital_interrupts). |
| `i2cs` | object | Optional | Any Inter-Integrated Circuit (I<sup>2</sup>C) pins' bus index and name. See [configuration info](/components/board/#i2cs). |
14 changes: 13 additions & 1 deletion docs/components/encoder/fake.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Enter a name for your encoder, select the type `encoder`, and select the `fake`

Click **Create component**.

{{< imgproc src="/components/encoder/configure-fake.png" alt="Configuration of a fake encoder in the Viam app config builder." resize="600x" >}}
![Configuration of a fake encoder in the Viam app config builder.](/components/encoder/configure-fake.png)

{{% /tab %}}
{{% tab name="JSON Template" %}}
Expand All @@ -34,6 +34,18 @@ Click **Create component**.
}
```

{{% /tab %}}
{{% tab name="JSON Example" %}}

```json {class="line-numbers linkable-line-numbers"}
{
"name": "myEncoder",
"type": "encoder",
"model" : "fake",
"attributes": {}
}
```

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

Expand Down
10 changes: 5 additions & 5 deletions docs/components/movement-sensor/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ linVel, err := myMovementSensor.LinearVelocity(context.Background(), nil)

### GetAngularVelocity

Report the current angular velocity about the x, y and z axes (as a 3D vector) in radians per second.
Report the current angular velocity about the x, y and z axes (as a 3D vector) in degrees per second.

Supported by IMU models and by `gyro-mpu6050`.

Expand All @@ -202,7 +202,7 @@ Supported by IMU models and by `gyro-mpu6050`.

**Returns:**

- [(Vector3)](https://python.viam.dev/autoapi/viam/components/movement_sensor/index.html#viam.components.movement_sensor.Vector3): A 3D vector containing three floats representing the angular velocity about the x, y and z axes in radians per second.
- [(Vector3)](https://python.viam.dev/autoapi/viam/components/movement_sensor/index.html#viam.components.movement_sensor.Vector3): A 3D vector containing three floats representing the angular velocity about the x, y and z axes in degrees per second.

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/components/movement_sensor/index.html#viam.components.movement_sensor.MovementSensor.get_angular_velocity).

Expand All @@ -226,7 +226,7 @@ y_ang_vel = ang_vel.y

**Returns:**

- [(r3.Vector)](https://pkg.go.dev/github.com/golang/geo/r3#Vector): A 3D vector containing three floats representing the angular velocity about the x, y and z axes in radians per second.
- [(r3.Vector)](https://pkg.go.dev/github.com/golang/geo/r3#Vector): A 3D vector containing three floats representing the angular velocity about the x, y and z axes in degrees per second.
- [(error)](https://pkg.go.dev/builtin#error): An error, if one occurred.

For more information, see the [Go SDK docs](https://pkg.go.dev/go.viam.com/rdk/components/movementsensor#MovementSensor).
Expand Down Expand Up @@ -367,7 +367,7 @@ Supported by IMU models.

**Returns:**

- [(Orientation)](https://python.viam.dev/autoapi/viam/components/movement_sensor/index.html#viam.components.movement_sensor.Orientation): Abstract base class for protocol messages, containing `o_x`, `o_y`, `o_z`, and `theta`, which together represent a vector pointing in the direction that the sensor is pointing, and the angle (`theta`) of the sensor's rotation about that axis.
- [(Orientation)](https://python.viam.dev/autoapi/viam/components/movement_sensor/index.html#viam.components.movement_sensor.Orientation): Abstract base class for protocol messages, containing `o_x`, `o_y`, `o_z`, and `theta`, which together represent a vector pointing in the direction that the sensor is pointing, and the angle (`theta`) in degrees of the sensor's rotation about that axis.

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/components/movement_sensor/index.html#viam.components.movement_sensor.MovementSensor.get_orientation).

Expand Down Expand Up @@ -406,7 +406,7 @@ orientation := sensorOrientation.OrientationVectorDegrees()
logger.Info("The x component of the orientation vector: ", orientation.OX)
logger.Info("The y component of the orientation vector: ", orientation.OY)
logger.Info("The z component of the orientation vector: ", orientation.OZ)
logger.Info("The number of degrees that the movement sensor is rotated about the vector: ", orientation.OX)
logger.Info("The number of degrees that the movement sensor is rotated about the vector: ", orientation.Theta)
```

{{% /tab %}}
Expand Down
32 changes: 16 additions & 16 deletions docs/extend/modular-resources/examples/odrive.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tags: ["motor", "odrive", "canbus", "serial", "module", "modular resources", "Py

The [Viam GitHub](https://github.com/viamrobotics/odrive) provides an implementation of ODrive Robotics' [ODrive S1](https://odriverobotics.com/shop/odrive-s1) motor driver as module defining two modular resources [extending](/extend/modular-resources/) the [motor API](/components/motor/#api) as new motor types.

[Install requirements](#requirements), [prepare](#prepare-your-odrive) your ODrive, and [configure](#configuration) the module to configure an `odrive-serial` or `odrive-canbus` [motor](/components/motor/) {{< glossary_tooltip term_id="resource" text="resource" >}} on your robot.
[Install requirements](#requirements), [prepare](#prepare-your-odrive) your ODrive, and [configure](#configuration) the module to configure an `serial` or `canbus` [motor](/components/motor/) {{< glossary_tooltip term_id="resource" text="resource" >}} on your robot.

{{% alert title="Note" color="note" %}}

Expand Down Expand Up @@ -60,7 +60,7 @@ If you wish to set the native configuration dynamically, use `odrivetool` to fin
Provide this in configuration as the optional attribute `odrive_config_file`.
See [add an `odrive_config_file`](#add-an-odrive_config_file) for more information.

This option is not recommend for the `odrive-canbus` model.
This option is not recommend for the `canbus` model.

{{% /alert %}}

Expand All @@ -82,27 +82,27 @@ Additionally, make sure you have [enabled SPI communication on your Pi](/install
4. Make sure your ODrive is connected to your [board](/components/board/) as follows, depending on your preferred connection method:

{{< tabs name="Connect your ODrive">}}
{{% tab name="odrive-serial" %}}
{{% tab name="serial" %}}

Plug the [USB Isolator for Odrive](https://odriverobotics.com/shop/usb-c-to-usb-a-cable-and-usb-isolator) into a USB port on your board.
Plug a USB-C to USB-A cable from the isolator to the ODrive.

{{% /tab %}}
{{% tab name="odrive-canbus" %}}
{{% tab name="canbus" %}}

Wire the CANH and CANL pins from your board to your ODrive.
Refer to your board and the [ODrive's pinout](https://docs.odriverobotics.com/v/latest/pinout.html) diagrams for the location of these pins.

You must make a serial connection to set up your ODrive. If CAN chains together multiple ODrives, only one at a time must have this serial connection for reconfiguration
After setting up the ODrive, if you wish to use the `odrive-canbus` model, you can either leave the serial connection plugged in or remove it and leave only the CANH and CANL pins wired.
After setting up the ODrive, if you wish to use the `canbus` model, you can either leave the serial connection plugged in or remove it and leave only the CANH and CANL pins wired.

Note that if you want to only use the CAN pins, you cannot specify an `"odrive_config_file"` in your Viam configuration.
The ODrive would not be able to make the serial connection it needs to perform reconfiguration.

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

After preparing your ODrive, configure the module to configure `odrive-serial` or `odrive-canbus` model motors on your robot.
After preparing your ODrive, configure the module to configure `serial` or `canbus` model motors on your robot.

## Configuration

Expand Down Expand Up @@ -142,14 +142,14 @@ Select **Raw JSON** mode.
Copy and paste the following JSON along with your module JSON depending on your preferred communication type:

{{< tabs name="Add an ODrive motor">}}
{{% tab name="odrive-serial" %}}
{{% tab name="serial" %}}

```json {class="line-numbers linkable-line-numbers"}
{
// "modules": [ {"name": "odrive" ... } ] MODULE JSON
"components": [
{
"model": "viam:motor:odrive-serial",
"model": "viam:odrive:serial",
"namespace": "rdk",
"attributes": {
},
Expand All @@ -162,14 +162,14 @@ Copy and paste the following JSON along with your module JSON depending on your
```

{{% /tab %}}
{{% tab name="odrive-canbus" %}}
{{% tab name="canbus" %}}

```json {class="line-numbers linkable-line-numbers"}
{
// "modules": [ {"name": "odrive" ... } ] MODULE JSON
"components": [
{
"model": "viam:motor:odrive-canbus",
"model": "viam:odrive:canbus",
"namespace": "rdk",
"attributes": {
"canbus_node_id": <int>,
Expand All @@ -195,7 +195,7 @@ Copy and paste the following JSON along with your module JSON depending on your
],
"components": [
{
"model": "viam:motor:odrive-canbus",
"model": "viam:odrive:canbus",
"namespace": "rdk",
"attributes": {
"canbus_node_id": 0,
Expand All @@ -207,7 +207,7 @@ Copy and paste the following JSON along with your module JSON depending on your
"name": "odrive-motor"
},
{
"model": "viam:motor:odrive-canbus",
"model": "viam:odrive:canbus",
"namespace": "rdk",
"attributes": {
"canbus_node_id": 2,
Expand All @@ -231,17 +231,17 @@ The following attributes are available for the motor resources available in the

| Name | Type | Inclusion | Description |
| ---- | ---- | --------- | ----------- |
| `canbus_node_id` | int | Optional | Required for successful initialization of the `"odrive-canbus"` type. <br> Node ID of the CAN node you would like to use. You configured this when [setting up your ODrive](https://docs.odriverobotics.com/v/latest/can-guide.html#setting-up-the-odrive). <br> Example: `0` |
| `canbus_node_id` | int | Optional | Required for successful initialization of the `"canbus"` type. <br> Node ID of the CAN node you would like to use. You configured this when [setting up your ODrive](https://docs.odriverobotics.com/v/latest/can-guide.html#setting-up-the-odrive). <br> Example: `0` |
| `odrive_config_file` | string | Optional | Filepath of a separate JSON file containing your ODrive's native configuration. See [add an `odrive_config_file`](#add-an-odrive_config_file) for instructions if you add this attribute. </br> See the [Odrive S1 Modular Component repository](https://github.com/viamrobotics/odrive/tree/main/sample-configs) for an example of this file. |
| `serial_number` | string | Optional | The serial number of the ODrive. Note that this is not necessary if you only have one ODrive connected. See "[Troubleshooting](#troubleshooting): [Hanging](https://github.com/viamrobotics/odrive#hanging)" for help finding this value. |
| `canbus_baud_rate` | string | Optional | [Baud rate](https://docs.odriverobotics.com/v/latest/can-guide.html#setting-up-the-odrive) of the ODrive CAN protocol. This attribute is only available for `"odrive-canbus"` connections. </br> Use [`odrivetool`](https://docs.odriverobotics.com/v/latest/odrivetool.html) to obtain this value with `<odrv>.can.config.baud_rate`. Format the string as a multiple of 1000 (k). <br> Example: `"250k"` |
| `canbus_baud_rate` | string | Optional | [Baud rate](https://docs.odriverobotics.com/v/latest/can-guide.html#setting-up-the-odrive) of the ODrive CAN protocol. This attribute is only available for `"canbus"` connections. </br> Use [`odrivetool`](https://docs.odriverobotics.com/v/latest/odrivetool.html) to obtain this value with `<odrv>.can.config.baud_rate`. Format the string as a multiple of 1000 (k). <br> Example: `"250k"` |

Save the config.
Check the [**Logs** tab](/program/debug/) of your robot in the Viam app to make sure your ODrive motor has connected and no errors are being raised.

{{% alert title="Tip" color="tip" %}}

The `"odrive-canbus"` type allows you to connect multiple ODrives without providing a `serial_number` as long as you have not defined any `odrive_config_file` once the drive has been configured with `odrivetool`.
The `"canbus"` type allows you to connect multiple ODrives without providing a `serial_number` as long as you have not defined any `odrive_config_file` once the drive has been configured with `odrivetool`.

{{% /alert %}}

Expand All @@ -253,7 +253,7 @@ To add an `odrive_config_file` and reconfigure your ODrive natively each time th
See the [ODrive documentation](https://docs.odriverobotics.com/v/latest/odrivetool.html#configuration-backup) for more info.
2. `iq_msg_rate_ms` in the config defaults to `0`.
You must set this to or around `100` to use the [motor API's `SetPower` method](https://docs.viam.com/components/motor/#setpower).
3. If you add an `odrive_config_file` to an `odrive-canbus` motor, you will have to leave the serial connection established with your ODrive plugged in to the USB port, in addition to wiring the CANH and CANL pins.
3. If you add an `odrive_config_file` to an `canbus` motor, you will have to leave the serial connection established with your ODrive plugged in to the USB port, in addition to wiring the CANH and CANL pins.

An alternative to adding an `odrive_config_file` is running the command `odrivetool restore-config /path/to/config.json` in your terminal.

Expand Down
19 changes: 6 additions & 13 deletions docs/extend/modular-resources/upload/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ To upload your custom module to the Viam Registry, either as a public or private
Editing and then uploading the `meta.json` file sets important configuration information about your module, such as whether it will be publicly available to all Viam users, or only available within your organization.

1. Edit the newly-created `meta.json` file, and provide the required configuration information for your custom module by filling in the following fields.
The `module_id` field is pre-populated using the `--name` you provided in the `viam module create` command, and `visibility` is set to `private` by default.
The `name` field is pre-populated using the `--name` you provided in the `viam module create` command, and `visibility` is set to `private` by default.

<table class="table table-striped">
<tr>
Expand All @@ -49,7 +49,7 @@ To upload your custom module to the Viam Registry, either as a public or private
<th>Description</th>
</tr>
<tr>
<td><code>name</code></td>
<td><code>module_id</code></td>
<td>string</td>
<td><strong>Required</strong></td>
<td>The name of the module, including its <a href="/manage/fleet/organizations/#create-a-namespace-for-your-organization">namespace</a></td>
Expand Down Expand Up @@ -91,7 +91,7 @@ To upload your custom module to the Viam Registry, either as a public or private

```json {class="line-numbers linkable-line-numbers"}
{
"name": "acme:my-module",
"module_id": "acme:my-module",
"visibility": "public",
"url": "https://github.com/acme-co-example/my-module",
"description": "An example custom module.",
Expand Down Expand Up @@ -184,21 +184,14 @@ You can also use the [Viam CLI](/manage/cli/) to update an existing custom modul
1. Update your custom module's `meta.json` file with the changes, if any.
For example, if you have altered your model's name, or adjusted the endpoint name, you'll need to update `meta.json` with these changes.
1. Run `viam module update` to register the configuration changes to your module (and to `meta.json` if applicable):
- To register a *public* module, run the following command from within the same directory as your `meta.json` file:
1. Run `viam module update` to register the configuration changes you just made to `meta.json` with the Viam Registry.
Run this command from within the same directory as your `meta.json` file:
``` sh {id="terminal-prompt" class="command-line" data-prompt="$"}
viam module update
```
- To register a *private* module, run the following command from within the same directory as your `meta.json` file, providing your organization ID:
``` sh {id="terminal-prompt" class="command-line" data-prompt="$"}
viam module update --org-id <org-id>
```
On successful update, the command will return a link to the updated module in the Viam Registry.
On a successful update, the command will return a link to the updated module in the Viam Registry.
1. Package your custom module to get it ready to upload to the Viam Registry.
Currently, the Registry only supports `tar.gz` or `tar.xz` format.
Expand Down
Loading

0 comments on commit 89afed8

Please sign in to comment.