Getting Started with

Picam360 on JetBot (Jetson Nano)


Revision: 1.1

Last Modified: 2020-06-16


Introduction        1

Precautions        1

Prepare for Setup        1

Camera Holder Printing        3

Firmware Installation        3

Software Setup        4

Camera Calibration        11

Jupyter Notebook        16


Introduction

This document describes how to install JetBot official firmware provided by NVIDIA on Jetson Nano and set up Picam360 on top of it.

Precautions

Functional Limitation

The Picam360 software for the Jetson Nano is available without a license, but the following features are limited when used without a license

If you would like to purchase a license, please contact us using the Inquiry Form.

Card-type WiFi antenna is required

JetBot's official wiki describes two types of WiFi antennas: the USB dongle type and the M2 card type; the Picam360 sends image data to the Jetson Nano via a USB connection. When using a USB dongle type antenna with two Picam360's connected, the USB communication limit of the Jetson Nano is exceeded and it does not work properly. Therefore, when connecting two Picam360s, please use an M2 card type antenna. Also, there is a report on the Internet that M2 cards will not work with products other than the product number specified in the official Wiki (it is difficult to set up). It is therefore recommended that you use the product with the specified part number.

Prepare for Setup

Picam360 kit

Prepare one of the following models:

Items not included in Picam360 kit

You’ll also need:

*Read about the WiFi antenna to use here.

Jetson Nano uses a microSD card as a boot device and main storage. It is important to have a card of sufficient speed and size for your project. The recommended minimum is a 64GB UHS-1 card.

Supplies power to the Jetson Nano. If you want to use the Jetson Nano as a stereo camera system and not as a JetBot radio control, we recommend using a 5V, 4A or higher DJ jack power supply. Using less than this may cause an error due to insufficient power when the calculation failure increases.

Used to operate Jetson Nano and Picam360.

Camera Holder Printing

3D printer data of a camera holder to fix Picam360 to JetBot. Please use it if you need it.

https://github.com/picam360/picam360-jetbot/blob/master/hardware/camera_holder_stereo.stl

Firmware Installation

Install Jetbot official software. Follow the steps on the official page below to proceed:

https://github.com/NVIDIA-AI-IOT/jetbot/wiki/software-setup

This manual uses jetbot_image_v0p3p2.zip. If you use a different version, you may get errors, so we recommend that you install the same one that this manual uses, unless you have a specific reason to do so.

Software Setup

Once the Jetbot official software installation is complete, the next step is to install the Picam360 softwares.

In this page, we will explain how to use Terminal which comes with Apple's mac, and for Windows users, please use PuTTy etc.

Step1 - First

  1. Open Terminal:

  1. Connect to your JetBot:

$ ssh jetbot@jetbot.local

  1. Update ubuntu's package list:

$ sudo apt-get update

  1. In this manual, the nono editor is used to rewrite the configuration file. The nano editor can be installed by executing the following command:

$ sudo apt-get install nano

  1. Create a directory to download the source code for Picam360 softwares:

$ cd
$ mkdir picam360
$ cd picam360

Step2 - Change JetBot’s settings

Power Mode

  1. Change Jetson Nano power mode to 10W (MAXN):

$ sudo nvpmodel -m 0

  1. Verify the Jetson Nano is in 10W (MAXN) power mode:

$ sudo nvpmodel -q

UDP Receive Buffer Size

  1. Open the system file and add the bottom two lines. If the same item already exists, the value will be updated.

$ sudo nano /etc/sysctl.conf

#udp performance
net.core.rmem_default=8388608
net.core.rmem_max=8388608

  1. Press Ctrl+O, Ctrl+X to save the changes to the file

  1. Reboot the device

$ sudo reboot

Step3 - Download resources for JetBot

  1. Download picam360-jetbot from github

$ cd ~/picam360

$ git clone https://github.com/picam360/picam360-jetbot.git

Step4 - Install picam360-capture

  1. Install the items required for the picam360-capture software:

$ sudo apt-get install cmake libjansson-dev libedit-dev libopencv-dev libfreetype6-dev v4l-utils rsync

  1. Download picam360-capture from github:

$ cd ~/picam360

$ git clone https://github.com/picam360/picam360-capture.git
$ cd picam360-capture

  1. Matches the versions of picam360-capture and the plugin for jetbbot
  1. Check the date of the plugin file and make a note of it:

$ ls ~/picam360/picam360-jetbot/capture/plugins

  1. Switch picam360-capture to the date branch of the plugin. Change the date of the following command to the date you wrote it down and run it:

$ git checkout `git log -1 --until="2020-05-15" --format=%H`

  1. Copy the plugin file of picam360-capture for jetbot to picam360-capture directory and authorize to execute it. The date at the end of the source plug-in file must match the actual file. Removes the trailing date in the destination file name:

$ cp ~/picam360/picam360-jetbot/capture/plugins/picam360tegra_20200515.so plugins/picam360tegra.so
$ sudo chmod 755 plugins/picam360tegra.so

  1. Copy the configuration file of picam360-capture for jetbot to picam360-capture directory:

$ mv config.json.tmp config.json.tmp.bk
$
cp ~/picam360/picam360-jetbot/capture/picam360-capture.conf config.json.tmp

Tips: config.json.tmp will be copied into the execution environment by make install, which is done in the steps below.

  1. Build and install picam360-capture. Execute the following commands in turn. Make sure that there are no errors in each command:

$ cmake .
$ make
$ sudo make install

The following items will be generated by the above command:

Path

Description

/usr/local/etc/picam360-capture.conf

configuration file

/usr/local/bin/picam360-capture

software

/usr/local/lib/picam360-capture

libraries

Step5 - Install picam360-server

  1. Install the items required for the picam360-server software:

$ sudo apt-get install cmake nodejs npm rsync

  1. Download picam360-server from github:

$ cd ~/picam360
$ git clone https://github.com/picam360/picam360-server.git
$ cd picam360-server

  1. Copy the plug-in files of picam360-server for jetbot to picam360-server directory:

$ cp ~/picam360/picam360-jetbot/server/plugins/* plugins

  1. Copy the configuration file of picam360-server for jetbot to picam360-server directory:

$ mv config.json.tmp config.json.tmp.bk
$
cp ~/picam360/picam360-jetbot/server/picam360-server.conf config.json.tmp

  1. Build and install picam360-server. Execute the following commands in turn. Make sure that there are no errors in each command:

$ cmake .
$ make
$ sudo make install

The following items will be generated by the above command:

Path

Description

/usr/local/etc/picam360-server.conf

configuration file

/usr/local/bin/picam360-server

/var/www/picam360-server

software

Step6 - Set up picam360-capture

  1. Navigate the directory:

$ cd /usr/local/etc/

  1. Copy the current configuration file and make a backup so that you can get your changes back:

$ sudo cp picam360-capture.conf picam360-capture.conf.bk

  1. Open the file in a text editor:

$ sudo nano picam360-capture.conf

  1. In the “stream_mixer_defs” element, change the array containing notation of “v4l2_capture cam_num=” to the following. The following changes enable cam_num=0 and cam_num=1, making sure to put a comma between the first element and the second element.

If you want to connect only one camera, comment out cam_num=1 with #. Be sure to delete the previous comma when you do so.

  1. Change "num_of_cam" to 2.

For 1 camera case, set 1.

  1. At the end of the file, change "license_path" to "/home/jetbot/picam360/license.txt".

  1. Press Ctrl+O, Ctrl+X to save the changes to the file

  1. Place the purchased license file in the path you have set up. If you don't have a license file, set up a dummy license file. The following command creates a dummy file:

$ echo "{}" > ~/picam360/license.txt

Step7 - Set up picam360-server

  1. Copy the current configuration file and make a backup so that you can get your changes back:

$ sudo cp picam360-server.conf picam360-server.conf.bk

  1. Open the file in a text editor:

$ sudo nano picam360-server.conf

  1. Set UUID to "wrtc_uuid".
  1. Get UUID from the URL:

https://www.picam360.com/equipment/uuid_generator

  1. Set UUID to "wrtc_uuid".

  1. If "wrtc_enabled" is true, it will be accessible from the outside via the Internet. Change "wrtc_enabled" to false if you don't want to access it through the internet, the UUID will be the key to connect. Keep your UUID long enough so that no one else will know about it.

  1. Uncomment "frame_mode" : "PICAM360MAP3D" and comment out other uncommented "frame_mode".

For 1 camera case, enable "PICAM360MAP".

  1. Set 1440 to "frame_width", 720 to "frame_height".

For 1 camera case, 720 to "frame_width", 720 to "frame_height".

  1. Press Ctrl+O, Ctrl+X to save the changes to the file

  1. Reboot

$ sudo reboot

Step8 - Confirmation of Connection

  1. Open http://jetbot.local:9001/ in your browser. Make sure the image is displayed.

  1. Drag the left edge of the screen to the center to bring up the menu, enable STEREO, and make sure that the two camera images are displayed.

  1. If the image does not appear, please review the settings to see if they are correct.

Camera Calibration

Focus Adjustment

  1. Open http://jetbot.local:9001/ in your browser, open the menu and enable STEREO.

  1. Rotate the lens while shooting something suitable and fix it at the position where the focus is best.

Calibration Board Printing

  1. Download the patterned file from the link below

https://github.com/picam360/picam360-jetbot/blob/master/capture/calib/checkerboard_pattern.png

  1. Print the file at 100% printing scale and stick it on a flat, hard board, such as cardboard.

Lens Calibration

Descriptions

Image Circle Calibration : EXE > CENTER

Corrects the center position of the image. This correction is required for your first calibration or when the lens is physically displaced due to contact during transport, etc.

Lens Distortion Calibration: EXE > DISTORTION

Corrects image distortion caused by the lens shape. This correction corrects the distortion of the image due to the shape of the lens design. Therefore, once the correction has been made, there is basically no need to do it again. You may need this correction for your first calibration or when you change your lens to a different model.

Steps

  1. Connect to your JetBot:

$ sudo ssh jetbot@jetbot.local

  1. Activate "CALIB" in "frame_mode" in picam360-server.conf:

$ sudo nano /usr/local/etc/picam360-server.conf

  1. Press Ctrl+O, Ctrl+X to save the changes to the file

 

  1. Restart picam360-server

$ service picam360-server restart

  1. Open http://jetbot.local:9001/ in your browser

  1. Drag the left edge of the screen to the center to bring up the menu

Menu Buttons:

Button

Action

Menu

Open the menu

Prev

Go to the menu item above

Next

Go to the menu item below

Select

Select the menu item with the current focus

Deselect

Move one level up

  1. Got to MENU > JETSONCALIB

  1. Select MARKER_MODE > CB

  1. Select CLEAR

  1. Select CAM > 0 (2nd round is CAM > 1)

  1. Recognize the calibration board and register the points
  1. Drag the left half of the screen to bring the view to the front and place the calibration board in front of the camera. When the board is recognized, a colored marker will appear. With that, select SET.

Press SET to display the registered points on the right side of the screen.

Tips:If it is difficult to recognize the board, it will be easier to recognize the board if it is done in a bright place or if the board is lit by a smartphone.

Tips : The previous position of the recognized marker is remembered. Therefore, even if the recognition marker is displayed and disappears, the point of the displayed position can be registered by pressing SET.

  1. Repeat the point registration while changing the field of view in the left half of the screen so that the lens is roughly covered with points.

Tips:It is easier to recognize the checkerboard when it is caught near the center of the field of view on the left side of the screen.

  1. Select EXE > CENTER

  1. Select EXE > DISTORTION

  1. Select Save

  1. Restart the picam360-capture:

$ service picam360-capture restart

  1. Return to step 5 and perform the same operation with the other camera (CAM : 1).

  1. After performing the calibration with two cameras, enable "PICAM360MAP3D" in "frame_mode" of picam360-server.conf. For 1 camera case, enable “PICAM360MAP”.

$ sudo nano /usr/local/etc/picam360-server.conf

  1. Press Ctrl+O, Ctrl+X to save the changes to the file

  1. Restart picam360-server

$ service picam360-server restart

Jupyter Notebook

This section explains how to use the Jupyter Notebook to manipulate JetBot using GamePad while viewing Picam360 images.

  1. Copy the Jupyter Notebook for Picam360

$ cd

$ rsync -a ~/picam360/picam360-jetbot/notebooks/ Notebooks/

  1. Install the required packages

$ sudo apt-get install python3-setuptools
$ sudo pip3 install pyquaternion

$ cd ~/picam360/picam360-capture/python_binding
$ sudo python3 setup.py install

  1. Access http://jetbot.local:8888. Password for JupyterLab is jetbot

  1. Open Notebooks > teleoperation > teleoperation-with-picam360.ipynb

  1. Run the notebook while following the instructions on the notebook.


[1]