Posts

Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Wednesday, 19 June 2019

ros with usb_cam on Jetson TX2

How to use usb_cam with ros kinetic on jetson tx2

Nvidia Jetson TX2 
Ubuntu 16.04 
ROS Kinetic
1. Create a new workspace catkin_ws in the root directory
mkdir -p ~/catkin_ws/src
cd catkin_ws/src/
2. Download usb_cam package
git clone https://github.com/bosch-ros-pkg/usb_cam.git
3. Go to the workspace directory to compile
cd ~/catkin_ws
catkin_make
4. Compile the specific information:
Base path: /home/nvidia/catkin_ws
Source space: /home/nvidia/catkin_ws/src
Build space: /home/nvidia/catkin_ws/build
Devel space: /home/nvidia/catkin_ws/devel
Install space: /home/nvidia/catkin_ws/install
Creating symlink "/home/nvidia/catkin_ws/src/CMakeLists.txt" pointing to "/opt/ros/kinetic/share/catkin/cmake/toplevel.cmake"
####
#### Running command: "cmake /home/nvidia/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/nvidia/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/nvidia/catkin_ws/install -G Unix Makefiles" in "/home/nvidia/catkin_ws/build"
####
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CATKIN_DEVEL_PREFIX: /home/nvidia/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/kinetic
-- This workspace overlays: /opt/ros/kinetic
-- Found PythonInterp: /usr/bin/python (found version "2.7.12") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/nvidia/catkin_ws/build/test_results
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.6
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - usb_cam
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'usb_cam'
-- ==> add_subdirectory(usb_cam)
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'libavcodec'
--   Found libavcodec, version 56.60.100
-- Checking for module 'libswscale'
--   Found libswscale, version 3.1.101
-- Configuring done
-- Generating done
-- Build files have been written to: /home/nvidia/catkin_ws/build
####
#### Running command: "make -j4 -l4" in "/home/nvidia/catkin_ws/build"
####
Scanning dependencies of target usb_cam
[ 25%] Building CXX object usb_cam/CMakeFiles/usb_cam.dir/src/usb_cam.cpp.o
[ 50%] Linking CXX shared library /home/nvidia/catkin_ws/devel/lib/libusb_cam.so
[ 50%] Built target usb_cam
Scanning dependencies of target usb_cam_node
[ 75%] Building CXX object usb_cam/CMakeFiles/usb_cam_node.dir/nodes/usb_cam_node.cpp.o
[100%] Linking CXX executable /home/nvidia/catkin_ws/devel/lib/usb_cam/usb_cam_node
[100%] Built target usb_cam_node
5. Environment variable update operation
source ~/catkin_ws/devel/setup.bash
6. Open the camera startup configuration file usb_cam-test.launch in the workspace directory.
cd ~/catkin_ws/src/usb_cam/launch
gedit usb_cam-test.launch
7. The usb_cam-test.launch file information is as follows:
<launch>
<node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" >
<param name="video_device" value="/dev/video1" />
<param name="image_width" value="640" />
<param name="image_height" value="480" />
<param name="pixel_format" value="yuyv" />
<param name="camera_frame_id" value="usb_cam" />
<param name="io_method" value="mmap"/>
</node>
<node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen">
<remap from="image" to="/usb_cam/image_raw"/>
<param name="autosize" value="true" />
</node>
</launch>
8. Since the TX2 comes with an onboard camera, the performance of the onboard camera ("/dev/video0") is not good, so we recommend using a take-away camera. Need to adjust the value of the video_device value to "/dev/video1" 
9. Execute the following command to call the camera
roslaunch usb_cam-test.launch
10. The results of the operation:
... logging to /home/nvidia/.ros/log/4b9c8574-9072-11e7-bf53-00044b8caad5/roslaunch-tegra-ubuntu-3059.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://tegra-ubuntu:35309/

SUMMARY
========

PARAMETERS
 * /image_view/autosize: True
 * /rosdistro: kinetic
 * /rosversion: 1.12.7
 * /usb_cam/camera_frame_id: usb_cam
 * /usb_cam/image_height: 480
 * /usb_cam/image_width: 640
 * /usb_cam/io_method: mmap
 * /usb_cam/pixel_format: yuyv
 * /usb_cam/video_device: /dev/video1

NODES
  /
    image_view (image_view/image_view)
    usb_cam (usb_cam/usb_cam_node)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found
process[usb_cam-1]: started with pid [3078]
process[image_view-2]: started with pid [3079]
init done
[ INFO] [1504421929.509447030]: Using transport "raw"
[ INFO] [1504421929.756668326]: using default calibration URL
[ INFO] [1504421929.757037809]: camera calibration URL: file:///home/nvidia/.ros/camera_info/head_camera.yaml
[ INFO] [1504421929.757321401]: Unable to open camera calibration file [/home/nvidia/.ros/camera_info/head_camera.yaml]
[ WARN] [1504421929.757445853]: Camera calibration file /home/nvidia/.ros/camera_info/head_camera.yaml not found.
[ INFO] [1504421929.757588513]: Starting 'head_camera' (/dev/video1) at 640x480 via mmap (yuyv) at 30 FPS
[ WARN] [1504421930.977394215]: unknown control 'focus_auto'
The pop-up camera screen will appear on your monitor.

Monday, 17 June 2019

error: usleep is not declared in this scope


Find every file which have this error and add the codes below to it:

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>



in case of orbslam2:
Files that need to be added are:
Examples/Monocular/mono_euroc.cc
Examples/Monocular/mono_kitti.cc
Examples/Monocular/mono_tum.cc
Examples/RGB-D/rgbd_tum.cc
Examples/Stereo/stereo_euroc.cc
Examples/Stereo/stereo_kitti.cc
src/LocalMapping.cc
src/LoopClosing.cc
src/System.cc
src/Tracking.cc
src/Viewer.cc

Friday, 22 March 2019

Install PyCharm in Ubuntu using umake

Install PyCharm in Ubuntu using umake


Ubuntu provides a wonderful command line tool, umake for developers. umake lets you easily install a number of development tools in Ubuntu such as Android StudioVisual Studio CodeUbuntu SDK, Eclipse, Arudino Software Distribution etc. PyCharm is also one of the development tools included in the umake.
To install PyCharm using umake, you need to have umake first. Normally, it should already be installed in your system, but if it is not, use the PPA below to get the latest stable version of umake:
sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make
sudo apt-get update
sudo apt-get install ubuntu-make

Once you have umake, use the command below to install PyCharm Community Edition in Ubuntu:
umake ide pycharm
To install PyCharm Professional Edition (you need a license for this), you can use the command below:
umake ide pycharm-professional

Tuesday, 26 February 2019

How to install Anaconda on Ubuntu 16.04 and some commands for conda

How to install Anaconda on Ubuntu 16.04


curl -O https://repo.continuum.io/archive/Anaconda3-4.3.1-Linux-x86_64.sh
bash Anaconda3-4.3.1-Linux-x86_64.sh
source ~/.bashrc

Simple Commands

conda list
See the list of all the packages available through the Anaconda.
conda create --name env1 python=3
Create a new environment named env1 with python3.
source activate env1
Activate the environment named env1.
source deactivate

Wednesday, 13 February 2019

Ubuntu에서 pip intsall을 한 후에 ImportError 발생

Ubuntu에서 pip intsall을 한 후에 ImportError 발생

Traceback (most recent call last):   File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main

terminal에서
hash -d pip
하니 해결되었다.

땡큐

Tuesday, 12 February 2019

How to convert ogv to mp4 in Ubuntu16.04

How to convert ogv file to mp4 file

I am using Ubuntu16.04 and RecordMyDesktop to record my screen. This program makes .ogv file as its output so I wanted to convert it to mp4 file.

wget http://ffmpeg.gusari.org/static/32bit/ffmpeg.static.32bit.latest.tar.gz
tar xzvf ffmpeg.static.32bit.latest.tar.gz

Get ffmpeg like above, or use sudo like below.

sudo apt get install ffmpeg

Then run it. 'out-1.ogv' is the input file. The value 5 after -crf controls the quality. The larger number, lower quality. If you want to resize the video file, control this number.

ffmpeg -i input.ogv -aq 80 -vcodec libx264 -preset slow -crf 5 -threads 0 output.mp4



Wednesday, 30 January 2019

Use Korean in Ubuntu 16.04

Use Korean in Ubuntu 16.04

 sudo apt-get install fonts-nanum*  
 sudo apt-get install nabi  
 sudo apt-get install im-config  
 im-config  

Change 'im-config' setting to Hangul and reboot!

Setting to use my gpu : NVIDIA graphic drivers / CUDA


Install NVIDIA Graphic Drivers

Find your NVIDIA driver on NVIDIA website and download it. I downloaded NVIDIA-Linux-x86_64-410.93. It should be installed without lightDM. You should open the TTY with ctrl + alt +f1 before you stop the lightDM. TTY's are text-only terminals commonly used as a way to get access to the computer to fix things, without actually logging into a possibly b0rked desktop.

 sudo service lightdm stop  
 chmod +x ./NVIDIA-Linux-x86_64-410.93  
 sudo ./NVIDIA-Linux-x86_64-410.93  
 sudo reboot  

Install CUDA 9.0 and cuDNN 7.0 on Ubuntu 16.04

Find CUDA version you want on NVIDIA website or if you are looking for the same version with me just follow me from the first row. If you downloaded a different one, start from the second row and change the file name as yours.

 # Uninstall Old Version  
 sudo apt-get purge cuda  
 sudo apt-get purge libcudnn6  
 sudo apt-get purge libcudnn6-dev  

 # Install CUDA toolkit 9.0 and cuDNN 7.0  
 wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb  
 wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7_7.0.5.15-1+cuda9.0_amd64.deb  
 wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7-dev_7.0.5.15-1+cuda9.0_amd64.deb  
 wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libnccl2_2.1.4-1+cuda9.0_amd64.deb  
 wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libnccl-dev_2.1.4-1+cuda9.0_amd64.deb  

If you just formatted your desktop, you need to fo this before dpkg.

 sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub  

 sudo dpkg -i cuda-repo-ubuntu1604_9.0.176-1_amd64.deb  
 sudo dpkg -i libcudnn7_7.0.5.15-1+cuda9.0_amd64.deb  
 sudo dpkg -i libcudnn7-dev_7.0.5.15-1+cuda9.0_amd64.deb  
 sudo dpkg -i libnccl2_2.1.4-1+cuda9.0_amd64.deb  
 sudo dpkg -i libnccl-dev_2.1.4-1+cuda9.0_amd64.deb

 sudo apt-get update  
 sudo apt-get install cuda=9.0.176-1  
 sudo apt-get install libcudnn7-dev  
 sudo apt-get install libnccl-dev  

Modify the PATH. Open '.bashrc' file and end two lines below.

 gedit .bashrc
 export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}  
 export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
 source .bashrc  

And then reboot your desktop.

 reboot  

Verify CUDA installation.

 jihyo@jihyo-desktop:~$ nvidia-smi  
 Wed Jan 30 15:19:03 2019      
 +-----------------------------------------------------------------------------+  
 | NVIDIA-SMI 410.48         Driver Version: 410.48          |  
 |-------------------------------+----------------------+----------------------+  
 | GPU Name    Persistence-M| Bus-Id    Disp.A | Volatile Uncorr. ECC |  
 | Fan Temp Perf Pwr:Usage/Cap|     Memory-Usage | GPU-Util Compute M. |  
 |===============================+======================+======================|  
 |  0 GeForce RTX 2070  Off | 00000000:01:00.0 On |         N/A |  
 | 0%  49C  P8  25W / 215W |  737MiB / 7944MiB |   2%   Default |  
 +-------------------------------+----------------------+----------------------+  
 +-----------------------------------------------------------------------------+  
 | Processes:                            GPU Memory |  
 | GPU    PID  Type  Process name               Usage   |  
 |=============================================================================|  
 |  0   1021   G  /usr/lib/xorg/Xorg              550MiB |  
 |  0   1581   G  compiz                    125MiB |  
 |  0   1980   G  ...uest-channel-token=15398769083618213155  59MiB |  
 +-----------------------------------------------------------------------------+  
 jihyo@jihyo-desktop:~$ nvcc -V  
 nvcc: NVIDIA (R) Cuda compiler driver  
 Copyright (c) 2005-2015 NVIDIA Corporation  
 Built on Tue_Aug_11_14:27:32_CDT_2015  
 Cuda compilation tools, release 7.5, V7.5.17  







Super Easy Way to Install Chrome on Ubuntu


Super Easy Way to Install Chrome on Ubuntu


 wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb

That's it.

[ new blog ]

new blog https://jihyo-jeon.github.io/