-
Notifications
You must be signed in to change notification settings - Fork 45
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
sguequierre
merged 26 commits into
viamrobotics:main
from
sguequierre:DOCS-923/nano-csi-camera-module
Sep 6, 2023
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
3f8bc47
make csi page
sguequierre 405e73b
add csi docs
sguequierre c5f6c8e
Update docs/components/board/jetson.md
sguequierre 9490f17
Update docs/extend/modular-resources/examples/csi.md
sguequierre fc1fcea
Link fixup
sguequierre ff5d2d1
Update docs/extend/modular-resources/examples/csi.md
sguequierre e984fb5
Apply suggestions from code review
sguequierre 7886cea
Apply suggestions remove tabs bc just raw json
sguequierre 707db27
Apply suggestions from code review
sguequierre 640e855
Apply suggestions from code review
sguequierre 22ce75d
Update csi.md remove trailing space
sguequierre 3002dda
Apply naomi's inline suggestions from code review
sguequierre 7899941
Update docs/extend/modular-resources/examples/csi.md
sguequierre 64c4610
Apply suggestions from code review
sguequierre a432a3f
Update csi.md suggestions from code review, tab
sguequierre f448729
Update csi.md
sguequierre 995926d
Split out modules and components example as suggested
sguequierre 0422070
Update docs/extend/modular-resources/examples/csi.md
sguequierre 1dbfe66
Apply suggestions from code review add array specification
sguequierre 2901c6a
suggestion add to examples page
sguequierre 1c20497
Merge branch 'main' into DOCS-923/nano-csi-camera-module
sguequierre b930ad0
Apply suggestions from code review
sguequierre 8ab21a9
Update csi.md wrap json code properly
sguequierre 81f10bb
fixup typo
sguequierre 6d809ef
Update docs/extend/modular-resources/examples/csi.md
sguequierre 813961d
Merge branch 'main' into DOCS-923/nano-csi-camera-module
sguequierre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
--- | ||
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. | ||
|
||
## 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 | ||
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 to configure a `csi` [camera](/components/camera/) component with the name `my_test_csi_cam`: | ||
|
||
```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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | | ||
| `debug` | boolean | Optional | Whether or not you want debug input from this camera in your robot's logs. <br> Default: `false` | |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good