Safe Energetics Services

This is a repository for RR services of Safe Energetics Project developed at RPI

The Devices In The Lab:

Description Username Hostname (Computer Name) IP Password OS ROS
Hopper Processing Unit jetson_silver jetson-silver-TX2 192.168.55.10 192.168.1.140 1234 Ubuntu 18.04 Melodic
Wrist Processing Unit jetson_blue jetson-blue-TX2 192.168.55.11 192.168.1.142 1234 Ubuntu 18.04 Melodic
Main Computer TODO TODO 192.168.55.2 TODO Ubuntu 18.04 Melodic

Services in this repo:

See the Google Spread Sheet for details.

Setting up the system

First follow the steps under title "Setting Up NVIDIA Jetson TX2 Devices with ROS and Kinect Azure" to prepare the hardware for using with this repo's software.

DO NOT USE THIS COMMAND YET !!!!!

After the hardware is setup, simply run

./all_devices_initial_setup.bash

DO NOT USE THIS COMMAND YET !!!!!

Setting Up NVIDIA Jetson TX2 Devices with ROS and Kinect Azure

Install Ubuntu 18.04 to NVIDIA Jetson TX2

Clearpath robotics has a nice tutorial with title Installing a Jetson TX2 for Husky robot. Following the "Step 3: Installing the software" in that tutorial one can install Ubuntu 18.04 to NVIDIA Jetson TX2. Note that this step takes some time to finish..

For alternative one can check the tutorial here as well. They are very similar instructions and put here only for another reference purpose.

Setting up remote access (VNC) to NVIDIA Jetson TX2

=======================================================================
                            README-vnc
                          Linux for Tegra
               Configuring VNC from the command-line
=======================================================================

A VNC server allows access to the graphical display of a Linux for Tegra system
over the network. This allows you to work physically remote from the Linux for
Tegra system, and avoids the need to connect an HDMI display, USB keyboard, or
mouse.

All commands specified below should be executed from a terminal on the Linux
for Tegra system. This could be a serial port, an SSH session, or a graphical
terminal application running on the HDMI display.

----------------------------------------------------------------------
Installing the VNC Server
----------------------------------------------------------------------

It is expected that the VNC server software is pre-installed. Execute the
following commands to ensure that it is:

sudo apt update
sudo apt install vino

----------------------------------------------------------------------
Enabling the VNC Server
----------------------------------------------------------------------

Execute the following commands to enable the VNC server:

# Enable the VNC server to start each time you log in
mkdir -p ~/.config/autostart
cp /usr/share/applications/vino-server.desktop ~/.config/autostart

# Configure the VNC server
gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino require-encryption false

# Set a password to access the VNC server
# Replace thepassword with your desired password
gsettings set org.gnome.Vino authentication-methods "['vnc']"
gsettings set org.gnome.Vino vnc-password $(echo -n 'thepassword'|base64)

# Reboot the system so that the settings take effect
sudo reboot

The VNC server is only available after you have logged in to Jetson locally. If
you wish VNC to be available automatically, use the system settings application
to enable automatic login.

----------------------------------------------------------------------
Connecting to the VNC server
----------------------------------------------------------------------

Use any standard VNC client application to connect to the VNC server that is
running on Linux for Tegra. Popular examples for Linux are gvncviewer and
remmina. Use your own favorite client for Windows or MacOS.

To connect, you will need to know the IP address of the Linux for Tegra system.
Execute the following command to determine the IP address:

ifconfig

Search the output for the text "inet addr:" followed by a sequence of four
numbers, for the relevant network interface (e.g. eth0 for wired Ethernet,
wlan0 for WiFi, or l4tbr0 for the USB device mode Ethernet connection).

----------------------------------------------------------------------
Setting the Desktop Resolution
----------------------------------------------------------------------

The desktop resolution is typically determined by the capabilities of the
display that is attached to Jetson. If no display is attached, a default
resolution of 640x480 is selected. To use a different resolution, edit
/etc/X11/xorg.conf and append the following lines:

Section "Screen"
   Identifier    "Default Screen"
   Monitor       "Configured Monitor"
   Device        "Tegra0"
   SubSection "Display"
       Depth    24
       Virtual 1280 800 # Modify the resolution by editing these values
   EndSubSection
EndSection 800

Install ROS Melodic to Ubuntu 18.04

See steps at ROS official website

Install Kinect Azure Sensor SDK to NVIDIA Jetson TX2

TODO

Install Kinect Azure ROS drivers

TODO

Install RR

TODO

Overall commands executed after a fresh Ubuntu 18.04 installed NVIDIA Jetson TX2 to setup the prerequisites of this repo

sudo apt update
sudo apt install vino
mkdir -p ~/.config/autostart
cp /usr/share/applications/vino-server.desktop ~/.config/autostart
gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino require-encryption false
sudo nano /etc/X11/xorg.conf
nano
nano ./.bashrc 
sudo nano /etc/X11/xorg.conf

sudo apt-get install curl
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo apt update 
sudo apt install ros-melodic-desktop-full
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
sudo rosdep init
rosdep update

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo apt-add-repository https://packages.microsoft.com/ubuntu/18.04/multiarch/prod
sudo apt-get update
sudo apt install libk4a1.4-dev
sudo apt install k4a-tools

wget https://raw.githubusercontent.com/microsoft/Azure-Kinect-Sensor-SDK/develop/scripts/99-k4a.rules
sudo cp 99-k4a.rules /etc/udev/rules.d/ # Unplug/plug Kinect after this
k4aviewer # Make sure the Kinect works fine

mkdir catkin_ws_kinect
cd catkin_ws_kinect/
mkdir src
cd src/
git clone https://github.com/microsoft/Azure_Kinect_ROS_Driver.git
cd catkin_ws_kinect/

sudo ln -s /usr/include/opencv4/opencv2/ /usr/include/opencv
sudo apt install libopencv3.2
sudo apt install ros-melodic-rgbd-launch 
sudo apt install ros-melodic-image-proc
catkin_make

nano ~/.bashrc # Add catkin_ws/devel/setup.bash to bashrc file 
source ~/.bashrc

roslaunch azure_kinect_ros_driver kinect_rgbd.launch 
rqt_image_view 

sudo add-apt-repository ppa:robotraconteur/ppa
sudo apt-get update
sudo apt-get install python-robotraconteur
sudo apt-get install python3-robotraconteur
sudo apt install -y python-pip
pip install pandas