Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCS-906: Document wheeled-odometry model of movement sensor #1734

Merged
merged 35 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
dfcd2b5
make wheeledodometry page
sguequierre Sep 1, 2023
366cabf
make wheeledodometry page better
sguequierre Sep 1, 2023
4975d81
Update wheeledodometry.md make time_interval_msec optional
sguequierre Sep 1, 2023
8d20302
Update docs/components/movement-sensor/wheeledodometry.md
sguequierre Sep 1, 2023
9cc187d
Add configure base step
sguequierre Sep 1, 2023
f801f13
Apply rand's inline suggestions from code review
sguequierre Sep 1, 2023
4afa892
Apply suggestions from code review position reporting motors
sguequierre Sep 1, 2023
45eb353
Apply suggestions from code review more fix with `wheeledodometry`
sguequierre Sep 1, 2023
e968221
Update wheeledodometry.md more suggestions from code review
sguequierre Sep 1, 2023
047e2cd
Update wheeledodometry.md more suggestions from code review
sguequierre Sep 1, 2023
0b589d4
Remove trailing space
sguequierre Sep 1, 2023
3a761f2
Fix typo (#1726)
mcvella Aug 31, 2023
4c897d8
Update image on servo test sections (#1728)
npentrel Sep 1, 2023
5b503f4
DOCS-1058: Add --force flag to CLI (#1727)
andf-viam Sep 1, 2023
eff3ebd
add tip about roboclaw and rename file
sguequierre Sep 1, 2023
e7f6bc8
Update movement sensor page link to wheeled-odometry for page renaming
sguequierre Sep 1, 2023
c9f4d34
Apply suggestions from code review
sguequierre Sep 1, 2023
0d485e5
Merge branch 'main' into DOCS-906/wheeled-encoder
sguequierre Sep 1, 2023
eef4f19
Apply suggestions from rand/martha inline code review
sguequierre Sep 5, 2023
904d382
Apply suggestions from code review add warning for time interval
sguequierre Sep 5, 2023
26dc6df
Update docs/components/movement-sensor/wheeled-odometry.md
sguequierre Sep 5, 2023
b845418
Remove trailing space
sguequierre Sep 5, 2023
138bd6c
Update docs/components/movement-sensor/wheeled-odometry.md
sguequierre Sep 5, 2023
8cb1e0d
Apply final suggestions from code review
sguequierre Sep 5, 2023
8858a08
Apply andrew suggestions from code review for clarity
sguequierre Sep 6, 2023
5b8efa3
Apply suggestions from code review change tags
sguequierre Sep 6, 2023
8095af2
Apply suggestions from code review make what this is more clear
sguequierre Sep 6, 2023
0a657dd
Apply suggestions from code review
sguequierre Sep 6, 2023
24dc836
fixup
sguequierre Sep 6, 2023
af320a2
fixup blank line
sguequierre Sep 6, 2023
72afcd6
Fixup
sguequierre Sep 6, 2023
5a8a967
Fixup modelname `wheeled-odometry`
sguequierre Sep 6, 2023
498f4f0
Fixup `wheeledodometry` to `wheeled-odometry`
sguequierre Sep 6, 2023
4ed6cea
Update docs/components/movement-sensor/wheeled-odometry.md
sguequierre Sep 6, 2023
e07588d
Merge branch 'main' into DOCS-906/wheeled-encoder
sguequierre Sep 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/components/movement-sensor/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Model | Description <a name="model-table"></a>
[`accel-adxl345`](./adxl345/) | The [Analog Devices ADXL345](https://www.analog.com/en/products/adxl345.html) digital accelerometer
[`gyro-mpu6050`](./mpu6050/) | A gyroscope/accelerometer manufactured by TDK InvenSense
[`merged`](./merged/) | A model that allows you to aggregate the API methods supported by multiple sensors into a singular sensor client, effectively merging the models of the individual resources
[`wheeled-odometry`](./wheeledodometry/) | A model that uses [encoders](/components/encoder/) to get an odometry estimate from a wheeled base
sguequierre marked this conversation as resolved.
Show resolved Hide resolved
[`fake`](./fake/) | Used to test code without hardware

## Control your movement sensor with Viam's client SDK libraries
Expand Down
69 changes: 69 additions & 0 deletions docs/components/movement-sensor/wheeled-odometry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: "Configure a wheeled-odometry movement sensor"
linkTitle: "wheeled-odometry"
type: "docs"
description: "Configure a wheeled-odometry movement sensor."
images: ["/icons/components/imu.svg"]
tags: ["movement sensor", "components", "movement sensor"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: extra movement sensor

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha removed! MAking better tags

sguequierre marked this conversation as resolved.
Show resolved Hide resolved
# SMEs: Rand, Martha
---

Configure a `wheeled-odometry` movement sensor to implement _wheeled odometry_ on your robot.

_Wheeled odometry_ is the estimation of position, orientation, linear velocity, and angular velocity using the dimensions of a base.
randhid marked this conversation as resolved.
Show resolved Hide resolved
sguequierre marked this conversation as resolved.
Show resolved Hide resolved
This model uses [encoders](/components/encoder/) from [position reporting motors](/components/motor/) to get an odometry estimate from a wheeled base.
sguequierre marked this conversation as resolved.
Show resolved Hide resolved

With a configured `wheeled-odometry` movement sensor, after every time `time_interval_msec` elapses during a [session](/program/apis/sessions/), your robot calculates an estimation of the position, orientation, linear velocity, and angular velocity of the wheeled base.
sguequierre marked this conversation as resolved.
Show resolved Hide resolved
You can access these readings through the [movement sensor API](/components/movement-sensor/#api).
sguequierre marked this conversation as resolved.
Show resolved Hide resolved

After configuring a `wheeled-odometry` movement sensor, you can operate your base with Viam's built-in services like the [navigation service](/services/navigation/).

## Set-up requirements

To prepare your robot, attach [encoders](/components/encoder/) to each of the position-reporting motors on your base to measure their rotation.

- Pick out motors that can report their own position, like the [`roboclaw`](/components/motor/roboclaw/) or [`gpio` motors](/components/motor/gpio/) with [encoders](/components/encoder/#configuration).
sguequierre marked this conversation as resolved.
Show resolved Hide resolved
You can access this property of a configured motor through the [motor API's `GetProperties()`](/components/motor/#getproperties).
randhid marked this conversation as resolved.
Show resolved Hide resolved
- Configure your rover as a [wheeled base component](/components/base/wheeled/).
sguequierre marked this conversation as resolved.
Show resolved Hide resolved
- Configure each of the position-reporting motors [as motor components](/components/motor/).
- Configure an [encoder component](/components/encoder/#configuration) for each of the encoders you attached to the position-reporting motors.
sguequierre marked this conversation as resolved.
Show resolved Hide resolved
- Then, proceed to [configure](#configuration) a `wheeledodometry` movement sensor with the name of each of the encoder components.
sguequierre marked this conversation as resolved.
Show resolved Hide resolved

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

The `roboclaw` motor does not require you to configure [encoder components](/components/encoder/#configuration) for use with the `wheeled-odometry` movement sensor.
It reports its own position with a built-in encoded motor.

{{% /alert %}}
sguequierre marked this conversation as resolved.
Show resolved Hide resolved

sguequierre marked this conversation as resolved.
Show resolved Hide resolved
## Configuration

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.
Select **Raw JSON** mode.
Copy and paste the following:

```json {class="line-numbers linkable-line-numbers"}
"name" : "<your-wheeledodometry-movement-sensor-name>",
"type" : "movement_sensor",
"model" : "wheeledodometry",
sguequierre marked this conversation as resolved.
Show resolved Hide resolved
"attributes" : {
"base" : "<your-base-name>",
"left_motors" : ["<your-base-left-motor-name-1>", "<your-base-left-motor-name-2>"],
"right_motors" : ["<your-base-right-motor-name-1", "your-base-right-motor-name-2>"],
"time-interval-msec": <number>
}
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure: Does this require depends_on like other things that function as other components? (Like the visual odometry sensor depends_on a camera.) I think ... no?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the validation function of most built-in models appends all dependencies, they are implicit and don't need to be explicitly configured.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but they will show up in your config once added as dependencies, you just don't have to configure them as a user - we use the helper functions to do that for you.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks @randhid !


Fill in and edit the attributes as applicable.

## Attributes

The following attributes are available for `wheeledodometry` movement sensors:
sguequierre marked this conversation as resolved.
Show resolved Hide resolved

| Name | Type | Inclusion | Description |
| ---- | ---- | --------- | ----------- |
| `base` | string | **Required** | The `name` of the [base](/components/base/) to which the encoders making up this movement sensor are wired. |
| `left_motors` | object | **Required** | A struct holding the name of each of the bases' left [position-reporting motors](/components/motor/gpio/). |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] I might be wrong, but it seems more like a list than a struct? whatever you think. same for right motors on next line

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, you're right! Thank you! Updating

sguequierre marked this conversation as resolved.
Show resolved Hide resolved
| `right_motors` | object | **Required** | A struct holding the name of each of the bases' right [position-reporting motors](/components/motor/gpio/). |
sguequierre marked this conversation as resolved.
Show resolved Hide resolved
| `time_interval_msec` | number | Optional | The time in between each wheeled odometry calculation. <br> Default: `500.0` </br> |
sguequierre marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 4 additions & 0 deletions docs/extend/modular-resources/upload/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ To upload your custom module to the Viam Registry, either as a public or private
viam module upload --version 1.0.0 --platform darwin/arm64 module.tar.gz
```

When you `upload` a module, the command performs basic [validation](/manage/cli/#upload-validation) of your packaged module to ensure it is compatible with the Viam Registry.

For more information, see the [`viam module` command](/manage/cli/#module)

## Update an existing module
Expand Down Expand Up @@ -226,4 +228,6 @@ You can also use the [Viam CLI](/manage/cli/) to update an existing custom modul
viam module upload --version 1.0.1 --platform darwin/arm64 my-module.tar.gz
```

When you `upload` a module, the command performs basic [validation](/manage/cli/#upload-validation) of your packaged module to ensure it is compatible with the Viam Registry.

For more information, see the [`viam module` command](/manage/cli/#module)
13 changes: 12 additions & 1 deletion docs/manage/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,14 @@ See [Upload a custom module](/extend/modular-resources/upload/#upload-a-custom-m
| ----------- | ----------- | ----------- |
| `create` | generate new metadata for a custom module on your local filesystem | - |
| `update` | update an existing custom module on your local filesystem with recent changes to the [`meta.json` file](#the-metajson-file) | - |
| `upload` | upload a new or existing custom module on your local filesystem to the Viam Registry |
| `upload` | validate and upload a new or existing custom module on your local filesystem to the Viam Registry. See [Upload validation](#upload-validation) for more information |
| `--help` | return help | - |

##### Named arguments

| argument | description | applicable commands | required
| ----------- | ----------- | ----------- | ----------- |
| `--force` | skip local validation of the packaged module, which may result in an unusable module if the contents of the packaged module are not correct | `upload` | false |
| `--module` | the path to the [`meta.json` file](#the-metajson-file) for the custom module, if not in the current directory | `update`, `upload` | false |
| `--name` | the name of the custom module to be created | `create` | true |
| `--org-id` | the organization ID to associate the module to. See [Using the `--org-id` argument](#using-the---org-id-and---public-namespace-arguments) | `create`, `update`, `upload` | true |
Expand Down Expand Up @@ -331,6 +332,16 @@ Users can choose to pin to a specific patch version, permit upgrades within majo
When you `update` a module configuration and then `upload` it, the `entrypoint` for that module defined in the [`meta.json` file](#the-metajson-file) is associated with the specific `--version` for that `upload`.
Therefore, you are able to change the `entrypoint` file from version to version, if desired.

##### Upload validation

When you `upload` a module, the command validates your local packaged module to ensure that it meets the requirements to successfully upload to the Viam Registry.
The following criteria are checked for every `upload`:

* The packaged module must exist on the filesystem at the path provided to the `upload` command.
* The packaged module must use the `.tar.gz` extension.
* The entry point file specified in the [`meta.json` file](#the-metajson-file) must exist on the filesystem at the path specified.
* The entry point file must be executable.

##### The `meta.json` file

When uploading a custom module, the Viam Registry tracks your module's metadata in a `meta.json` file.
Expand Down
2 changes: 1 addition & 1 deletion docs/services/slam/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/
slam_svc = SLAMClient.from_robot(robot=robot, name="my_slam_service")

# Get the point cloud map in standard PCD format.
pcd_map = await slam.get_point_cloud_map()
pcd_map = await slam_svc.get_point_cloud_map()
```

{{% /tab %}}
Expand Down
2 changes: 1 addition & 1 deletion static/include/components/servo-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

After you establish the connection to your servo motor, navigate to the [Control tab](/manage/fleet/robots/#control) and select the dropdown panel dedicated to the motor. Use the buttons to move the servo motor to the desired angle.

![The servo component in the control tab](components/servo/servo-control-tab.png)
{{<imgproc src="/components/servo/servo-control-tab.png" resize="400x" declaredimensions=true alt="The servo component in the control tab">}}