Vins-mono on TX2 tutorial === ###### tags: `NSPO` # hardware 1. 3S LiPo battery 2. Nvidia Tx2 3. Nvidia Tx2 expand 4. USB hub 5. Arducam(Ar0134) 6. IMU source ==test on== :::success ubuntu 16.04 ros kinetic TX2 jetpack 3.3.3 eigen 3.7 ceres solver 1.14 opencv 3.3.1 ::: # installation ## install Nvidia TX2 OS 0. [video of NVIDIA Jetson SDK Manager - JetPack 4.2](https://www.youtube.com/watch?v=s1QDsa6SzuQ&fbclid=IwAR0-h0sy0K59X2cg87KyIHgJtUsV1Kk_Tdn3sXUaiEgTWXgioLDBYftRCzQ&ab_channel=JetsonHacks) 1. Download SDK manager https://developer.nvidia.com/embedded/downloads ![](https://i.imgur.com/csJGwve.png) 2. Go To step two - chose TX2 - jetpack 3.3.3 3. Recovery mode 1. connect to your computer by MicroUSB 2. press force recovery button 3. press power button while recovery button still pressing 4. release the buttons 5. press step2 continue ![](https://i.imgur.com/chfOJoz.png) 4. setup ubuntu system # install vins_mono ### 1. install nesessary ``` sudo apt-get install software-properties-common sudo apt-add-repository universe sudo apt-get update ``` ``` # CMake $ sudo apt-get install cmake # google-glog + gflags $ sudo apt-get install libgoogle-glog-dev # BLAS & LAPACK $ sudo apt-get install libatlas-base-dev $ sudo apt-get install libsuitesparse-dev $ sudo add-apt-repository ppa:bzindovic/suitesparse-bugfix-1319687 $ sudo apt-get update $ sudo apt-get install libsuitesparse-dev ``` ### 2. install eigen3.3.7 http://eigen.tuxfamily.org/index.php?title=Main_Page ``` git clone https://gitlab.com/libeigen/eigen.git cd eigen git checkout -b 3.7 3.3.7 mkdir build cd build cmake ../ sudo make install ``` ### 3. install Ceres solver download ver 1.14.0 tar.gz https://github.com/ceres-solver/ceres-solver/releases ``` $ tar zxf ceres-solver-1.14.0.tar.gz $ mkdir ceres-bin $ cd ceres-bin $ cmake ../ceres-solver-1.14.0 $ make -j4 $ make test $ sudo make install ``` ## install ROS 1. install ROS http://wiki.ros.org/kinetic/Installation/Ubuntu 2. make a workspace director ``` $ cd $ mkdir -p catkin_ws/src $ cd catkin_ws ``` 4. build it ``` $ catkin_make ``` ### 3. go to catkin_ws/src ``` $ cd ~/catkin_ws/src $ git clone https://github.com/HKUST-Aerial-Robotics/VINS-Mono $ cd .. $ catkin_make ``` ## move to expand board from ![](https://i.imgur.com/z7qXnGL.jpg =300x) to ![](https://i.imgur.com/pIVr7bu.jpg =300x) you will need usb hub ![](https://i.imgur.com/BelPE16.jpg =300x) for 1. flight controller 2. mouse wireless dungle and plug AR0134 USB to origin socket like this ![](https://i.imgur.com/A0rWpkQ.jpg =300x) ## install IMU driver if using pxhawk ``` $ sudo apt-get install ros-kinetic-mavros ros-kinetic-mavros-extras $ cd /opt/ros/kinetic/lib/mavros $ sudo ./install_geographiclib_datasets.sh $ roscd mavros $ cd launch ``` vim px4.launch ``` line 5: <arg name="fcu_url" default="/dev/ttyACM0:57600" /> to <arg name="fcu_url" default="/dev/ttyACM0:921600" /> ``` if using sheng-wen hawk ``` $ cd catkin_ws/src $ git clone https://github.com/Networked-Control-Robotics-Lab/vins_mono_bridge.git ``` # install ardocam-ros ``` $ cd catkin_ws/src $ git clone https://github.com/eason27271563/arducam_ros.git $ cd .. $ catkin_make ``` ## some config file ### for arducam ``` vim /home/nvidia/catkin_ws/src/arducam_ros/camera_config_files/AR0134_640x484.json ``` file in the link https://hackmd.io/CH-7z97VTOycI4cL2AywRg ### for vins_mono ``` vim /home/nvidia/catkin_ws/src/VINS-Mono/config/black_box/diy.yaml ``` file in the link https://hackmd.io/R19N5YSQQgaxbjF1IYZ1JA?view ``` vim /home/nvidia/catkin_ws/src/VINS-Mono/vins_estimator/launch/diy.launch ``` file in the link https://hackmd.io/ZfldKpftSUOgiEtihU-xaQ # calibration ## distortion on other powerfull computer ### install ``` sudo apt-get install python-setuptools python-rosinstall ipython libeigen3-dev libboost-all-dev doxygen libopencv-dev ros-melodic-vision-opencv ros-melodic-image-transport-plugins ros-melodic-cmake-modules software-properties-common libpoco-dev python-matplotlib python-scipy python-git python-pip ipython libtbb-dev libblas-dev liblapack-dev python-catkin-tools libv4l-dev sudo apt update sudo apt install python-igraph cd ~/kalibr_workspace/src git clone https://github.com/ethz-asl/Kalibr.git cd ~/kalibr_workspace catkin_make ``` ### Download CDE-packages https://github.com/ethz-asl/kalibr/wiki/downloads ![](https://i.imgur.com/WNqFEBQ.png) ``` tar zxf kalibr_20062014.tar.gz cd kalibr=cde mkdir dynamic ``` ### download Aprilgrid download Aprilgrid and print it out recommand to use 0.5*0.5 unscale https://github.com/ethz-asl/kalibr/wiki/downloads ![](https://i.imgur.com/XQPrPpo.png) put april_6x6_50x50cm.yaml into dir kalibr-cde/dynamic ### record ROS bag go back to TX2 ``` roslaunch arducam_usb2_ros arducam_node.launch rosbag record /arducam/triggered/camera/image_raw ``` go to your computer ``` source ~/kalibr_workspace/devel/setup.bash cd kalibr-cde kalibr_calibrate_cameras --target dynamic/april_6x6_50x50cm.yaml --bag dynamic/your-file-name.bag --models pinhole-radtan --topics /arducam/camera/image_raw ``` finish you will get ![](https://i.imgur.com/7nbh78t.png) go to TX2 distortion: [-0.34256295 0.1029213 0.00116642 -0.00157431] projection: [409.91609966 409.58921469 308.58311911 234.12912127] ### edit diy.yaml ## 執行 ### with px4 delete the imu package in diy.launch first then ``` roslaunch mavros px4.launch roslaunch vins_estimator diy.launch ``` ### with shengwen_hawk ``` roslaunch vins_estimator diy.launch ```