Last active
February 18, 2019 13:17
-
-
Save raunakdoesdev/9d7a82c23e4b283a1e79009903095655 to your computer and use it in GitHub Desktop.
Sets up TX1/TX2 w/ PyTorch Inference Environment
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
# Run this after a fresh flashing of JetPack 3.0 on a Jetson TX1 | |
# NEED TO BE LOGGED INTO TO nvidia USER ACCOUNT WITH PASSWORD OF: nvidia | |
sudo c_rehash /etc/ssl/certs | |
sudo dhclient wlan0 | |
############################# Install Karl's Repository ############################# | |
sudo apt-get --assume-yes install git | |
git clone https://github.com/karlzipser/kzpy3.2.git kzpy3 | |
############################# Install PyTorch w/ CUDA support ############################# | |
sudo apt-get --assume-yes install cmake | |
sudo apt-get --assume-yes install python-pip | |
# upgrade pip | |
sudo -H pip install -U pip | |
sudo -H pip --version | |
# pip 9.0.1 from /home/ubuntu/.local/lib/python2.7/site-packages (python 2.7) | |
# clone pyTorch repo | |
git clone http://github.com/pytorch/pytorch | |
cd pytorch | |
sudo apt-get --assume-yes install python-scipy | |
sudo -H pip install -U numpy | |
sudo -H pip install -U setuptools | |
sudo -H pip install -r requirements.txt | |
sudo python setup.py install # takes 1-2 hours to install from source | |
# Verify CUDA (from python interactive terminal) | |
# import torch | |
# print(torch.cuda.is_available()) | |
# a = torch.cuda.FloatTensor(2) | |
# print(a) | |
# b = torch.randn(2).cuda() | |
# print(b) | |
# c = a + b | |
# print(c) | |
############################# Install and Setup ROS ############################# | |
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' | |
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116 | |
sudo apt-get --assume-yes update | |
sudo apt-get --assume-yes install ros-kinetic-desktop | |
sudo apt-get --assume-yes install python-rosdep | |
sudo c_rehash /etc/ssl/certs | |
sudo rosdep init | |
rosdep update | |
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc | |
source ~/.bashrc | |
mkdir -p ~/catkin_ws/src | |
cd ~/catkin_ws/src | |
catkin_init_workspace | |
cd ~/catkin_ws/ | |
catkin_make | |
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc | |
source ~/.bashrc | |
############################# Install ZED USB drivers ############################# | |
cd ~ | |
wget https://www.stereolabs.com/developers/downloads/ZED_SDK_Linux_JTX1_v2.0.1.run | |
chmod +x ZED_SDK_Linux_JTX2_v2.0.1.run | |
./ZED_SDK_Linux_JTX2_v2.0.1.run | |
# test ZED with /usr/local/zed/tools/ZED\ Explorer | |
############################# Install ZED ROS Wrapper ############################# | |
sudo apt-get --assume-yes install libpcl1.7 | |
sudo apt-get --assume-yes install ros-kinetic-pcl-ros | |
sudo apt-get --assume-yes install ros-kinetic-image-view | |
cd ~/catkin_ws/src | |
git clone https://github.com/stereolabs/zed-ros-wrapper.git | |
cd ~/catkin_ws | |
catkin_make | |
# To test if the installation succeded run: | |
# roslaunch zed_wrapper zed.launch | |
# rosrun image_view image_view image:=/camera/right/image_rect_color | |
############################# Install PyTorch Source Code ############################# | |
cd ~/catkin_ws/src | |
git clone https://github.com/sauhaardac/pytorch_inference.git bair_car | |
cd .. | |
catkin_make | |
source ~/.bashrc | |
# To test if the installation succeded run: | |
# roslaunch bair_car bair_car.launch use_zed:=true | |
############################# Install TMUX ############################# | |
# Not mandatory, but installing tmux allows you to run multiple terminal sessions simultaneously and attach and detach from them remotely. (This is especially useful over ssh) | |
sudo apt-get --assume-yes install tmux | |
# Tutorial on use available at https://gist.github.com/MohamedAlaa/2961058 | |
############################# Install Shortcuts ########################## | |
# Generate Random Car Name | |
sudo apt-get --assume-yes install gpw | |
comp_name=`gpw 1 5` | |
echo 'export PYTHONPATH=~:$PYTHONPATH' >> ~/.bashrc | |
echo 'export PATH=~/kzpy3/scripts:$PATH' >> ~/.bashrc | |
echo 'export COMPUTER_NAME="Mr. $comp_name"' >> ~/.bashrc | |
echo "alias rhz='rostopic hz /bair_car/zed/left/image_rect_color'" >> ~/.bashrc | |
echo "alias rls='ls -al /media/ubuntu/rosbags'" >> ~/.bashrc | |
echo "alias rrm='rm catkin_ws/src/bair_car/rosbags/*'" >> ~/.bashrc | |
echo "alias rlog='rm ~/.ros/log/*'" >> ~/.bashrc | |
echo "alias rla='roslaunch bair_car bair_car.launch use_zed:=true record:=true'" >> ~/.bashrc | |
echo "alias rlac='roslaunch bair_car bair_car.launch use_zed:=true record:=true caffe:=true'" >> ~/.bashrc | |
echo "alias rgy='rostopic echo /bair_car/gyro'" >> ~/.bashrc | |
echo "alias rgp='rostopic echo /bair_car/gps'" >> ~/.bashrc | |
echo "alias rac='rostopic echo /bair_car/acc'" >> ~/.bashrc | |
echo "alias rst='rostopic echo /bair_car/steer'" >> ~/.bashrc | |
echo "alias rmo='rostopic echo /bair_car/motor'" >> ~/.bashrc | |
echo "alias ren='rostopic echo /bair_car/encoder'" >> ~/.bashrc | |
echo "alias rcd='cd /media/ubuntu/rosbags'" >> ~/.bashrc | |
echo "alias ssd='sudo shutdown -h now'" >> ~/.bashrc | |
echo "alias rcn='echo \$COMPUTER_NAME'" >> ~/.bashrc | |
echo "alias riv='rosrun image_view image_view image:=/bair_car/zed/right/image_rect_color'" >> ~/.bashrc |
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
# Run this after a fresh flashing of JetPack 3.0 on a Jetson TX2 | |
# NEED TO BE LOGGED INTO TO nvidia USER ACCOUNT WITH PASSWORD OF: nvidia | |
sudo c_rehash /etc/ssl/certs | |
sudo dhclient wlan0 | |
############################# Install Karl's Repository ############################# | |
sudo apt-get --assume-yes install git | |
git clone https://github.com/karlzipser/kzpy3.2.git kzpy3 | |
############################# Kernel Surgery to Enable USB ACM ############################# | |
# # Download Kernel from NVIDIA | |
# cd ~ | |
# mkdir l4t-kernel-surgery | |
# mkdir kernel-stuff | |
# cd kernel-stuff | |
# wget http://developer.nvidia.com/embedded/dlc/l4t-sources-27-1 -O source.tbz2 | |
# tar xjf source.tbz2 | |
# tar xjf kernel_src.tbz2 -C ~/l4t-kernel-surgery/ | |
# cd .. | |
# rm -rf kernel-stuff | |
# # Kernel Surgery | |
# cd ~/l4t-kernel-surgery/kernel/kernel-4.4 | |
# zcat /proc/config.gz > .config | |
# echo "CONFIG_USB_ACM=m" >> .config | |
# make clean | |
# make prepare | |
# make modules_prepare | |
# make M=drivers/usb/class | |
# sudo cp drivers/usb/class/cdc-acm.ko /lib/modules/`uname -r`/kernel/ | |
# sudo depmod -a | |
# # Verify Surgery | |
# sudo modprobe cdc-acm | |
# ls /dev/ttyACM* # Should see ttyACM0 or 1 or something if arduino is plugged in | |
############################# Install PyTorch w/ CUDA support ############################# | |
sudo apt-get --assume-yes install cmake | |
sudo apt-get --assume-yes install python-pip | |
# upgrade pip | |
sudo -H pip install -U pip | |
sudo -H pip --version | |
# pip 9.0.1 from /home/ubuntu/.local/lib/python2.7/site-packages (python 2.7) | |
# clone pyTorch repo | |
git clone http://github.com/pytorch/pytorch | |
cd pytorch | |
sudo apt-get --assume-yes install python-scipy | |
sudo -H pip install -U numpy | |
sudo -H pip install -U setuptools | |
sudo -H pip install -r requirements.txt | |
sudo python setup.py install # takes 1-2 hours to install from source | |
# Verify CUDA (from python interactive terminal) | |
# import torch | |
# print(torch.cuda.is_available()) | |
# a = torch.cuda.FloatTensor(2) | |
# print(a) | |
# b = torch.randn(2).cuda() | |
# print(b) | |
# c = a + b | |
# print(c) | |
############################# Install and Setup ROS ############################# | |
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' | |
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116 | |
sudo apt-get --assume-yes update | |
sudo apt-get --assume-yes install ros-kinetic-desktop | |
sudo apt-get --assume-yes install python-rosdep | |
sudo c_rehash /etc/ssl/certs | |
sudo rosdep init | |
rosdep update | |
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc | |
source ~/.bashrc | |
mkdir -p ~/catkin_ws/src | |
cd ~/catkin_ws/src | |
catkin_init_workspace | |
cd ~/catkin_ws/ | |
catkin_make | |
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc | |
source ~/.bashrc | |
############################# Install ZED USB drivers ############################# | |
cd ~ | |
wget https://www.stereolabs.com/developers/downloads/ZED_SDK_Linux_JTX2_v2.0.1.run | |
chmod +x ZED_SDK_Linux_JTX2_v2.0.1.run | |
./ZED_SDK_Linux_JTX2_v2.0.1.run | |
# test ZED with /usr/local/zed/tools/ZED\ Explorer | |
############################# Install ZED ROS Wrapper ############################# | |
sudo apt-get --assume-yes install libpcl1.7 | |
sudo apt-get --assume-yes install ros-kinetic-pcl-ros | |
sudo apt-get --assume-yes install ros-kinetic-image-view | |
cd ~/catkin_ws/src | |
git clone https://github.com/stereolabs/zed-ros-wrapper.git | |
cd ~/catkin_ws | |
catkin_make | |
# To test if the installation succeded run: | |
# roslaunch zed_wrapper zed.launch | |
# rosrun image_view image_view image:=/camera/right/image_rect_color | |
############################# Install PyTorch Source Code ############################# | |
cd ~/catkin_ws/src | |
git clone https://github.com/sauhaardac/pytorch_inference.git bair_car | |
cd .. | |
catkin_make | |
source ~/.bashrc | |
# To test if the installation succeded run: | |
# roslaunch bair_car bair_car.launch use_zed:=true | |
############################# Install TMUX ############################# | |
# Not mandatory, but installing tmux allows you to run multiple terminal sessions simultaneously and attach and detach from them remotely. (This is especially useful over ssh) | |
sudo apt-get --assume-yes install tmux | |
# Tutorial on use available at https://gist.github.com/MohamedAlaa/2961058 | |
############################# Install Shortcuts ########################## | |
# Generate Random Car Name | |
sudo apt-get --assume-yes install gpw | |
comp_name=`gpw 1 5` | |
echo 'export PYTHONPATH=~:$PYTHONPATH' >> ~/.bashrc | |
echo 'export PATH=~/kzpy3/scripts:$PATH' >> ~/.bashrc | |
echo 'export COMPUTER_NAME="Mr. $comp_name"' >> ~/.bashrc | |
echo "alias rhz='rostopic hz /bair_car/zed/left/image_rect_color'" >> ~/.bashrc | |
echo "alias rls='ls -al /media/ubuntu/rosbags'" >> ~/.bashrc | |
echo "alias rrm='rm catkin_ws/src/bair_car/rosbags/*'" >> ~/.bashrc | |
echo "alias rlog='rm ~/.ros/log/*'" >> ~/.bashrc | |
echo "alias rla='roslaunch bair_car bair_car.launch use_zed:=true record:=true'" >> ~/.bashrc | |
echo "alias rlac='roslaunch bair_car bair_car.launch use_zed:=true record:=true caffe:=true'" >> ~/.bashrc | |
echo "alias rgy='rostopic echo /bair_car/gyro'" >> ~/.bashrc | |
echo "alias rgp='rostopic echo /bair_car/gps'" >> ~/.bashrc | |
echo "alias rac='rostopic echo /bair_car/acc'" >> ~/.bashrc | |
echo "alias rst='rostopic echo /bair_car/steer'" >> ~/.bashrc | |
echo "alias rmo='rostopic echo /bair_car/motor'" >> ~/.bashrc | |
echo "alias ren='rostopic echo /bair_car/encoder'" >> ~/.bashrc | |
echo "alias rcd='cd /media/ubuntu/rosbags'" >> ~/.bashrc | |
echo "alias ssd='sudo shutdown -h now'" >> ~/.bashrc | |
echo "alias rcn='echo \$COMPUTER_NAME'" >> ~/.bashrc | |
echo "alias riv='rosrun image_view image_view image:=/bair_car/zed/right/image_rect_color'" >> ~/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment