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-923: Document viam:camera:csi modular camera as model for the Jetson Orin Nano's embedded camera #1716

Merged
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3f8bc47
make csi page
sguequierre Aug 29, 2023
405e73b
add csi docs
sguequierre Aug 29, 2023
c5f6c8e
Update docs/components/board/jetson.md
sguequierre Aug 29, 2023
9490f17
Update docs/extend/modular-resources/examples/csi.md
sguequierre Aug 29, 2023
fc1fcea
Link fixup
sguequierre Aug 29, 2023
ff5d2d1
Update docs/extend/modular-resources/examples/csi.md
sguequierre Aug 29, 2023
e984fb5
Apply suggestions from code review
sguequierre Aug 29, 2023
7886cea
Apply suggestions remove tabs bc just raw json
sguequierre Aug 29, 2023
707db27
Apply suggestions from code review
sguequierre Aug 29, 2023
640e855
Apply suggestions from code review
sguequierre Aug 30, 2023
22ce75d
Update csi.md remove trailing space
sguequierre Aug 30, 2023
3002dda
Apply naomi's inline suggestions from code review
sguequierre Sep 1, 2023
7899941
Update docs/extend/modular-resources/examples/csi.md
sguequierre Sep 1, 2023
64c4610
Apply suggestions from code review
sguequierre Sep 1, 2023
a432a3f
Update csi.md suggestions from code review, tab
sguequierre Sep 1, 2023
f448729
Update csi.md
sguequierre Sep 1, 2023
995926d
Split out modules and components example as suggested
sguequierre Sep 5, 2023
0422070
Update docs/extend/modular-resources/examples/csi.md
sguequierre Sep 5, 2023
1dbfe66
Apply suggestions from code review add array specification
sguequierre Sep 6, 2023
2901c6a
suggestion add to examples page
sguequierre Sep 6, 2023
1c20497
Merge branch 'main' into DOCS-923/nano-csi-camera-module
sguequierre Sep 6, 2023
b930ad0
Apply suggestions from code review
sguequierre Sep 6, 2023
8ab21a9
Update csi.md wrap json code properly
sguequierre Sep 6, 2023
81f10bb
fixup typo
sguequierre Sep 6, 2023
6d809ef
Update docs/extend/modular-resources/examples/csi.md
sguequierre Sep 6, 2023
813961d
Merge branch 'main' into DOCS-923/nano-csi-camera-module
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
2 changes: 2 additions & 0 deletions docs/components/board/jetson.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ tags: ["board", "components"]

Follow one of our Jetson [setup guides](/installation/) to prepare your board for running `viam-server` before configuring a `jetson` board.

If you have a CSI camera, follow [these instructions](/extend/modular-resources/examples/csi/) to configure it using the `viam:camera:csi` model.

{{% /alert %}}

Configure a `jetson` board to integrate a [NVIDIA Jetson Orin Module and Developer Kit](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-agx-xavier/), or [NVIDIA Jetson Nano](https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-nano/) into your robot:
Expand Down
1 change: 1 addition & 0 deletions docs/extend/modular-resources/examples/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Once you have created a modular resource, you can test your custom resource usin
{{< cards >}}
{{% card link="/extend/modular-resources/examples/rplidar/" customTitle="Add an RPlidar camera as a Modular Resource" %}}
{{% card link="/extend/modular-resources/examples/odrive/" customTitle="Add an ODrive motor as a Modular Resource" %}}
{{% card link="/extend/modular-resources/examples/csi/" customTitle="Add a CSI Camera as a Modular Resource" %}}
{{% card link="/extend/modular-resources/examples/custom-arm/" %}}
{{% card link="/extend/modular-resources/examples/tflite-module/" customTitle="Add a TensorFlow Lite Modular Service" %}}
{{% card link="/tutorials/custom/custom-base-dog/" %}}
Expand Down
114 changes: 114 additions & 0 deletions docs/extend/modular-resources/examples/csi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
title: "Add a CSI Camera as a Modular Resource"
linkTitle: "CSI Camera"
weight: 40
type: "docs"
description: "Use the viam:camera:csi model to add a CSI Camera to your robot."
tags: ["board", "csi", "jetson", "serial", "module", "modular resources", "Python", "python SDK", "nvidia", "jetson orin", "jetson orin nano", "nano", "camera"]
# SMEs: Sean
---


Many boards, like the Jetson Orin Nano, come with the option to use Camera Serial Interface (CSI) cameras, like [these cameras from E-con Systems](https://www.e-consystems.com/nvidia-jetson-agx-orin-cameras.asp) or [this camera from Seed Technologies](https://www.digikey.com/en/products/detail/seeed-technology-co.,-ltd/114992263/12396924).
These cameras are excellent for utilizing embedded vision systems like Viam's [vision service](/services/vision/).
Not all CSI cameras are supported by the [webcam camera model](/components/camera/webcam/).
Instead, Viam supports CSI cameras by providing a [modular resource](/extend/modular-resources/) for your CSI camera: `viam:camera:csi`.

This module includes a simple wrapper around `GStreamer` and a control interface for the **control** tab of the [Viam app](https://app.viam.com) so you can utilize the hardware accelerated GST plugins and use the embedded CSI cameras on your `jetson` boards with Viam.

The module is open-sourced and available on [GitHub](https://github.com/seanavery/viam-csi).

To use the CSI camera module, follow the [Installation](#installation) and [configuration](#configuration) steps.
sguequierre marked this conversation as resolved.
Show resolved Hide resolved

## Installation

On your robot's computer, download [the `viam:camera:csi` appimage](https://github.com/viamrobotics/odrive) and make it executable:

``` {class="command-line" data-prompt="$"}
sudo wget https://github.com/seanavery/viam-csi/releases/download/v0.0.2/viam-csi-0.0.2-aarch64.AppImage -O /usr/local/bin/viam-csi
Copy link
Member

Choose a reason for hiding this comment

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

We will want to update the install instructions once it is uploaded to the module registry.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds good

sudo chmod 755 /usr/local/bin/viam-csi
```

## Configuration

{{< tabs name="Connect your CSI Module and Modular Resource">}}
{{% tab name="JSON Template" %}}
npentrel marked this conversation as resolved.
Show resolved Hide resolved

Go to your robot's page on the [Viam app](https://app.viam.com/).
Navigate to the **Config** tab on your robot's page and select **Raw JSON** mode.

Copy and paste the JSON object for the module into the modules array to add Viam's `csi-mr` module:

```json {class="line-numbers linkable-line-numbers"}
{
"modules": [
{
"executable_path": "</usr/bin/csi-mr>",
"name": "<your-csi-cam-module-name>"
}
]
}

Next, add the following JSON object to your components array toconfigure a `csi` [camera](/components/camera/) component with the name `my_test_csi_cam`:
sguequierre marked this conversation as resolved.
Show resolved Hide resolved

```json {class="line-numbers linkable-line-numbers"}
{
"model": "viam:camera:csi",
"attributes": {
"width_px": <int>,
"height_px": <int>,
"frame_rate": <int>,
"debug": "<boolean>"
},
"depends_on": [],
"name": "<your-csi-cam-name>",
"namespace": "rdk",
"type": "camera"
}

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

```json {class="line-numbers linkable-line-numbers"}
npentrel marked this conversation as resolved.
Show resolved Hide resolved
{
"modules": [
{
"executable_path": "/usr/bin/csi-mr",
"name": "csi_cam_module"
}
],
"components": [
{
"model": "viam:camera:csi",
"attributes": {
"width_px": 1920,
"height_px": 1080,
"frame_rate": 30,
"debug": true
},
"depends_on": [],
"name": "my_test_csi_cam",
"namespace": "rdk",
"type": "camera"
}
]
}
```

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

Save the config.
Edit and fill in the attributes as applicable.

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

The following attributes are available for the `viam:camera:csi` model:
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for adding the attribute parameters!


| Name | Type | Inclusion | Description |
| ---- | ---- | --------- | ----------- |
| `width_px` | int | Optional | Width of the image this camera captures in pixels. <br> Default: `1920` |
| `height_px` | int | Optional | Height of the image this camera captures in pixels. <br> Default: `1080` |
| `frame_rate` | int | Optional | The image capture frame rate this camera should use. <br> Default: `30` |
| `video_path` | string | Optional | The filepath to the input sensor of this camera on your board. If none is given, your robot will attempt to detect the video path automatically <br> Default: `"0"` </br> |
sguequierre marked this conversation as resolved.
Show resolved Hide resolved
| `debug` | boolean | Optional | Whether or not you want debug input from this camera in your robot's logs. <br> Default: `false` |
Loading