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 5 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
3 changes: 3 additions & 0 deletions docs/components/board/jetson.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ 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 after configuring a `jetson` board you want to add your Orin Nano's CSI camera to your robot, you can with Viam's `viam:camera:csi` model.
Follow [these instructions](/extend/modular-resources/examples/csi/) to do so.
sguequierre marked this conversation as resolved.
Show resolved Hide resolved

{{% /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
82 changes: 82 additions & 0 deletions docs/extend/modular-resources/examples/csi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
title: "Add a CSI Camera as a Modular Resource"
linkTitle: "CSI Camera"
weight: 40
type: "docs"
description: "How to add a CSI Camera as a modular resource of your robot."
sguequierre marked this conversation as resolved.
Show resolved Hide resolved
tags: ["board", "csi", "jetson", "serial", "module", "modular resources", "Python", "python SDK", "nvidia", "jetson orin", "jetson orin nano", "nano", "camera"]
# SMEs: Sean
---


Viam provides a modular resource [extending](/extend/modular-resources/) the [camera API](/components/camera/#api) as a new `viam:camera:csi` model of [camera](/components/camera/).
Copy link
Collaborator

Choose a reason for hiding this comment

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

I thin kyou want to provide the value before the explanation - what does this resource allow readers to do?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok done I think. Sentence is a little bare though-- maybe revisit this feedback tmrw

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

(I will revisit)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added more talking about what I think is the value-add of CSI cameras and explaining more about what they are-- lmk what you think. Using info from here but not sure whether or not to link @npentrel https://embeddedcomputing.com/technology/analog-and-power/mipi-csi-2-v3-0-enhances-imaging-reduces-cabling-for-embedded-systems-designers

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is good but I think what's missing is why I'd need to use this over the normal camera component - see suggestion.

Copy link
Member

Choose a reason for hiding this comment

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

This sounds good. In the context of Jetson devices one of the major advantages is using the hardware-accelerated ISP (image signal processing) library on the host machine called libargus.

Also, mechanically reliable connection from the camera to the host machine on mobile robotics platforms. (As opposed to using usb cables/ports).

sguequierre marked this conversation as resolved.
Show resolved Hide resolved

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).

[Install requirements](#requirements) and [configure](#configuration) the module to add an `viam:camera:csi` [camera](/components/camera/) {{< glossary_tooltip term_id="resource" text="resource" >}} to your robot.
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing article in Install requirements but that also doesn't sound super great? Should that be "get the modular resouce" or something like that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmmm I can change here but I don't know if we actually need to change the beginning of the sentence! I think that without article is actually the normal way to say it, but I could be wrong 😆 Requirements as a noun and directive, right? Like a medium article?

sguequierre marked this conversation as resolved.
Show resolved Hide resolved

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

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

### Module

{{< tabs name="Add the csi module">}}
{{% 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 following raw JSON to add a `csi` [camera](/components/camera/) component with the name `my_test_csi_cam`:

```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"
}
]
}
```

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.

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

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"` |
| `debug` | boolean | Optional | Whether or not you want debug input from this camera in your robot's logs. <br> Example: `true` |
sguequierre marked this conversation as resolved.
Show resolved Hide resolved